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.
@@ -0,0 +1,139 @@
1
+ var D_=Object.defineProperty;var I_=(n,s,i)=>s in n?D_(n,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[s]=i;var Lt=(n,s,i)=>I_(n,typeof s!="symbol"?s+"":s,i);(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const v of document.querySelectorAll('link[rel="modulepreload"]'))h(v);new MutationObserver(v=>{for(const R of v)if(R.type==="childList")for(const x of R.addedNodes)x.tagName==="LINK"&&x.rel==="modulepreload"&&h(x)}).observe(document,{childList:!0,subtree:!0});function i(v){const R={};return v.integrity&&(R.integrity=v.integrity),v.referrerPolicy&&(R.referrerPolicy=v.referrerPolicy),v.crossOrigin==="use-credentials"?R.credentials="include":v.crossOrigin==="anonymous"?R.credentials="omit":R.credentials="same-origin",R}function h(v){if(v.ep)return;v.ep=!0;const R=i(v);fetch(v.href,R)}})();function j_(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var pc={exports:{}},Pi={},mc={exports:{}},nt={};/**
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 Pd;function P_(){if(Pd)return nt;Pd=1;var n=Symbol.for("react.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),x=Symbol.for("react.context"),r=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),u=Symbol.iterator;function y(H){return H===null||typeof H!="object"?null:(H=u&&H[u]||H["@@iterator"],typeof H=="function"?H:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,f={};function a(H,q,ne){this.props=H,this.context=q,this.refs=f,this.updater=ne||S}a.prototype.isReactComponent={},a.prototype.setState=function(H,q){if(typeof H!="object"&&typeof H!="function"&&H!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,H,q,"setState")},a.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function m(){}m.prototype=a.prototype;function p(H,q,ne){this.props=H,this.context=q,this.refs=f,this.updater=ne||S}var d=p.prototype=new m;d.constructor=p,L(d,a.prototype),d.isPureReactComponent=!0;var k=Array.isArray,D=Object.prototype.hasOwnProperty,E={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function b(H,q,ne){var re,ue={},de=null,K=null;if(q!=null)for(re in q.ref!==void 0&&(K=q.ref),q.key!==void 0&&(de=""+q.key),q)D.call(q,re)&&!M.hasOwnProperty(re)&&(ue[re]=q[re]);var W=arguments.length-2;if(W===1)ue.children=ne;else if(1<W){for(var J=Array(W),Z=0;Z<W;Z++)J[Z]=arguments[Z+2];ue.children=J}if(H&&H.defaultProps)for(re in W=H.defaultProps,W)ue[re]===void 0&&(ue[re]=W[re]);return{$$typeof:n,type:H,key:de,ref:K,props:ue,_owner:E.current}}function T(H,q){return{$$typeof:n,type:H.type,key:q,ref:H.ref,props:H.props,_owner:H._owner}}function N(H){return typeof H=="object"&&H!==null&&H.$$typeof===n}function B(H){var q={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(ne){return q[ne]})}var F=/\/+/g;function O(H,q){return typeof H=="object"&&H!==null&&H.key!=null?B(""+H.key):q.toString(36)}function U(H,q,ne,re,ue){var de=typeof H;(de==="undefined"||de==="boolean")&&(H=null);var K=!1;if(H===null)K=!0;else switch(de){case"string":case"number":K=!0;break;case"object":switch(H.$$typeof){case n:case s:K=!0}}if(K)return K=H,ue=ue(K),H=re===""?"."+O(K,0):re,k(ue)?(ne="",H!=null&&(ne=H.replace(F,"$&/")+"/"),U(ue,q,ne,"",function(Z){return Z})):ue!=null&&(N(ue)&&(ue=T(ue,ne+(!ue.key||K&&K.key===ue.key?"":(""+ue.key).replace(F,"$&/")+"/")+H)),q.push(ue)),1;if(K=0,re=re===""?".":re+":",k(H))for(var W=0;W<H.length;W++){de=H[W];var J=re+O(de,W);K+=U(de,q,ne,J,ue)}else if(J=y(H),typeof J=="function")for(H=J.call(H),W=0;!(de=H.next()).done;)de=de.value,J=re+O(de,W++),K+=U(de,q,ne,J,ue);else if(de==="object")throw q=String(H),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.");return K}function V(H,q,ne){if(H==null)return H;var re=[],ue=0;return U(H,re,"","",function(de){return q.call(ne,de,ue++)}),re}function Y(H){if(H._status===-1){var q=H._result;q=q(),q.then(function(ne){(H._status===0||H._status===-1)&&(H._status=1,H._result=ne)},function(ne){(H._status===0||H._status===-1)&&(H._status=2,H._result=ne)}),H._status===-1&&(H._status=0,H._result=q)}if(H._status===1)return H._result.default;throw H._result}var X={current:null},G={transition:null},P={ReactCurrentDispatcher:X,ReactCurrentBatchConfig:G,ReactCurrentOwner:E};function $(){throw Error("act(...) is not supported in production builds of React.")}return nt.Children={map:V,forEach:function(H,q,ne){V(H,function(){q.apply(this,arguments)},ne)},count:function(H){var q=0;return V(H,function(){q++}),q},toArray:function(H){return V(H,function(q){return q})||[]},only:function(H){if(!N(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},nt.Component=a,nt.Fragment=i,nt.Profiler=v,nt.PureComponent=p,nt.StrictMode=h,nt.Suspense=c,nt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=P,nt.act=$,nt.cloneElement=function(H,q,ne){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var re=L({},H.props),ue=H.key,de=H.ref,K=H._owner;if(q!=null){if(q.ref!==void 0&&(de=q.ref,K=E.current),q.key!==void 0&&(ue=""+q.key),H.type&&H.type.defaultProps)var W=H.type.defaultProps;for(J in q)D.call(q,J)&&!M.hasOwnProperty(J)&&(re[J]=q[J]===void 0&&W!==void 0?W[J]:q[J])}var J=arguments.length-2;if(J===1)re.children=ne;else if(1<J){W=Array(J);for(var Z=0;Z<J;Z++)W[Z]=arguments[Z+2];re.children=W}return{$$typeof:n,type:H.type,key:ue,ref:de,props:re,_owner:K}},nt.createContext=function(H){return H={$$typeof:x,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:R,_context:H},H.Consumer=H},nt.createElement=b,nt.createFactory=function(H){var q=b.bind(null,H);return q.type=H,q},nt.createRef=function(){return{current:null}},nt.forwardRef=function(H){return{$$typeof:r,render:H}},nt.isValidElement=N,nt.lazy=function(H){return{$$typeof:_,_payload:{_status:-1,_result:H},_init:Y}},nt.memo=function(H,q){return{$$typeof:g,type:H,compare:q===void 0?null:q}},nt.startTransition=function(H){var q=G.transition;G.transition={};try{H()}finally{G.transition=q}},nt.unstable_act=$,nt.useCallback=function(H,q){return X.current.useCallback(H,q)},nt.useContext=function(H){return X.current.useContext(H)},nt.useDebugValue=function(){},nt.useDeferredValue=function(H){return X.current.useDeferredValue(H)},nt.useEffect=function(H,q){return X.current.useEffect(H,q)},nt.useId=function(){return X.current.useId()},nt.useImperativeHandle=function(H,q,ne){return X.current.useImperativeHandle(H,q,ne)},nt.useInsertionEffect=function(H,q){return X.current.useInsertionEffect(H,q)},nt.useLayoutEffect=function(H,q){return X.current.useLayoutEffect(H,q)},nt.useMemo=function(H,q){return X.current.useMemo(H,q)},nt.useReducer=function(H,q,ne){return X.current.useReducer(H,q,ne)},nt.useRef=function(H){return X.current.useRef(H)},nt.useState=function(H){return X.current.useState(H)},nt.useSyncExternalStore=function(H,q,ne){return X.current.useSyncExternalStore(H,q,ne)},nt.useTransition=function(){return X.current.useTransition()},nt.version="18.3.1",nt}var Od;function fu(){return Od||(Od=1,mc.exports=P_()),mc.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 Bd;function O_(){if(Bd)return Pi;Bd=1;var n=fu(),s=Symbol.for("react.element"),i=Symbol.for("react.fragment"),h=Object.prototype.hasOwnProperty,v=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,R={key:!0,ref:!0,__self:!0,__source:!0};function x(r,c,g){var _,u={},y=null,S=null;g!==void 0&&(y=""+g),c.key!==void 0&&(y=""+c.key),c.ref!==void 0&&(S=c.ref);for(_ in c)h.call(c,_)&&!R.hasOwnProperty(_)&&(u[_]=c[_]);if(r&&r.defaultProps)for(_ in c=r.defaultProps,c)u[_]===void 0&&(u[_]=c[_]);return{$$typeof:s,type:r,key:y,ref:S,props:u,_owner:v.current}}return Pi.Fragment=i,Pi.jsx=x,Pi.jsxs=x,Pi}var Fd;function B_(){return Fd||(Fd=1,pc.exports=O_()),pc.exports}var l=B_(),ga={},gc={exports:{}},nn={},_c={exports:{}},vc={};/**
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 Hd;function F_(){return Hd||(Hd=1,(function(n){function s(G,P){var $=G.length;G.push(P);e:for(;0<$;){var H=$-1>>>1,q=G[H];if(0<v(q,P))G[H]=P,G[$]=q,$=H;else break e}}function i(G){return G.length===0?null:G[0]}function h(G){if(G.length===0)return null;var P=G[0],$=G.pop();if($!==P){G[0]=$;e:for(var H=0,q=G.length,ne=q>>>1;H<ne;){var re=2*(H+1)-1,ue=G[re],de=re+1,K=G[de];if(0>v(ue,$))de<q&&0>v(K,ue)?(G[H]=K,G[de]=$,H=de):(G[H]=ue,G[re]=$,H=re);else if(de<q&&0>v(K,$))G[H]=K,G[de]=$,H=de;else break e}}return P}function v(G,P){var $=G.sortIndex-P.sortIndex;return $!==0?$:G.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var R=performance;n.unstable_now=function(){return R.now()}}else{var x=Date,r=x.now();n.unstable_now=function(){return x.now()-r}}var c=[],g=[],_=1,u=null,y=3,S=!1,L=!1,f=!1,a=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(G){for(var P=i(g);P!==null;){if(P.callback===null)h(g);else if(P.startTime<=G)h(g),P.sortIndex=P.expirationTime,s(c,P);else break;P=i(g)}}function k(G){if(f=!1,d(G),!L)if(i(c)!==null)L=!0,Y(D);else{var P=i(g);P!==null&&X(k,P.startTime-G)}}function D(G,P){L=!1,f&&(f=!1,m(b),b=-1),S=!0;var $=y;try{for(d(P),u=i(c);u!==null&&(!(u.expirationTime>P)||G&&!B());){var H=u.callback;if(typeof H=="function"){u.callback=null,y=u.priorityLevel;var q=H(u.expirationTime<=P);P=n.unstable_now(),typeof q=="function"?u.callback=q:u===i(c)&&h(c),d(P)}else h(c);u=i(c)}if(u!==null)var ne=!0;else{var re=i(g);re!==null&&X(k,re.startTime-P),ne=!1}return ne}finally{u=null,y=$,S=!1}}var E=!1,M=null,b=-1,T=5,N=-1;function B(){return!(n.unstable_now()-N<T)}function F(){if(M!==null){var G=n.unstable_now();N=G;var P=!0;try{P=M(!0,G)}finally{P?O():(E=!1,M=null)}}else E=!1}var O;if(typeof p=="function")O=function(){p(F)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,V=U.port2;U.port1.onmessage=F,O=function(){V.postMessage(null)}}else O=function(){a(F,0)};function Y(G){M=G,E||(E=!0,O())}function X(G,P){b=a(function(){G(n.unstable_now())},P)}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(G){G.callback=null},n.unstable_continueExecution=function(){L||S||(L=!0,Y(D))},n.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<G?Math.floor(1e3/G):5},n.unstable_getCurrentPriorityLevel=function(){return y},n.unstable_getFirstCallbackNode=function(){return i(c)},n.unstable_next=function(G){switch(y){case 1:case 2:case 3:var P=3;break;default:P=y}var $=y;y=P;try{return G()}finally{y=$}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(G,P){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var $=y;y=G;try{return P()}finally{y=$}},n.unstable_scheduleCallback=function(G,P,$){var H=n.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?H+$:H):$=H,G){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=$+q,G={id:_++,callback:P,priorityLevel:G,startTime:$,expirationTime:q,sortIndex:-1},$>H?(G.sortIndex=$,s(g,G),i(c)===null&&G===i(g)&&(f?(m(b),b=-1):f=!0,X(k,$-H))):(G.sortIndex=q,s(c,G),L||S||(L=!0,Y(D))),G},n.unstable_shouldYield=B,n.unstable_wrapCallback=function(G){var P=y;return function(){var $=y;y=P;try{return G.apply(this,arguments)}finally{y=$}}}})(vc)),vc}var $d;function H_(){return $d||($d=1,_c.exports=F_()),_c.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 Ud;function $_(){if(Ud)return nn;Ud=1;var n=fu(),s=H_();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o<arguments.length;o++)t+="&args[]="+encodeURIComponent(arguments[o]);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 h=new Set,v={};function R(e,t){x(e,t),x(e+"Capture",t)}function x(e,t){for(v[e]=t,e=0;e<t.length;e++)h.add(t[e])}var r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,_={},u={};function y(e){return c.call(u,e)?!0:c.call(_,e)?!1:g.test(e)?u[e]=!0:(_[e]=!0,!1)}function S(e,t,o,w){if(o!==null&&o.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return w?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function L(e,t,o,w){if(t===null||typeof t>"u"||S(e,t,o,w))return!0;if(w)return!1;if(o!==null)switch(o.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 f(e,t,o,w,A,j,z){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=w,this.attributeNamespace=A,this.mustUseProperty=o,this.propertyName=e,this.type=t,this.sanitizeURL=j,this.removeEmptyString=z}var a={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){a[e]=new f(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 f(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){a[e]=new f(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){a[e]=new f(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 f(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){a[e]=new f(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){a[e]=new f(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){a[e]=new f(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){a[e]=new f(e,5,!1,e.toLowerCase(),null,!1,!1)});var m=/[\-:]([a-z])/g;function p(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(m,p);a[t]=new f(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(m,p);a[t]=new f(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(m,p);a[t]=new f(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){a[e]=new f(e,1,!1,e.toLowerCase(),null,!1,!1)}),a.xlinkHref=new f("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){a[e]=new f(e,1,!1,e.toLowerCase(),null,!0,!0)});function d(e,t,o,w){var A=a.hasOwnProperty(t)?a[t]:null;(A!==null?A.type!==0:w||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(L(t,o,A,w)&&(o=null),w||A===null?y(t)&&(o===null?e.removeAttribute(t):e.setAttribute(t,""+o)):A.mustUseProperty?e[A.propertyName]=o===null?A.type===3?!1:"":o:(t=A.attributeName,w=A.attributeNamespace,o===null?e.removeAttribute(t):(A=A.type,o=A===3||A===4&&o===!0?"":""+o,w?e.setAttributeNS(w,t,o):e.setAttribute(t,o))))}var k=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,D=Symbol.for("react.element"),E=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"),B=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),X=Symbol.for("react.offscreen"),G=Symbol.iterator;function P(e){return e===null||typeof e!="object"?null:(e=G&&e[G]||e["@@iterator"],typeof e=="function"?e:null)}var $=Object.assign,H;function q(e){if(H===void 0)try{throw Error()}catch(o){var t=o.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||""}return`
34
+ `+H+e}var ne=!1;function re(e,t){if(!e||ne)return"";ne=!0;var o=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(he){var w=he}Reflect.construct(e,[],t)}else{try{t.call()}catch(he){w=he}e.call(t.prototype)}else{try{throw Error()}catch(he){w=he}e()}}catch(he){if(he&&w&&typeof he.stack=="string"){for(var A=he.stack.split(`
35
+ `),j=w.stack.split(`
36
+ `),z=A.length-1,Q=j.length-1;1<=z&&0<=Q&&A[z]!==j[Q];)Q--;for(;1<=z&&0<=Q;z--,Q--)if(A[z]!==j[Q]){if(z!==1||Q!==1)do if(z--,Q--,0>Q||A[z]!==j[Q]){var ee=`
37
+ `+A[z].replace(" at new "," at ");return e.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",e.displayName)),ee}while(1<=z&&0<=Q);break}}}finally{ne=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?q(e):""}function ue(e){switch(e.tag){case 5:return q(e.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return e=re(e.type,!1),e;case 11:return e=re(e.type.render,!1),e;case 1:return e=re(e.type,!0),e;default:return""}}function de(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 E:return"Portal";case T:return"Profiler";case b:return"StrictMode";case O:return"Suspense";case U:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case B:return(e.displayName||"Context")+".Consumer";case N:return(e._context.displayName||"Context")+".Provider";case F:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return t=e.displayName||null,t!==null?t:de(e.type)||"Memo";case Y:t=e._payload,e=e._init;try{return de(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 de(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",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),w=""+e[t];if(!e.hasOwnProperty(t)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var A=o.get,j=o.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return A.call(this)},set:function(z){w=""+z,j.call(this,z)}}),Object.defineProperty(e,t,{enumerable:o.enumerable}),{getValue:function(){return w},setValue:function(z){w=""+z},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function pe(e){e._valueTracker||(e._valueTracker=Z(e))}function me(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var o=t.getValue(),w="";return e&&(w=J(e)?e.checked?"true":"false":e.value),e=w,e!==o?(t.setValue(e),!0):!1}function ie(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 Le(e,t){var o=t.checked;return $({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function Ae(e,t){var o=t.defaultValue==null?"":t.defaultValue,w=t.checked!=null?t.checked:t.defaultChecked;o=W(t.value!=null?t.value:o),e._wrapperState={initialChecked:w,initialValue:o,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Xe(e,t){t=t.checked,t!=null&&d(e,"checked",t,!1)}function Ce(e,t){Xe(e,t);var o=W(t.value),w=t.type;if(o!=null)w==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(w==="submit"||w==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Me(e,t.type,o):t.hasOwnProperty("defaultValue")&&Me(e,t.type,W(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fe(e,t,o){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var w=t.type;if(!(w!=="submit"&&w!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,o||t===e.value||(e.value=t),e.defaultValue=t}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function Me(e,t,o){(t!=="number"||ie(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var _e=Array.isArray;function Ee(e,t,o,w){if(e=e.options,t){t={};for(var A=0;A<o.length;A++)t["$"+o[A]]=!0;for(o=0;o<e.length;o++)A=t.hasOwnProperty("$"+e[o].value),e[o].selected!==A&&(e[o].selected=A),A&&w&&(e[o].defaultSelected=!0)}else{for(o=""+W(o),t=null,A=0;A<e.length;A++){if(e[A].value===o){e[A].selected=!0,w&&(e[A].defaultSelected=!0);return}t!==null||e[A].disabled||(t=e[A])}t!==null&&(t.selected=!0)}}function Fe(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(i(91));return $({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Se(e,t){var o=t.value;if(o==null){if(o=t.children,t=t.defaultValue,o!=null){if(t!=null)throw Error(i(92));if(_e(o)){if(1<o.length)throw Error(i(93));o=o[0]}t=o}t==null&&(t=""),o=t}e._wrapperState={initialValue:W(o)}}function Ne(e,t){var o=W(t.value),w=W(t.defaultValue);o!=null&&(o=""+o,o!==e.value&&(e.value=o),t.defaultValue==null&&e.defaultValue!==o&&(e.defaultValue=o)),w!=null&&(e.defaultValue=""+w)}function et(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 Je(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 lt,ct=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,o,w,A){MSApp.execUnsafeLocalFunction(function(){return e(t,o,w,A)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(lt=lt||document.createElement("div"),lt.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=lt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function $e(e,t){if(t){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=t;return}}e.textContent=t}var Ze={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},Ve=["Webkit","ms","Moz","O"];Object.keys(Ze).forEach(function(e){Ve.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ze[t]=Ze[e]})});function st(e,t,o){return t==null||typeof t=="boolean"||t===""?"":o||typeof t!="number"||t===0||Ze.hasOwnProperty(e)&&Ze[e]?(""+t).trim():t+"px"}function dt(e,t){e=e.style;for(var o in t)if(t.hasOwnProperty(o)){var w=o.indexOf("--")===0,A=st(o,t[o],w);o==="float"&&(o="cssFloat"),w?e.setProperty(o,A):e[o]=A}}var Re=$({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 ze(e,t){if(t){if(Re[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function te(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 le=null;function ke(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rt=null,Te=null,We=null;function ut(e){if(e=bi(e)){if(typeof rt!="function")throw Error(i(280));var t=e.stateNode;t&&(t=Ao(t),rt(e.stateNode,e.type,t))}}function Mt(e){Te?We?We.push(e):We=[e]:Te=e}function Pt(){if(Te){var e=Te,t=We;if(We=Te=null,ut(e),t)for(e=0;e<t.length;e++)ut(t[e])}}function rs(e,t){return e(t)}function As(){}var gn=!1;function Qi(e,t,o){if(gn)return e(t,o);gn=!0;try{return rs(e,t,o)}finally{gn=!1,(Te!==null||We!==null)&&(As(),Pt())}}function Ns(e,t){var o=e.stateNode;if(o===null)return null;var w=Ao(o);if(w===null)return null;o=w[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":(w=!w.disabled)||(e=e.type,w=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!w;break e;default:e=!1}if(e)return null;if(o&&typeof o!="function")throw Error(i(231,t,typeof o));return o}var Yr=!1;if(r)try{var cn={};Object.defineProperty(cn,"passive",{get:function(){Yr=!0}}),window.addEventListener("test",cn,cn),window.removeEventListener("test",cn,cn)}catch{Yr=!1}function Ba(e,t,o,w,A,j,z,Q,ee){var he=Array.prototype.slice.call(arguments,3);try{t.apply(o,he)}catch(ve){this.onError(ve)}}var Ds=!1,sr=null,Is=!1,Xr=null,Ji={onError:function(e){Ds=!0,sr=e}};function Zi(e,t,o,w,A,j,z,Q,ee){Ds=!1,sr=null,Ba.apply(Ji,arguments)}function Qr(e,t,o,w,A,j,z,Q,ee){if(Zi.apply(this,arguments),Ds){if(Ds){var he=sr;Ds=!1,sr=null}else throw Error(i(198));Is||(Is=!0,Xr=he)}}function Un(e){var t=e,o=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(o=t.return),e=t.return;while(e)}return t.tag===3?o:null}function Jr(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 eo(e){if(Un(e)!==e)throw Error(i(188))}function Fa(e){var t=e.alternate;if(!t){if(t=Un(e),t===null)throw Error(i(188));return t!==e?null:e}for(var o=e,w=t;;){var A=o.return;if(A===null)break;var j=A.alternate;if(j===null){if(w=A.return,w!==null){o=w;continue}break}if(A.child===j.child){for(j=A.child;j;){if(j===o)return eo(A),e;if(j===w)return eo(A),t;j=j.sibling}throw Error(i(188))}if(o.return!==w.return)o=A,w=j;else{for(var z=!1,Q=A.child;Q;){if(Q===o){z=!0,o=A,w=j;break}if(Q===w){z=!0,w=A,o=j;break}Q=Q.sibling}if(!z){for(Q=j.child;Q;){if(Q===o){z=!0,o=j,w=A;break}if(Q===w){z=!0,w=j,o=A;break}Q=Q.sibling}if(!z)throw Error(i(189))}}if(o.alternate!==w)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?e:t}function to(e){return e=Fa(e),e!==null?Zr(e):null}function Zr(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Zr(e);if(t!==null)return t;e=e.sibling}return null}var no=s.unstable_scheduleCallback,so=s.unstable_cancelCallback,Ha=s.unstable_shouldYield,$a=s.unstable_requestPaint,gt=s.unstable_now,ei=s.unstable_getCurrentPriorityLevel,ti=s.unstable_ImmediatePriority,is=s.unstable_UserBlockingPriority,Wn=s.unstable_NormalPriority,ro=s.unstable_LowPriority,ni=s.unstable_IdlePriority,rr=null,Xt=null;function si(e){if(Xt&&typeof Xt.onCommitFiberRoot=="function")try{Xt.onCommitFiberRoot(rr,e,void 0,(e.current.flags&128)===128)}catch{}}var At=Math.clz32?Math.clz32:ar,ir=Math.log,or=Math.LN2;function ar(e){return e>>>=0,e===0?32:31-(ir(e)/or|0)|0}var _n=64,os=4194304;function Ht(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 lr(e,t){var o=e.pendingLanes;if(o===0)return 0;var w=0,A=e.suspendedLanes,j=e.pingedLanes,z=o&268435455;if(z!==0){var Q=z&~A;Q!==0?w=Ht(Q):(j&=z,j!==0&&(w=Ht(j)))}else z=o&~A,z!==0?w=Ht(z):j!==0&&(w=Ht(j));if(w===0)return 0;if(t!==0&&t!==w&&(t&A)===0&&(A=w&-w,j=t&-t,A>=j||A===16&&(j&4194240)!==0))return t;if((w&4)!==0&&(w|=o&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=w;0<t;)o=31-At(t),A=1<<o,w|=e[o],t&=~A;return w}function io(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 as(e,t){for(var o=e.suspendedLanes,w=e.pingedLanes,A=e.expirationTimes,j=e.pendingLanes;0<j;){var z=31-At(j),Q=1<<z,ee=A[z];ee===-1?((Q&o)===0||(Q&w)!==0)&&(A[z]=io(Q,t)):ee<=t&&(e.expiredLanes|=Q),j&=~Q}}function ls(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function oo(){var e=_n;return _n<<=1,(_n&4194240)===0&&(_n=64),e}function Nt(e){for(var t=[],o=0;31>o;o++)t.push(e);return t}function zn(e,t,o){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-At(t),e[t]=o}function ao(e,t){var o=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 w=e.eventTimes;for(e=e.expirationTimes;0<o;){var A=31-At(o),j=1<<A;t[A]=0,w[A]=-1,e[A]=-1,o&=~j}}function ri(e,t){var o=e.entangledLanes|=t;for(e=e.entanglements;o;){var w=31-At(o),A=1<<w;A&t|e[w]&t&&(e[w]|=t),o&=~A}}var ot=0;function lo(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var ii,oi,cr,co,ai,ur=!1,js=[],vn=null,Rn=null,Mn=null,cs=new Map,Vn=new Map,yn=[],li="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 hr(e,t){switch(e){case"focusin":case"focusout":vn=null;break;case"dragenter":case"dragleave":Rn=null;break;case"mouseover":case"mouseout":Mn=null;break;case"pointerover":case"pointerout":cs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vn.delete(t.pointerId)}}function Ps(e,t,o,w,A,j){return e===null||e.nativeEvent!==j?(e={blockedOn:t,domEventName:o,eventSystemFlags:w,nativeEvent:j,targetContainers:[A]},t!==null&&(t=bi(t),t!==null&&oi(t)),e):(e.eventSystemFlags|=w,t=e.targetContainers,A!==null&&t.indexOf(A)===-1&&t.push(A),e)}function Ua(e,t,o,w,A){switch(t){case"focusin":return vn=Ps(vn,e,t,o,w,A),!0;case"dragenter":return Rn=Ps(Rn,e,t,o,w,A),!0;case"mouseover":return Mn=Ps(Mn,e,t,o,w,A),!0;case"pointerover":var j=A.pointerId;return cs.set(j,Ps(cs.get(j)||null,e,t,o,w,A)),!0;case"gotpointercapture":return j=A.pointerId,Vn.set(j,Ps(Vn.get(j)||null,e,t,o,w,A)),!0}return!1}function uo(e){var t=Ws(e.target);if(t!==null){var o=Un(t);if(o!==null){if(t=o.tag,t===13){if(t=Jr(o),t!==null){e.blockedOn=t,ai(e.priority,function(){cr(o)});return}}else if(t===3&&o.stateNode.current.memoizedState.isDehydrated){e.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Os(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var o=ui(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(o===null){o=e.nativeEvent;var w=new o.constructor(o.type,o);le=w,o.target.dispatchEvent(w),le=null}else return t=bi(o),t!==null&&oi(t),e.blockedOn=o,!1;t.shift()}return!0}function wn(e,t,o){Os(e)&&o.delete(t)}function Wa(){ur=!1,vn!==null&&Os(vn)&&(vn=null),Rn!==null&&Os(Rn)&&(Rn=null),Mn!==null&&Os(Mn)&&(Mn=null),cs.forEach(wn),Vn.forEach(wn)}function bn(e,t){e.blockedOn===t&&(e.blockedOn=null,ur||(ur=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Wa)))}function us(e){function t(A){return bn(A,e)}if(0<js.length){bn(js[0],e);for(var o=1;o<js.length;o++){var w=js[o];w.blockedOn===e&&(w.blockedOn=null)}}for(vn!==null&&bn(vn,e),Rn!==null&&bn(Rn,e),Mn!==null&&bn(Mn,e),cs.forEach(t),Vn.forEach(t),o=0;o<yn.length;o++)w=yn[o],w.blockedOn===e&&(w.blockedOn=null);for(;0<yn.length&&(o=yn[0],o.blockedOn===null);)uo(o),o.blockedOn===null&&yn.shift()}var qn=k.ReactCurrentBatchConfig,Bs=!0;function za(e,t,o,w){var A=ot,j=qn.transition;qn.transition=null;try{ot=1,ci(e,t,o,w)}finally{ot=A,qn.transition=j}}function Va(e,t,o,w){var A=ot,j=qn.transition;qn.transition=null;try{ot=4,ci(e,t,o,w)}finally{ot=A,qn.transition=j}}function ci(e,t,o,w){if(Bs){var A=ui(e,t,o,w);if(A===null)rl(e,t,w,Kn,o),hr(e,w);else if(Ua(A,e,t,o,w))w.stopPropagation();else if(hr(e,w),t&4&&-1<li.indexOf(e)){for(;A!==null;){var j=bi(A);if(j!==null&&ii(j),j=ui(e,t,o,w),j===null&&rl(e,t,w,Kn,o),j===A)break;A=j}A!==null&&w.stopPropagation()}else rl(e,t,w,null,o)}}var Kn=null;function ui(e,t,o,w){if(Kn=null,e=ke(w),e=Ws(e),e!==null)if(t=Un(e),t===null)e=null;else if(o=t.tag,o===13){if(e=Jr(t),e!==null)return e;e=null}else if(o===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Kn=e,null}function ho(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(ei()){case ti:return 1;case is:return 4;case Wn:case ro:return 16;case ni:return 536870912;default:return 16}default:return 16}}var An=null,Nn=null,dr=null;function fr(){if(dr)return dr;var e,t=Nn,o=t.length,w,A="value"in An?An.value:An.textContent,j=A.length;for(e=0;e<o&&t[e]===A[e];e++);var z=o-e;for(w=1;w<=z&&t[o-w]===A[j-w];w++);return dr=A.slice(e,1<w?1-w:void 0)}function pr(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 Fs(){return!0}function fo(){return!1}function Kt(e){function t(o,w,A,j,z){this._reactName=o,this._targetInst=A,this.type=w,this.nativeEvent=j,this.target=z,this.currentTarget=null;for(var Q in e)e.hasOwnProperty(Q)&&(o=e[Q],this[Q]=o?o(j):j[Q]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?Fs:fo,this.isPropagationStopped=fo,this}return $(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Fs)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Fs)},persist:function(){},isPersistent:Fs}),t}var hs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mr=Kt(hs),Hs=$({},hs,{view:0,detail:0}),qa=Kt(Hs),$s,gr,Gn,Us=$({},Hs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qe,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!==Gn&&(Gn&&e.type==="mousemove"?($s=e.screenX-Gn.screenX,gr=e.screenY-Gn.screenY):gr=$s=0,Gn=e),$s)},movementY:function(e){return"movementY"in e?e.movementY:gr}}),po=Kt(Us),mo=$({},Us,{dataTransfer:0}),go=Kt(mo),_o=$({},Hs,{relatedTarget:0}),_r=Kt(_o),vo=$({},hs,{animationName:0,elapsedTime:0,pseudoElement:0}),yo=Kt(vo),Ka=$({},hs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),wo=Kt(Ka),bo=$({},hs,{data:0}),hi=Kt(bo),So={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Co={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"},oe={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ye(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=oe[e])?!!t[e]:!1}function Qe(){return ye}var Dn=$({},Hs,{key:function(e){if(e.key){var t=So[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=pr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Co[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qe,charCode:function(e){return e.type==="keypress"?pr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?pr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Yn=Kt(Dn),bg=$({},Us,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lu=Kt(bg),Sg=$({},Hs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qe}),Cg=Kt(Sg),xg=$({},hs,{propertyName:0,elapsedTime:0,pseudoElement:0}),kg=Kt(xg),Eg=$({},Us,{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}),Lg=Kt(Eg),Tg=[9,13,27,32],Ga=r&&"CompositionEvent"in window,di=null;r&&"documentMode"in document&&(di=document.documentMode);var Rg=r&&"TextEvent"in window&&!di,Tu=r&&(!Ga||di&&8<di&&11>=di),Ru=" ",Mu=!1;function Au(e,t){switch(e){case"keyup":return Tg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vr=!1;function Mg(e,t){switch(e){case"compositionend":return Nu(t);case"keypress":return t.which!==32?null:(Mu=!0,Ru);case"textInput":return e=t.data,e===Ru&&Mu?null:e;default:return null}}function Ag(e,t){if(vr)return e==="compositionend"||!Ga&&Au(e,t)?(e=fr(),dr=Nn=An=null,vr=!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 Tu&&t.locale!=="ko"?null:t.data;default:return null}}var Ng={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 Du(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ng[e.type]:t==="textarea"}function Iu(e,t,o,w){Mt(w),t=To(t,"onChange"),0<t.length&&(o=new mr("onChange","change",null,o,w),e.push({event:o,listeners:t}))}var fi=null,pi=null;function Dg(e){Ju(e,0)}function xo(e){var t=Cr(e);if(me(t))return e}function Ig(e,t){if(e==="change")return t}var ju=!1;if(r){var Ya;if(r){var Xa="oninput"in document;if(!Xa){var Pu=document.createElement("div");Pu.setAttribute("oninput","return;"),Xa=typeof Pu.oninput=="function"}Ya=Xa}else Ya=!1;ju=Ya&&(!document.documentMode||9<document.documentMode)}function Ou(){fi&&(fi.detachEvent("onpropertychange",Bu),pi=fi=null)}function Bu(e){if(e.propertyName==="value"&&xo(pi)){var t=[];Iu(t,pi,e,ke(e)),Qi(Dg,t)}}function jg(e,t,o){e==="focusin"?(Ou(),fi=t,pi=o,fi.attachEvent("onpropertychange",Bu)):e==="focusout"&&Ou()}function Pg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return xo(pi)}function Og(e,t){if(e==="click")return xo(t)}function Bg(e,t){if(e==="input"||e==="change")return xo(t)}function Fg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Sn=typeof Object.is=="function"?Object.is:Fg;function mi(e,t){if(Sn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var o=Object.keys(e),w=Object.keys(t);if(o.length!==w.length)return!1;for(w=0;w<o.length;w++){var A=o[w];if(!c.call(t,A)||!Sn(e[A],t[A]))return!1}return!0}function Fu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Hu(e,t){var o=Fu(e);e=0;for(var w;o;){if(o.nodeType===3){if(w=e+o.textContent.length,e<=t&&w>=t)return{node:o,offset:t-e};e=w}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Fu(o)}}function $u(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$u(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Uu(){for(var e=window,t=ie();t instanceof e.HTMLIFrameElement;){try{var o=typeof t.contentWindow.location.href=="string"}catch{o=!1}if(o)e=t.contentWindow;else break;t=ie(e.document)}return t}function Qa(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 Hg(e){var t=Uu(),o=e.focusedElem,w=e.selectionRange;if(t!==o&&o&&o.ownerDocument&&$u(o.ownerDocument.documentElement,o)){if(w!==null&&Qa(o)){if(t=w.start,e=w.end,e===void 0&&(e=t),"selectionStart"in o)o.selectionStart=t,o.selectionEnd=Math.min(e,o.value.length);else if(e=(t=o.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var A=o.textContent.length,j=Math.min(w.start,A);w=w.end===void 0?j:Math.min(w.end,A),!e.extend&&j>w&&(A=w,w=j,j=A),A=Hu(o,j);var z=Hu(o,w);A&&z&&(e.rangeCount!==1||e.anchorNode!==A.node||e.anchorOffset!==A.offset||e.focusNode!==z.node||e.focusOffset!==z.offset)&&(t=t.createRange(),t.setStart(A.node,A.offset),e.removeAllRanges(),j>w?(e.addRange(t),e.extend(z.node,z.offset)):(t.setEnd(z.node,z.offset),e.addRange(t)))}}for(t=[],e=o;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<t.length;o++)e=t[o],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var $g=r&&"documentMode"in document&&11>=document.documentMode,yr=null,Ja=null,gi=null,Za=!1;function Wu(e,t,o){var w=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Za||yr==null||yr!==ie(w)||(w=yr,"selectionStart"in w&&Qa(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),gi&&mi(gi,w)||(gi=w,w=To(Ja,"onSelect"),0<w.length&&(t=new mr("onSelect","select",null,t,o),e.push({event:t,listeners:w}),t.target=yr)))}function ko(e,t){var o={};return o[e.toLowerCase()]=t.toLowerCase(),o["Webkit"+e]="webkit"+t,o["Moz"+e]="moz"+t,o}var wr={animationend:ko("Animation","AnimationEnd"),animationiteration:ko("Animation","AnimationIteration"),animationstart:ko("Animation","AnimationStart"),transitionend:ko("Transition","TransitionEnd")},el={},zu={};r&&(zu=document.createElement("div").style,"AnimationEvent"in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),"TransitionEvent"in window||delete wr.transitionend.transition);function Eo(e){if(el[e])return el[e];if(!wr[e])return e;var t=wr[e],o;for(o in t)if(t.hasOwnProperty(o)&&o in zu)return el[e]=t[o];return e}var Vu=Eo("animationend"),qu=Eo("animationiteration"),Ku=Eo("animationstart"),Gu=Eo("transitionend"),Yu=new Map,Xu="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 ds(e,t){Yu.set(e,t),R(t,[e])}for(var tl=0;tl<Xu.length;tl++){var nl=Xu[tl],Ug=nl.toLowerCase(),Wg=nl[0].toUpperCase()+nl.slice(1);ds(Ug,"on"+Wg)}ds(Vu,"onAnimationEnd"),ds(qu,"onAnimationIteration"),ds(Ku,"onAnimationStart"),ds("dblclick","onDoubleClick"),ds("focusin","onFocus"),ds("focusout","onBlur"),ds(Gu,"onTransitionEnd"),x("onMouseEnter",["mouseout","mouseover"]),x("onMouseLeave",["mouseout","mouseover"]),x("onPointerEnter",["pointerout","pointerover"]),x("onPointerLeave",["pointerout","pointerover"]),R("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),R("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),R("onBeforeInput",["compositionend","keypress","textInput","paste"]),R("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),R("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),R("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _i="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(" "),zg=new Set("cancel close invalid load scroll toggle".split(" ").concat(_i));function Qu(e,t,o){var w=e.type||"unknown-event";e.currentTarget=o,Qr(w,t,void 0,e),e.currentTarget=null}function Ju(e,t){t=(t&4)!==0;for(var o=0;o<e.length;o++){var w=e[o],A=w.event;w=w.listeners;e:{var j=void 0;if(t)for(var z=w.length-1;0<=z;z--){var Q=w[z],ee=Q.instance,he=Q.currentTarget;if(Q=Q.listener,ee!==j&&A.isPropagationStopped())break e;Qu(A,Q,he),j=ee}else for(z=0;z<w.length;z++){if(Q=w[z],ee=Q.instance,he=Q.currentTarget,Q=Q.listener,ee!==j&&A.isPropagationStopped())break e;Qu(A,Q,he),j=ee}}}if(Is)throw e=Xr,Is=!1,Xr=null,e}function _t(e,t){var o=t[ul];o===void 0&&(o=t[ul]=new Set);var w=e+"__bubble";o.has(w)||(Zu(t,e,2,!1),o.add(w))}function sl(e,t,o){var w=0;t&&(w|=4),Zu(o,e,w,t)}var Lo="_reactListening"+Math.random().toString(36).slice(2);function vi(e){if(!e[Lo]){e[Lo]=!0,h.forEach(function(o){o!=="selectionchange"&&(zg.has(o)||sl(o,!1,e),sl(o,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Lo]||(t[Lo]=!0,sl("selectionchange",!1,t))}}function Zu(e,t,o,w){switch(ho(t)){case 1:var A=za;break;case 4:A=Va;break;default:A=ci}o=A.bind(null,t,o,e),A=void 0,!Yr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(A=!0),w?A!==void 0?e.addEventListener(t,o,{capture:!0,passive:A}):e.addEventListener(t,o,!0):A!==void 0?e.addEventListener(t,o,{passive:A}):e.addEventListener(t,o,!1)}function rl(e,t,o,w,A){var j=w;if((t&1)===0&&(t&2)===0&&w!==null)e:for(;;){if(w===null)return;var z=w.tag;if(z===3||z===4){var Q=w.stateNode.containerInfo;if(Q===A||Q.nodeType===8&&Q.parentNode===A)break;if(z===4)for(z=w.return;z!==null;){var ee=z.tag;if((ee===3||ee===4)&&(ee=z.stateNode.containerInfo,ee===A||ee.nodeType===8&&ee.parentNode===A))return;z=z.return}for(;Q!==null;){if(z=Ws(Q),z===null)return;if(ee=z.tag,ee===5||ee===6){w=j=z;continue e}Q=Q.parentNode}}w=w.return}Qi(function(){var he=j,ve=ke(o),be=[];e:{var ge=Yu.get(e);if(ge!==void 0){var De=mr,Pe=e;switch(e){case"keypress":if(pr(o)===0)break e;case"keydown":case"keyup":De=Yn;break;case"focusin":Pe="focus",De=_r;break;case"focusout":Pe="blur",De=_r;break;case"beforeblur":case"afterblur":De=_r;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":De=po;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":De=go;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":De=Cg;break;case Vu:case qu:case Ku:De=yo;break;case Gu:De=kg;break;case"scroll":De=qa;break;case"wheel":De=Lg;break;case"copy":case"cut":case"paste":De=wo;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":De=Lu}var Be=(t&4)!==0,xt=!Be&&e==="scroll",ae=Be?ge!==null?ge+"Capture":null:ge;Be=[];for(var se=he,ce;se!==null;){ce=se;var xe=ce.stateNode;if(ce.tag===5&&xe!==null&&(ce=xe,ae!==null&&(xe=Ns(se,ae),xe!=null&&Be.push(yi(se,xe,ce)))),xt)break;se=se.return}0<Be.length&&(ge=new De(ge,Pe,null,o,ve),be.push({event:ge,listeners:Be}))}}if((t&7)===0){e:{if(ge=e==="mouseover"||e==="pointerover",De=e==="mouseout"||e==="pointerout",ge&&o!==le&&(Pe=o.relatedTarget||o.fromElement)&&(Ws(Pe)||Pe[Xn]))break e;if((De||ge)&&(ge=ve.window===ve?ve:(ge=ve.ownerDocument)?ge.defaultView||ge.parentWindow:window,De?(Pe=o.relatedTarget||o.toElement,De=he,Pe=Pe?Ws(Pe):null,Pe!==null&&(xt=Un(Pe),Pe!==xt||Pe.tag!==5&&Pe.tag!==6)&&(Pe=null)):(De=null,Pe=he),De!==Pe)){if(Be=po,xe="onMouseLeave",ae="onMouseEnter",se="mouse",(e==="pointerout"||e==="pointerover")&&(Be=Lu,xe="onPointerLeave",ae="onPointerEnter",se="pointer"),xt=De==null?ge:Cr(De),ce=Pe==null?ge:Cr(Pe),ge=new Be(xe,se+"leave",De,o,ve),ge.target=xt,ge.relatedTarget=ce,xe=null,Ws(ve)===he&&(Be=new Be(ae,se+"enter",Pe,o,ve),Be.target=ce,Be.relatedTarget=xt,xe=Be),xt=xe,De&&Pe)t:{for(Be=De,ae=Pe,se=0,ce=Be;ce;ce=br(ce))se++;for(ce=0,xe=ae;xe;xe=br(xe))ce++;for(;0<se-ce;)Be=br(Be),se--;for(;0<ce-se;)ae=br(ae),ce--;for(;se--;){if(Be===ae||ae!==null&&Be===ae.alternate)break t;Be=br(Be),ae=br(ae)}Be=null}else Be=null;De!==null&&eh(be,ge,De,Be,!1),Pe!==null&&xt!==null&&eh(be,xt,Pe,Be,!0)}}e:{if(ge=he?Cr(he):window,De=ge.nodeName&&ge.nodeName.toLowerCase(),De==="select"||De==="input"&&ge.type==="file")var He=Ig;else if(Du(ge))if(ju)He=Bg;else{He=Pg;var qe=jg}else(De=ge.nodeName)&&De.toLowerCase()==="input"&&(ge.type==="checkbox"||ge.type==="radio")&&(He=Og);if(He&&(He=He(e,he))){Iu(be,He,o,ve);break e}qe&&qe(e,ge,he),e==="focusout"&&(qe=ge._wrapperState)&&qe.controlled&&ge.type==="number"&&Me(ge,"number",ge.value)}switch(qe=he?Cr(he):window,e){case"focusin":(Du(qe)||qe.contentEditable==="true")&&(yr=qe,Ja=he,gi=null);break;case"focusout":gi=Ja=yr=null;break;case"mousedown":Za=!0;break;case"contextmenu":case"mouseup":case"dragend":Za=!1,Wu(be,o,ve);break;case"selectionchange":if($g)break;case"keydown":case"keyup":Wu(be,o,ve)}var Ke;if(Ga)e:{switch(e){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else vr?Au(e,o)&&(Ge="onCompositionEnd"):e==="keydown"&&o.keyCode===229&&(Ge="onCompositionStart");Ge&&(Tu&&o.locale!=="ko"&&(vr||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&vr&&(Ke=fr()):(An=ve,Nn="value"in An?An.value:An.textContent,vr=!0)),qe=To(he,Ge),0<qe.length&&(Ge=new hi(Ge,e,null,o,ve),be.push({event:Ge,listeners:qe}),Ke?Ge.data=Ke:(Ke=Nu(o),Ke!==null&&(Ge.data=Ke)))),(Ke=Rg?Mg(e,o):Ag(e,o))&&(he=To(he,"onBeforeInput"),0<he.length&&(ve=new hi("onBeforeInput","beforeinput",null,o,ve),be.push({event:ve,listeners:he}),ve.data=Ke))}Ju(be,t)})}function yi(e,t,o){return{instance:e,listener:t,currentTarget:o}}function To(e,t){for(var o=t+"Capture",w=[];e!==null;){var A=e,j=A.stateNode;A.tag===5&&j!==null&&(A=j,j=Ns(e,o),j!=null&&w.unshift(yi(e,j,A)),j=Ns(e,t),j!=null&&w.push(yi(e,j,A))),e=e.return}return w}function br(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function eh(e,t,o,w,A){for(var j=t._reactName,z=[];o!==null&&o!==w;){var Q=o,ee=Q.alternate,he=Q.stateNode;if(ee!==null&&ee===w)break;Q.tag===5&&he!==null&&(Q=he,A?(ee=Ns(o,j),ee!=null&&z.unshift(yi(o,ee,Q))):A||(ee=Ns(o,j),ee!=null&&z.push(yi(o,ee,Q)))),o=o.return}z.length!==0&&e.push({event:t,listeners:z})}var Vg=/\r\n?/g,qg=/\u0000|\uFFFD/g;function th(e){return(typeof e=="string"?e:""+e).replace(Vg,`
38
+ `).replace(qg,"")}function Ro(e,t,o){if(t=th(t),th(e)!==t&&o)throw Error(i(425))}function Mo(){}var il=null,ol=null;function al(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 ll=typeof setTimeout=="function"?setTimeout:void 0,Kg=typeof clearTimeout=="function"?clearTimeout:void 0,nh=typeof Promise=="function"?Promise:void 0,Gg=typeof queueMicrotask=="function"?queueMicrotask:typeof nh<"u"?function(e){return nh.resolve(null).then(e).catch(Yg)}:ll;function Yg(e){setTimeout(function(){throw e})}function cl(e,t){var o=t,w=0;do{var A=o.nextSibling;if(e.removeChild(o),A&&A.nodeType===8)if(o=A.data,o==="/$"){if(w===0){e.removeChild(A),us(t);return}w--}else o!=="$"&&o!=="$?"&&o!=="$!"||w++;o=A}while(o);us(t)}function fs(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 sh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var o=e.data;if(o==="$"||o==="$!"||o==="$?"){if(t===0)return e;t--}else o==="/$"&&t++}e=e.previousSibling}return null}var Sr=Math.random().toString(36).slice(2),In="__reactFiber$"+Sr,wi="__reactProps$"+Sr,Xn="__reactContainer$"+Sr,ul="__reactEvents$"+Sr,Xg="__reactListeners$"+Sr,Qg="__reactHandles$"+Sr;function Ws(e){var t=e[In];if(t)return t;for(var o=e.parentNode;o;){if(t=o[Xn]||o[In]){if(o=t.alternate,t.child!==null||o!==null&&o.child!==null)for(e=sh(e);e!==null;){if(o=e[In])return o;e=sh(e)}return t}e=o,o=e.parentNode}return null}function bi(e){return e=e[In]||e[Xn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Cr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(i(33))}function Ao(e){return e[wi]||null}var hl=[],xr=-1;function ps(e){return{current:e}}function vt(e){0>xr||(e.current=hl[xr],hl[xr]=null,xr--)}function pt(e,t){xr++,hl[xr]=e.current,e.current=t}var ms={},$t=ps(ms),Qt=ps(!1),zs=ms;function kr(e,t){var o=e.type.contextTypes;if(!o)return ms;var w=e.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===t)return w.__reactInternalMemoizedMaskedChildContext;var A={},j;for(j in o)A[j]=t[j];return w&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=A),A}function Jt(e){return e=e.childContextTypes,e!=null}function No(){vt(Qt),vt($t)}function rh(e,t,o){if($t.current!==ms)throw Error(i(168));pt($t,t),pt(Qt,o)}function ih(e,t,o){var w=e.stateNode;if(t=t.childContextTypes,typeof w.getChildContext!="function")return o;w=w.getChildContext();for(var A in w)if(!(A in t))throw Error(i(108,K(e)||"Unknown",A));return $({},o,w)}function Do(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ms,zs=$t.current,pt($t,e),pt(Qt,Qt.current),!0}function oh(e,t,o){var w=e.stateNode;if(!w)throw Error(i(169));o?(e=ih(e,t,zs),w.__reactInternalMemoizedMergedChildContext=e,vt(Qt),vt($t),pt($t,e)):vt(Qt),pt(Qt,o)}var Qn=null,Io=!1,dl=!1;function ah(e){Qn===null?Qn=[e]:Qn.push(e)}function Jg(e){Io=!0,ah(e)}function gs(){if(!dl&&Qn!==null){dl=!0;var e=0,t=ot;try{var o=Qn;for(ot=1;e<o.length;e++){var w=o[e];do w=w(!0);while(w!==null)}Qn=null,Io=!1}catch(A){throw Qn!==null&&(Qn=Qn.slice(e+1)),no(ti,gs),A}finally{ot=t,dl=!1}}return null}var Er=[],Lr=0,jo=null,Po=0,un=[],hn=0,Vs=null,Jn=1,Zn="";function qs(e,t){Er[Lr++]=Po,Er[Lr++]=jo,jo=e,Po=t}function lh(e,t,o){un[hn++]=Jn,un[hn++]=Zn,un[hn++]=Vs,Vs=e;var w=Jn;e=Zn;var A=32-At(w)-1;w&=~(1<<A),o+=1;var j=32-At(t)+A;if(30<j){var z=A-A%5;j=(w&(1<<z)-1).toString(32),w>>=z,A-=z,Jn=1<<32-At(t)+A|o<<A|w,Zn=j+e}else Jn=1<<j|o<<A|w,Zn=e}function fl(e){e.return!==null&&(qs(e,1),lh(e,1,0))}function pl(e){for(;e===jo;)jo=Er[--Lr],Er[Lr]=null,Po=Er[--Lr],Er[Lr]=null;for(;e===Vs;)Vs=un[--hn],un[hn]=null,Zn=un[--hn],un[hn]=null,Jn=un[--hn],un[hn]=null}var on=null,an=null,wt=!1,Cn=null;function ch(e,t){var o=mn(5,null,null,0);o.elementType="DELETED",o.stateNode=t,o.return=e,t=e.deletions,t===null?(e.deletions=[o],e.flags|=16):t.push(o)}function uh(e,t){switch(e.tag){case 5:var o=e.type;return t=t.nodeType!==1||o.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,on=e,an=fs(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?(o=Vs!==null?{id:Jn,overflow:Zn}:null,e.memoizedState={dehydrated:t,treeContext:o,retryLane:1073741824},o=mn(18,null,null,0),o.stateNode=t,o.return=e,e.child=o,on=e,an=null,!0):!1;default:return!1}}function ml(e){return(e.mode&1)!==0&&(e.flags&128)===0}function gl(e){if(wt){var t=an;if(t){var o=t;if(!uh(e,t)){if(ml(e))throw Error(i(418));t=fs(o.nextSibling);var w=on;t&&uh(e,t)?ch(w,o):(e.flags=e.flags&-4097|2,wt=!1,on=e)}}else{if(ml(e))throw Error(i(418));e.flags=e.flags&-4097|2,wt=!1,on=e}}}function hh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;on=e}function Oo(e){if(e!==on)return!1;if(!wt)return hh(e),wt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!al(e.type,e.memoizedProps)),t&&(t=an)){if(ml(e))throw dh(),Error(i(418));for(;t;)ch(e,t),t=fs(t.nextSibling)}if(hh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var o=e.data;if(o==="/$"){if(t===0){an=fs(e.nextSibling);break e}t--}else o!=="$"&&o!=="$!"&&o!=="$?"||t++}e=e.nextSibling}an=null}}else an=on?fs(e.stateNode.nextSibling):null;return!0}function dh(){for(var e=an;e;)e=fs(e.nextSibling)}function Tr(){an=on=null,wt=!1}function _l(e){Cn===null?Cn=[e]:Cn.push(e)}var Zg=k.ReactCurrentBatchConfig;function Si(e,t,o){if(e=o.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(o._owner){if(o=o._owner,o){if(o.tag!==1)throw Error(i(309));var w=o.stateNode}if(!w)throw Error(i(147,e));var A=w,j=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===j?t.ref:(t=function(z){var Q=A.refs;z===null?delete Q[j]:Q[j]=z},t._stringRef=j,t)}if(typeof e!="string")throw Error(i(284));if(!o._owner)throw Error(i(290,e))}return e}function Bo(e,t){throw e=Object.prototype.toString.call(t),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function fh(e){var t=e._init;return t(e._payload)}function ph(e){function t(ae,se){if(e){var ce=ae.deletions;ce===null?(ae.deletions=[se],ae.flags|=16):ce.push(se)}}function o(ae,se){if(!e)return null;for(;se!==null;)t(ae,se),se=se.sibling;return null}function w(ae,se){for(ae=new Map;se!==null;)se.key!==null?ae.set(se.key,se):ae.set(se.index,se),se=se.sibling;return ae}function A(ae,se){return ae=xs(ae,se),ae.index=0,ae.sibling=null,ae}function j(ae,se,ce){return ae.index=ce,e?(ce=ae.alternate,ce!==null?(ce=ce.index,ce<se?(ae.flags|=2,se):ce):(ae.flags|=2,se)):(ae.flags|=1048576,se)}function z(ae){return e&&ae.alternate===null&&(ae.flags|=2),ae}function Q(ae,se,ce,xe){return se===null||se.tag!==6?(se=lc(ce,ae.mode,xe),se.return=ae,se):(se=A(se,ce),se.return=ae,se)}function ee(ae,se,ce,xe){var He=ce.type;return He===M?ve(ae,se,ce.props.children,xe,ce.key):se!==null&&(se.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===Y&&fh(He)===se.type)?(xe=A(se,ce.props),xe.ref=Si(ae,se,ce),xe.return=ae,xe):(xe=la(ce.type,ce.key,ce.props,null,ae.mode,xe),xe.ref=Si(ae,se,ce),xe.return=ae,xe)}function he(ae,se,ce,xe){return se===null||se.tag!==4||se.stateNode.containerInfo!==ce.containerInfo||se.stateNode.implementation!==ce.implementation?(se=cc(ce,ae.mode,xe),se.return=ae,se):(se=A(se,ce.children||[]),se.return=ae,se)}function ve(ae,se,ce,xe,He){return se===null||se.tag!==7?(se=er(ce,ae.mode,xe,He),se.return=ae,se):(se=A(se,ce),se.return=ae,se)}function be(ae,se,ce){if(typeof se=="string"&&se!==""||typeof se=="number")return se=lc(""+se,ae.mode,ce),se.return=ae,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case D:return ce=la(se.type,se.key,se.props,null,ae.mode,ce),ce.ref=Si(ae,null,se),ce.return=ae,ce;case E:return se=cc(se,ae.mode,ce),se.return=ae,se;case Y:var xe=se._init;return be(ae,xe(se._payload),ce)}if(_e(se)||P(se))return se=er(se,ae.mode,ce,null),se.return=ae,se;Bo(ae,se)}return null}function ge(ae,se,ce,xe){var He=se!==null?se.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return He!==null?null:Q(ae,se,""+ce,xe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case D:return ce.key===He?ee(ae,se,ce,xe):null;case E:return ce.key===He?he(ae,se,ce,xe):null;case Y:return He=ce._init,ge(ae,se,He(ce._payload),xe)}if(_e(ce)||P(ce))return He!==null?null:ve(ae,se,ce,xe,null);Bo(ae,ce)}return null}function De(ae,se,ce,xe,He){if(typeof xe=="string"&&xe!==""||typeof xe=="number")return ae=ae.get(ce)||null,Q(se,ae,""+xe,He);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case D:return ae=ae.get(xe.key===null?ce:xe.key)||null,ee(se,ae,xe,He);case E:return ae=ae.get(xe.key===null?ce:xe.key)||null,he(se,ae,xe,He);case Y:var qe=xe._init;return De(ae,se,ce,qe(xe._payload),He)}if(_e(xe)||P(xe))return ae=ae.get(ce)||null,ve(se,ae,xe,He,null);Bo(se,xe)}return null}function Pe(ae,se,ce,xe){for(var He=null,qe=null,Ke=se,Ge=se=0,jt=null;Ke!==null&&Ge<ce.length;Ge++){Ke.index>Ge?(jt=Ke,Ke=null):jt=Ke.sibling;var at=ge(ae,Ke,ce[Ge],xe);if(at===null){Ke===null&&(Ke=jt);break}e&&Ke&&at.alternate===null&&t(ae,Ke),se=j(at,se,Ge),qe===null?He=at:qe.sibling=at,qe=at,Ke=jt}if(Ge===ce.length)return o(ae,Ke),wt&&qs(ae,Ge),He;if(Ke===null){for(;Ge<ce.length;Ge++)Ke=be(ae,ce[Ge],xe),Ke!==null&&(se=j(Ke,se,Ge),qe===null?He=Ke:qe.sibling=Ke,qe=Ke);return wt&&qs(ae,Ge),He}for(Ke=w(ae,Ke);Ge<ce.length;Ge++)jt=De(Ke,ae,Ge,ce[Ge],xe),jt!==null&&(e&&jt.alternate!==null&&Ke.delete(jt.key===null?Ge:jt.key),se=j(jt,se,Ge),qe===null?He=jt:qe.sibling=jt,qe=jt);return e&&Ke.forEach(function(ks){return t(ae,ks)}),wt&&qs(ae,Ge),He}function Be(ae,se,ce,xe){var He=P(ce);if(typeof He!="function")throw Error(i(150));if(ce=He.call(ce),ce==null)throw Error(i(151));for(var qe=He=null,Ke=se,Ge=se=0,jt=null,at=ce.next();Ke!==null&&!at.done;Ge++,at=ce.next()){Ke.index>Ge?(jt=Ke,Ke=null):jt=Ke.sibling;var ks=ge(ae,Ke,at.value,xe);if(ks===null){Ke===null&&(Ke=jt);break}e&&Ke&&ks.alternate===null&&t(ae,Ke),se=j(ks,se,Ge),qe===null?He=ks:qe.sibling=ks,qe=ks,Ke=jt}if(at.done)return o(ae,Ke),wt&&qs(ae,Ge),He;if(Ke===null){for(;!at.done;Ge++,at=ce.next())at=be(ae,at.value,xe),at!==null&&(se=j(at,se,Ge),qe===null?He=at:qe.sibling=at,qe=at);return wt&&qs(ae,Ge),He}for(Ke=w(ae,Ke);!at.done;Ge++,at=ce.next())at=De(Ke,ae,Ge,at.value,xe),at!==null&&(e&&at.alternate!==null&&Ke.delete(at.key===null?Ge:at.key),se=j(at,se,Ge),qe===null?He=at:qe.sibling=at,qe=at);return e&&Ke.forEach(function(N_){return t(ae,N_)}),wt&&qs(ae,Ge),He}function xt(ae,se,ce,xe){if(typeof ce=="object"&&ce!==null&&ce.type===M&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case D:e:{for(var He=ce.key,qe=se;qe!==null;){if(qe.key===He){if(He=ce.type,He===M){if(qe.tag===7){o(ae,qe.sibling),se=A(qe,ce.props.children),se.return=ae,ae=se;break e}}else if(qe.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===Y&&fh(He)===qe.type){o(ae,qe.sibling),se=A(qe,ce.props),se.ref=Si(ae,qe,ce),se.return=ae,ae=se;break e}o(ae,qe);break}else t(ae,qe);qe=qe.sibling}ce.type===M?(se=er(ce.props.children,ae.mode,xe,ce.key),se.return=ae,ae=se):(xe=la(ce.type,ce.key,ce.props,null,ae.mode,xe),xe.ref=Si(ae,se,ce),xe.return=ae,ae=xe)}return z(ae);case E:e:{for(qe=ce.key;se!==null;){if(se.key===qe)if(se.tag===4&&se.stateNode.containerInfo===ce.containerInfo&&se.stateNode.implementation===ce.implementation){o(ae,se.sibling),se=A(se,ce.children||[]),se.return=ae,ae=se;break e}else{o(ae,se);break}else t(ae,se);se=se.sibling}se=cc(ce,ae.mode,xe),se.return=ae,ae=se}return z(ae);case Y:return qe=ce._init,xt(ae,se,qe(ce._payload),xe)}if(_e(ce))return Pe(ae,se,ce,xe);if(P(ce))return Be(ae,se,ce,xe);Bo(ae,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,se!==null&&se.tag===6?(o(ae,se.sibling),se=A(se,ce),se.return=ae,ae=se):(o(ae,se),se=lc(ce,ae.mode,xe),se.return=ae,ae=se),z(ae)):o(ae,se)}return xt}var Rr=ph(!0),mh=ph(!1),Fo=ps(null),Ho=null,Mr=null,vl=null;function yl(){vl=Mr=Ho=null}function wl(e){var t=Fo.current;vt(Fo),e._currentValue=t}function bl(e,t,o){for(;e!==null;){var w=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,w!==null&&(w.childLanes|=t)):w!==null&&(w.childLanes&t)!==t&&(w.childLanes|=t),e===o)break;e=e.return}}function Ar(e,t){Ho=e,vl=Mr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Zt=!0),e.firstContext=null)}function dn(e){var t=e._currentValue;if(vl!==e)if(e={context:e,memoizedValue:t,next:null},Mr===null){if(Ho===null)throw Error(i(308));Mr=e,Ho.dependencies={lanes:0,firstContext:e}}else Mr=Mr.next=e;return t}var Ks=null;function Sl(e){Ks===null?Ks=[e]:Ks.push(e)}function gh(e,t,o,w){var A=t.interleaved;return A===null?(o.next=o,Sl(t)):(o.next=A.next,A.next=o),t.interleaved=o,es(e,w)}function es(e,t){e.lanes|=t;var o=e.alternate;for(o!==null&&(o.lanes|=t),o=e,e=e.return;e!==null;)e.childLanes|=t,o=e.alternate,o!==null&&(o.childLanes|=t),o=e,e=e.return;return o.tag===3?o.stateNode:null}var _s=!1;function Cl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _h(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 ts(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function vs(e,t,o){var w=e.updateQueue;if(w===null)return null;if(w=w.shared,(it&2)!==0){var A=w.pending;return A===null?t.next=t:(t.next=A.next,A.next=t),w.pending=t,es(e,o)}return A=w.interleaved,A===null?(t.next=t,Sl(w)):(t.next=A.next,A.next=t),w.interleaved=t,es(e,o)}function $o(e,t,o){if(t=t.updateQueue,t!==null&&(t=t.shared,(o&4194240)!==0)){var w=t.lanes;w&=e.pendingLanes,o|=w,t.lanes=o,ri(e,o)}}function vh(e,t){var o=e.updateQueue,w=e.alternate;if(w!==null&&(w=w.updateQueue,o===w)){var A=null,j=null;if(o=o.firstBaseUpdate,o!==null){do{var z={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};j===null?A=j=z:j=j.next=z,o=o.next}while(o!==null);j===null?A=j=t:j=j.next=t}else A=j=t;o={baseState:w.baseState,firstBaseUpdate:A,lastBaseUpdate:j,shared:w.shared,effects:w.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=t:e.next=t,o.lastBaseUpdate=t}function Uo(e,t,o,w){var A=e.updateQueue;_s=!1;var j=A.firstBaseUpdate,z=A.lastBaseUpdate,Q=A.shared.pending;if(Q!==null){A.shared.pending=null;var ee=Q,he=ee.next;ee.next=null,z===null?j=he:z.next=he,z=ee;var ve=e.alternate;ve!==null&&(ve=ve.updateQueue,Q=ve.lastBaseUpdate,Q!==z&&(Q===null?ve.firstBaseUpdate=he:Q.next=he,ve.lastBaseUpdate=ee))}if(j!==null){var be=A.baseState;z=0,ve=he=ee=null,Q=j;do{var ge=Q.lane,De=Q.eventTime;if((w&ge)===ge){ve!==null&&(ve=ve.next={eventTime:De,lane:0,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null});e:{var Pe=e,Be=Q;switch(ge=t,De=o,Be.tag){case 1:if(Pe=Be.payload,typeof Pe=="function"){be=Pe.call(De,be,ge);break e}be=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=Be.payload,ge=typeof Pe=="function"?Pe.call(De,be,ge):Pe,ge==null)break e;be=$({},be,ge);break e;case 2:_s=!0}}Q.callback!==null&&Q.lane!==0&&(e.flags|=64,ge=A.effects,ge===null?A.effects=[Q]:ge.push(Q))}else De={eventTime:De,lane:ge,tag:Q.tag,payload:Q.payload,callback:Q.callback,next:null},ve===null?(he=ve=De,ee=be):ve=ve.next=De,z|=ge;if(Q=Q.next,Q===null){if(Q=A.shared.pending,Q===null)break;ge=Q,Q=ge.next,ge.next=null,A.lastBaseUpdate=ge,A.shared.pending=null}}while(!0);if(ve===null&&(ee=be),A.baseState=ee,A.firstBaseUpdate=he,A.lastBaseUpdate=ve,t=A.shared.interleaved,t!==null){A=t;do z|=A.lane,A=A.next;while(A!==t)}else j===null&&(A.shared.lanes=0);Xs|=z,e.lanes=z,e.memoizedState=be}}function yh(e,t,o){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var w=e[t],A=w.callback;if(A!==null){if(w.callback=null,w=o,typeof A!="function")throw Error(i(191,A));A.call(w)}}}var Ci={},jn=ps(Ci),xi=ps(Ci),ki=ps(Ci);function Gs(e){if(e===Ci)throw Error(i(174));return e}function xl(e,t){switch(pt(ki,t),pt(xi,e),pt(jn,Ci),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Je(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Je(t,e)}vt(jn),pt(jn,t)}function Nr(){vt(jn),vt(xi),vt(ki)}function wh(e){Gs(ki.current);var t=Gs(jn.current),o=Je(t,e.type);t!==o&&(pt(xi,e),pt(jn,o))}function kl(e){xi.current===e&&(vt(jn),vt(xi))}var bt=ps(0);function Wo(e){for(var t=e;t!==null;){if(t.tag===13){var o=t.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.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 El=[];function Ll(){for(var e=0;e<El.length;e++)El[e]._workInProgressVersionPrimary=null;El.length=0}var zo=k.ReactCurrentDispatcher,Tl=k.ReactCurrentBatchConfig,Ys=0,St=null,Tt=null,Dt=null,Vo=!1,Ei=!1,Li=0,e_=0;function Ut(){throw Error(i(321))}function Rl(e,t){if(t===null)return!1;for(var o=0;o<t.length&&o<e.length;o++)if(!Sn(e[o],t[o]))return!1;return!0}function Ml(e,t,o,w,A,j){if(Ys=j,St=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,zo.current=e===null||e.memoizedState===null?r_:i_,e=o(w,A),Ei){j=0;do{if(Ei=!1,Li=0,25<=j)throw Error(i(301));j+=1,Dt=Tt=null,t.updateQueue=null,zo.current=o_,e=o(w,A)}while(Ei)}if(zo.current=Go,t=Tt!==null&&Tt.next!==null,Ys=0,Dt=Tt=St=null,Vo=!1,t)throw Error(i(300));return e}function Al(){var e=Li!==0;return Li=0,e}function Pn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dt===null?St.memoizedState=Dt=e:Dt=Dt.next=e,Dt}function fn(){if(Tt===null){var e=St.alternate;e=e!==null?e.memoizedState:null}else e=Tt.next;var t=Dt===null?St.memoizedState:Dt.next;if(t!==null)Dt=t,Tt=e;else{if(e===null)throw Error(i(310));Tt=e,e={memoizedState:Tt.memoizedState,baseState:Tt.baseState,baseQueue:Tt.baseQueue,queue:Tt.queue,next:null},Dt===null?St.memoizedState=Dt=e:Dt=Dt.next=e}return Dt}function Ti(e,t){return typeof t=="function"?t(e):t}function Nl(e){var t=fn(),o=t.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=e;var w=Tt,A=w.baseQueue,j=o.pending;if(j!==null){if(A!==null){var z=A.next;A.next=j.next,j.next=z}w.baseQueue=A=j,o.pending=null}if(A!==null){j=A.next,w=w.baseState;var Q=z=null,ee=null,he=j;do{var ve=he.lane;if((Ys&ve)===ve)ee!==null&&(ee=ee.next={lane:0,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),w=he.hasEagerState?he.eagerState:e(w,he.action);else{var be={lane:ve,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null};ee===null?(Q=ee=be,z=w):ee=ee.next=be,St.lanes|=ve,Xs|=ve}he=he.next}while(he!==null&&he!==j);ee===null?z=w:ee.next=Q,Sn(w,t.memoizedState)||(Zt=!0),t.memoizedState=w,t.baseState=z,t.baseQueue=ee,o.lastRenderedState=w}if(e=o.interleaved,e!==null){A=e;do j=A.lane,St.lanes|=j,Xs|=j,A=A.next;while(A!==e)}else A===null&&(o.lanes=0);return[t.memoizedState,o.dispatch]}function Dl(e){var t=fn(),o=t.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=e;var w=o.dispatch,A=o.pending,j=t.memoizedState;if(A!==null){o.pending=null;var z=A=A.next;do j=e(j,z.action),z=z.next;while(z!==A);Sn(j,t.memoizedState)||(Zt=!0),t.memoizedState=j,t.baseQueue===null&&(t.baseState=j),o.lastRenderedState=j}return[j,w]}function bh(){}function Sh(e,t){var o=St,w=fn(),A=t(),j=!Sn(w.memoizedState,A);if(j&&(w.memoizedState=A,Zt=!0),w=w.queue,Il(kh.bind(null,o,w,e),[e]),w.getSnapshot!==t||j||Dt!==null&&Dt.memoizedState.tag&1){if(o.flags|=2048,Ri(9,xh.bind(null,o,w,A,t),void 0,null),It===null)throw Error(i(349));(Ys&30)!==0||Ch(o,t,A)}return A}function Ch(e,t,o){e.flags|=16384,e={getSnapshot:t,value:o},t=St.updateQueue,t===null?(t={lastEffect:null,stores:null},St.updateQueue=t,t.stores=[e]):(o=t.stores,o===null?t.stores=[e]:o.push(e))}function xh(e,t,o,w){t.value=o,t.getSnapshot=w,Eh(t)&&Lh(e)}function kh(e,t,o){return o(function(){Eh(t)&&Lh(e)})}function Eh(e){var t=e.getSnapshot;e=e.value;try{var o=t();return!Sn(e,o)}catch{return!0}}function Lh(e){var t=es(e,1);t!==null&&Ln(t,e,1,-1)}function Th(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:Ti,lastRenderedState:e},t.queue=e,e=e.dispatch=s_.bind(null,St,e),[t.memoizedState,e]}function Ri(e,t,o,w){return e={tag:e,create:t,destroy:o,deps:w,next:null},t=St.updateQueue,t===null?(t={lastEffect:null,stores:null},St.updateQueue=t,t.lastEffect=e.next=e):(o=t.lastEffect,o===null?t.lastEffect=e.next=e:(w=o.next,o.next=e,e.next=w,t.lastEffect=e)),e}function Rh(){return fn().memoizedState}function qo(e,t,o,w){var A=Pn();St.flags|=e,A.memoizedState=Ri(1|t,o,void 0,w===void 0?null:w)}function Ko(e,t,o,w){var A=fn();w=w===void 0?null:w;var j=void 0;if(Tt!==null){var z=Tt.memoizedState;if(j=z.destroy,w!==null&&Rl(w,z.deps)){A.memoizedState=Ri(t,o,j,w);return}}St.flags|=e,A.memoizedState=Ri(1|t,o,j,w)}function Mh(e,t){return qo(8390656,8,e,t)}function Il(e,t){return Ko(2048,8,e,t)}function Ah(e,t){return Ko(4,2,e,t)}function Nh(e,t){return Ko(4,4,e,t)}function Dh(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 Ih(e,t,o){return o=o!=null?o.concat([e]):null,Ko(4,4,Dh.bind(null,t,e),o)}function jl(){}function jh(e,t){var o=fn();t=t===void 0?null:t;var w=o.memoizedState;return w!==null&&t!==null&&Rl(t,w[1])?w[0]:(o.memoizedState=[e,t],e)}function Ph(e,t){var o=fn();t=t===void 0?null:t;var w=o.memoizedState;return w!==null&&t!==null&&Rl(t,w[1])?w[0]:(e=e(),o.memoizedState=[e,t],e)}function Oh(e,t,o){return(Ys&21)===0?(e.baseState&&(e.baseState=!1,Zt=!0),e.memoizedState=o):(Sn(o,t)||(o=oo(),St.lanes|=o,Xs|=o,e.baseState=!0),t)}function t_(e,t){var o=ot;ot=o!==0&&4>o?o:4,e(!0);var w=Tl.transition;Tl.transition={};try{e(!1),t()}finally{ot=o,Tl.transition=w}}function Bh(){return fn().memoizedState}function n_(e,t,o){var w=Ss(e);if(o={lane:w,action:o,hasEagerState:!1,eagerState:null,next:null},Fh(e))Hh(t,o);else if(o=gh(e,t,o,w),o!==null){var A=Yt();Ln(o,e,w,A),$h(o,t,w)}}function s_(e,t,o){var w=Ss(e),A={lane:w,action:o,hasEagerState:!1,eagerState:null,next:null};if(Fh(e))Hh(t,A);else{var j=e.alternate;if(e.lanes===0&&(j===null||j.lanes===0)&&(j=t.lastRenderedReducer,j!==null))try{var z=t.lastRenderedState,Q=j(z,o);if(A.hasEagerState=!0,A.eagerState=Q,Sn(Q,z)){var ee=t.interleaved;ee===null?(A.next=A,Sl(t)):(A.next=ee.next,ee.next=A),t.interleaved=A;return}}catch{}finally{}o=gh(e,t,A,w),o!==null&&(A=Yt(),Ln(o,e,w,A),$h(o,t,w))}}function Fh(e){var t=e.alternate;return e===St||t!==null&&t===St}function Hh(e,t){Ei=Vo=!0;var o=e.pending;o===null?t.next=t:(t.next=o.next,o.next=t),e.pending=t}function $h(e,t,o){if((o&4194240)!==0){var w=t.lanes;w&=e.pendingLanes,o|=w,t.lanes=o,ri(e,o)}}var Go={readContext:dn,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},r_={readContext:dn,useCallback:function(e,t){return Pn().memoizedState=[e,t===void 0?null:t],e},useContext:dn,useEffect:Mh,useImperativeHandle:function(e,t,o){return o=o!=null?o.concat([e]):null,qo(4194308,4,Dh.bind(null,t,e),o)},useLayoutEffect:function(e,t){return qo(4194308,4,e,t)},useInsertionEffect:function(e,t){return qo(4,2,e,t)},useMemo:function(e,t){var o=Pn();return t=t===void 0?null:t,e=e(),o.memoizedState=[e,t],e},useReducer:function(e,t,o){var w=Pn();return t=o!==void 0?o(t):t,w.memoizedState=w.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},w.queue=e,e=e.dispatch=n_.bind(null,St,e),[w.memoizedState,e]},useRef:function(e){var t=Pn();return e={current:e},t.memoizedState=e},useState:Th,useDebugValue:jl,useDeferredValue:function(e){return Pn().memoizedState=e},useTransition:function(){var e=Th(!1),t=e[0];return e=t_.bind(null,e[1]),Pn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,o){var w=St,A=Pn();if(wt){if(o===void 0)throw Error(i(407));o=o()}else{if(o=t(),It===null)throw Error(i(349));(Ys&30)!==0||Ch(w,t,o)}A.memoizedState=o;var j={value:o,getSnapshot:t};return A.queue=j,Mh(kh.bind(null,w,j,e),[e]),w.flags|=2048,Ri(9,xh.bind(null,w,j,o,t),void 0,null),o},useId:function(){var e=Pn(),t=It.identifierPrefix;if(wt){var o=Zn,w=Jn;o=(w&~(1<<32-At(w)-1)).toString(32)+o,t=":"+t+"R"+o,o=Li++,0<o&&(t+="H"+o.toString(32)),t+=":"}else o=e_++,t=":"+t+"r"+o.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},i_={readContext:dn,useCallback:jh,useContext:dn,useEffect:Il,useImperativeHandle:Ih,useInsertionEffect:Ah,useLayoutEffect:Nh,useMemo:Ph,useReducer:Nl,useRef:Rh,useState:function(){return Nl(Ti)},useDebugValue:jl,useDeferredValue:function(e){var t=fn();return Oh(t,Tt.memoizedState,e)},useTransition:function(){var e=Nl(Ti)[0],t=fn().memoizedState;return[e,t]},useMutableSource:bh,useSyncExternalStore:Sh,useId:Bh,unstable_isNewReconciler:!1},o_={readContext:dn,useCallback:jh,useContext:dn,useEffect:Il,useImperativeHandle:Ih,useInsertionEffect:Ah,useLayoutEffect:Nh,useMemo:Ph,useReducer:Dl,useRef:Rh,useState:function(){return Dl(Ti)},useDebugValue:jl,useDeferredValue:function(e){var t=fn();return Tt===null?t.memoizedState=e:Oh(t,Tt.memoizedState,e)},useTransition:function(){var e=Dl(Ti)[0],t=fn().memoizedState;return[e,t]},useMutableSource:bh,useSyncExternalStore:Sh,useId:Bh,unstable_isNewReconciler:!1};function xn(e,t){if(e&&e.defaultProps){t=$({},t),e=e.defaultProps;for(var o in e)t[o]===void 0&&(t[o]=e[o]);return t}return t}function Pl(e,t,o,w){t=e.memoizedState,o=o(w,t),o=o==null?t:$({},t,o),e.memoizedState=o,e.lanes===0&&(e.updateQueue.baseState=o)}var Yo={isMounted:function(e){return(e=e._reactInternals)?Un(e)===e:!1},enqueueSetState:function(e,t,o){e=e._reactInternals;var w=Yt(),A=Ss(e),j=ts(w,A);j.payload=t,o!=null&&(j.callback=o),t=vs(e,j,A),t!==null&&(Ln(t,e,A,w),$o(t,e,A))},enqueueReplaceState:function(e,t,o){e=e._reactInternals;var w=Yt(),A=Ss(e),j=ts(w,A);j.tag=1,j.payload=t,o!=null&&(j.callback=o),t=vs(e,j,A),t!==null&&(Ln(t,e,A,w),$o(t,e,A))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var o=Yt(),w=Ss(e),A=ts(o,w);A.tag=2,t!=null&&(A.callback=t),t=vs(e,A,w),t!==null&&(Ln(t,e,w,o),$o(t,e,w))}};function Uh(e,t,o,w,A,j,z){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(w,j,z):t.prototype&&t.prototype.isPureReactComponent?!mi(o,w)||!mi(A,j):!0}function Wh(e,t,o){var w=!1,A=ms,j=t.contextType;return typeof j=="object"&&j!==null?j=dn(j):(A=Jt(t)?zs:$t.current,w=t.contextTypes,j=(w=w!=null)?kr(e,A):ms),t=new t(o,j),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Yo,e.stateNode=t,t._reactInternals=e,w&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=A,e.__reactInternalMemoizedMaskedChildContext=j),t}function zh(e,t,o,w){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(o,w),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(o,w),t.state!==e&&Yo.enqueueReplaceState(t,t.state,null)}function Ol(e,t,o,w){var A=e.stateNode;A.props=o,A.state=e.memoizedState,A.refs={},Cl(e);var j=t.contextType;typeof j=="object"&&j!==null?A.context=dn(j):(j=Jt(t)?zs:$t.current,A.context=kr(e,j)),A.state=e.memoizedState,j=t.getDerivedStateFromProps,typeof j=="function"&&(Pl(e,t,j,o),A.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(t=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),t!==A.state&&Yo.enqueueReplaceState(A,A.state,null),Uo(e,o,A,w),A.state=e.memoizedState),typeof A.componentDidMount=="function"&&(e.flags|=4194308)}function Dr(e,t){try{var o="",w=t;do o+=ue(w),w=w.return;while(w);var A=o}catch(j){A=`
39
+ Error generating stack: `+j.message+`
40
+ `+j.stack}return{value:e,source:t,stack:A,digest:null}}function Bl(e,t,o){return{value:e,source:null,stack:o??null,digest:t??null}}function Fl(e,t){try{console.error(t.value)}catch(o){setTimeout(function(){throw o})}}var a_=typeof WeakMap=="function"?WeakMap:Map;function Vh(e,t,o){o=ts(-1,o),o.tag=3,o.payload={element:null};var w=t.value;return o.callback=function(){na||(na=!0,ec=w),Fl(e,t)},o}function qh(e,t,o){o=ts(-1,o),o.tag=3;var w=e.type.getDerivedStateFromError;if(typeof w=="function"){var A=t.value;o.payload=function(){return w(A)},o.callback=function(){Fl(e,t)}}var j=e.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(o.callback=function(){Fl(e,t),typeof w!="function"&&(ws===null?ws=new Set([this]):ws.add(this));var z=t.stack;this.componentDidCatch(t.value,{componentStack:z!==null?z:""})}),o}function Kh(e,t,o){var w=e.pingCache;if(w===null){w=e.pingCache=new a_;var A=new Set;w.set(t,A)}else A=w.get(t),A===void 0&&(A=new Set,w.set(t,A));A.has(o)||(A.add(o),e=b_.bind(null,e,t,o),t.then(e,e))}function Gh(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 Yh(e,t,o,w,A){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(t=ts(-1,1),t.tag=2,vs(o,t,1))),o.lanes|=1),e):(e.flags|=65536,e.lanes=A,e)}var l_=k.ReactCurrentOwner,Zt=!1;function Gt(e,t,o,w){t.child=e===null?mh(t,null,o,w):Rr(t,e.child,o,w)}function Xh(e,t,o,w,A){o=o.render;var j=t.ref;return Ar(t,A),w=Ml(e,t,o,w,j,A),o=Al(),e!==null&&!Zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~A,ns(e,t,A)):(wt&&o&&fl(t),t.flags|=1,Gt(e,t,w,A),t.child)}function Qh(e,t,o,w,A){if(e===null){var j=o.type;return typeof j=="function"&&!ac(j)&&j.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(t.tag=15,t.type=j,Jh(e,t,j,w,A)):(e=la(o.type,null,w,t,t.mode,A),e.ref=t.ref,e.return=t,t.child=e)}if(j=e.child,(e.lanes&A)===0){var z=j.memoizedProps;if(o=o.compare,o=o!==null?o:mi,o(z,w)&&e.ref===t.ref)return ns(e,t,A)}return t.flags|=1,e=xs(j,w),e.ref=t.ref,e.return=t,t.child=e}function Jh(e,t,o,w,A){if(e!==null){var j=e.memoizedProps;if(mi(j,w)&&e.ref===t.ref)if(Zt=!1,t.pendingProps=w=j,(e.lanes&A)!==0)(e.flags&131072)!==0&&(Zt=!0);else return t.lanes=e.lanes,ns(e,t,A)}return Hl(e,t,o,w,A)}function Zh(e,t,o){var w=t.pendingProps,A=w.children,j=e!==null?e.memoizedState:null;if(w.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},pt(jr,ln),ln|=o;else{if((o&1073741824)===0)return e=j!==null?j.baseLanes|o:o,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,pt(jr,ln),ln|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=j!==null?j.baseLanes:o,pt(jr,ln),ln|=w}else j!==null?(w=j.baseLanes|o,t.memoizedState=null):w=o,pt(jr,ln),ln|=w;return Gt(e,t,A,o),t.child}function ed(e,t){var o=t.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(t.flags|=512,t.flags|=2097152)}function Hl(e,t,o,w,A){var j=Jt(o)?zs:$t.current;return j=kr(t,j),Ar(t,A),o=Ml(e,t,o,w,j,A),w=Al(),e!==null&&!Zt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~A,ns(e,t,A)):(wt&&w&&fl(t),t.flags|=1,Gt(e,t,o,A),t.child)}function td(e,t,o,w,A){if(Jt(o)){var j=!0;Do(t)}else j=!1;if(Ar(t,A),t.stateNode===null)Qo(e,t),Wh(t,o,w),Ol(t,o,w,A),w=!0;else if(e===null){var z=t.stateNode,Q=t.memoizedProps;z.props=Q;var ee=z.context,he=o.contextType;typeof he=="object"&&he!==null?he=dn(he):(he=Jt(o)?zs:$t.current,he=kr(t,he));var ve=o.getDerivedStateFromProps,be=typeof ve=="function"||typeof z.getSnapshotBeforeUpdate=="function";be||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==w||ee!==he)&&zh(t,z,w,he),_s=!1;var ge=t.memoizedState;z.state=ge,Uo(t,w,z,A),ee=t.memoizedState,Q!==w||ge!==ee||Qt.current||_s?(typeof ve=="function"&&(Pl(t,o,ve,w),ee=t.memoizedState),(Q=_s||Uh(t,o,Q,w,ge,ee,he))?(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=w,t.memoizedState=ee),z.props=w,z.state=ee,z.context=he,w=Q):(typeof z.componentDidMount=="function"&&(t.flags|=4194308),w=!1)}else{z=t.stateNode,_h(e,t),Q=t.memoizedProps,he=t.type===t.elementType?Q:xn(t.type,Q),z.props=he,be=t.pendingProps,ge=z.context,ee=o.contextType,typeof ee=="object"&&ee!==null?ee=dn(ee):(ee=Jt(o)?zs:$t.current,ee=kr(t,ee));var De=o.getDerivedStateFromProps;(ve=typeof De=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Q!==be||ge!==ee)&&zh(t,z,w,ee),_s=!1,ge=t.memoizedState,z.state=ge,Uo(t,w,z,A);var Pe=t.memoizedState;Q!==be||ge!==Pe||Qt.current||_s?(typeof De=="function"&&(Pl(t,o,De,w),Pe=t.memoizedState),(he=_s||Uh(t,o,he,w,ge,Pe,ee)||!1)?(ve||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(w,Pe,ee),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(w,Pe,ee)),typeof z.componentDidUpdate=="function"&&(t.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof z.componentDidUpdate!="function"||Q===e.memoizedProps&&ge===e.memoizedState||(t.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===e.memoizedProps&&ge===e.memoizedState||(t.flags|=1024),t.memoizedProps=w,t.memoizedState=Pe),z.props=w,z.state=Pe,z.context=ee,w=he):(typeof z.componentDidUpdate!="function"||Q===e.memoizedProps&&ge===e.memoizedState||(t.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||Q===e.memoizedProps&&ge===e.memoizedState||(t.flags|=1024),w=!1)}return $l(e,t,o,w,j,A)}function $l(e,t,o,w,A,j){ed(e,t);var z=(t.flags&128)!==0;if(!w&&!z)return A&&oh(t,o,!1),ns(e,t,j);w=t.stateNode,l_.current=t;var Q=z&&typeof o.getDerivedStateFromError!="function"?null:w.render();return t.flags|=1,e!==null&&z?(t.child=Rr(t,e.child,null,j),t.child=Rr(t,null,Q,j)):Gt(e,t,Q,j),t.memoizedState=w.state,A&&oh(t,o,!0),t.child}function nd(e){var t=e.stateNode;t.pendingContext?rh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&rh(e,t.context,!1),xl(e,t.containerInfo)}function sd(e,t,o,w,A){return Tr(),_l(A),t.flags|=256,Gt(e,t,o,w),t.child}var Ul={dehydrated:null,treeContext:null,retryLane:0};function Wl(e){return{baseLanes:e,cachePool:null,transitions:null}}function rd(e,t,o){var w=t.pendingProps,A=bt.current,j=!1,z=(t.flags&128)!==0,Q;if((Q=z)||(Q=e!==null&&e.memoizedState===null?!1:(A&2)!==0),Q?(j=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(A|=1),pt(bt,A&1),e===null)return gl(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=w.children,e=w.fallback,j?(w=t.mode,j=t.child,z={mode:"hidden",children:z},(w&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=z):j=ca(z,w,0,null),e=er(e,w,o,null),j.return=t,e.return=t,j.sibling=e,t.child=j,t.child.memoizedState=Wl(o),t.memoizedState=Ul,e):zl(t,z));if(A=e.memoizedState,A!==null&&(Q=A.dehydrated,Q!==null))return c_(e,t,z,w,Q,A,o);if(j){j=w.fallback,z=t.mode,A=e.child,Q=A.sibling;var ee={mode:"hidden",children:w.children};return(z&1)===0&&t.child!==A?(w=t.child,w.childLanes=0,w.pendingProps=ee,t.deletions=null):(w=xs(A,ee),w.subtreeFlags=A.subtreeFlags&14680064),Q!==null?j=xs(Q,j):(j=er(j,z,o,null),j.flags|=2),j.return=t,w.return=t,w.sibling=j,t.child=w,w=j,j=t.child,z=e.child.memoizedState,z=z===null?Wl(o):{baseLanes:z.baseLanes|o,cachePool:null,transitions:z.transitions},j.memoizedState=z,j.childLanes=e.childLanes&~o,t.memoizedState=Ul,w}return j=e.child,e=j.sibling,w=xs(j,{mode:"visible",children:w.children}),(t.mode&1)===0&&(w.lanes=o),w.return=t,w.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=w,t.memoizedState=null,w}function zl(e,t){return t=ca({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Xo(e,t,o,w){return w!==null&&_l(w),Rr(t,e.child,null,o),e=zl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function c_(e,t,o,w,A,j,z){if(o)return t.flags&256?(t.flags&=-257,w=Bl(Error(i(422))),Xo(e,t,z,w)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(j=w.fallback,A=t.mode,w=ca({mode:"visible",children:w.children},A,0,null),j=er(j,A,z,null),j.flags|=2,w.return=t,j.return=t,w.sibling=j,t.child=w,(t.mode&1)!==0&&Rr(t,e.child,null,z),t.child.memoizedState=Wl(z),t.memoizedState=Ul,j);if((t.mode&1)===0)return Xo(e,t,z,null);if(A.data==="$!"){if(w=A.nextSibling&&A.nextSibling.dataset,w)var Q=w.dgst;return w=Q,j=Error(i(419)),w=Bl(j,w,void 0),Xo(e,t,z,w)}if(Q=(z&e.childLanes)!==0,Zt||Q){if(w=It,w!==null){switch(z&-z){case 4:A=2;break;case 16:A=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:A=32;break;case 536870912:A=268435456;break;default:A=0}A=(A&(w.suspendedLanes|z))!==0?0:A,A!==0&&A!==j.retryLane&&(j.retryLane=A,es(e,A),Ln(w,e,A,-1))}return oc(),w=Bl(Error(i(421))),Xo(e,t,z,w)}return A.data==="$?"?(t.flags|=128,t.child=e.child,t=S_.bind(null,e),A._reactRetry=t,null):(e=j.treeContext,an=fs(A.nextSibling),on=t,wt=!0,Cn=null,e!==null&&(un[hn++]=Jn,un[hn++]=Zn,un[hn++]=Vs,Jn=e.id,Zn=e.overflow,Vs=t),t=zl(t,w.children),t.flags|=4096,t)}function id(e,t,o){e.lanes|=t;var w=e.alternate;w!==null&&(w.lanes|=t),bl(e.return,t,o)}function Vl(e,t,o,w,A){var j=e.memoizedState;j===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:w,tail:o,tailMode:A}:(j.isBackwards=t,j.rendering=null,j.renderingStartTime=0,j.last=w,j.tail=o,j.tailMode=A)}function od(e,t,o){var w=t.pendingProps,A=w.revealOrder,j=w.tail;if(Gt(e,t,w.children,o),w=bt.current,(w&2)!==0)w=w&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&&id(e,o,t);else if(e.tag===19)id(e,o,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}w&=1}if(pt(bt,w),(t.mode&1)===0)t.memoizedState=null;else switch(A){case"forwards":for(o=t.child,A=null;o!==null;)e=o.alternate,e!==null&&Wo(e)===null&&(A=o),o=o.sibling;o=A,o===null?(A=t.child,t.child=null):(A=o.sibling,o.sibling=null),Vl(t,!1,A,o,j);break;case"backwards":for(o=null,A=t.child,t.child=null;A!==null;){if(e=A.alternate,e!==null&&Wo(e)===null){t.child=A;break}e=A.sibling,A.sibling=o,o=A,A=e}Vl(t,!0,o,null,j);break;case"together":Vl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Qo(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ns(e,t,o){if(e!==null&&(t.dependencies=e.dependencies),Xs|=t.lanes,(o&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,o=xs(e,e.pendingProps),t.child=o,o.return=t;e.sibling!==null;)e=e.sibling,o=o.sibling=xs(e,e.pendingProps),o.return=t;o.sibling=null}return t.child}function u_(e,t,o){switch(t.tag){case 3:nd(t),Tr();break;case 5:wh(t);break;case 1:Jt(t.type)&&Do(t);break;case 4:xl(t,t.stateNode.containerInfo);break;case 10:var w=t.type._context,A=t.memoizedProps.value;pt(Fo,w._currentValue),w._currentValue=A;break;case 13:if(w=t.memoizedState,w!==null)return w.dehydrated!==null?(pt(bt,bt.current&1),t.flags|=128,null):(o&t.child.childLanes)!==0?rd(e,t,o):(pt(bt,bt.current&1),e=ns(e,t,o),e!==null?e.sibling:null);pt(bt,bt.current&1);break;case 19:if(w=(o&t.childLanes)!==0,(e.flags&128)!==0){if(w)return od(e,t,o);t.flags|=128}if(A=t.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),pt(bt,bt.current),w)break;return null;case 22:case 23:return t.lanes=0,Zh(e,t,o)}return ns(e,t,o)}var ad,ql,ld,cd;ad=function(e,t){for(var o=t.child;o!==null;){if(o.tag===5||o.tag===6)e.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break;for(;o.sibling===null;){if(o.return===null||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},ql=function(){},ld=function(e,t,o,w){var A=e.memoizedProps;if(A!==w){e=t.stateNode,Gs(jn.current);var j=null;switch(o){case"input":A=Le(e,A),w=Le(e,w),j=[];break;case"select":A=$({},A,{value:void 0}),w=$({},w,{value:void 0}),j=[];break;case"textarea":A=Fe(e,A),w=Fe(e,w),j=[];break;default:typeof A.onClick!="function"&&typeof w.onClick=="function"&&(e.onclick=Mo)}ze(o,w);var z;o=null;for(he in A)if(!w.hasOwnProperty(he)&&A.hasOwnProperty(he)&&A[he]!=null)if(he==="style"){var Q=A[he];for(z in Q)Q.hasOwnProperty(z)&&(o||(o={}),o[z]="")}else he!=="dangerouslySetInnerHTML"&&he!=="children"&&he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&he!=="autoFocus"&&(v.hasOwnProperty(he)?j||(j=[]):(j=j||[]).push(he,null));for(he in w){var ee=w[he];if(Q=A!=null?A[he]:void 0,w.hasOwnProperty(he)&&ee!==Q&&(ee!=null||Q!=null))if(he==="style")if(Q){for(z in Q)!Q.hasOwnProperty(z)||ee&&ee.hasOwnProperty(z)||(o||(o={}),o[z]="");for(z in ee)ee.hasOwnProperty(z)&&Q[z]!==ee[z]&&(o||(o={}),o[z]=ee[z])}else o||(j||(j=[]),j.push(he,o)),o=ee;else he==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,Q=Q?Q.__html:void 0,ee!=null&&Q!==ee&&(j=j||[]).push(he,ee)):he==="children"?typeof ee!="string"&&typeof ee!="number"||(j=j||[]).push(he,""+ee):he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&(v.hasOwnProperty(he)?(ee!=null&&he==="onScroll"&&_t("scroll",e),j||Q===ee||(j=[])):(j=j||[]).push(he,ee))}o&&(j=j||[]).push("style",o);var he=j;(t.updateQueue=he)&&(t.flags|=4)}},cd=function(e,t,o,w){o!==w&&(t.flags|=4)};function Mi(e,t){if(!wt)switch(e.tailMode){case"hidden":t=e.tail;for(var o=null;t!==null;)t.alternate!==null&&(o=t),t=t.sibling;o===null?e.tail=null:o.sibling=null;break;case"collapsed":o=e.tail;for(var w=null;o!==null;)o.alternate!==null&&(w=o),o=o.sibling;w===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:w.sibling=null}}function Wt(e){var t=e.alternate!==null&&e.alternate.child===e.child,o=0,w=0;if(t)for(var A=e.child;A!==null;)o|=A.lanes|A.childLanes,w|=A.subtreeFlags&14680064,w|=A.flags&14680064,A.return=e,A=A.sibling;else for(A=e.child;A!==null;)o|=A.lanes|A.childLanes,w|=A.subtreeFlags,w|=A.flags,A.return=e,A=A.sibling;return e.subtreeFlags|=w,e.childLanes=o,t}function h_(e,t,o){var w=t.pendingProps;switch(pl(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(t),null;case 1:return Jt(t.type)&&No(),Wt(t),null;case 3:return w=t.stateNode,Nr(),vt(Qt),vt($t),Ll(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(e===null||e.child===null)&&(Oo(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Cn!==null&&(sc(Cn),Cn=null))),ql(e,t),Wt(t),null;case 5:kl(t);var A=Gs(ki.current);if(o=t.type,e!==null&&t.stateNode!=null)ld(e,t,o,w,A),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!w){if(t.stateNode===null)throw Error(i(166));return Wt(t),null}if(e=Gs(jn.current),Oo(t)){w=t.stateNode,o=t.type;var j=t.memoizedProps;switch(w[In]=t,w[wi]=j,e=(t.mode&1)!==0,o){case"dialog":_t("cancel",w),_t("close",w);break;case"iframe":case"object":case"embed":_t("load",w);break;case"video":case"audio":for(A=0;A<_i.length;A++)_t(_i[A],w);break;case"source":_t("error",w);break;case"img":case"image":case"link":_t("error",w),_t("load",w);break;case"details":_t("toggle",w);break;case"input":Ae(w,j),_t("invalid",w);break;case"select":w._wrapperState={wasMultiple:!!j.multiple},_t("invalid",w);break;case"textarea":Se(w,j),_t("invalid",w)}ze(o,j),A=null;for(var z in j)if(j.hasOwnProperty(z)){var Q=j[z];z==="children"?typeof Q=="string"?w.textContent!==Q&&(j.suppressHydrationWarning!==!0&&Ro(w.textContent,Q,e),A=["children",Q]):typeof Q=="number"&&w.textContent!==""+Q&&(j.suppressHydrationWarning!==!0&&Ro(w.textContent,Q,e),A=["children",""+Q]):v.hasOwnProperty(z)&&Q!=null&&z==="onScroll"&&_t("scroll",w)}switch(o){case"input":pe(w),fe(w,j,!0);break;case"textarea":pe(w),et(w);break;case"select":case"option":break;default:typeof j.onClick=="function"&&(w.onclick=Mo)}w=A,t.updateQueue=w,w!==null&&(t.flags|=4)}else{z=A.nodeType===9?A:A.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=tt(o)),e==="http://www.w3.org/1999/xhtml"?o==="script"?(e=z.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof w.is=="string"?e=z.createElement(o,{is:w.is}):(e=z.createElement(o),o==="select"&&(z=e,w.multiple?z.multiple=!0:w.size&&(z.size=w.size))):e=z.createElementNS(e,o),e[In]=t,e[wi]=w,ad(e,t,!1,!1),t.stateNode=e;e:{switch(z=te(o,w),o){case"dialog":_t("cancel",e),_t("close",e),A=w;break;case"iframe":case"object":case"embed":_t("load",e),A=w;break;case"video":case"audio":for(A=0;A<_i.length;A++)_t(_i[A],e);A=w;break;case"source":_t("error",e),A=w;break;case"img":case"image":case"link":_t("error",e),_t("load",e),A=w;break;case"details":_t("toggle",e),A=w;break;case"input":Ae(e,w),A=Le(e,w),_t("invalid",e);break;case"option":A=w;break;case"select":e._wrapperState={wasMultiple:!!w.multiple},A=$({},w,{value:void 0}),_t("invalid",e);break;case"textarea":Se(e,w),A=Fe(e,w),_t("invalid",e);break;default:A=w}ze(o,A),Q=A;for(j in Q)if(Q.hasOwnProperty(j)){var ee=Q[j];j==="style"?dt(e,ee):j==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&ct(e,ee)):j==="children"?typeof ee=="string"?(o!=="textarea"||ee!=="")&&$e(e,ee):typeof ee=="number"&&$e(e,""+ee):j!=="suppressContentEditableWarning"&&j!=="suppressHydrationWarning"&&j!=="autoFocus"&&(v.hasOwnProperty(j)?ee!=null&&j==="onScroll"&&_t("scroll",e):ee!=null&&d(e,j,ee,z))}switch(o){case"input":pe(e),fe(e,w,!1);break;case"textarea":pe(e),et(e);break;case"option":w.value!=null&&e.setAttribute("value",""+W(w.value));break;case"select":e.multiple=!!w.multiple,j=w.value,j!=null?Ee(e,!!w.multiple,j,!1):w.defaultValue!=null&&Ee(e,!!w.multiple,w.defaultValue,!0);break;default:typeof A.onClick=="function"&&(e.onclick=Mo)}switch(o){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}}w&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Wt(t),null;case 6:if(e&&t.stateNode!=null)cd(e,t,e.memoizedProps,w);else{if(typeof w!="string"&&t.stateNode===null)throw Error(i(166));if(o=Gs(ki.current),Gs(jn.current),Oo(t)){if(w=t.stateNode,o=t.memoizedProps,w[In]=t,(j=w.nodeValue!==o)&&(e=on,e!==null))switch(e.tag){case 3:Ro(w.nodeValue,o,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ro(w.nodeValue,o,(e.mode&1)!==0)}j&&(t.flags|=4)}else w=(o.nodeType===9?o:o.ownerDocument).createTextNode(w),w[In]=t,t.stateNode=w}return Wt(t),null;case 13:if(vt(bt),w=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wt&&an!==null&&(t.mode&1)!==0&&(t.flags&128)===0)dh(),Tr(),t.flags|=98560,j=!1;else if(j=Oo(t),w!==null&&w.dehydrated!==null){if(e===null){if(!j)throw Error(i(318));if(j=t.memoizedState,j=j!==null?j.dehydrated:null,!j)throw Error(i(317));j[In]=t}else Tr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Wt(t),j=!1}else Cn!==null&&(sc(Cn),Cn=null),j=!0;if(!j)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=o,t):(w=w!==null,w!==(e!==null&&e.memoizedState!==null)&&w&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(bt.current&1)!==0?Rt===0&&(Rt=3):oc())),t.updateQueue!==null&&(t.flags|=4),Wt(t),null);case 4:return Nr(),ql(e,t),e===null&&vi(t.stateNode.containerInfo),Wt(t),null;case 10:return wl(t.type._context),Wt(t),null;case 17:return Jt(t.type)&&No(),Wt(t),null;case 19:if(vt(bt),j=t.memoizedState,j===null)return Wt(t),null;if(w=(t.flags&128)!==0,z=j.rendering,z===null)if(w)Mi(j,!1);else{if(Rt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(z=Wo(e),z!==null){for(t.flags|=128,Mi(j,!1),w=z.updateQueue,w!==null&&(t.updateQueue=w,t.flags|=4),t.subtreeFlags=0,w=o,o=t.child;o!==null;)j=o,e=w,j.flags&=14680066,z=j.alternate,z===null?(j.childLanes=0,j.lanes=e,j.child=null,j.subtreeFlags=0,j.memoizedProps=null,j.memoizedState=null,j.updateQueue=null,j.dependencies=null,j.stateNode=null):(j.childLanes=z.childLanes,j.lanes=z.lanes,j.child=z.child,j.subtreeFlags=0,j.deletions=null,j.memoizedProps=z.memoizedProps,j.memoizedState=z.memoizedState,j.updateQueue=z.updateQueue,j.type=z.type,e=z.dependencies,j.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),o=o.sibling;return pt(bt,bt.current&1|2),t.child}e=e.sibling}j.tail!==null&&gt()>Pr&&(t.flags|=128,w=!0,Mi(j,!1),t.lanes=4194304)}else{if(!w)if(e=Wo(z),e!==null){if(t.flags|=128,w=!0,o=e.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),Mi(j,!0),j.tail===null&&j.tailMode==="hidden"&&!z.alternate&&!wt)return Wt(t),null}else 2*gt()-j.renderingStartTime>Pr&&o!==1073741824&&(t.flags|=128,w=!0,Mi(j,!1),t.lanes=4194304);j.isBackwards?(z.sibling=t.child,t.child=z):(o=j.last,o!==null?o.sibling=z:t.child=z,j.last=z)}return j.tail!==null?(t=j.tail,j.rendering=t,j.tail=t.sibling,j.renderingStartTime=gt(),t.sibling=null,o=bt.current,pt(bt,w?o&1|2:o&1),t):(Wt(t),null);case 22:case 23:return ic(),w=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==w&&(t.flags|=8192),w&&(t.mode&1)!==0?(ln&1073741824)!==0&&(Wt(t),t.subtreeFlags&6&&(t.flags|=8192)):Wt(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function d_(e,t){switch(pl(t),t.tag){case 1:return Jt(t.type)&&No(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nr(),vt(Qt),vt($t),Ll(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return kl(t),null;case 13:if(vt(bt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Tr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vt(bt),null;case 4:return Nr(),null;case 10:return wl(t.type._context),null;case 22:case 23:return ic(),null;case 24:return null;default:return null}}var Jo=!1,zt=!1,f_=typeof WeakSet=="function"?WeakSet:Set,je=null;function Ir(e,t){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(w){Ct(e,t,w)}else o.current=null}function Kl(e,t,o){try{o()}catch(w){Ct(e,t,w)}}var ud=!1;function p_(e,t){if(il=Bs,e=Uu(),Qa(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var w=o.getSelection&&o.getSelection();if(w&&w.rangeCount!==0){o=w.anchorNode;var A=w.anchorOffset,j=w.focusNode;w=w.focusOffset;try{o.nodeType,j.nodeType}catch{o=null;break e}var z=0,Q=-1,ee=-1,he=0,ve=0,be=e,ge=null;t:for(;;){for(var De;be!==o||A!==0&&be.nodeType!==3||(Q=z+A),be!==j||w!==0&&be.nodeType!==3||(ee=z+w),be.nodeType===3&&(z+=be.nodeValue.length),(De=be.firstChild)!==null;)ge=be,be=De;for(;;){if(be===e)break t;if(ge===o&&++he===A&&(Q=z),ge===j&&++ve===w&&(ee=z),(De=be.nextSibling)!==null)break;be=ge,ge=be.parentNode}be=De}o=Q===-1||ee===-1?null:{start:Q,end:ee}}else o=null}o=o||{start:0,end:0}}else o=null;for(ol={focusedElem:e,selectionRange:o},Bs=!1,je=t;je!==null;)if(t=je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,je=e;else for(;je!==null;){t=je;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 Be=Pe.memoizedProps,xt=Pe.memoizedState,ae=t.stateNode,se=ae.getSnapshotBeforeUpdate(t.elementType===t.type?Be:xn(t.type,Be),xt);ae.__reactInternalSnapshotBeforeUpdate=se}break;case 3:var ce=t.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(xe){Ct(t,t.return,xe)}if(e=t.sibling,e!==null){e.return=t.return,je=e;break}je=t.return}return Pe=ud,ud=!1,Pe}function Ai(e,t,o){var w=t.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var A=w=w.next;do{if((A.tag&e)===e){var j=A.destroy;A.destroy=void 0,j!==void 0&&Kl(t,o,j)}A=A.next}while(A!==w)}}function Zo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var o=t=t.next;do{if((o.tag&e)===e){var w=o.create;o.destroy=w()}o=o.next}while(o!==t)}}function Gl(e){var t=e.ref;if(t!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof t=="function"?t(e):t.current=e}}function hd(e){var t=e.alternate;t!==null&&(e.alternate=null,hd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[In],delete t[wi],delete t[ul],delete t[Xg],delete t[Qg])),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 dd(e){return e.tag===5||e.tag===3||e.tag===4}function fd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||dd(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 Yl(e,t,o){var w=e.tag;if(w===5||w===6)e=e.stateNode,t?o.nodeType===8?o.parentNode.insertBefore(e,t):o.insertBefore(e,t):(o.nodeType===8?(t=o.parentNode,t.insertBefore(e,o)):(t=o,t.appendChild(e)),o=o._reactRootContainer,o!=null||t.onclick!==null||(t.onclick=Mo));else if(w!==4&&(e=e.child,e!==null))for(Yl(e,t,o),e=e.sibling;e!==null;)Yl(e,t,o),e=e.sibling}function Xl(e,t,o){var w=e.tag;if(w===5||w===6)e=e.stateNode,t?o.insertBefore(e,t):o.appendChild(e);else if(w!==4&&(e=e.child,e!==null))for(Xl(e,t,o),e=e.sibling;e!==null;)Xl(e,t,o),e=e.sibling}var Ot=null,kn=!1;function ys(e,t,o){for(o=o.child;o!==null;)pd(e,t,o),o=o.sibling}function pd(e,t,o){if(Xt&&typeof Xt.onCommitFiberUnmount=="function")try{Xt.onCommitFiberUnmount(rr,o)}catch{}switch(o.tag){case 5:zt||Ir(o,t);case 6:var w=Ot,A=kn;Ot=null,ys(e,t,o),Ot=w,kn=A,Ot!==null&&(kn?(e=Ot,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):Ot.removeChild(o.stateNode));break;case 18:Ot!==null&&(kn?(e=Ot,o=o.stateNode,e.nodeType===8?cl(e.parentNode,o):e.nodeType===1&&cl(e,o),us(e)):cl(Ot,o.stateNode));break;case 4:w=Ot,A=kn,Ot=o.stateNode.containerInfo,kn=!0,ys(e,t,o),Ot=w,kn=A;break;case 0:case 11:case 14:case 15:if(!zt&&(w=o.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){A=w=w.next;do{var j=A,z=j.destroy;j=j.tag,z!==void 0&&((j&2)!==0||(j&4)!==0)&&Kl(o,t,z),A=A.next}while(A!==w)}ys(e,t,o);break;case 1:if(!zt&&(Ir(o,t),w=o.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=o.memoizedProps,w.state=o.memoizedState,w.componentWillUnmount()}catch(Q){Ct(o,t,Q)}ys(e,t,o);break;case 21:ys(e,t,o);break;case 22:o.mode&1?(zt=(w=zt)||o.memoizedState!==null,ys(e,t,o),zt=w):ys(e,t,o);break;default:ys(e,t,o)}}function md(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new f_),t.forEach(function(w){var A=C_.bind(null,e,w);o.has(w)||(o.add(w),w.then(A,A))})}}function En(e,t){var o=t.deletions;if(o!==null)for(var w=0;w<o.length;w++){var A=o[w];try{var j=e,z=t,Q=z;e:for(;Q!==null;){switch(Q.tag){case 5:Ot=Q.stateNode,kn=!1;break e;case 3:Ot=Q.stateNode.containerInfo,kn=!0;break e;case 4:Ot=Q.stateNode.containerInfo,kn=!0;break e}Q=Q.return}if(Ot===null)throw Error(i(160));pd(j,z,A),Ot=null,kn=!1;var ee=A.alternate;ee!==null&&(ee.return=null),A.return=null}catch(he){Ct(A,t,he)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)gd(t,e),t=t.sibling}function gd(e,t){var o=e.alternate,w=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(En(t,e),On(e),w&4){try{Ai(3,e,e.return),Zo(3,e)}catch(Be){Ct(e,e.return,Be)}try{Ai(5,e,e.return)}catch(Be){Ct(e,e.return,Be)}}break;case 1:En(t,e),On(e),w&512&&o!==null&&Ir(o,o.return);break;case 5:if(En(t,e),On(e),w&512&&o!==null&&Ir(o,o.return),e.flags&32){var A=e.stateNode;try{$e(A,"")}catch(Be){Ct(e,e.return,Be)}}if(w&4&&(A=e.stateNode,A!=null)){var j=e.memoizedProps,z=o!==null?o.memoizedProps:j,Q=e.type,ee=e.updateQueue;if(e.updateQueue=null,ee!==null)try{Q==="input"&&j.type==="radio"&&j.name!=null&&Xe(A,j),te(Q,z);var he=te(Q,j);for(z=0;z<ee.length;z+=2){var ve=ee[z],be=ee[z+1];ve==="style"?dt(A,be):ve==="dangerouslySetInnerHTML"?ct(A,be):ve==="children"?$e(A,be):d(A,ve,be,he)}switch(Q){case"input":Ce(A,j);break;case"textarea":Ne(A,j);break;case"select":var ge=A._wrapperState.wasMultiple;A._wrapperState.wasMultiple=!!j.multiple;var De=j.value;De!=null?Ee(A,!!j.multiple,De,!1):ge!==!!j.multiple&&(j.defaultValue!=null?Ee(A,!!j.multiple,j.defaultValue,!0):Ee(A,!!j.multiple,j.multiple?[]:"",!1))}A[wi]=j}catch(Be){Ct(e,e.return,Be)}}break;case 6:if(En(t,e),On(e),w&4){if(e.stateNode===null)throw Error(i(162));A=e.stateNode,j=e.memoizedProps;try{A.nodeValue=j}catch(Be){Ct(e,e.return,Be)}}break;case 3:if(En(t,e),On(e),w&4&&o!==null&&o.memoizedState.isDehydrated)try{us(t.containerInfo)}catch(Be){Ct(e,e.return,Be)}break;case 4:En(t,e),On(e);break;case 13:En(t,e),On(e),A=e.child,A.flags&8192&&(j=A.memoizedState!==null,A.stateNode.isHidden=j,!j||A.alternate!==null&&A.alternate.memoizedState!==null||(Zl=gt())),w&4&&md(e);break;case 22:if(ve=o!==null&&o.memoizedState!==null,e.mode&1?(zt=(he=zt)||ve,En(t,e),zt=he):En(t,e),On(e),w&8192){if(he=e.memoizedState!==null,(e.stateNode.isHidden=he)&&!ve&&(e.mode&1)!==0)for(je=e,ve=e.child;ve!==null;){for(be=je=ve;je!==null;){switch(ge=je,De=ge.child,ge.tag){case 0:case 11:case 14:case 15:Ai(4,ge,ge.return);break;case 1:Ir(ge,ge.return);var Pe=ge.stateNode;if(typeof Pe.componentWillUnmount=="function"){w=ge,o=ge.return;try{t=w,Pe.props=t.memoizedProps,Pe.state=t.memoizedState,Pe.componentWillUnmount()}catch(Be){Ct(w,o,Be)}}break;case 5:Ir(ge,ge.return);break;case 22:if(ge.memoizedState!==null){yd(be);continue}}De!==null?(De.return=ge,je=De):yd(be)}ve=ve.sibling}e:for(ve=null,be=e;;){if(be.tag===5){if(ve===null){ve=be;try{A=be.stateNode,he?(j=A.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none"):(Q=be.stateNode,ee=be.memoizedProps.style,z=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,Q.style.display=st("display",z))}catch(Be){Ct(e,e.return,Be)}}}else if(be.tag===6){if(ve===null)try{be.stateNode.nodeValue=he?"":be.memoizedProps}catch(Be){Ct(e,e.return,Be)}}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:En(t,e),On(e),w&4&&md(e);break;case 21:break;default:En(t,e),On(e)}}function On(e){var t=e.flags;if(t&2){try{e:{for(var o=e.return;o!==null;){if(dd(o)){var w=o;break e}o=o.return}throw Error(i(160))}switch(w.tag){case 5:var A=w.stateNode;w.flags&32&&($e(A,""),w.flags&=-33);var j=fd(e);Xl(e,j,A);break;case 3:case 4:var z=w.stateNode.containerInfo,Q=fd(e);Yl(e,Q,z);break;default:throw Error(i(161))}}catch(ee){Ct(e,e.return,ee)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function m_(e,t,o){je=e,_d(e)}function _d(e,t,o){for(var w=(e.mode&1)!==0;je!==null;){var A=je,j=A.child;if(A.tag===22&&w){var z=A.memoizedState!==null||Jo;if(!z){var Q=A.alternate,ee=Q!==null&&Q.memoizedState!==null||zt;Q=Jo;var he=zt;if(Jo=z,(zt=ee)&&!he)for(je=A;je!==null;)z=je,ee=z.child,z.tag===22&&z.memoizedState!==null?wd(A):ee!==null?(ee.return=z,je=ee):wd(A);for(;j!==null;)je=j,_d(j),j=j.sibling;je=A,Jo=Q,zt=he}vd(e)}else(A.subtreeFlags&8772)!==0&&j!==null?(j.return=A,je=j):vd(e)}}function vd(e){for(;je!==null;){var t=je;if((t.flags&8772)!==0){var o=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:zt||Zo(5,t);break;case 1:var w=t.stateNode;if(t.flags&4&&!zt)if(o===null)w.componentDidMount();else{var A=t.elementType===t.type?o.memoizedProps:xn(t.type,o.memoizedProps);w.componentDidUpdate(A,o.memoizedState,w.__reactInternalSnapshotBeforeUpdate)}var j=t.updateQueue;j!==null&&yh(t,j,w);break;case 3:var z=t.updateQueue;if(z!==null){if(o=null,t.child!==null)switch(t.child.tag){case 5:o=t.child.stateNode;break;case 1:o=t.child.stateNode}yh(t,z,o)}break;case 5:var Q=t.stateNode;if(o===null&&t.flags&4){o=Q;var ee=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":ee.autoFocus&&o.focus();break;case"img":ee.src&&(o.src=ee.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var he=t.alternate;if(he!==null){var ve=he.memoizedState;if(ve!==null){var be=ve.dehydrated;be!==null&&us(be)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(i(163))}zt||t.flags&512&&Gl(t)}catch(ge){Ct(t,t.return,ge)}}if(t===e){je=null;break}if(o=t.sibling,o!==null){o.return=t.return,je=o;break}je=t.return}}function yd(e){for(;je!==null;){var t=je;if(t===e){je=null;break}var o=t.sibling;if(o!==null){o.return=t.return,je=o;break}je=t.return}}function wd(e){for(;je!==null;){var t=je;try{switch(t.tag){case 0:case 11:case 15:var o=t.return;try{Zo(4,t)}catch(ee){Ct(t,o,ee)}break;case 1:var w=t.stateNode;if(typeof w.componentDidMount=="function"){var A=t.return;try{w.componentDidMount()}catch(ee){Ct(t,A,ee)}}var j=t.return;try{Gl(t)}catch(ee){Ct(t,j,ee)}break;case 5:var z=t.return;try{Gl(t)}catch(ee){Ct(t,z,ee)}}}catch(ee){Ct(t,t.return,ee)}if(t===e){je=null;break}var Q=t.sibling;if(Q!==null){Q.return=t.return,je=Q;break}je=t.return}}var g_=Math.ceil,ea=k.ReactCurrentDispatcher,Ql=k.ReactCurrentOwner,pn=k.ReactCurrentBatchConfig,it=0,It=null,Et=null,Bt=0,ln=0,jr=ps(0),Rt=0,Ni=null,Xs=0,ta=0,Jl=0,Di=null,en=null,Zl=0,Pr=1/0,ss=null,na=!1,ec=null,ws=null,sa=!1,bs=null,ra=0,Ii=0,tc=null,ia=-1,oa=0;function Yt(){return(it&6)!==0?gt():ia!==-1?ia:ia=gt()}function Ss(e){return(e.mode&1)===0?1:(it&2)!==0&&Bt!==0?Bt&-Bt:Zg.transition!==null?(oa===0&&(oa=oo()),oa):(e=ot,e!==0||(e=window.event,e=e===void 0?16:ho(e.type)),e)}function Ln(e,t,o,w){if(50<Ii)throw Ii=0,tc=null,Error(i(185));zn(e,o,w),((it&2)===0||e!==It)&&(e===It&&((it&2)===0&&(ta|=o),Rt===4&&Cs(e,Bt)),tn(e,w),o===1&&it===0&&(t.mode&1)===0&&(Pr=gt()+500,Io&&gs()))}function tn(e,t){var o=e.callbackNode;as(e,t);var w=lr(e,e===It?Bt:0);if(w===0)o!==null&&so(o),e.callbackNode=null,e.callbackPriority=0;else if(t=w&-w,e.callbackPriority!==t){if(o!=null&&so(o),t===1)e.tag===0?Jg(Sd.bind(null,e)):ah(Sd.bind(null,e)),Gg(function(){(it&6)===0&&gs()}),o=null;else{switch(lo(w)){case 1:o=ti;break;case 4:o=is;break;case 16:o=Wn;break;case 536870912:o=ni;break;default:o=Wn}o=Md(o,bd.bind(null,e))}e.callbackPriority=t,e.callbackNode=o}}function bd(e,t){if(ia=-1,oa=0,(it&6)!==0)throw Error(i(327));var o=e.callbackNode;if(Or()&&e.callbackNode!==o)return null;var w=lr(e,e===It?Bt:0);if(w===0)return null;if((w&30)!==0||(w&e.expiredLanes)!==0||t)t=aa(e,w);else{t=w;var A=it;it|=2;var j=xd();(It!==e||Bt!==t)&&(ss=null,Pr=gt()+500,Js(e,t));do try{y_();break}catch(Q){Cd(e,Q)}while(!0);yl(),ea.current=j,it=A,Et!==null?t=0:(It=null,Bt=0,t=Rt)}if(t!==0){if(t===2&&(A=ls(e),A!==0&&(w=A,t=nc(e,A))),t===1)throw o=Ni,Js(e,0),Cs(e,w),tn(e,gt()),o;if(t===6)Cs(e,w);else{if(A=e.current.alternate,(w&30)===0&&!__(A)&&(t=aa(e,w),t===2&&(j=ls(e),j!==0&&(w=j,t=nc(e,j))),t===1))throw o=Ni,Js(e,0),Cs(e,w),tn(e,gt()),o;switch(e.finishedWork=A,e.finishedLanes=w,t){case 0:case 1:throw Error(i(345));case 2:Zs(e,en,ss);break;case 3:if(Cs(e,w),(w&130023424)===w&&(t=Zl+500-gt(),10<t)){if(lr(e,0)!==0)break;if(A=e.suspendedLanes,(A&w)!==w){Yt(),e.pingedLanes|=e.suspendedLanes&A;break}e.timeoutHandle=ll(Zs.bind(null,e,en,ss),t);break}Zs(e,en,ss);break;case 4:if(Cs(e,w),(w&4194240)===w)break;for(t=e.eventTimes,A=-1;0<w;){var z=31-At(w);j=1<<z,z=t[z],z>A&&(A=z),w&=~j}if(w=A,w=gt()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*g_(w/1960))-w,10<w){e.timeoutHandle=ll(Zs.bind(null,e,en,ss),w);break}Zs(e,en,ss);break;case 5:Zs(e,en,ss);break;default:throw Error(i(329))}}}return tn(e,gt()),e.callbackNode===o?bd.bind(null,e):null}function nc(e,t){var o=Di;return e.current.memoizedState.isDehydrated&&(Js(e,t).flags|=256),e=aa(e,t),e!==2&&(t=en,en=o,t!==null&&sc(t)),e}function sc(e){en===null?en=e:en.push.apply(en,e)}function __(e){for(var t=e;;){if(t.flags&16384){var o=t.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var w=0;w<o.length;w++){var A=o[w],j=A.getSnapshot;A=A.value;try{if(!Sn(j(),A))return!1}catch{return!1}}}if(o=t.child,t.subtreeFlags&16384&&o!==null)o.return=t,t=o;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 Cs(e,t){for(t&=~Jl,t&=~ta,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var o=31-At(t),w=1<<o;e[o]=-1,t&=~w}}function Sd(e){if((it&6)!==0)throw Error(i(327));Or();var t=lr(e,0);if((t&1)===0)return tn(e,gt()),null;var o=aa(e,t);if(e.tag!==0&&o===2){var w=ls(e);w!==0&&(t=w,o=nc(e,w))}if(o===1)throw o=Ni,Js(e,0),Cs(e,t),tn(e,gt()),o;if(o===6)throw Error(i(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Zs(e,en,ss),tn(e,gt()),null}function rc(e,t){var o=it;it|=1;try{return e(t)}finally{it=o,it===0&&(Pr=gt()+500,Io&&gs())}}function Qs(e){bs!==null&&bs.tag===0&&(it&6)===0&&Or();var t=it;it|=1;var o=pn.transition,w=ot;try{if(pn.transition=null,ot=1,e)return e()}finally{ot=w,pn.transition=o,it=t,(it&6)===0&&gs()}}function ic(){ln=jr.current,vt(jr)}function Js(e,t){e.finishedWork=null,e.finishedLanes=0;var o=e.timeoutHandle;if(o!==-1&&(e.timeoutHandle=-1,Kg(o)),Et!==null)for(o=Et.return;o!==null;){var w=o;switch(pl(w),w.tag){case 1:w=w.type.childContextTypes,w!=null&&No();break;case 3:Nr(),vt(Qt),vt($t),Ll();break;case 5:kl(w);break;case 4:Nr();break;case 13:vt(bt);break;case 19:vt(bt);break;case 10:wl(w.type._context);break;case 22:case 23:ic()}o=o.return}if(It=e,Et=e=xs(e.current,null),Bt=ln=t,Rt=0,Ni=null,Jl=ta=Xs=0,en=Di=null,Ks!==null){for(t=0;t<Ks.length;t++)if(o=Ks[t],w=o.interleaved,w!==null){o.interleaved=null;var A=w.next,j=o.pending;if(j!==null){var z=j.next;j.next=A,w.next=z}o.pending=w}Ks=null}return e}function Cd(e,t){do{var o=Et;try{if(yl(),zo.current=Go,Vo){for(var w=St.memoizedState;w!==null;){var A=w.queue;A!==null&&(A.pending=null),w=w.next}Vo=!1}if(Ys=0,Dt=Tt=St=null,Ei=!1,Li=0,Ql.current=null,o===null||o.return===null){Rt=1,Ni=t,Et=null;break}e:{var j=e,z=o.return,Q=o,ee=t;if(t=Bt,Q.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var he=ee,ve=Q,be=ve.tag;if((ve.mode&1)===0&&(be===0||be===11||be===15)){var ge=ve.alternate;ge?(ve.updateQueue=ge.updateQueue,ve.memoizedState=ge.memoizedState,ve.lanes=ge.lanes):(ve.updateQueue=null,ve.memoizedState=null)}var De=Gh(z);if(De!==null){De.flags&=-257,Yh(De,z,Q,j,t),De.mode&1&&Kh(j,he,t),t=De,ee=he;var Pe=t.updateQueue;if(Pe===null){var Be=new Set;Be.add(ee),t.updateQueue=Be}else Pe.add(ee);break e}else{if((t&1)===0){Kh(j,he,t),oc();break e}ee=Error(i(426))}}else if(wt&&Q.mode&1){var xt=Gh(z);if(xt!==null){(xt.flags&65536)===0&&(xt.flags|=256),Yh(xt,z,Q,j,t),_l(Dr(ee,Q));break e}}j=ee=Dr(ee,Q),Rt!==4&&(Rt=2),Di===null?Di=[j]:Di.push(j),j=z;do{switch(j.tag){case 3:j.flags|=65536,t&=-t,j.lanes|=t;var ae=Vh(j,ee,t);vh(j,ae);break e;case 1:Q=ee;var se=j.type,ce=j.stateNode;if((j.flags&128)===0&&(typeof se.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(ws===null||!ws.has(ce)))){j.flags|=65536,t&=-t,j.lanes|=t;var xe=qh(j,Q,t);vh(j,xe);break e}}j=j.return}while(j!==null)}Ed(o)}catch(He){t=He,Et===o&&o!==null&&(Et=o=o.return);continue}break}while(!0)}function xd(){var e=ea.current;return ea.current=Go,e===null?Go:e}function oc(){(Rt===0||Rt===3||Rt===2)&&(Rt=4),It===null||(Xs&268435455)===0&&(ta&268435455)===0||Cs(It,Bt)}function aa(e,t){var o=it;it|=2;var w=xd();(It!==e||Bt!==t)&&(ss=null,Js(e,t));do try{v_();break}catch(A){Cd(e,A)}while(!0);if(yl(),it=o,ea.current=w,Et!==null)throw Error(i(261));return It=null,Bt=0,Rt}function v_(){for(;Et!==null;)kd(Et)}function y_(){for(;Et!==null&&!Ha();)kd(Et)}function kd(e){var t=Rd(e.alternate,e,ln);e.memoizedProps=e.pendingProps,t===null?Ed(e):Et=t,Ql.current=null}function Ed(e){var t=e;do{var o=t.alternate;if(e=t.return,(t.flags&32768)===0){if(o=h_(o,t,ln),o!==null){Et=o;return}}else{if(o=d_(o,t),o!==null){o.flags&=32767,Et=o;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Rt=6,Et=null;return}}if(t=t.sibling,t!==null){Et=t;return}Et=t=e}while(t!==null);Rt===0&&(Rt=5)}function Zs(e,t,o){var w=ot,A=pn.transition;try{pn.transition=null,ot=1,w_(e,t,o,w)}finally{pn.transition=A,ot=w}return null}function w_(e,t,o,w){do Or();while(bs!==null);if((it&6)!==0)throw Error(i(327));o=e.finishedWork;var A=e.finishedLanes;if(o===null)return null;if(e.finishedWork=null,e.finishedLanes=0,o===e.current)throw Error(i(177));e.callbackNode=null,e.callbackPriority=0;var j=o.lanes|o.childLanes;if(ao(e,j),e===It&&(Et=It=null,Bt=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||sa||(sa=!0,Md(Wn,function(){return Or(),null})),j=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||j){j=pn.transition,pn.transition=null;var z=ot;ot=1;var Q=it;it|=4,Ql.current=null,p_(e,o),gd(o,e),Hg(ol),Bs=!!il,ol=il=null,e.current=o,m_(o),$a(),it=Q,ot=z,pn.transition=j}else e.current=o;if(sa&&(sa=!1,bs=e,ra=A),j=e.pendingLanes,j===0&&(ws=null),si(o.stateNode),tn(e,gt()),t!==null)for(w=e.onRecoverableError,o=0;o<t.length;o++)A=t[o],w(A.value,{componentStack:A.stack,digest:A.digest});if(na)throw na=!1,e=ec,ec=null,e;return(ra&1)!==0&&e.tag!==0&&Or(),j=e.pendingLanes,(j&1)!==0?e===tc?Ii++:(Ii=0,tc=e):Ii=0,gs(),null}function Or(){if(bs!==null){var e=lo(ra),t=pn.transition,o=ot;try{if(pn.transition=null,ot=16>e?16:e,bs===null)var w=!1;else{if(e=bs,bs=null,ra=0,(it&6)!==0)throw Error(i(331));var A=it;for(it|=4,je=e.current;je!==null;){var j=je,z=j.child;if((je.flags&16)!==0){var Q=j.deletions;if(Q!==null){for(var ee=0;ee<Q.length;ee++){var he=Q[ee];for(je=he;je!==null;){var ve=je;switch(ve.tag){case 0:case 11:case 15:Ai(8,ve,j)}var be=ve.child;if(be!==null)be.return=ve,je=be;else for(;je!==null;){ve=je;var ge=ve.sibling,De=ve.return;if(hd(ve),ve===he){je=null;break}if(ge!==null){ge.return=De,je=ge;break}je=De}}}var Pe=j.alternate;if(Pe!==null){var Be=Pe.child;if(Be!==null){Pe.child=null;do{var xt=Be.sibling;Be.sibling=null,Be=xt}while(Be!==null)}}je=j}}if((j.subtreeFlags&2064)!==0&&z!==null)z.return=j,je=z;else e:for(;je!==null;){if(j=je,(j.flags&2048)!==0)switch(j.tag){case 0:case 11:case 15:Ai(9,j,j.return)}var ae=j.sibling;if(ae!==null){ae.return=j.return,je=ae;break e}je=j.return}}var se=e.current;for(je=se;je!==null;){z=je;var ce=z.child;if((z.subtreeFlags&2064)!==0&&ce!==null)ce.return=z,je=ce;else e:for(z=se;je!==null;){if(Q=je,(Q.flags&2048)!==0)try{switch(Q.tag){case 0:case 11:case 15:Zo(9,Q)}}catch(He){Ct(Q,Q.return,He)}if(Q===z){je=null;break e}var xe=Q.sibling;if(xe!==null){xe.return=Q.return,je=xe;break e}je=Q.return}}if(it=A,gs(),Xt&&typeof Xt.onPostCommitFiberRoot=="function")try{Xt.onPostCommitFiberRoot(rr,e)}catch{}w=!0}return w}finally{ot=o,pn.transition=t}}return!1}function Ld(e,t,o){t=Dr(o,t),t=Vh(e,t,1),e=vs(e,t,1),t=Yt(),e!==null&&(zn(e,1,t),tn(e,t))}function Ct(e,t,o){if(e.tag===3)Ld(e,e,o);else for(;t!==null;){if(t.tag===3){Ld(t,e,o);break}else if(t.tag===1){var w=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(ws===null||!ws.has(w))){e=Dr(o,e),e=qh(t,e,1),t=vs(t,e,1),e=Yt(),t!==null&&(zn(t,1,e),tn(t,e));break}}t=t.return}}function b_(e,t,o){var w=e.pingCache;w!==null&&w.delete(t),t=Yt(),e.pingedLanes|=e.suspendedLanes&o,It===e&&(Bt&o)===o&&(Rt===4||Rt===3&&(Bt&130023424)===Bt&&500>gt()-Zl?Js(e,0):Jl|=o),tn(e,t)}function Td(e,t){t===0&&((e.mode&1)===0?t=1:(t=os,os<<=1,(os&130023424)===0&&(os=4194304)));var o=Yt();e=es(e,t),e!==null&&(zn(e,t,o),tn(e,o))}function S_(e){var t=e.memoizedState,o=0;t!==null&&(o=t.retryLane),Td(e,o)}function C_(e,t){var o=0;switch(e.tag){case 13:var w=e.stateNode,A=e.memoizedState;A!==null&&(o=A.retryLane);break;case 19:w=e.stateNode;break;default:throw Error(i(314))}w!==null&&w.delete(t),Td(e,o)}var Rd;Rd=function(e,t,o){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)Zt=!0;else{if((e.lanes&o)===0&&(t.flags&128)===0)return Zt=!1,u_(e,t,o);Zt=(e.flags&131072)!==0}else Zt=!1,wt&&(t.flags&1048576)!==0&&lh(t,Po,t.index);switch(t.lanes=0,t.tag){case 2:var w=t.type;Qo(e,t),e=t.pendingProps;var A=kr(t,$t.current);Ar(t,o),A=Ml(null,t,w,e,A,o);var j=Al();return t.flags|=1,typeof A=="object"&&A!==null&&typeof A.render=="function"&&A.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jt(w)?(j=!0,Do(t)):j=!1,t.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,Cl(t),A.updater=Yo,t.stateNode=A,A._reactInternals=t,Ol(t,w,e,o),t=$l(null,t,w,!0,j,o)):(t.tag=0,wt&&j&&fl(t),Gt(null,t,A,o),t=t.child),t;case 16:w=t.elementType;e:{switch(Qo(e,t),e=t.pendingProps,A=w._init,w=A(w._payload),t.type=w,A=t.tag=k_(w),e=xn(w,e),A){case 0:t=Hl(null,t,w,e,o);break e;case 1:t=td(null,t,w,e,o);break e;case 11:t=Xh(null,t,w,e,o);break e;case 14:t=Qh(null,t,w,xn(w.type,e),o);break e}throw Error(i(306,w,""))}return t;case 0:return w=t.type,A=t.pendingProps,A=t.elementType===w?A:xn(w,A),Hl(e,t,w,A,o);case 1:return w=t.type,A=t.pendingProps,A=t.elementType===w?A:xn(w,A),td(e,t,w,A,o);case 3:e:{if(nd(t),e===null)throw Error(i(387));w=t.pendingProps,j=t.memoizedState,A=j.element,_h(e,t),Uo(t,w,null,o);var z=t.memoizedState;if(w=z.element,j.isDehydrated)if(j={element:w,isDehydrated:!1,cache:z.cache,pendingSuspenseBoundaries:z.pendingSuspenseBoundaries,transitions:z.transitions},t.updateQueue.baseState=j,t.memoizedState=j,t.flags&256){A=Dr(Error(i(423)),t),t=sd(e,t,w,o,A);break e}else if(w!==A){A=Dr(Error(i(424)),t),t=sd(e,t,w,o,A);break e}else for(an=fs(t.stateNode.containerInfo.firstChild),on=t,wt=!0,Cn=null,o=mh(t,null,w,o),t.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Tr(),w===A){t=ns(e,t,o);break e}Gt(e,t,w,o)}t=t.child}return t;case 5:return wh(t),e===null&&gl(t),w=t.type,A=t.pendingProps,j=e!==null?e.memoizedProps:null,z=A.children,al(w,A)?z=null:j!==null&&al(w,j)&&(t.flags|=32),ed(e,t),Gt(e,t,z,o),t.child;case 6:return e===null&&gl(t),null;case 13:return rd(e,t,o);case 4:return xl(t,t.stateNode.containerInfo),w=t.pendingProps,e===null?t.child=Rr(t,null,w,o):Gt(e,t,w,o),t.child;case 11:return w=t.type,A=t.pendingProps,A=t.elementType===w?A:xn(w,A),Xh(e,t,w,A,o);case 7:return Gt(e,t,t.pendingProps,o),t.child;case 8:return Gt(e,t,t.pendingProps.children,o),t.child;case 12:return Gt(e,t,t.pendingProps.children,o),t.child;case 10:e:{if(w=t.type._context,A=t.pendingProps,j=t.memoizedProps,z=A.value,pt(Fo,w._currentValue),w._currentValue=z,j!==null)if(Sn(j.value,z)){if(j.children===A.children&&!Qt.current){t=ns(e,t,o);break e}}else for(j=t.child,j!==null&&(j.return=t);j!==null;){var Q=j.dependencies;if(Q!==null){z=j.child;for(var ee=Q.firstContext;ee!==null;){if(ee.context===w){if(j.tag===1){ee=ts(-1,o&-o),ee.tag=2;var he=j.updateQueue;if(he!==null){he=he.shared;var ve=he.pending;ve===null?ee.next=ee:(ee.next=ve.next,ve.next=ee),he.pending=ee}}j.lanes|=o,ee=j.alternate,ee!==null&&(ee.lanes|=o),bl(j.return,o,t),Q.lanes|=o;break}ee=ee.next}}else if(j.tag===10)z=j.type===t.type?null:j.child;else if(j.tag===18){if(z=j.return,z===null)throw Error(i(341));z.lanes|=o,Q=z.alternate,Q!==null&&(Q.lanes|=o),bl(z,o,t),z=j.sibling}else z=j.child;if(z!==null)z.return=j;else for(z=j;z!==null;){if(z===t){z=null;break}if(j=z.sibling,j!==null){j.return=z.return,z=j;break}z=z.return}j=z}Gt(e,t,A.children,o),t=t.child}return t;case 9:return A=t.type,w=t.pendingProps.children,Ar(t,o),A=dn(A),w=w(A),t.flags|=1,Gt(e,t,w,o),t.child;case 14:return w=t.type,A=xn(w,t.pendingProps),A=xn(w.type,A),Qh(e,t,w,A,o);case 15:return Jh(e,t,t.type,t.pendingProps,o);case 17:return w=t.type,A=t.pendingProps,A=t.elementType===w?A:xn(w,A),Qo(e,t),t.tag=1,Jt(w)?(e=!0,Do(t)):e=!1,Ar(t,o),Wh(t,w,A),Ol(t,w,A,o),$l(null,t,w,!0,e,o);case 19:return od(e,t,o);case 22:return Zh(e,t,o)}throw Error(i(156,t.tag))};function Md(e,t){return no(e,t)}function x_(e,t,o,w){this.tag=e,this.key=o,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=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(e,t,o,w){return new x_(e,t,o,w)}function ac(e){return e=e.prototype,!(!e||!e.isReactComponent)}function k_(e){if(typeof e=="function")return ac(e)?1:0;if(e!=null){if(e=e.$$typeof,e===F)return 11;if(e===V)return 14}return 2}function xs(e,t){var o=e.alternate;return o===null?(o=mn(e.tag,t,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=t,o.type=e.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=e.flags&14680064,o.childLanes=e.childLanes,o.lanes=e.lanes,o.child=e.child,o.memoizedProps=e.memoizedProps,o.memoizedState=e.memoizedState,o.updateQueue=e.updateQueue,t=e.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function la(e,t,o,w,A,j){var z=2;if(w=e,typeof e=="function")ac(e)&&(z=1);else if(typeof e=="string")z=5;else e:switch(e){case M:return er(o.children,A,j,t);case b:z=8,A|=8;break;case T:return e=mn(12,o,t,A|2),e.elementType=T,e.lanes=j,e;case O:return e=mn(13,o,t,A),e.elementType=O,e.lanes=j,e;case U:return e=mn(19,o,t,A),e.elementType=U,e.lanes=j,e;case X:return ca(o,A,j,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case N:z=10;break e;case B:z=9;break e;case F:z=11;break e;case V:z=14;break e;case Y:z=16,w=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=mn(z,o,t,A),t.elementType=e,t.type=w,t.lanes=j,t}function er(e,t,o,w){return e=mn(7,e,w,t),e.lanes=o,e}function ca(e,t,o,w){return e=mn(22,e,w,t),e.elementType=X,e.lanes=o,e.stateNode={isHidden:!1},e}function lc(e,t,o){return e=mn(6,e,null,t),e.lanes=o,e}function cc(e,t,o){return t=mn(4,e.children!==null?e.children:[],e.key,t),t.lanes=o,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function E_(e,t,o,w,A){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=Nt(0),this.expirationTimes=Nt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nt(0),this.identifierPrefix=w,this.onRecoverableError=A,this.mutableSourceEagerHydrationData=null}function uc(e,t,o,w,A,j,z,Q,ee){return e=new E_(e,t,o,Q,ee),t===1?(t=1,j===!0&&(t|=8)):t=0,j=mn(3,null,null,t),e.current=j,j.stateNode=e,j.memoizedState={element:w,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Cl(j),e}function L_(e,t,o){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:w==null?null:""+w,children:e,containerInfo:t,implementation:o}}function Ad(e){if(!e)return ms;e=e._reactInternals;e:{if(Un(e)!==e||e.tag!==1)throw Error(i(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Jt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(i(171))}if(e.tag===1){var o=e.type;if(Jt(o))return ih(e,o,t)}return t}function Nd(e,t,o,w,A,j,z,Q,ee){return e=uc(o,w,!0,e,A,j,z,Q,ee),e.context=Ad(null),o=e.current,w=Yt(),A=Ss(o),j=ts(w,A),j.callback=t??null,vs(o,j,A),e.current.lanes=A,zn(e,A,w),tn(e,w),e}function ua(e,t,o,w){var A=t.current,j=Yt(),z=Ss(A);return o=Ad(o),t.context===null?t.context=o:t.pendingContext=o,t=ts(j,z),t.payload={element:e},w=w===void 0?null:w,w!==null&&(t.callback=w),e=vs(A,t,z),e!==null&&(Ln(e,A,z,j),$o(e,A,z)),z}function ha(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 Dd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var o=e.retryLane;e.retryLane=o!==0&&o<t?o:t}}function hc(e,t){Dd(e,t),(e=e.alternate)&&Dd(e,t)}function T_(){return null}var Id=typeof reportError=="function"?reportError:function(e){console.error(e)};function dc(e){this._internalRoot=e}da.prototype.render=dc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));ua(e,t,null,null)},da.prototype.unmount=dc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Qs(function(){ua(null,e,null,null)}),t[Xn]=null}};function da(e){this._internalRoot=e}da.prototype.unstable_scheduleHydration=function(e){if(e){var t=co();e={blockedOn:null,target:e,priority:t};for(var o=0;o<yn.length&&t!==0&&t<yn[o].priority;o++);yn.splice(o,0,e),o===0&&uo(e)}};function fc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function fa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function jd(){}function R_(e,t,o,w,A){if(A){if(typeof w=="function"){var j=w;w=function(){var he=ha(z);j.call(he)}}var z=Nd(t,w,e,0,null,!1,!1,"",jd);return e._reactRootContainer=z,e[Xn]=z.current,vi(e.nodeType===8?e.parentNode:e),Qs(),z}for(;A=e.lastChild;)e.removeChild(A);if(typeof w=="function"){var Q=w;w=function(){var he=ha(ee);Q.call(he)}}var ee=uc(e,0,!1,null,null,!1,!1,"",jd);return e._reactRootContainer=ee,e[Xn]=ee.current,vi(e.nodeType===8?e.parentNode:e),Qs(function(){ua(t,ee,o,w)}),ee}function pa(e,t,o,w,A){var j=o._reactRootContainer;if(j){var z=j;if(typeof A=="function"){var Q=A;A=function(){var ee=ha(z);Q.call(ee)}}ua(t,z,e,A)}else z=R_(o,t,e,A,w);return ha(z)}ii=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var o=Ht(t.pendingLanes);o!==0&&(ri(t,o|1),tn(t,gt()),(it&6)===0&&(Pr=gt()+500,gs()))}break;case 13:Qs(function(){var w=es(e,1);if(w!==null){var A=Yt();Ln(w,e,1,A)}}),hc(e,1)}},oi=function(e){if(e.tag===13){var t=es(e,134217728);if(t!==null){var o=Yt();Ln(t,e,134217728,o)}hc(e,134217728)}},cr=function(e){if(e.tag===13){var t=Ss(e),o=es(e,t);if(o!==null){var w=Yt();Ln(o,e,t,w)}hc(e,t)}},co=function(){return ot},ai=function(e,t){var o=ot;try{return ot=e,t()}finally{ot=o}},rt=function(e,t,o){switch(t){case"input":if(Ce(e,o),t=o.name,o.type==="radio"&&t!=null){for(o=e;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<o.length;t++){var w=o[t];if(w!==e&&w.form===e.form){var A=Ao(w);if(!A)throw Error(i(90));me(w),Ce(w,A)}}}break;case"textarea":Ne(e,o);break;case"select":t=o.value,t!=null&&Ee(e,!!o.multiple,t,!1)}},rs=rc,As=Qs;var M_={usingClientEntryPoint:!1,Events:[bi,Cr,Ao,Mt,Pt,rc]},ji={findFiberByHostInstance:Ws,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},A_={bundleType:ji.bundleType,version:ji.version,rendererPackageName:ji.rendererPackageName,rendererConfig:ji.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:k.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=to(e),e===null?null:e.stateNode},findFiberByHostInstance:ji.findFiberByHostInstance||T_,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 ma=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ma.isDisabled&&ma.supportsFiber)try{rr=ma.inject(A_),Xt=ma}catch{}}return nn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=M_,nn.createPortal=function(e,t){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!fc(t))throw Error(i(200));return L_(e,t,null,o)},nn.createRoot=function(e,t){if(!fc(e))throw Error(i(299));var o=!1,w="",A=Id;return t!=null&&(t.unstable_strictMode===!0&&(o=!0),t.identifierPrefix!==void 0&&(w=t.identifierPrefix),t.onRecoverableError!==void 0&&(A=t.onRecoverableError)),t=uc(e,1,!1,null,null,o,!1,w,A),e[Xn]=t.current,vi(e.nodeType===8?e.parentNode:e),new dc(t)},nn.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(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=to(t),e=e===null?null:e.stateNode,e},nn.flushSync=function(e){return Qs(e)},nn.hydrate=function(e,t,o){if(!fa(t))throw Error(i(200));return pa(null,e,t,!0,o)},nn.hydrateRoot=function(e,t,o){if(!fc(e))throw Error(i(405));var w=o!=null&&o.hydratedSources||null,A=!1,j="",z=Id;if(o!=null&&(o.unstable_strictMode===!0&&(A=!0),o.identifierPrefix!==void 0&&(j=o.identifierPrefix),o.onRecoverableError!==void 0&&(z=o.onRecoverableError)),t=Nd(t,null,e,1,o??null,A,!1,j,z),e[Xn]=t.current,vi(e),w)for(e=0;e<w.length;e++)o=w[e],A=o._getVersion,A=A(o._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[o,A]:t.mutableSourceEagerHydrationData.push(o,A);return new da(t)},nn.render=function(e,t,o){if(!fa(t))throw Error(i(200));return pa(null,e,t,!1,o)},nn.unmountComponentAtNode=function(e){if(!fa(e))throw Error(i(40));return e._reactRootContainer?(Qs(function(){pa(null,null,e,!1,function(){e._reactRootContainer=null,e[Xn]=null})}),!0):!1},nn.unstable_batchedUpdates=rc,nn.unstable_renderSubtreeIntoContainer=function(e,t,o,w){if(!fa(o))throw Error(i(200));if(e==null||e._reactInternals===void 0)throw Error(i(38));return pa(e,t,o,!1,w)},nn.version="18.3.1-next-f1338f8080-20240426",nn}var Wd;function Ip(){if(Wd)return gc.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(s){console.error(s)}}return n(),gc.exports=$_(),gc.exports}var zd;function U_(){if(zd)return ga;zd=1;var n=Ip();return ga.createRoot=n.createRoot,ga.hydrateRoot=n.hydrateRoot,ga}var W_=U_(),I=fu();const z_=j_(I);function Oe(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null}function Ie(n){return typeof n=="string"?n:null}function we(n){return typeof n=="string"&&n.length>0?n:null}function ft(n){return typeof n=="boolean"?n:null}function Ue(n){return typeof n=="number"&&Number.isFinite(n)?n:null}function Sa(n){if(!Array.isArray(n))return null;const s=[];for(const i of n){if(typeof i!="string")return null;s.push(i)}return s}function yt(n,s){if(!Array.isArray(n))return null;const i=[];for(const h of n){const v=s(h);if(v===null)return null;i.push(v)}return i}function sn(n,s){if(!Array.isArray(n))return null;const i=[];for(const h of n){const v=s(h);v!==null&&i.push(v)}return i}function Ye(n,s){return typeof n=="string"&&s.includes(n)?n:null}function V_(n){try{return JSON.parse(n)}catch{return}}const q_=["auto","default","acceptEdits","plan"];function $r(n){return typeof n=="string"&&q_.includes(n)}const K_={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:[],settingsFailed:[],settingsHostOnly:[],settingsShellMissing:[],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 G_(n){return Object.prototype.hasOwnProperty.call(K_,n)}function $n(n,s=0){const i=Oe(n);if(i===null)return null;const h=Ie(i.key);if(h===null||h.length===0)return null;const v=i.params;if(v===void 0)return{key:h};const R=Oe(v);if(R===null)return null;const x={};for(const[r,c]of Object.entries(R)){if(typeof c=="string"||typeof c=="number"&&Number.isFinite(c)){x[r]=c;continue}const g=s===0?$n(c,s+1):null;if(g===null)return null;x[r]=g}return{key:h,params:x}}function Y_(n){if(!Array.isArray(n))return null;const s=[];for(const i of n){const h=$n(i);if(h===null)return null;s.push(h)}return s}const Wr=["claude-code","codex","opencode","antigravity"],X_=["gemini-cli","antigravity-ide"],Ia=[...Wr,...X_],Q_={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function Kr(n){return Wr.includes(n)}const J_=["at-quoted","bare-path-paste"],Z_=["at"],ev=["usage-with-variants","token-count","usage-with-catalog","status-line"],tv=["child-session-marker"],nv=["active","missing","other-command","disabled","unreadable"];function jp(n,s=null){return!n.statusSource||s==="unknown"}const Pp={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 pu(n){return n.filter(s=>s.available).length>1}function sv(n){const s=Oe(n);if(s===null)return null;const i=s.modes;if(!Array.isArray(i)||i.length===0)return null;const h=[];for(const x of i){if(!$r(x))return null;h.push(x)}const v=s.launchMode;if(!$r(v)||!h.includes(v))return null;const R=we(s.keyLabel);return R===null?null:{modes:h,launchMode:v,keyLabel:R,approvesPendingOnCycle:s.approvesPendingOnCycle===!0}}function rv(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.state,nv),h=we(s.settingsPath),v=we(s.scriptPath),R=s.fragment,x=R===null?null:we(R);return i===null||h===null||v===null||R!==null&&x===null?null:{state:i,settingsPath:h,scriptPath:v,fragment:x}}function iv(n){const s=Oe(n);if(s===null)return null;const i=we(s.value),h=Ie(s.label),v=Ie(s.family),R=ft(s.long),x=s.window,r=x===null?null:Ue(x);return i===null||h===null||v===null||R===null||x!==null&&r===null?null:{value:i,label:h,family:v,long:R,window:r}}function ov(n){const s=Oe(n);if(s===null)return null;const i=we(s.value),h=Ie(s.label);return i===null||h===null?null:{value:i,label:h}}function Vd(n,s){const i=yt(n,s);return i===null||i.length===0?null:i}function av(n){const s=Oe(n);return s===null?{...Pp}:{sessionIdAtLaunch:s.sessionIdAtLaunch===!0,resume:s.resume===!0,statusSource:s.statusSource===!0,readySignal:s.readySignal===!0,permissionCycle:sv(s.permissionCycle),models:Vd(s.models,iv),efforts:Vd(s.efforts,ov),questionCards:s.questionCards===!0,imagesByPath:Ye(s.imagesByPath,J_),fileMentions:Ye(s.fileMentions,Z_),rewind:s.rewind===!0,contextWindowSource:Ye(s.contextWindowSource,ev),plans:s.plans===!0,waitingBlocksSubmit:s.waitingBlocksSubmit===!0}}function qd(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.id,Wr),h=Ie(s.label),v=Ie(s.command),R=Ie(s.installUrl);return i===null||h===null||v===null||R===null?null:{id:i,label:h,command:v,available:s.available===!0,version:Ie(s.version),installUrl:R,missingMessage:$n(s.missingMessage),capabilities:av(s.capabilities),environmentNotice:Ye(s.environmentNotice,tv),statusLine:rv(s.statusLine)}}const lv=["custom","ai","first-message","none"],cv=["native","vault"],uv=["idle","scanning","ready"],hv=["agent","shell"],dv=["busy","idle","waiting","offline","unknown"],fv=["server-closed"];function pv(n){const s=Oe(n);if(s===null)return null;const i=we(s.sessionId),h=Ie(s.title),v=Ye(s.titleSource,lv),R=Ue(s.updatedAt),x=Ue(s.sizeBytes);if(i===null||h===null||v===null||R===null||x===null)return null;const r=s.agent===void 0?"claude-code":Ye(s.agent,Ia);if(r===null)return null;const c=Ie(s.cwd)??"";return{agent:r,sessionId:i,cwd:c,title:h,titleSource:v,updatedAt:R,sizeBytes:x,archived:s.archived===!0,storage:Ye(s.storage,cv)??"native",partial:s.partial===!0}}function mv(n){const s=Oe(n);if(s===null)return null;const i=Ie(s.cwd),h=ft(s.cwdExists),v=sn(s.sessions,pv),R=Ue(s.lastActivityAt);if(i===null||h===null||v===null||R===null)return null;const x=we(s.key);if(x!==null)return{key:x,fallbackName:Ie(s.fallbackName)??"",cwd:i,cwdExists:h,sessions:v,lastActivityAt:R};const r=we(s.slug);return r===null?null:{key:r,fallbackName:i.length===0?r:"",cwd:i,cwdExists:h,sessions:v,lastActivityAt:R}}function gv(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.state,uv),h=Ue(s.scannedFiles),v=Ue(s.totalFiles);return i===null||h===null||v===null?null:{state:i,scannedFiles:h,totalFiles:v}}function Kd(n){const s=Oe(n);if(s===null)return null;const i=we(s.terminalId),h=Ye(s.kind,hv)??"agent";let v=null;if(h==="agent"&&(v=s.agent===void 0?"claude-code":Ye(s.agent,Wr),v===null))return null;const R=Ie(s.cwd),x=Ie(s.sessionId),r=Ie(s.label),c=ft(s.resumed),g=Ue(s.createdAt),_=ft(s.alive);if(i===null||R===null||x===null||r===null||c===null||g===null||_===null)return null;const u=s.exitCode;return{terminalId:i,kind:h,agent:v,cwd:R,sessionId:x,label:r,resumed:c,createdAt:g,alive:_,exitCode:typeof u=="number"?u:null,sleeping:s.sleeping===!0}}const Op=["user","assistant"],Bp=["content","attachment","pasted"],_v=["compacted","interrupted","error"],vv=["cli-plans","project","scratch"],yv=120,wv=20,yc={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},Gd=["waiting","live","unavailable","no-transcript"];function bv(n){const s=Oe(n);if(s===null)return null;const i=Ue(s.inputTokens),h=Ue(s.outputTokens),v=Ue(s.cacheCreationInputTokens),R=Ue(s.cacheReadInputTokens);return i===null||h===null||v===null||R===null?null:{inputTokens:i,outputTokens:h,cacheCreationInputTokens:v,cacheReadInputTokens:R}}function Sv(n){const s=Oe(n);if(s===null)return null;const i=we(s.label);return i===null?null:{label:i,description:Ie(s.description)??""}}function Cv(n){const s=Oe(n);if(s===null)return null;const i=we(s.question),h=yt(s.options,Sv);return i===null||h===null||h.length===0?null:{question:i,header:Ie(s.header)??"",multiSelect:s.multiSelect===!0,options:h}}function Fp(n){const s=Oe(n);if(s===null)return null;switch(s.kind){case"text":{const i=Ie(s.text),h=ft(s.truncated);return i===null||h===null?null:{kind:"text",text:i,truncated:h}}case"tool-call":{const i=Ie(s.toolUseId),h=Ie(s.name),v=Ie(s.input),R=ft(s.truncated);return i===null||h===null||v===null||R===null?null:{kind:"tool-call",toolUseId:i,name:h,input:v,truncated:R}}case"tool-result":{const i=Ie(s.toolUseId),h=Ie(s.text),v=ft(s.isError),R=ft(s.truncated),x=Ue(s.imageCount);return i===null||h===null||v===null||R===null||x===null?null:{kind:"tool-result",toolUseId:i,text:h,isError:v,truncated:R,imageCount:x}}case"thinking":return{kind:"thinking"};case"question":{const i=we(s.toolUseId),h=yt(s.questions,Cv);return i===null||h===null||h.length===0?null:{kind:"question",toolUseId:i,questions:h}}case"image":{const i=Ue(s.index),h=Ie(s.mediaType);if(i===null||h===null)return null;const v=Ye(s.source,Bp)??"content";return{kind:"image",index:i,mediaType:h,source:v}}case"notice":{const i=Ye(s.notice,_v);return i===null?null:{kind:"notice",notice:i,detail:Ie(s.detail)??""}}default:return null}}function wc(n){const s=Oe(n);if(s===null)return null;const i=we(s.eventId),h=Ye(s.role,Op),v=Ue(s.at),R=yt(s.parts,Fp);return i===null||h===null||v===null||R===null?null:{eventId:i,role:h,at:v,parts:R,model:Ie(s.model),usage:bv(s.usage),effort:Ie(s.effort),durationMs:Ue(s.durationMs),queued:s.queued===!0}}function xv(n){const s=Oe(n);if(s===null)return null;const i=we(s.toolUseId),h=Ie(s.description),v=Ue(s.startedAt);return i===null||h===null||v===null?null:{toolUseId:i,description:h.slice(0,yv),background:s.background===!0,startedAt:v}}function Yd(n){const s=Oe(n);if(s===null)return null;const i=Ue(s.lastRequestTokens),h=Ue(s.lastOutputTokens),v=Ue(s.totalInputTokens),R=Ue(s.totalOutputTokens),x=Ue(s.totalCacheReadTokens),r=Ue(s.assistantMessages);if(i===null||h===null||v===null||R===null||x===null||r===null)return null;const c=Ie(s.lastEffort);return{lastRequestTokens:i,lastOutputTokens:h,lastModel:Ie(s.lastModel),contextWindow:Ue(s.contextWindow),contextWindowEstimated:s.contextWindowEstimated===!0,totalInputTokens:v,totalOutputTokens:R,totalCacheReadTokens:x,assistantMessages:r,...c!==null?{lastEffort:c}:{}}}function kv(n){const s=Oe(n);if(s===null)return null;const i=we(s.fileName),h=we(s.title),v=Ue(s.modifiedAt),R=Ue(s.sizeBytes);if(i===null||h===null||v===null||R===null)return null;const x=s.origin,r=vv.find(g=>g===x)??"cli-plans",c=Ie(s.path)??"";return{fileName:i,title:h,origin:r,path:c,exists:s.exists===!0,modifiedAt:v,sizeBytes:R}}function Ev(n){const s=Oe(n);if(s===null)return null;const i=we(s.fileName),h=Ie(s.text);return i===null||h===null?null:{fileName:i,text:h,truncated:s.truncated===!0}}const Hp=[{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 Lv(n){if(n.window===null)return n.label;const s=n.window>=1e6?`${Math.round(n.window/1e6)}M`:`${Math.round(n.window/1e3)}k`;return`${n.label} · ${s}`}function Tv(n,s=Hp){const i=Rv(n,s);if(i===null||n===null)return null;const h=n.includes("[1m]");return s.find(v=>v.family===i&&v.long===h)??null}function Rv(n,s=Hp){var h;return n===null||n.length===0?null:((h=s.filter(v=>v.family.length>0).sort((v,R)=>R.family.length-v.family.length).find(v=>n.includes(v.family)))==null?void 0:h.family)??null}function Mv(n){return`/model ${n}`}function Av(n){return`/effort ${n}`}const Nv=["staged","unstaged","untracked","conflict"],Dv=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],Iv=["ready","not-a-repo","git-missing","error"],bc={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},jv=["meta","hunk","context","added","removed"];function Pv(n){const s=Oe(n);if(s===null)return null;const i=we(s.path),h=Ye(s.kind,Dv),v=Ye(s.stage,Nv);return i===null||h===null||v===null?null:{path:i,kind:h,stage:v,oldPath:Ie(s.oldPath)}}function Ov(n){const s=Oe(n);if(s===null)return null;const i=we(s.path);return i===null?null:{path:i,branch:Ie(s.branch),isCurrent:s.isCurrent===!0}}function Bv(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.state,Iv),h=Ie(s.repoRoot),v=Ue(s.ahead),R=Ue(s.behind),x=yt(s.changes,Pv),r=yt(s.worktrees,Ov),c=Ue(s.updatedAt);return i===null||h===null||v===null||R===null||x===null||r===null||c===null?null:{state:i,message:$n(s.message),repoRoot:h,branch:Ie(s.branch),head:Ie(s.head),upstream:Ie(s.upstream),ahead:v,behind:R,changes:x,worktrees:r,truncated:s.truncated===!0,updatedAt:c}}function Fv(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.kind,jv),h=Ie(s.text);return i===null||h===null?null:{kind:i,text:h,oldLine:Ue(s.oldLine),newLine:Ue(s.newLine)}}function Hv(n){const s=Oe(n);if(s===null)return null;const i=we(s.path),h=ft(s.staged),v=yt(s.lines,Fv);return i===null||h===null||v===null?null:{path:i,staged:h,lines:v,truncated:s.truncated===!0,binary:s.binary===!0,message:$n(s.message)}}const $v=["dir","file"],Uv=["ignored","always"];function $p(n){const s=Oe(n);if(s===null)return null;const i=we(s.name),h=we(s.path),v=Ye(s.kind,$v),R=Ue(s.sizeBytes),x=Ue(s.modifiedAt);if(i===null||h===null||v===null||R===null||x===null)return null;const r=Ye(s.hidden,Uv),c={name:i,path:h,kind:v,sizeBytes:R,modifiedAt:x};return r===null?c:{...c,hidden:r}}function Wv(n){const s=Oe(n);if(s===null)return null;const i=Ie(s.query),h=yt(s.entries,$p);return i===null||h===null?null:{query:i,entries:h,truncated:s.truncated===!0}}function zv(n){const s=Oe(n);if(s===null)return null;const i=Ie(s.path),h=yt(s.entries,$p),v=Ue(s.hiddenCount);return i===null||h===null||v===null?null:{path:i,entries:h,truncated:s.truncated===!0,hiddenCount:v}}function Vv(n){const s=Oe(n);if(s===null)return null;const i=we(s.path),h=Ie(s.text),v=Ue(s.sizeBytes),R=ft(s.binary);return i===null||h===null||v===null||R===null?null:{path:i,language:Ie(s.language),text:h,sizeBytes:v,truncated:s.truncated===!0,binary:R}}function qv(n){const s=Oe(n);if(s===null)return null;const i=we(s.pickerId),h=we(s.path),v=yt(s.entries,x=>we(x)),R=yt(s.roots,x=>we(x));return i===null||h===null||v===null||R===null?null:{pickerId:i,path:h,entries:v,roots:R,canGoUp:s.canGoUp===!0,truncated:s.truncated===!0}}const Up=1e6,Kv=100,Gv=999999;function Wp(n){return n.pasted.reduce((s,i)=>s+i.text.length,n.text.length)}function qc(n){return n.text.trim().length===0&&n.pasted.every(s=>s.text.trim().length===0)}function zp(n,s){return n.text!==s.text||n.pasted.length!==s.pasted.length?!1:n.pasted.every((i,h)=>{const v=s.pasted[h];return v!==void 0&&v.number===i.number&&v.text===i.text})}function Yv(n){const s=Oe(n);if(s===null)return null;const i=s.number,h=Ie(s.text);return typeof i!="number"||!Number.isInteger(i)||i<1||i>Gv||h===null?null:{number:i,text:h}}function Xv(n){const s=Oe(n);if(s===null)return null;const i=Ie(s.text),h=yt(s.pasted,Yv);return i===null||h===null||h.length>Kv||new Set(h.map(v=>v.number)).size!==h.length?null:{text:i,pasted:h}}const ka="MEMORY.md",mu=["AGENTS.md","CLAUDE.md"],Vp=["claude-code","codex","antigravity","opencode"],Qv=["outside","encoding"],Jv=["create","append-block","replace-block","append-lines","copy"];function Zv(n){return{instructionFiles:[...mu],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 e0(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.name,mu),h=ft(s.exists),v=ft(s.hasBlock),R=ft(s.blockCurrent),x=ft(s.brokenBlock),r=s.problem,c=r===null?null:Ye(r,Qv);return i===null||h===null||v===null||R===null||x===null||r!==null&&c===null?null:{name:i,exists:h,hasBlock:v,blockCurrent:R,brokenBlock:x,problem:c}}function t0(n){const s=Oe(n);if(s===null)return null;switch(s.kind){case"not-repo":return{kind:"not-repo"};case"error":{const i=$n(s.message);return i===null?null:{kind:"error",message:i}}case"repo":{const i=ft(s.ignored);if(i===null)return null;if(s.worktree===null)return{kind:"repo",ignored:i,worktree:null};const h=Oe(s.worktree);if(h===null)return null;const v=we(h.mainPath),R=ft(h.mainHasMemory);return v===null||R===null?null:{kind:"repo",ignored:i,worktree:{mainPath:v,mainHasMemory:R}}}default:return null}}function n0(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.agent,Vp),h=we(s.label),v=ft(s.reaches),R=$n(s.via);return i===null||h===null||v===null||R===null?null:{agent:i,label:h,reaches:v,via:R}}function s0(n){const s=Oe(n);if(s===null)return null;const i=we(s.name),h=Ie(s.title),v=Ie(s.description),R=Ue(s.sizeBytes),x=Ue(s.modifiedAt);return i===null||h===null||v===null||R===null||x===null?null:{name:i,title:h,description:v,sizeBytes:R,modifiedAt:x}}const r0=["line","command","json"];function i0(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.agent,Vp),h=we(s.label),v=we(s.target),R=Ye(s.kind,r0),x=we(s.text),r=$n(s.note);return i===null||h===null||v===null||R===null||x===null||r===null?null:{agent:i,label:h,target:v,kind:R,text:x,note:r}}function o0(n){const s=Oe(n);if(s===null)return null;const i=we(s.cwd),h=ft(s.folderExists),v=ft(s.indexExists),R=ft(s.installed),x=yt(s.notes,s0),r=yt(s.files,e0),c=t0(s.git),g=yt(s.reach,n0),_=Oe(s.native),u=_===null?null:Ue(_.available),y=_===null?null:Ue(_.pending),S=yt(s.globalFragments,i0);return i===null||h===null||v===null||R===null||x===null||r===null||c===null||g===null||u===null||y===null||S===null?null:{cwd:i,folderExists:h,indexExists:v,installed:R,notes:x,files:r,git:c,reach:g,native:{available:u,pending:y},globalFragments:S}}function Xd(n){const s=Oe(n);if(s===null)return null;const i=we(s.file),h=Ye(s.action,Jv),v=Ie(s.preview),R=Ie(s.copiedFrom);return i===null||h===null||v===null?null:{file:i,action:h,preview:v,copiedFrom:R}}function a0(n){const s=Oe(n);if(s===null)return null;const i=we(s.name),h=Ie(s.text),v=ft(s.truncated);return i===null||h===null||v===null?null:{name:i,text:h,truncated:v}}const Qd=20;function l0(n,s="Nota"){const i=n.text.split(`
41
+ `).map(h=>h.trim()).find(h=>h.length>0);return i===void 0?n.images.length>0?"Imagen":s:i.length>40?`${i.slice(0,40)}…`:i}function c0(n){const s=Oe(n);if(s===null)return null;const i=we(s.imageId),h=we(s.mediaType),v=Ue(s.bytes);return i===null||h===null||v===null?null:{imageId:i,mediaType:h,bytes:v}}function u0(n){const s=Oe(n);if(s===null)return null;const i=we(s.noteId),h=Ie(s.text),v=yt(s.images,c0),R=Ue(s.createdAt),x=Ue(s.updatedAt);return i===null||h===null||v===null?null:{noteId:i,text:h,images:v,createdAt:R??0,updatedAt:x??0}}const qp=3,h0=3e4,d0=["results","time"];function zr(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function Hi(n,s){if(n==null)return null;const i=s(n);return i===null?void 0:i}function Kp(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.agent,Ia),h=we(s.sessionId),v=Hi(s.cwd,Ie),R=Ie(s.title),x=Hi(s.eventId,we),r=Hi(s.role,y=>Ye(y,Op)),c=Hi(s.at,Ue),g=Ie(s.snippet),_=zr(s.matchStart),u=zr(s.matchLength);return i===null||h===null||v===void 0||R===null||x===void 0||r===void 0||c===void 0||g===null||_===null||u===null||_+u>g.length?null:{agent:i,sessionId:h,cwd:v,title:R,eventId:x,role:r,at:c,snippet:g,matchStart:_,matchLength:u}}function f0(n){const s=Oe(n);if(s===null)return null;const i=Ie(s.query),h=sn(s.hits,Kp),v=zr(s.sessionsScanned),R=zr(s.sessionsTotal),x=Hi(s.truncated,r=>Ye(r,d0));return i===null||h===null||v===null||R===null||v>R||x===void 0?null:{query:i,hits:h,sessionsScanned:v,sessionsTotal:R,truncated:x}}function p0(n){const s=Oe(n);if(s===null)return null;const i=Ie(s.query),h=sn(s.hits,Kp),v=zr(s.sessionsScanned),R=zr(s.sessionsTotal);return i===null||h===null||v===null||R===null||v>R?null:{query:i,hits:h,sessionsScanned:v,sessionsTotal:R}}const m0=["off","idle","measuring","writing","moving"];function qt(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function Oi(n,s){if(n==null)return null;const i=s(n);return i===null?void 0:i}function g0(n){const s=Oe(n);if(s===null)return null;const i=Ye(s.agent,Ia),h=qt(s.sessions),v=qt(s.eventBytes),R=qt(s.images),x=qt(s.imageBytes),r=qt(s.skippedArchived),c=qt(s.skippedEmpty),g=qt(s.unsupported),_=qt(s.failed),u=Y_(s.failureReasons);return i===null||h===null||v===null||R===null||x===null||r===null||c===null||g===null||_===null||u===null?null:{agent:i,sessions:h,eventBytes:v,images:R,imageBytes:x,skippedArchived:r,skippedEmpty:c,unsupported:g,failed:_,failureReasons:u}}function _0(n){const s=Oe(n);if(s===null)return null;const i=Ue(s.measuredAt),h=Ue(s.durationMs),v=sn(s.byAgent,g0),R=qt(s.memoryProjects),x=qt(s.memoryBytes);return i===null||h===null||v===null||R===null||x===null?null:{measuredAt:i,durationMs:h,byAgent:v,memoryProjects:R,memoryBytes:x}}function v0(n){const s=Oe(n);if(s===null)return null;const i=qt(s.done),h=qt(s.total);return i===null||h===null?null:{done:i,total:h}}function y0(n){const s=Oe(n);if(s===null)return null;const i=ft(s.enabled),h=Ie(s.dir),v=ft(s.isDefaultDir),R=Ye(s.state,m0),x=qt(s.sessions),r=qt(s.passSessions),c=qt(s.bytes),g=qt(s.pending),_=Oi(s.progress,v0),u=Oi(s.lastPassAt,Ue),y=Oi(s.measurement,_0),S=Oi(s.previousDir,Ie),L=Oi(s.lastError,$n);return i===null||h===null||v===null||R===null||x===null||r===null||c===null||g===null||_===void 0||u===void 0||y===void 0||S===void 0||L===void 0?null:{enabled:i,dir:h,isDefaultDir:v,state:R,progress:_,sessions:x,passSessions:r,bytes:c,lastPassAt:u,pending:g,measurement:y,previousDir:S,lastError:L}}const Gp=1024,Yp=65535,w0="pair",b0=4001;function S0(n){return typeof n=="number"&&Number.isInteger(n)&&n>=Gp&&n<=Yp}const C0=["off","active","restart-needed","port-busy"];function x0(n){const s=Oe(n);if(s===null)return null;const i=we(s.id),h=Ie(s.label),v=Ue(s.createdAt),R=ft(s.connected);if(i===null||h===null||v===null||R===null)return null;const x=s.lastSeenAt,r=x==null?null:Ue(x);return x!=null&&r===null?null:{id:i,label:h,createdAt:v,lastSeenAt:r,connected:R}}function k0(n){const s=Oe(n);if(s===null)return null;const i=ft(s.enabled),h=Ue(s.port),v=Ye(s.state,C0),R=Ue(s.listeningPort),x=Ie(s.sshUser),r=Sa(s.hostNames),c=ft(s.pairingActive),g=yt(s.devices,x0);return i===null||h===null||v===null||R===null||x===null||r===null||c===null||g===null?null:{enabled:i,port:h,state:v,listeningPort:R,sshUser:x,hostNames:r,pairingActive:c,devices:g}}function E0(n){const s=Oe(n);if(s===null)return null;const i=we(s.code),h=Ue(s.expiresAt);return i===null||h===null?null:{code:i,expiresAt:h}}const L0=["powershell-admin","powershell","terminal"];function T0(n){const s=Oe(n);if(s===null)return null;const i=we(s.payload),h=we(s.authorizeCommand),v=Ye(s.shell,L0),R=we(s.code),x=Ue(s.expiresAt);return i===null||h===null||v===null||R===null||x===null?null:{payload:i,authorizeCommand:h,shell:v,code:R,expiresAt:x}}const R0=["auto","pwsh","powershell","cmd","git-bash","login","bash","sh","zsh"];function Xp(n){return Ye(n,R0)}function M0(n){const s=Oe(n);if(s===null)return null;const i=Xp(s.id),h=we(s.label);return i===null||i==="auto"||h===null?null:{id:i,label:h}}function Jd(n){return Array.isArray(n)?[...new Set(n.filter(s=>typeof s=="string"&&Kr(s)))]:null}function A0(n){const s=Oe(n);if(s===null)return null;const i=Xp(s.consoleShell),h=sn(s.consoleShells,M0),v=s.shellName,R=v===null?null:we(v),x=Jd(s.disabledAgents),r=Jd(s.disabledAtStart);return i===null||h===null||x===null||r===null||v!==null&&R===null?null:{consoleShell:i,consoleShells:h,shellName:R,disabledAgents:x,disabledAtStart:r}}const Fr=8,N0="/ws",Kc="token",Ea=12*1024*1024,Sc=8,Zd=10*1024*1024,Cc=4,D0=["sending","prefilled"],I0=["no-delivery","not-ready","send-failed"],j0=["cli-not-found","shell-not-found","spawn-failed","bad-message","unknown-terminal","terminal-asleep","invalid-cwd","too-many-terminals","invalid-path","read-failed","submit-failed","answer-failed","mode-failed","archive-failed","notes-failed","picker-failed","memory-failed","vault-failed","continue-failed","search-failed","remote-failed","settings-failed","remote-refused","agent-unsupported","internal"];function P0(n){const s={model:null,effort:null,contextWindow:null};if(typeof n!="object"||n===null)return s;const i=n;return{model:we(i.model),effort:we(i.effort),contextWindow:Ue(i.contextWindow)}}function O0(n){const s=Oe(n);if(s===null)return null;const i=we(s.terminalId),h=Xv(s.draft);return i===null||h===null?null:{terminalId:i,draft:h}}function ef(n){return typeof n=="number"&&Number.isInteger(n)&&n>=0?n:null}function _a(n,s){const i=we(s.requestId);return i!==null&&(n.requestId=i),n}function tf(n){var s;return((s=sn(n,xv))==null?void 0:s.slice(0,wv))??null}function B0(n){const s=Oe(V_(n));if(s===null)return null;switch(s.type){case"hello":{const i=Ue(s.protocolVersion),h=Ie(s.platform),v=Ie(s.defaultCwd);return i===null||h===null||v===null?null:{type:"hello",protocolVersion:i,agents:sn(s.agents,qd)??[],defaultAgent:Ye(s.defaultAgent,Wr),platform:h,defaultCwd:v,shellName:we(s.shellName),remoteClient:s.remoteClient===!0}}case"agents":{const i=sn(s.agents,qd);return i===null?null:{type:"agents",agents:i,defaultAgent:Ye(s.defaultAgent,Wr)}}case"terminal.list":{const i=sn(s.terminals,Kd),h=Sa(s.order);return i===null||h===null?null:{type:"terminal.list",terminals:i,order:h}}case"terminal.opened":{const i=we(s.requestId),h=Kd(s.terminal);return i===null||h===null?null:{type:"terminal.opened",requestId:i,terminal:h}}case"terminal.output":{const i=we(s.terminalId),h=Ie(s.data);return i===null||h===null?null:{type:"terminal.output",terminalId:i,data:h}}case"terminal.replay":{const i=we(s.terminalId),h=Ie(s.data);return i===null||h===null?null:{type:"terminal.replay",terminalId:i,data:h,truncated:s.truncated===!0}}case"terminal.exit":{const i=we(s.terminalId),h=Ue(s.exitCode);if(i===null||h===null)return null;const v=s.signal;return{type:"terminal.exit",terminalId:i,exitCode:h,signal:typeof v=="number"?v:null}}case"terminal.closed":{const i=we(s.terminalId);return i===null?null:{type:"terminal.closed",terminalId:i}}case"terminal.activity":{const i=we(s.terminalId),h=Ye(s.activity,dv);if(i===null||h===null)return null;const v=h==="offline"?Ye(s.offlineReason,fv):null;return v===null?{type:"terminal.activity",terminalId:i,activity:h}:{type:"terminal.activity",terminalId:i,activity:h,offlineReason:v}}case"index.status":{const i=gv(s.status);return i===null?null:{type:"index.status",status:i}}case"index.projects":{const i=sn(s.projects,mv);return i===null?null:{type:"index.projects",projects:i,replace:s.replace===!0}}case"conversation.reset":{const i=we(s.terminalId),h=Ie(s.sessionId),v=Ye(s.state,Gd),R=sn(s.events,wc),x=Yd(s.usage);return i===null||h===null||v===null||R===null||x===null?null:{type:"conversation.reset",terminalId:i,sessionId:h,state:v,events:R,hasMore:s.hasMore===!0,usage:x,permissionMode:$r(s.permissionMode)?s.permissionMode:null,defaults:P0(s.defaults),waitingFor:we(s.waitingFor),openToolCall:s.openToolCall===!0,subagents:tf(s.subagents)??[]}}case"conversation.subagents":{const i=we(s.terminalId),h=tf(s.subagents);return i===null||h===null?null:{type:"conversation.subagents",terminalId:i,subagents:h}}case"agent.submitted":{const i=we(s.terminalId),h=we(s.requestId),v=ft(s.delivered);return i===null||h===null||v===null?null:{type:"agent.submitted",terminalId:i,requestId:h,delivered:v}}case"conversation.append":{const i=we(s.terminalId),h=sn(s.events,wc),v=Yd(s.usage);return i===null||h===null||v===null?null:{type:"conversation.append",terminalId:i,events:h,usage:v,permissionMode:$r(s.permissionMode)?s.permissionMode:null}}case"conversation.mode":{const i=we(s.terminalId),h=s.mode;return i===null||!$r(h)?null:{type:"conversation.mode",terminalId:i,mode:h}}case"conversation.waiting":{const i=we(s.terminalId);return i===null?null:{type:"conversation.waiting",terminalId:i,waitingFor:we(s.waitingFor)}}case"conversation.toolCall":{const i=we(s.terminalId),h=ft(s.open);return i===null||h===null?null:{type:"conversation.toolCall",terminalId:i,open:h}}case"conversation.page":{const i=we(s.terminalId),h=sn(s.events,wc);return i===null||h===null?null:{type:"conversation.page",terminalId:i,events:h,hasMore:s.hasMore===!0}}case"conversation.turns":{const i=we(s.terminalId),h=yt(s.turns,v=>{const R=Oe(v);if(R===null)return null;const x=we(R.eventId),r=Ue(R.durationMs);return x===null||r===null?null:{eventId:x,durationMs:r}});return i===null||h===null?null:{type:"conversation.turns",terminalId:i,turns:h}}case"conversation.parts":{const i=we(s.terminalId),h=yt(s.updates,v=>{const R=Oe(v);if(R===null)return null;const x=we(R.eventId),r=yt(R.parts,Fp);return x===null||r===null?null:{eventId:x,parts:r}});return i===null||h===null?null:{type:"conversation.parts",terminalId:i,updates:h}}case"conversation.imageData":{const i=we(s.terminalId),h=we(s.eventId),v=Ue(s.index),R=Ie(s.mediaType);if(i===null||h===null||v===null||R===null)return null;const x=s.data;return{type:"conversation.imageData",terminalId:i,eventId:h,index:v,source:Ye(s.source,Bp)??"content",mediaType:R,data:typeof x=="string"?x:null}}case"conversation.state":{const i=we(s.terminalId),h=Ye(s.state,Gd);return i===null||h===null?null:{type:"conversation.state",terminalId:i,state:h}}case"git.status":{const i=we(s.terminalId),h=Bv(s.status);return i===null||h===null?null:{type:"git.status",terminalId:i,status:h}}case"git.diff":{const i=we(s.terminalId),h=Hv(s.diff);return i===null||h===null?null:{type:"git.diff",terminalId:i,diff:h}}case"files.listing":{const i=we(s.terminalId),h=zv(s.listing);return i===null||h===null?null:{type:"files.listing",terminalId:i,listing:h}}case"picker.listing":{const i=qv(s.listing);return i===null?null:{type:"picker.listing",listing:i}}case"files.preview":{const i=we(s.terminalId),h=Vv(s.preview);return i===null||h===null?null:{type:"files.preview",terminalId:i,preview:h}}case"conversation.plans":{const i=we(s.terminalId),h=yt(s.plans,kv);return i===null||h===null?null:{type:"conversation.plans",terminalId:i,plans:h}}case"plans.content":{const i=we(s.terminalId),h=Ev(s.plan);return i===null||h===null?null:{type:"plans.content",terminalId:i,plan:h}}case"files.results":{const i=we(s.terminalId),h=Wv(s.result);return i===null||h===null?null:{type:"files.results",terminalId:i,result:h}}case"notes.list":{const i=yt(s.notes,u0);return i===null?null:{type:"notes.list",notes:i}}case"notes.imageData":{const i=we(s.imageId),h=Ie(s.mediaType);if(i===null||h===null)return null;const v=s.data;return{type:"notes.imageData",imageId:i,mediaType:h,data:typeof v=="string"?v:null}}case"memory.status":{const i=we(s.terminalId),h=o0(s.status);return i===null||h===null?null:{type:"memory.status",terminalId:i,status:h}}case"memory.planned":{const i=we(s.terminalId),h=yt(s.changes,Xd);return i===null||h===null?null:_a({type:"memory.planned",terminalId:i,changes:h},s)}case"memory.installed":{const i=we(s.terminalId),h=yt(s.applied,Xd);return i===null||h===null?null:_a({type:"memory.installed",terminalId:i,applied:h},s)}case"memory.imported":{const i=we(s.terminalId),h=Sa(s.copied),v=Sa(s.skipped);return i===null||h===null||v===null?null:_a({type:"memory.imported",terminalId:i,copied:h,skipped:v},s)}case"memory.content":{const i=we(s.terminalId),h=a0(s.note);return i===null||h===null?null:_a({type:"memory.content",terminalId:i,note:h},s)}case"vault.status":{const i=y0(s.status);return i===null?null:{type:"vault.status",status:i}}case"vault.exported":{const i=we(s.projectKey),h=Ue(s.sessions);return i===null||h===null?null:{type:"vault.exported",projectKey:i,sessions:h}}case"session.continued":{const i=we(s.requestId),h=we(s.terminalId),v=Oe(s.source),R=Ye(v==null?void 0:v.agent,Ia),x=we(v==null?void 0:v.sessionId),r=Ie(v==null?void 0:v.title),c=ef(s.includedTurns),g=ef(s.totalTurns),_=Ye(s.delivery,D0);return i===null||h===null||R===null||x===null||r===null||c===null||g===null||c>g||_===null?null:{type:"session.continued",requestId:i,terminalId:h,source:{agent:R,sessionId:x,title:r},includedTurns:c,totalTurns:g,totalTurnsIsMinimum:s.totalTurnsIsMinimum===!0,delivery:_}}case"composer.prefill":{const i=we(s.terminalId),h=we(s.text),v=Ye(s.reason,I0);return i===null||h===null||v===null?null:{type:"composer.prefill",terminalId:i,text:h,reason:v}}case"composer.drafts":{const i=sn(s.drafts,O0);return i===null?null:{type:"composer.drafts",drafts:i}}case"search.progress":{const i=we(s.searchId),h=p0(s.progress);return i===null||h===null?null:{type:"search.progress",searchId:i,progress:h}}case"remote.status":{const i=k0(s.status);return i===null?null:{type:"remote.status",status:i}}case"settings.status":{const i=A0(s.settings);return i===null?null:{type:"settings.status",settings:i}}case"remote.pairing.code":{const i=E0(s.pairing);return i===null?null:{type:"remote.pairing.code",pairing:i}}case"remote.phone.pairing":{const i=T0(s.pairing);return i===null?null:{type:"remote.phone.pairing",pairing:i}}case"search.results":{const i=we(s.searchId),h=f0(s.result);return i===null||h===null?null:{type:"search.results",searchId:i,result:h}}case"error":{const i=$n(s.text);if(i===null)return null;const v={type:"error",code:Ye(s.code,j0)??"internal",text:i},R=Ie(s.detail);R!==null&&(v.detail=R);const x=we(s.requestId);return x!==null&&(v.requestId=x),v}default:return null}}function nf(n){return JSON.stringify(n)}const F0=/^[A-Za-z]:\\$/;function Vr(n,s){return n.length===0?"":s==="win32"?H0(n):$0(n)}function H0(n){let s=n.replace(/\//g,"\\");for(s.startsWith("\\\\?\\UNC\\")?s=`\\\\${s.slice(8)}`:s.startsWith("\\\\?\\")&&(s=s.slice(4)),s=s.startsWith("\\\\")?`\\\\${s.slice(2).replace(/\\+/g,"\\")}`:s.replace(/\\+/g,"\\");s.endsWith("\\")&&!F0.test(s);)s=s.slice(0,-1);return s.toLowerCase()}function Qp(n,s,i){return n.length===0||i==="win32"&&n!==s&&n.toLowerCase()===s.toLowerCase()?s:n}function $0(n){let s=n.replace(/\/+/g,"/");for(;s.length>1&&s.endsWith("/");)s=s.slice(0,-1);return s}function U0(n,s,i,h){const v=Vr(i.cwd,h);let R=-1;for(const[x,r]of n.entries()){const c=s(r);c===void 0||c.kind!=="agent"||Vr(c.cwd,h)===v&&(R=x)}return R===-1?n.length:R+1}function Jp(n){return`[Pasted text #${n}]`}function W0(n){return`[Start of pasted text #${n}]`}function z0(n){return`[End of pasted text #${n}]`}function V0(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function q0(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function K0(){return/\[Pasted text #(\d{1,6})\]/g}const Zp="https://buymeacoffee.com/cvelasquez",G0="modulepreload",Y0=function(n){return"/"+n},sf={},Bn=function(s,i,h){let v=Promise.resolve();if(i&&i.length>0){let x=function(g){return Promise.all(g.map(_=>Promise.resolve(_).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),c=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));v=x(i.map(g=>{if(g=Y0(g),g in sf)return;sf[g]=!0;const _=g.endsWith(".css"),u=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${u}`))return;const y=document.createElement("link");if(y.rel=_?"stylesheet":G0,_||(y.as="script"),y.crossOrigin="",y.href=g,c&&y.setAttribute("nonce",c),document.head.appendChild(y),_)return new Promise((S,L)=>{y.addEventListener("load",S),y.addEventListener("error",()=>L(new Error(`Unable to preload CSS for ${g}`)))})}))}function R(x){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=x,window.dispatchEvent(r),!r.defaultPrevented)throw x}return v.then(x=>{for(const r of x||[])r.status==="rejected"&&R(r.reason);return s().catch(R)})},X0={"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 backup to {{path}}. The current folder stays untouched","app.picker.vault.title":"Backup folder","app.sidebar.name":"Projects","app.sidebar.show":"Show the project list","app.status.connecting":"Connecting","app.status.failed":"No connection","app.status.open":"Connected","app.status.reconnecting":"Reconnecting","app.status.revoked":"Access revoked","archive.allBlocked_one":"Its only conversation has an open tab. Close it first.","archive.allBlocked_other":"Its {{count}} conversations have an open tab. Close them first.","archive.blockedStays_one":"Another one has an open tab and stays.","archive.blockedStays_other":"{{count}} others have an open tab and stay.","archive.confirm_one":"Archive {{count}} conversation?","archive.confirm_other":"Archive the {{count}} conversations?","archive.withBlocked":"{{confirm}} {{blocked}}","common.cancel":"Cancel","common.close":"Close","common.closeEsc":"Close (Esc)","common.copied":"Copied","common.copyCode":"Copy code","common.dismissNotice":"Dismiss the notice","common.gotIt":"Got it","composer.attach":"Attach a file","composer.attachTitle":"Attach a file: a log, a PDF, a document or an image","composer.chip.editHint":"Show and edit the pasted text","composer.chip.editorLabel":"Edit pasted text #{{number}}","composer.chip.pastedTextEmpty":"#{{number}} · Pasted text · empty, won't be sent","composer.chip.pastedText_one":"#{{number}} · Pasted text · {{count}} line","composer.chip.pastedText_other":"#{{number}} · Pasted text · {{count}} lines","composer.chip.remove":"Remove","composer.pastedImage":"pasted image","composer.placeholder.ended":"This tab's session has ended.","composer.placeholder.ready":"Type your message.","composer.placeholder.sleeping":"This tab doesn't have the CLI open yet.","composer.problem.draftTooLong":"This message is too long to keep as a draft: if you close Agent Workbench before sending it, it will be lost.","composer.problem.empty":'"{{name}}" is empty.',"composer.problem.imageTooBig":"The image is {{size}} MB; the maximum is {{max}} MB.","composer.problem.imageUnreadable":"Couldn't read the image from the clipboard.","composer.problem.tooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"composer.problem.tooManyFiles_one":"Up to {{count}} file per message.","composer.problem.tooManyFiles_other":"Up to {{count}} files per message.","composer.problem.tooManyImages_one":"Up to {{count}} image per message.","composer.problem.tooManyImages_other":"Up to {{count}} images per message.","composer.problem.unreadable":`Couldn't read "{{name}}".`,"composer.resizeTitle":"Drag to resize the message box","composer.send":"Send","composer.sendTitle":"Send (Enter)","composer.stop":"Stop","composer.stopTitle":"Interrupt whatever the CLI is doing (Esc)","console.collapse":"Collapse. The processes keep running: to end them, use each terminal's ×","console.name":"Console","console.noShell":"No system console was found to open.","console.openAnother":"Open another {{shell}} in {{cwd}}","console.openAnyIn":"Open a console in {{cwd}}","console.openIn":"Open {{shell}} in {{cwd}}","console.tab.close":"Close this terminal and end its process","console.tab.exited":"Exited with code {{code}}","console.tab.label":"Terminal {{number}}","console.tab.title":"{{shell}} {{number}} in {{cwd}}","continue.menuLabel":"Continue with","controls.effort.high":"High","controls.effort.inUse":"Effort in use: {{effort}}. Changing it sends /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.","docs.backToList":"Show the list","docs.failed":"Couldn't read the document. Use ⟳ to try again.","docs.mode.formatted":"Formatted","docs.mode.label":"How to show this Markdown","docs.mode.source":"Source","docs.reload":"Read the document again","docs.reloadFailed":"Couldn't read it again: this is the last version that arrived.","docs.search.placeholder":"Search this document","docs.tab.close":"Close this document","files.allHidden":"everything in it is hidden","files.empty":"empty","files.hidden.hide":"Hide again what .gitignore and the built-in list exclude","files.hidden.show":"Also show what .gitignore and the built-in list exclude","files.hiddenCount_one":"{{count}} hidden","files.hiddenCount_other":"{{count}} hidden","files.hiddenTitle":"Hidden: .git, node_modules, dist, bin, obj and whatever .gitignore says","files.insertFolderPath":"Put this folder's path in your message","files.insertPath":"Put the path of {{name}} in your message","files.loading":"loading…","files.menu.copyAbsolute":"Copy absolute path","files.menu.copyRelative":"Copy relative path","files.menu.insertMention":"Insert as @path","files.menu.openWithSystem":"Open with the default app","files.moreEntries":"there are more entries than shown","files.pathInserted":"Added to your message","files.preview.binary":"Binary file: no preview.","files.preview.insertPath":"Put the path in your message","files.preview.truncated":"The file was cut off because of its size. Open it with the default app to see all of it.","files.readDirFailed":"Couldn't read the directory.","files.readingDir":"Reading the directory…","files.readingFile":"Reading the file…","files.refresh":"Reload the tree","files.reveal":"Open {{name}} in the system's file explorer","files.revealFolder":"Open this folder in the system's file explorer","files.row.alwaysHidden":"always hidden: .git, node_modules, dist, bin, obj","files.row.ignored":"hidden by .gitignore","files.search.clear":"Clear (Esc)","files.search.more":"there are more results than shown","files.search.moreTitle":"Narrow the search to see them all","files.search.none":"No file with that name.","files.search.placeholder":"Search files by name…","files.search.prompt":"Type to search.","files.search.searching":"Searching…","format.bytes.b":"{{value}} B","format.bytes.gb":"{{value}} GB","format.bytes.kb":"{{value}} KB","format.bytes.mb":"{{value}} MB","format.duration.minutes":"{{value}} min","format.duration.minutesSeconds":"{{minutes}} min {{seconds}} s","format.duration.ms":"{{value}} ms","format.duration.seconds":"{{value}} s","format.duration.underSecond":"less than 1 s","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.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 backup, ignoring case and accents","search.mode.titles":"In titles","search.off":"The backup is off: the search covers what it saved while it was on.","search.placeholder.conversations":"Search the conversations (Enter)","search.placeholder.titles":"Filter projects and sessions","search.role.assistant":"Response","search.role.title":"Title","search.role.user":"Request","search.sessions_one":"{{count}} session","search.sessions_other":"{{count}} sessions","search.status.done":"{{found}}.","search.status.none":"No results","search.status.noneIn":"No results in {{sessions}}.","search.status.progressFound_one":"Searching… {{scanned}} of {{count}} session, {{found}} so far.","search.status.progressFound_other":"Searching… {{scanned}} of {{count}} sessions, {{found}} so far.","search.status.progress_one":"Searching… {{scanned}} of {{count}} session.","search.status.progress_other":"Searching… {{scanned}} of {{count}} sessions.","search.status.searching":"Searching…","search.status.truncatedResults":"{{found}}: these are the first ones, refine the search to see the rest.","search.status.truncatedTime":"{{found}}: the search stopped after {{seconds}} s and {{left}} were left unchecked.","search.tooShort":"Type at least {{min}} characters and press Enter.","searchHook.connectionLost":"The connection to the server was lost: search again.","server.agentUnknown":"This server doesn't know how to launch that CLI.","server.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 backup couldn't be searched.","server.settingsFailed":"Couldn't save the settings.","server.settingsHostOnly":"These settings can only be changed on the computer running Agent Workbench.","server.settingsShellMissing":"That console isn't installed anymore.","server.shellNotFound":"No system console was found to open.","server.submitInterrupted":"The message wasn't fully sent: the interruption cut it off.","server.submitStoppedTool":"The message wasn't fully sent: {{label}} opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedToolNoLabel":"The message wasn't fully sent: the CLI opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedWaiting":"The message wasn't fully sent: {{label}} started waiting for an answer while it was being typed. Answer it before sending another message.","server.submitStoppedWaitingNoLabel":"The message wasn't fully sent: the CLI started waiting for an answer while it was being typed. Answer it before sending another message.","server.tabClosedWhileOpening":"The tab closed while it was opening.","server.tabDirGone":"The tab's directory no longer exists.","server.tabOpenFailed":"The tab couldn't be opened.","server.terminalAsleep":"This tab doesn't have its CLI open. Open it to write to the agent.","server.terminalGone":"The terminal no longer exists.","server.terminalOpenFailed":"The terminal couldn't be opened.","server.tooManyTabs":"You can't open more than {{max}} tabs at once.","server.vaultBusyMeasuring":"The backup is busy measuring. Try again when it's done.","server.vaultBusyMoving":"The backup is busy moving to another folder. Try again when it's done.","server.vaultBusyWriting":"The backup is busy copying. Try again when it's done.","server.vaultCannotWrite":"That folder can't be written to.","server.vaultCurrentInsideTarget":"The current backup can't end up inside the new folder.","server.vaultDiskFull":"Disk full: the pass stopped ({{detail}})","server.vaultFailed":"The backup operation couldn't be completed.","server.vaultIndexNotReady":"The history is still being read. Measure when it's done.","server.vaultMeasureFirst":"First measure how much it would take.","server.vaultMemoryFailed":"memory of {{cwd}}: {{detail}}","server.vaultMoveFailed":"The backup couldn't be moved: {{detail}}","server.vaultMoving":"The backup is moving to another folder. Try again when it's done.","server.vaultNoCopyYet":"There's no backup yet.","server.vaultNotLoaded":"The backup isn't loaded.","server.vaultProjectGone":"That project is no longer in the sidebar.","server.vaultReasonNewerFormat":"the existing copy is in a newer format","server.vaultReasonOriginMissing":"the source wasn't found","server.vaultReasonUnsafeId":"a session id that can't be copied","server.vaultSessionFailed":"{{agent}}/{{session}}: {{detail}}","server.vaultSessionMissing":"That session isn't in the backup.","server.vaultTargetCliFolder":"That folder belongs to a CLI: the backup isn't kept there.","server.vaultTargetInsideCurrent":"The new folder can't be inside the current backup.","server.vaultTargetNotAbsolute":"The backup folder has to be an absolute path.","server.waitingSubmit":"{{label}} is waiting for an answer: answer it before sending another message.","session.untitled":"Untitled session","settings.cli.disabled":"Off","settings.cli.hint":"An unchecked CLI doesn't show in the menu or the sidebar, and its history isn't read.","settings.cli.install":"How to install it","settings.cli.notInstalled":"Not installed","settings.cli.restart":"Changes to the CLIs apply when you restart the app.","settings.console.auto":"Automatic","settings.console.autoWith":"Automatic ({{shell}})","settings.console.hint":"For consoles you open from now on; the open ones keep theirs.","settings.hiddenHint":"Hidden: {{name}}. You can show it again from ⚙ Settings.","settings.hide.console":"Hide the console (it comes back from ⚙ Settings)","settings.hide.notes":"Hide the notes (they come back from ⚙ Settings)","settings.hostOnly":"The console and the CLIs can only be changed on the computer running Agent Workbench.","settings.language":"Language","settings.more.open":"{{name}}…","settings.oldServer":"The server is from an older version: restart it to choose the console and the CLIs.","settings.open":"Settings","settings.panels.cliAlways":"The CLI tab is always shown: the agent's permissions and questions appear there.","settings.panels.consoleConfirmYes":"Hide and close","settings.panels.consoleConfirm_one":"Hiding the console closes {{count}} open terminal.","settings.panels.consoleConfirm_other":"Hiding the console closes {{count}} open terminals.","settings.section.appearance":"Appearance","settings.section.clis":"CLIs","settings.section.console":"Console","settings.section.more":"More","settings.section.panels":"Panels","settings.terminalTheme":"Terminal theme","settings.terminalTheme.dark":"Always dark","settings.terminalTheme.follow":"Follow the app's theme","settings.terminalTheme.hint":"CLIs pick their colors for a dark terminal: on a light one, some text is hard to read.","settings.title":"Settings","shortcuts.altNumber":"<strong>Alt + number</strong> isn't used either, on purpose: on Windows, Alt with the numeric keypad is how you type characters that aren't on the keyboard (<kbd>Alt + 164</kbd> = ñ). Intercepting it breaks typing accented characters. To switch tabs there are <kbd>Alt + ←</kbd> and <kbd>Alt + →</kbd>.","shortcuts.app.closeTab":"Close the active tab","shortcuts.app.newTab":"New tab in the current tab's directory","shortcuts.app.previousTab":"Go back to the previous tab (outside the terminal: inside, it goes to the CLI)","shortcuts.app.switchTab":"Previous / next tab (also Alt + PgUp / PgDn)","shortcuts.app.togglePanel":"Show or hide the right panel","shortcuts.ariaLabel":"Keyboard shortcuts","shortcuts.browserReserved":"<strong>Ctrl+T</strong>, <strong>Ctrl+W</strong> and <strong>Ctrl+Tab</strong> can't be used: the browser keeps them for its own tabs and the event never reaches the page.","shortcuts.cliHint":"The CLI handles these. The app doesn't intercept them: they reach it as they are. In the terminal, a new line is still <kbd>Ctrl + J</kbd> and images are pasted with <kbd>Alt + V</kbd>; the message box is the one with the keys above.","shortcuts.section.app":"Application","shortcuts.section.cli":"CLI, inside the terminal","shortcuts.section.composer":"In the message box","shortcuts.title":"Shortcuts","sidebar.action.archive":"Archive","sidebar.action.restore":"Restore","sidebar.action.undo":"Undo","sidebar.archived.hide_one":"Hide {{count}} archived","sidebar.archived.hide_other":"Hide {{count}} archived","sidebar.archived.show_one":"Show {{count}} archived","sidebar.archived.show_other":"Show {{count}} archived","sidebar.archived.toggleTitle":"Archived sessions stay on disk; this only shows or hides them","sidebar.empty.noMatch":"Nothing matches the filter.","sidebar.empty.noProjects":"No projects found in the history.","sidebar.hide":"Hide the projects","sidebar.history.button":"Archive history…","sidebar.history.buttonTitle":"Hide a CLI's sessions from before today in one go. Nothing is deleted","sidebar.history.confirm_one":"{{count}} {{label}} session will be hidden; nothing is deleted","sidebar.history.confirm_other":"{{count}} {{label}} sessions will be hidden; nothing is deleted","sidebar.history.count_one":"{{count}} session from before today","sidebar.history.count_other":"{{count}} sessions from before today","sidebar.history.heading":"Archive everything before today","sidebar.history.region":"Archive history","sidebar.indexing":"Indexing {{scanned}} / {{total}}","sidebar.newProject":"New project: choose or create a folder","sidebar.project.archive":"Archive project","sidebar.project.archiveTitle":"Archive the project: hides its conversations from the sidebar. Nothing is deleted","sidebar.project.export":"Export to Markdown","sidebar.project.folderGone":"The folder no longer exists on disk","sidebar.project.missing":"folder not found","sidebar.project.newSession":"New session in this project","sidebar.reindex":"Reindex the history","sidebar.searchMode.label":"Where to search","sidebar.searchMode.titlesTitle":"Filters the list by project name and session title","sidebar.selection.count_one":"{{count}} selected","sidebar.selection.count_other":"{{count}} selected","sidebar.session.archive":"Archive — hides it from the list, nothing is deleted","sidebar.session.blocked":"It has an open tab. Close it first.","sidebar.session.restore":"Restore to the list","sidebar.undo.dismissTitle":"Dismiss the notice; the sessions stay archived","sidebar.undo.text_one":"Archived {{count}} session from {{what}}","sidebar.undo.text_other":"Archived {{count}} sessions from {{what}}","sidebar.vaultLine.lastError":"Last error: {{error}}","sidebar.vaultLine.title":"See the backup's status and folder","sound.notify.blocked":"The browser is blocking this page's notifications. Allow them in the site's settings and click again.","sound.notify.off":"System notifications off — click to turn them on","sound.notify.on":"System notifications on — click to turn them off. They only show when this window isn't in view.","sound.off":"Notification sound muted — click to turn it on","sound.on":"Notification sound on — click to mute","sound.volume":"Notification sound volume","statusLine.benefit":"With the status line configured, this CLI's tabs show their status, the “waiting” bar when it asks for permission to use a tool, 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 backup operation is in progress. Wait for it to finish.","vault.button.off":"Backup: off. Set it up","vault.button.on":"Backup: on. See the status and the folder","vault.dialog.activate":"Turn on","vault.dialog.activateExistingHint":"The folder already has a backup. Once on, it completes it and keeps it up to date.","vault.dialog.activateExistingTitle":"The folder already has a backup: turning it on completes it","vault.dialog.activateMeasuredHint":"Copies everything measured and, after that, every session that changes and stays quiet for a minute.","vault.dialog.activateMeasuredTitle":"Copies what was measured now and, after that, every session that changes","vault.dialog.changeDir":"Change folder…","vault.dialog.changeDirTitle":"Choose another folder. What was copied gets copied there; this one stays untouched","vault.dialog.defaultDir":"It's the default one, in the app's folder.","vault.dialog.folderSection":"Folder","vault.dialog.inFolder":"In the folder","vault.dialog.lastError":"Last error","vault.dialog.lastPass":"last pass {{when}}","vault.dialog.measure":"Measure","vault.dialog.measureAgain":"Measure again","vault.dialog.measureTitle":"Reads the whole history without writing anything, not even the folder","vault.dialog.needsMeasure":"First measure how much it would take: then “{{activate}}” shows up.","vault.dialog.openFolder":"Open folder","vault.dialog.openFolderTitle":"Open the folder in the system's file explorer","vault.dialog.pendingCalm_one":"{{count}} waiting for its quiet minute","vault.dialog.pendingCalm_other":"{{count}} waiting for their quiet minute","vault.dialog.sizeSection":"How much it would take","vault.dialog.table.archived":"Archived","vault.dialog.table.archivedTitle":"Archived sessions aren't copied","vault.dialog.table.images":"Images","vault.dialog.table.memory_one":"Memory of {{count}} project","vault.dialog.table.memory_other":"Memory of {{count}} projects","vault.dialog.table.sessions":"Sessions","vault.dialog.table.size":"Size","vault.dialog.table.total":"Total","vault.dialog.turnOff":"Turn off","vault.dialog.turnOffHint":"Turning it off doesn't delete anything: what was copied stays in the folder.","vault.dialog.waiting":"Waiting for the server's status…","vault.export.done":"Exported: the folder was opened","vault.export.exporting":"Exporting to Markdown…","vault.export.idle":"Export this project's sessions to Markdown","vault.indexNotReady":"The history is still being read. Measure when it's done.","vault.line.copying":"copying","vault.line.copyingProgress":"copying {{done}} / {{total}}","vault.line.measuring":"measuring","vault.line.moving":"moving to another folder","vault.line.neverCopied":"not copied yet","vault.line.pending_one":"{{count}} waiting","vault.line.pending_other":"{{count}} waiting","vault.mark.copy":"backup","vault.mark.copyTitle":"The CLI's history no longer has this session. The backup opens, in Markdown.","vault.mark.partial":"partial","vault.mark.partialTitle":"Only the summary and the documents were recovered: the conversation's content is encrypted.","vault.measure.summary":"Measured {{when}}, in {{duration}}","vault.measure.summaryNoWhen":"Measured in {{duration}}","vault.name":"Backup","vault.note.empty_one":"{{count}} empty","vault.note.empty_other":"{{count}} empty","vault.note.failedWithReasons_one":"{{count}} failed ({{reasons}})","vault.note.failedWithReasons_other":"{{count}} failed ({{reasons}})","vault.note.failed_one":"{{count}} failed","vault.note.failed_other":"{{count}} failed","vault.note.notCopied":"Not copied: {{parts}}","vault.note.unsupported_one":"{{count}} without a full read","vault.note.unsupported_other":"{{count}} without a full read","vault.previousDir":"The previous folder was left untouched: {{dir}}","vault.privacy":"It keeps the same as each CLI's history —messages, tool inputs and results, images— in a folder of yours. If you put it in a synced folder or in a repository, all that travels with it.","vault.sessions_one":"{{count}} session","vault.sessions_other":"{{count}} sessions","vault.state.measuring":"Measuring…","vault.state.measuringProgress":"Measuring… {{done}} / {{total}}","vault.state.moving":"Moving to another folder…","vault.state.off":"Off","vault.state.on":"On","vault.state.writing":"Copying…","vault.state.writingProgress":"Copying… {{done}} / {{total}}","workspace.connectFailed":"Couldn't connect to the local server. Open the URL it printed at startup again."},gu=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],em="en",xc={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},Q0={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},_u={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"},J0={es:()=>Bn(()=>import("./es-C_iXI_cL.js"),[]),de:()=>Bn(()=>import("./de-DlErJERu.js"),[]),fr:()=>Bn(()=>import("./fr-DQrvpEX-.js"),[]),"pt-BR":()=>Bn(()=>import("./pt-BR-B9DfN4SI.js"),[]),ru:()=>Bn(()=>import("./ru-DLtRgmP7.js"),[]),ja:()=>Bn(()=>import("./ja-D5vZsdVh.js"),[]),ko:()=>Bn(()=>import("./ko-BpH6AFJf.js"),[]),"zh-CN":()=>Bn(()=>import("./zh-CN-qo3wh4w3.js"),[])},tm=X0,Gc=new Map([["en",tm]]),rf=new Map,Yc=new Set;let Wi=em,Xc=_u[em],of=0;function nm(n){return gu.includes(n)}function Qc(){return Wi}function ja(){return Xc}function Z0(n){return _u[n]}function sm(n){return Yc.add(n),()=>Yc.delete(n)}async function rm(n,s=_u[n]){const i=++of;if(!Gc.has(n)&&n!=="en"){const h=await J0[n]();Gc.set(n,h.default)}if(i===of&&!(Wi===n&&Xc===s)){Wi=n,Xc=s;for(const h of Yc)h()}}function ey(n,s){let i=rf.get(n);return i===void 0&&(i=new Intl.PluralRules(n),rf.set(n,i)),i.select(s)}function af(n,s,i,h){if(h!==void 0){const v=n[`${i}_${ey(s,h)}`]??n[`${i}_other`];if(v!==void 0)return v}return n[i]}function ty(n,s,i,h){const v=h==null?void 0:h.count,R=typeof v=="number"?v:void 0;return(n===void 0?void 0:af(n,s,i,R))??af(tm,"en",i,R)??i}function Ca(n,s){return s===void 0?n:n.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(i,h)=>{const v=s[h];return v===void 0?i:String(v)})}function im(n,s){return ty(Gc.get(Wi),Wi,n,s)}function C(n,s){return Ca(im(n,s),s)}function ny(){return[{keys:"Esc",description:C("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:C("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:C("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:C("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:C("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:C("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:C("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:C("agent.shortcuts.codex.searchHistory")},{keys:"@",description:C("agent.shortcuts.codex.mention")},{keys:"/",description:C("agent.shortcuts.commands")},{keys:"Ctrl + G",description:C("agent.shortcuts.codex.externalEditor")}]}function sy(){return[{keys:"Esc Esc",description:C("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:C("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:C("agent.shortcuts.opencode.commandList")},{keys:C("agent.shortcuts.leaderThen",{key:"M"}),description:C("agent.shortcuts.opencode.model")},{keys:C("agent.shortcuts.leaderThen",{key:"N"}),description:C("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:C("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:C("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:C("agent.shortcuts.opencode.paste")}]}function ry(){return[{keys:"Esc",description:C("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:C("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:C("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:C("agent.shortcuts.commands")},{keys:"?",description:C("agent.shortcuts.antigravity.help")}]}function iy(){return[{keys:"Esc",description:C("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:C("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:C("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:C("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:C("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:C("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:C("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:C("agent.shortcuts.claudeCode.pasteText")}]}const Ur={"claude-code":{shortLabel:"CC",get shortcuts(){return iy()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1},codex:{shortLabel:"CX",get shortcuts(){return ny()},get shortcutsNote(){return C("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},opencode:{shortLabel:"OC",get shortcuts(){return sy()},get shortcutsNote(){return C("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},antigravity:{shortLabel:"AG",get shortcuts(){return ry()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0}},oy={"gemini-cli":"GC","antigravity-ide":"AI"};function ay(n){return Kr(n)?Ur[n].shortLabel:oy[n]}function Gi(n,s){var i;return Kr(n)?((i=s.find(h=>h.id===n))==null?void 0:i.label)??n:Q_[n]}const om="Sesion sin titulo";function Fn(n,s){return s==="none"||n===om?C("session.untitled"):n}function ly(n,s){const i=new Map;for(const v of s)v.titleSource==="none"||v.title===om||i.set(`${v.agent}\0${v.sessionId}`,v.title);const h=new Map;for(const v of n){if(v.agent===null||v.sessionId.length===0)continue;const R=i.get(`${v.agent}\0${v.sessionId}`);R!==void 0&&h.set(v.terminalId,R)}return h}function Jc(n){return n.storage==="native"&&Kr(n.agent)}function cy(n){return n!==null&&Ur[n].savesModelChoice}function uy(n){return n===null?null:Ur[n].instructionsFile}function hy(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 dy(n,s){const i=Tv(s,n);return i===null?null:n.find(h=>h.value===i.value)??null}function fy(n,s){return n??s.launchMode}const py={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},my={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function am(n){return C(py[n])}function gy(n){return C(my[n])}function _y(n,s){return C("agent.mode.title",{mode:am(n),hint:gy(n),key:s.keyLabel})}function lm(n,s){return n.approvesPendingOnCycle&&s!==null}function vy(n,s,i,h){if(lm(s,h))return C("agent.mode.blocked");const v=_y(n,s);return!s.approvesPendingOnCycle||i?v:C("agent.mode.titleBlind",{title:v})}const yy={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 wy(n){return C(yy[n])}function by(){return C("agent.statusLine.noFragment")}function Sy(n,s,i=new Set){return n.filter(h=>(s||h.id!=="plans")&&(h.id==="cli"||!i.has(h.id)))}function Cy(n,s,i=new Set){return n==="plans"&&!s||n!=="cli"&&i.has(n)?"cli":n}function xy(n,s,i){const h=v=>v===null?void 0:s.find(R=>R.id===v);return h(n)??h(i)??s[0]??null}function ky(n){return[{keys:"Enter",description:C("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:C("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:C(n?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:C("agent.shortcuts.interruptCli")}]}function Ey(){return C("agent.composer.imagesRefused")}function Ly(n,s,i){return i??(n==="token-count"||n==="status-line"?s.contextWindow:null)}function Ty(n,s){return n==="status-line"?s.lastRequestTokens>0:s.assistantMessages>0}function Ry(n,s){return n===null&&s!==null&&s.state!=="active"}function My(n){return C(n==="other-command"?"agent.meter.setup.otherCommand":n==="disabled"?"agent.meter.setup.disabled":n==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function Ay(n,s){return s.contextWindowEstimated?C("agent.meter.origin.estimated"):n==="usage-with-catalog"&&s.contextWindow!==null?C("agent.meter.origin.catalog"):null}function Ny(n,s=null){return s==="status-line"?C("agent.meter.idle.statusLine"):n===null?C("agent.meter.idle.noFile"):C("agent.meter.idle.withFile",{file:n})}function Dy(n,s=null){return n==="idle"?C("agent.dot.idle"):n==="unknown"?s===null?C("agent.dot.noStatus"):s.state==="active"?C("agent.dot.statusLinePending"):C("agent.dot.statusLineOnly"):C("agent.dot.open")}function lf(n,s){return n.length===0?!0:n.some(i=>i.id===s&&i.available&&i.capabilities.resume)}function Iy(n,s,i){return n?i?C("agent.note.empty"):C("agent.note.send",{cwd:s??""}):C(s===null?"agent.note.needsTab":"agent.note.noReadySignal")}function cm(n,s,i){const h=Vr(s,i);let v=null;for(const R of n)R.kind!=="agent"||R.agent===null||Vr(R.cwd,i)===h&&(v=R.agent);return v}function um(n,s){var h;const i=s.filter(v=>v.available);for(const v of n)if(v!==null&&i.some(R=>R.id===v))return v;return((h=i[0])==null?void 0:h.id)??null}function jy(n){let s=null;for(const i of n){const h=i.agent;Kr(h)&&(s===null||i.updatedAt>s.updatedAt)&&(s={agent:h,updatedAt:i.updatedAt})}return(s==null?void 0:s.agent)??null}function Py(n,s,i,h,v){return um([cm(n,s,i),v],h)}function Oy(n,s,i,h,v){return um([cm(n,s.cwd,i),jy(s.sessions),v],h)}function hm(n){return n.filter(s=>s.available)}function By(n,s){const i=n.findIndex(h=>h.id===s);return i===-1?0:i}function Fy(n,s,i){return i<=0?0:((n+s)%i+i)%i}function Hy(n,s,i,h=4){const v=n.bottom+2,R=n.top-2-s.height,x=v+s.height+h<=i.height||R<h?Math.max(h,Math.min(v,i.height-s.height-h)):R;return{left:Math.max(h,Math.min(n.left,i.width-s.width-h)),top:x}}function $y(n,s,i){const h=n;return h===null||typeof h!="object"||typeof h.contains!="function"?!0:i!==null&&i.contains(n)?!1:h.contains(s)}function dm(n,s,i=!1){return s===null||i||!pu(n)?[]:hm(n).filter(h=>h.id!==s)}function Uy(){return C("agent.continue.title")}function Wy(n,s,i){return s?C("agent.continue.discovering"):n.length===0?C("agent.continue.noConversation"):i?null:C("agent.continue.noMessages")}function zy(n,s,i,h){const v=s>=i&&!h?i===1?C("agent.handoff.turns.single"):C("agent.handoff.turns.all",{count:i}):s===1?h?C("agent.handoff.turns.lastOneOfMore",{total:i}):C("agent.handoff.turns.lastOne",{total:i}):h?C("agent.handoff.turns.lastManyOfMore",{count:i,included:s}):C("agent.handoff.turns.lastMany",{count:i,included:s});return C("agent.handoff.notice",{label:n,turns:v})}const cf=40;function uf(n){const s=n.replace(/\s+/g," ").trim(),i=[...s],h=i.length>cf?`${i.slice(0,cf).join("").trimEnd()}…`:s;return h.length>0?C("agent.handoff.tabLabel",{title:h}):C("agent.handoff.tabLabelNoTitle")}function Vy(){return C("agent.handoff.sending")}function qy(n){switch(n){case"no-delivery":return C("agent.handoff.prefill.noDelivery");case"not-ready":return C("agent.handoff.prefill.notReady");case"send-failed":return C("agent.handoff.prefill.sendFailed")}}function hf(n,s){return n.trim().length===0?s:`${s}
42
+
43
+ ${n}`}function Ky(n,s){return n&&s!==null}function Gy(n,s,i){if(!Kr(n))return{badge:!0,unavailableTitle:null};const h=s.find(x=>x.id===n),v=s.some(x=>x.available),R=h!==void 0&&!h.available&&v;return{badge:i||R,unavailableTitle:R?C("agent.session.cliMissing",{label:h.label}):null}}function Yy(n,s,i){return n!==null&&s===""&&!i.sessionIdAtLaunch}function Xy(){return C("agent.thread.noTranscript")}function Qy(){return C("agent.thread.discovering")}function Jy(n,s,i,h,v=null){return!h||!jp(n,v)||!s?null:i===null?C("agent.openTool.noLabel"):C("agent.openTool.withLabel",{label:i})}function fm(n,s=!1){return C(n==="permission prompt"?"agent.waiting.permission":n==="question"&&s?"agent.waiting.question":"agent.waiting.answer")}function Zy(n){return n.relaunching?"relaunching":n.offlineReason==="server-closed"&&n.alive?"offer":null}function ew(n){return n===null?C("agent.serverClosed.noLabel"):C("agent.serverClosed.withLabel",{label:n})}function tw(){return C("agent.serverClosed.relaunch")}function nw(){return C("agent.serverClosed.relaunching")}function sw(n,s){const i=new Map,h=[];for(const[v,R]of n){const x=s.find(r=>r.terminalId===v);x===void 0||x.alive&&R==="exited"?h.push(v):i.set(v,x.alive?R:"exited")}return{phases:i,finished:h}}function rw(n,s,i){var h;return!i||s===null||((h=n.permissionCycle)==null?void 0:h.approvesPendingOnCycle)!==!0&&!n.waitingBlocksSubmit?null:fm(s,n.questionCards)}const iw=2e4;function ow(n){if(n.label.length>0)return n.label;const s=n.cwd.split(/[\\/]/).filter(i=>i.length>0);return s[s.length-1]??n.cwd}function aw(n,s,i){const h=n.map(R=>({terminalId:R.terminalId,kind:R.kind,cwd:R.cwd})),v=[];for(const R of s){const x=U0(h.map(r=>r.terminalId),r=>h.find(c=>c.terminalId===r),{cwd:R.cwd},i);v.push({pending:R,index:x,label:ow(R)}),h.splice(x,0,{terminalId:`pending:${R.requestId}`,kind:"agent",cwd:R.cwd})}return v}function df(n,s,i){const h=Vr(s,i);return n.some(v=>Vr(v.cwd,i)===h)}function pm(){return C("agent.openBlocked")}const lw={low:"controls.effort.low",medium:"controls.effort.medium",high:"controls.effort.high",xhigh:"controls.effort.xhigh",max:"controls.effort.max"};function cw(n){const s=lw[n.value];return s===void 0?n.label:C(s)}function uw(n){return n.value==="default"?C("controls.model.default"):Lv(n)}function hw({models:n,efforts:s,model:i,effort:h,modelProvisional:v=!1,effortProvisional:R=!1,savesChoice:x=!1,disabled:r,onCommand:c}){const g=n===null?null:dy(n,i),_=g===null&&i!==null;return l.jsxs(l.Fragment,{children:[n!==null&&l.jsxs("select",{className:"agent-select",value:(g==null?void 0:g.value)??"",disabled:r,onChange:u=>{u.target.value.length>0&&c(Mv(u.target.value))},title:i===null?C("controls.model.noData"):v?C("controls.model.provisional",{model:i}):x?C("controls.model.inUseSaved",{model:i}):C("controls.model.inUse",{model:i}),children:[g===null&&l.jsx("option",{value:"",children:_?i??"":C("controls.model.placeholder")}),n.map(u=>l.jsx("option",{value:u.value,children:uw(u)},u.value))]}),s!==null&&l.jsxs("select",{className:"agent-select",value:h??"",disabled:r,onChange:u=>{u.target.value.length>0&&c(Av(u.target.value))},title:h===null?C("controls.effort.noData"):R?C("controls.effort.provisional",{effort:h}):x?C("controls.effort.inUseSaved",{effort:h}):C("controls.effort.inUse",{effort:h}),children:[h===null&&l.jsx("option",{value:"",children:C("controls.effort.placeholder")}),s.map(u=>l.jsx("option",{value:u.value,children:cw(u)},u.value))]})]})}function dw({mode:n,cycle:s,disabled:i,waitingFor:h=null,statusKnown:v=!0,onChange:R}){const x=fy(n,s);return l.jsx("select",{className:"agent-select agent-select-mode",value:x,disabled:i||lm(s,h),onChange:r=>{$r(r.target.value)&&R(r.target.value)},title:vy(x,s,v,h),children:s.modes.map(r=>l.jsx("option",{value:r,children:am(r)},r))})}function La(n){const s=n.replace(/(\r?\n)+$/,"");return s.length===0?0:s.split(`
44
+ `).length}function fw(n,s){return s===0?C("composer.chip.pastedTextEmpty",{number:n}):C("composer.chip.pastedText",{number:n,count:s})}function pw(n){return n.length===0?1:Math.max(...n)+1}function mw(n){const s=new Set;for(const i of n.matchAll(K0()))s.add(Number(i[1]));return[...s].sort((i,h)=>i-h)}const gw=/[^\s([{"'¿¡«]/u,_w=/[\p{L}\p{N}]/u;function vw(n,s,i,h){const{start:v,end:R,before:x,after:r}=mm(n,s,i),c=`${x!==""&&gw.test(x)?" ":""}${Jp(h)}${r!==""&&_w.test(r)?" ":""}`;return gm(n,v,R,c)}const yw=/[^\s([{¿¡«]/u,ww=/[\p{L}\p{N}"'«]/u;function ff(n,s,i,h){const{start:v,end:R,before:x,after:r}=mm(n,s,i),c=x!==""&&yw.test(x),g=r===""||ww.test(r),_=`${c?" ":""}${h}${g?" ":""}`;return gm(n,v,R,_)}function mm(n,s,i){const h=Math.max(0,Math.min(s,n.length)),v=Math.max(h,Math.min(i,n.length));return{start:h,end:v,before:h>0?n.charAt(h-1):"",after:v<n.length?n.charAt(v):""}}function gm(n,s,i,h){return{text:`${n.slice(0,s)}${h}${n.slice(i)}`,inserted:h,caret:s+h.length}}function _m(n,s){const i=new RegExp(`( ?)${Cw(Jp(s))}( ?)`,"g");return n.replace(i,(h,v,R)=>v!==""&&R!==""?" ":"")}function bw(n,s){let i=s;const h=[];for(const v of n){const R=v.text.replace(/\r\n?/g,`
45
+ `).replace(/\n+$/,"");if(R.trim().length===0){i=_m(i,v.number);continue}h.push(`${W0(v.number)}
46
+ ${R}
47
+ ${z0(v.number)}`)}return i.trim().length>0&&h.push(i),h.join(`
48
+
49
+ `)}function Sw(n,s=!1){const i=n.replace(/\r\n?/g,`
50
+ `),h=[],v=c=>{const g=c.replace(/^\n+|\n+$/g,"");g.trim().length>0&&h.push({kind:"text",text:g})};let R=0;for(const c of i.matchAll(V0())){const g=c[1]??"",_=(c.index??0)+g.length;v(i.slice(R,_)),h.push({kind:"pasted",number:Number(c[2]),text:c[3]??"",complete:!0}),R=(c.index??0)+c[0].length}const x=i.slice(R),r=s?q0().exec(x):null;if(r!==null){const c=r.index+(r[1]??"").length;v(x.slice(0,c)),h.push({kind:"pasted",number:Number(r[2]),text:x.slice(r.index+r[0].length),complete:!1})}else v(x);return h.some(c=>c.kind==="pasted")?h:[{kind:"text",text:n}]}function Cw(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const xw=800;function vm(n){return{text:n.text,pasted:n.items.flatMap(s=>s.kind==="text"?[{number:s.number,text:s.text}]:[])}}function kw(n,s){return{text:n.text,items:n.pasted.map(i=>({id:s(),kind:"text",number:i.number,text:i.text,lines:La(i.text)}))}}function Ew(n,s){if(s===void 0)return{start:n,end:n,direction:"forward",scrollTop:"end"};const i=R=>Math.min(Math.max(0,R),n),h=i(s.selectionStart),v=Math.max(h,i(s.selectionEnd));return{start:h,end:v,direction:s.backward?"backward":"forward",scrollTop:Math.max(0,s.scrollTop)}}function Lw(n){return Wp(vm(n))>Up}function pf(n,s){return n===void 0||qc(n)?qc(s):zp(n,s)}function Tw(n){return n===void 0||n.text.trim().length===0&&n.items.length===0}const Rw={text:"",pasted:[]};class Mw{constructor(s){Lt(this,"local",new Map);Lt(this,"views",new Map);Lt(this,"saved",new Map);Lt(this,"touched",new Set);Lt(this,"pending",new Map);Lt(this,"listeners",new Set);Lt(this,"serverKeeps",!1);this.deps=s}get(s){return this.local.get(s)}put(s,i){this.local.set(s,i),this.schedule(s,vm(i))}rememberView(s,i){this.views.set(s,i)}viewOf(s){return this.views.get(s)}submitted(s){this.cancel(s),this.local.delete(s),this.views.delete(s),this.saved.delete(s),this.touched.add(s)}restore(s){this.serverKeeps=!0;const i=[];for(const{terminalId:h,draft:v}of s)this.touched.has(h)||(this.saved.set(h,v),Tw(this.local.get(h))&&(this.local.set(h,kw(v,this.deps.newId)),this.views.delete(h),i.push(h)));for(const h of i)for(const v of this.listeners)v(h);for(const[h,v]of[...this.pending])v.handle===null&&this.sendNow(h)}reconnected(){this.serverKeeps=!1}retain(s){const i=new Set(s);for(const h of new Set([...this.local.keys(),...this.views.keys(),...this.saved.keys(),...this.touched,...this.pending.keys()]))i.has(h)||(this.cancel(h),this.local.delete(h),this.views.delete(h),this.saved.delete(h),this.touched.delete(h))}flushAll(){for(const s of[...this.pending.keys()])this.sendNow(s)}onRestored(s){return this.listeners.add(s),()=>this.listeners.delete(s)}schedule(s,i){const h=this.pending.get(s);if(h!==void 0&&zp(h.draft,i)||(this.cancel(s),pf(this.saved.get(s),i)))return;this.touched.add(s);const v=this.deps.setTimer(()=>this.sendNow(s),this.deps.delayMs??xw);this.pending.set(s,{handle:v,draft:i})}cancel(s){const i=this.pending.get(s);i!==void 0&&(i.handle!==null&&this.deps.clearTimer(i.handle),this.pending.delete(s))}sendNow(s){const i=this.pending.get(s);if(i===void 0)return;if(i.handle!==null&&this.deps.clearTimer(i.handle),!this.serverKeeps||!this.deps.connected()){this.pending.set(s,{handle:null,draft:i.draft});return}this.pending.delete(s);const h=Wp(i.draft)>Up?Rw:i.draft;pf(this.saved.get(s),h)||(this.deps.send(s,h),qc(h)?this.saved.delete(s):this.saved.set(s,h))}}const Zc=1024,eu=Zc*1024,mf=eu*1024;function Hr(n,s=0){return new Intl.NumberFormat(ja(),{minimumFractionDigits:s,maximumFractionDigits:s,useGrouping:!1}).format(n)}function rn(n){return!Number.isFinite(n)||n<Zc?C("format.bytes.b",{value:Hr(Math.max(0,Math.round(n)||0))}):n<eu?C("format.bytes.kb",{value:Hr(Math.round(n/Zc))}):n<mf?C("format.bytes.mb",{value:Hr(n/eu,1)}):C("format.bytes.gb",{value:Hr(n/mf,2)})}function ym(n){const s=Math.floor(n/60),i=n%60;return i===0?C("format.duration.minutes",{value:s}):C("format.duration.minutesSeconds",{minutes:s,seconds:i})}function Aw(n){if(n<1e3)return C("format.duration.ms",{value:n});const s=Math.round(n/1e3);return s<60?C("format.duration.seconds",{value:s}):ym(s)}function zi(n){if(!Number.isFinite(n)||n<1e3)return C("format.duration.underSecond");const s=Math.round(n/1e3);return s<60?C("format.duration.seconds",{value:s}):ym(s)}function Hn(n,s=Date.now()){if(n<=0)return"";const i=Math.floor((s-n)/6e4);if(i<1)return C("time.justNow");if(i<60)return C("time.minutesAgo",{count:i});const h=Math.floor(i/60);if(h<24)return C("time.hoursAgo",{count:h});const v=Math.floor(h/24);return v<30?C("time.daysAgo",{count:v}):Nw(n)}function Nw(n){return new Date(n).toLocaleDateString(ja())}function wm(n){return new Date(n).toLocaleTimeString(ja(),{hour:"2-digit",minute:"2-digit"})}function vu(n){return new Intl.ListFormat(ja(),{type:"conjunction"}).format(n)}var bm=Ip();function Sm({src:n,caption:s,onClose:i}){return I.useEffect(()=>{const h=v=>{v.key==="Escape"&&(v.preventDefault(),v.stopPropagation(),i())};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[i]),bm.createPortal(l.jsxs("div",{className:"viewer",onClick:i,role:"presentation",children:[l.jsx("div",{className:"viewer-frame",onClick:h=>h.stopPropagation(),children:l.jsx("img",{className:"viewer-image",src:n,alt:s})}),l.jsxs("div",{className:"viewer-bar",children:[l.jsx("span",{className:"viewer-caption",children:s}),l.jsx("button",{className:"viewer-close",onClick:i,title:C("common.closeEsc"),children:"×"})]})]}),document.body)}const Dw=768,Iw=`(max-width: ${Dw}px)`,jw="(hover: none)",gf="agent-workbench.narrow-view",Cm="tab",xm=["chat","cli","git","files","plans","memory","notes","console"];function Pw(n){return typeof n=="string"&&xm.includes(n)}function Ow(n){return Pw(n)?n:null}function Bw(n){const s=n.hidden??new Set,i=h=>h==="chat"||h==="cli"||!s.has(h);return n.hasTab?xm.filter(h=>(h!=="plans"||n.plansAvailable)&&i(h)):["chat","notes"].filter(i)}function Fw(n,s){return s.includes(n)?n:"chat"}function _f(n){switch(n){case"cli":case"git":case"files":case"plans":case"memory":return n;default:return null}}const Hw={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 $w(n){return Hw[n]}const Uw=/^[A-Za-z0-9_-]{1,80}$/;function Ww(n){const s=new URLSearchParams(n).get(Cm);return s!==null&&Uw.test(s)?s:null}function zw(n,s){const i=new URLSearchParams(n);for(const v of s)i.delete(v);const h=i.toString();return h.length>0?`?${h}`:""}const Vw=[{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 qw(n,s){return n.shiftKey||n.altKey?!1:!s||n.ctrlKey||n.metaKey}const Kw="AgentWorkbenchAndroid/",Gw="agentworkbench://settings",Yw="agentworkbench://disconnect",vf="agentWorkbenchBack";function km(n){return n.includes(Kw)}function Xw(n){return n.dialogOpen?"close-dialog":n.sheetOpen?"close-sheet":n.drawerOpen?"close-drawer":n.view!=="chat"?"show-chat":null}const Qw=6e4,Jw=10*6e4,Zw=15e3,e1=4e3,t1=3,Em={runStartedAt:null,busySeenAt:null};function n1(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function s1(n,s){var h;let i=0;if(n!==null){const v=s.findIndex(R=>R.eventId===n);if(v===-1)return!0;i=v+1}for(let v=i;v<s.length;v+=1)if(((h=s[v])==null?void 0:h.role)==="assistant")return!0;return!1}function r1(n,s,i,h){const v=s==="busy"||n==="busy"?h:i.busySeenAt;let R=null;return s==="busy"?n==="idle"?R=h:(n==="busy"||n==="waiting")&&(R=i.runStartedAt):s==="waiting"&&(R=i.runStartedAt),{runStartedAt:R,busySeenAt:v}}function i1(n,s,i,h){const v=new Map;for(const[R,x]of s){const r=n.get(R),c=i.get(R);v.set(R,c!==void 0&&r===x?c:r1(r,x,c??Em,h))}return v}function o1(n,s){const i=new Map;for(const[h,v]of n)v.phase!=="sending"?i.set(h,v):v.queued&&i.set(h,{...v,queued:!1,sentAt:s});return i}function a1(n,s,i){const h=n.get(s.terminalId);if(h===void 0||h.requestId!==s.requestId)return n;const v=new Map(n);return s.delivered?v.set(s.terminalId,{...h,phase:"delivered",queued:!1,deliveredAt:i}):v.delete(s.terminalId),v}function l1(n){if(!n.live||n.waitingFor!==null)return null;const{receipt:s,activity:i,now:h}=n,v=n.clock??Em;if((s==null?void 0:s.phase)==="sending"&&(s.queued||h-s.sentAt<Qw))return{kind:"sending"};const R=(s==null?void 0:s.phase)==="delivered"?s.deliveredAt:null;return i==="busy"?{kind:"working",since:v.runStartedAt,justDelivered:R!==null&&h-R<e1}:s===null||R===null||s1(s.afterEventId,n.events)?null:i==="unknown"?h-R<Jw?{kind:"awaiting-reply",since:R}:null:i!=="idle"&&i!==null||v.busySeenAt!==null&&v.busySeenAt>=s.sentAt?null:h-R<Zw?{kind:"delivered"}:null}function c1(n,s){switch(n.kind){case"sending":return C("thread.status.sending");case"delivered":return C("thread.status.delivered");case"working":{const i=n.since===null?0:s-n.since;if(i<1e3)return n.justDelivered?C("thread.status.workingDelivered"):C("thread.status.working");const h={elapsed:zi(i)};return n.justDelivered?C("thread.status.workingForDelivered",h):C("thread.status.workingFor",h)}case"awaiting-reply":{const i=s-n.since;return i<1e3?C("thread.status.delivered"):C("thread.status.awaitingReply",{elapsed:zi(i)})}}}function u1(n,s){const i=n.slice(0,t1).map(v=>C("thread.status.subagent",{name:v.description.length>0?v.description:C("thread.status.subagentUnnamed"),elapsed:zi(Math.max(0,s-v.startedAt))})),h=n.length-i.length;return h>0&&i.push(C("thread.status.subagentsMore",{count:h})),C("thread.status.subagents",{count:n.length,list:vu(i)})}const h1=5,d1=1200;function kc(){return crypto.randomUUID()}function f1(n=!0){const[s,i]=I.useState([]),[h,v]=I.useState(null),R=I.useCallback(L=>{if(s.filter(a=>a.kind==="image").length>=Sc){v(C("composer.problem.tooManyImages",{count:Sc}));return}if(L.size>Ea){const a=Math.round(L.size/1024/1024),m=Ea/1024/1024;v(L.name.length>0?C("composer.problem.tooBig",{name:L.name,size:a,max:m}):C("composer.problem.imageTooBig",{size:a,max:m}));return}const f=new FileReader;f.onload=()=>{const a=f.result;if(typeof a!="string")return;const m=a.indexOf(",");m!==-1&&i(p=>p.filter(d=>d.kind==="image").length>=Sc?p:[...p,{id:kc(),kind:"image",mediaType:L.type,base64:a.slice(m+1),dataUrl:a,bytes:L.size,name:L.name.length>0?L.name:C("composer.pastedImage")}])},f.onerror=()=>v(C("composer.problem.imageUnreadable")),f.readAsDataURL(L)},[s]),x=I.useCallback(L=>{if(s.filter(a=>a.kind==="file").length>=Cc){v(C("composer.problem.tooManyFiles",{count:Cc}));return}if(L.size===0){v(C("composer.problem.empty",{name:L.name}));return}if(L.size>Zd){v(C("composer.problem.tooBig",{name:L.name,size:Math.round(L.size/1024/1024),max:Zd/1024/1024}));return}const f=new FileReader;f.onload=()=>{const a=f.result;if(typeof a!="string")return;const m=a.indexOf(",");m!==-1&&i(p=>p.filter(d=>d.kind==="file").length>=Cc?p:[...p,{id:kc(),kind:"file",name:L.name.length>0?L.name:"archivo",base64:a.slice(m+1),bytes:L.size}])},f.onerror=()=>v(C("composer.problem.unreadable",{name:L.name})),f.readAsDataURL(L)},[s]),r=I.useCallback(L=>{const f=Array.from(L),a=f.filter(p=>p.type.startsWith("image/")),m=f.filter(p=>!p.type.startsWith("image/"));if(a.length>0&&!n)v(Ey());else for(const p of a)R(p);for(const p of m)x(p)},[R,x,n]),c=I.useCallback((L,f=[])=>{if(L.files.length>0)return r(L.files),{consumed:!0,pastedNumber:null};const a=L.getData("text/plain");if(a.length===0)return{consumed:!1,pastedNumber:null};if(a.split(`
51
+ `).length<h1&&a.length<d1)return{consumed:!1,pastedNumber:null};const m=pw([...s.flatMap(p=>p.kind==="text"?[p.number]:[]),...f]);return i(p=>[...p,{id:kc(),kind:"text",number:m,text:a,lines:La(a)}]),{consumed:!0,pastedNumber:m}},[r,s]),g=I.useCallback(L=>{i(f=>f.filter(a=>a.id!==L))},[]),_=I.useCallback((L,f)=>{i(a=>a.map(m=>m.id===L&&m.kind==="text"?{...m,text:f,lines:La(f)}:m))},[]),u=I.useCallback(L=>{i(L),v(null)},[]),y=I.useCallback(()=>u([]),[u]),S=I.useCallback(()=>v(null),[]);return{items:s,problem:h,acceptPaste:c,acceptFiles:r,remove:g,updateText:_,replace:u,clear:y,dismissProblem:S}}function xa({min:n,max:s,value:i,measure:h,onChange:v,onCommit:R,onStart:x}){const r=I.useRef(!1),c=I.useRef(i),g=I.useCallback(y=>{r.current=!0,c.current=i,x==null||x(y),y.currentTarget.setPointerCapture(y.pointerId),y.preventDefault()},[x,i]),_=I.useCallback(y=>{if(!r.current)return;const S=Math.min(s,Math.max(n,h(y)));c.current=S,v(S)},[s,n,h,v]),u=I.useCallback(y=>{r.current&&(r.current=!1,y.currentTarget.releasePointerCapture(y.pointerId),R(c.current))},[R]);return{onPointerDown:g,onPointerMove:_,onPointerUp:u,onPointerCancel:u}}function Lm(n){const[s,i]=I.useState(()=>typeof window<"u"&&window.matchMedia(n).matches);return I.useEffect(()=>{const h=window.matchMedia(n),v=()=>i(h.matches);return v(),h.addEventListener("change",v),()=>h.removeEventListener("change",v)},[n]),s}function p1(){return Lm(Iw)}function m1(){return Lm(jw)}const Tm="agent_workbench_prefs",tu="agent-workbench.",Rm=/^[a-z0-9][a-z0-9.-]{0,59}$/,Mm=200,g1=400*24*60*60,_1=3500;function v1(n){const s=new Map;for(const i of n.split(";")){const h=i.indexOf("=");if(h===-1||i.slice(0,h).trim()!==Tm)continue;let v;try{v=JSON.parse(decodeURIComponent(i.slice(h+1).trim()))}catch{return s}if(v===null||typeof v!="object"||Array.isArray(v))return s;for(const[R,x]of Object.entries(v))!Rm.test(R)||typeof x!="string"||x.length>Mm||s.set(`${tu}${R}`,x);return s}return s}function y1(n){const s={};for(const[h,v]of n){if(!h.startsWith(tu))continue;const R=h.slice(tu.length);!Rm.test(R)||v.length>Mm||(s[R]=v)}const i=encodeURIComponent(JSON.stringify(s));return i.length>_1?null:i}function w1(n){return`${Tm}=${n}; Path=/; Max-Age=${g1}; SameSite=Strict`}function Am(){try{return v1(document.cookie)}catch{return new Map}}function Nm(n,s){const i=Am();if(i.get(n)===s)return;i.set(n,s);const h=y1(i);if(h!==null)try{document.cookie=w1(h)}catch{}}function mt(n,s,i){const h=Am().get(n);if(h!==void 0){const v=i(h);if(v!==null)return v}try{const v=window.localStorage.getItem(n);if(v===null)return s;const R=i(v);return R===null?s:(h===void 0&&Nm(n,v),R)}catch{return s}}function ht(n,s){Nm(n,s);try{window.localStorage.setItem(n,s)}catch{}}function b1(n,s,i){const h=Number.parseInt(n,10);return Number.isFinite(h)&&h>=s&&h<=i?h:null}const yf=90,S1=260,wf=720,bf="agent-workbench.composer-height";function Sf(n){return{selectionStart:n.selectionStart,selectionEnd:n.selectionEnd,backward:n.selectionDirection==="backward",scrollTop:n.scrollTop}}function C1({connection:n,drafts:s,terminalId:i,alive:h,sleeping:v=!1,projectColor:R,activity:x,controls:r,leading:c,imagesAllowed:g=!0,blockedReason:_=null,prefills:u,onPrefillApplied:y,notice:S=null,onDismissNotice:L,onSubmitted:f,fontSize:a,insertRef:m}){const[p,d]=I.useState(""),[k,D]=I.useState(!1),E=f1(g),M=I.useRef(null),b=m1(),[T,N]=I.useState(()=>mt(bf,S1,fe=>b1(fe,yf,wf))),[B,F]=I.useState(!1),O=I.useCallback(()=>{const fe=M.current;if(fe===null)return;fe.style.height="auto";const Me=fe.offsetHeight-fe.clientHeight,_e=fe.scrollHeight+Me,Ee=B?T:Math.min(_e,T);fe.style.height=`${Ee}px`,fe.style.overflowY=_e>Ee?"auto":"hidden"},[T,B]);I.useEffect(O,[p,O,a]);const U=I.useRef(0),V=I.useRef(0),Y=xa({min:yf,max:wf,value:T,measure:I.useCallback(fe=>U.current-fe.clientY-V.current,[]),onChange:N,onCommit:I.useCallback(fe=>{F(!1),ht(bf,String(fe))},[]),onStart:I.useCallback(fe=>{const Me=M.current,_e=Me==null?void 0:Me.getBoundingClientRect();U.current=(_e==null?void 0:_e.bottom)??fe.clientY,V.current=((_e==null?void 0:_e.bottom)??fe.clientY)-fe.clientY-((_e==null?void 0:_e.height)??0),F(!0)},[])}),X=I.useRef(null),[G,P]=I.useState(0),$=I.useCallback(()=>P(fe=>fe+1),[]),H=I.useRef(p);H.current=p;const q=I.useRef(E.items);q.current=E.items;const{replace:ne}=E;I.useEffect(()=>{const fe=X.current;fe!==null&&s.put(fe,{text:p,items:E.items})},[p,E.items,s]),I.useEffect(()=>{var _e;const fe=X.current;if(fe===i)return;if(X.current=i,fe!==null){s.put(fe,{text:H.current,items:q.current});const Ee=M.current;Ee!==null&&s.rememberView(fe,Sf(Ee))}const Me=i===null?void 0:s.get(i);d((Me==null?void 0:Me.text)??""),ne((Me==null?void 0:Me.items)??[]),$(),i!==null&&((_e=M.current)==null||_e.focus())},[i,ne,s,$]),I.useEffect(()=>()=>{const fe=X.current;fe!==null&&s.put(fe,{text:H.current,items:q.current})},[s]),I.useLayoutEffect(()=>()=>{const fe=X.current,Me=M.current;fe!==null&&Me!==null&&s.rememberView(fe,Sf(Me))},[s]),I.useEffect(()=>{if(G===0)return;const fe=X.current,Me=M.current;if(fe===null||Me===null)return;const _e=Ew(Me.value.length,s.viewOf(fe));Me.setSelectionRange(_e.start,_e.end,_e.direction),Me.scrollTop=_e.scrollTop==="end"?Me.scrollHeight:_e.scrollTop},[G,s]),I.useEffect(()=>s.onRestored(fe=>{if(fe!==X.current)return;const Me=s.get(fe);Me!==void 0&&(d(Me.text),ne(Me.items),$())}),[s,ne,$]);const re=I.useRef(new Set);I.useEffect(()=>{if(!(u===void 0||u.length===0)){for(const fe of u)if(!re.current.has(fe.id)){if(re.current.add(fe.id),fe.terminalId===X.current)d(Me=>hf(Me,fe.text));else{const Me=s.get(fe.terminalId);s.put(fe.terminalId,{text:hf((Me==null?void 0:Me.text)??"",fe.text),items:(Me==null?void 0:Me.items)??[]})}y==null||y(fe.id)}}},[u,y,s]);const ue=I.useCallback(()=>{if(i===null||_!==null)return;const fe=E.items.filter(Ne=>Ne.kind==="text").map(Ne=>({number:Ne.number,text:Ne.text})),Me=E.items.filter(Ne=>Ne.kind==="image").map(Ne=>({mediaType:Ne.mediaType,data:Ne.base64})),_e=E.items.filter(Ne=>Ne.kind==="file").map(Ne=>({name:Ne.name,data:Ne.base64})),Ee=bw(fe,p);if(Ee.length===0&&Me.length===0&&_e.length===0)return;const Fe=n1(),Se=n.send({type:"agent.submit",terminalId:i,text:Ee,images:Me,..._e.length>0?{files:_e}:{},requestId:Fe});s.submitted(i),d(""),E.clear(),f==null||f(i,Fe,!Se)},[n,s,i,p,E,_,f]),de=I.useCallback(()=>{i!==null&&n.send({type:"agent.interrupt",terminalId:i})},[n,i]),K=I.useCallback(fe=>{if(fe.key==="Enter"&&qw(fe,b)){fe.preventDefault(),ue();return}fe.key==="Escape"&&(fe.preventDefault(),de())},[ue,de,b]),W=I.useCallback((fe,Me)=>{const{inserted:_e}=vw(fe.value,fe.selectionStart,fe.selectionEnd,Me);let Ee=!1;try{Ee=document.execCommand("insertText",!1,_e)}catch{Ee=!1}Ee||(fe.setRangeText(_e,fe.selectionStart,fe.selectionEnd,"end"),d(fe.value))},[]),J=I.useCallback((fe,Me)=>{const _e=M.current;if(_e===null||_e.disabled){d(Se=>ff(Se,Se.length,Se.length,fe).text);return}const{inserted:Ee}=ff(_e.value,_e.selectionStart,_e.selectionEnd,fe);let Fe=!1;if(Me){_e.focus();try{Fe=document.execCommand("insertText",!1,Ee)}catch{Fe=!1}}Fe||(_e.setRangeText(Ee,_e.selectionStart,_e.selectionEnd,"end"),d(_e.value))},[]);I.useEffect(()=>{if(m!==void 0)return m.current=J,()=>{m.current===J&&(m.current=null)}},[m,J]);const Z=I.useCallback(fe=>{if(fe.clipboardData===null)return;const Me=E.acceptPaste(fe.clipboardData,mw(fe.currentTarget.value));Me.consumed&&(fe.preventDefault(),Me.pastedNumber!==null&&W(fe.currentTarget,Me.pastedNumber))},[E,W]),pe=I.useCallback(fe=>{E.remove(fe.id),fe.kind==="text"&&d(Me=>_m(Me,fe.number))},[E]),me=I.useRef(null),ie=i===null||!h,Le=p.trim().length>0||E.items.some(fe=>fe.kind!=="text"||fe.text.trim().length>0),Ae=h&&x!=="idle",Xe=Le||!Ae,Ce=Lw({text:p,items:E.items});return l.jsxs("div",{className:`composer${k?" composer-dragging":""}`,style:R===void 0?void 0:{"--composer-accent":R},onDragOver:fe=>{Array.from(fe.dataTransfer.types).includes("Files")&&(fe.preventDefault(),D(!0))},onDragLeave:()=>D(!1),onDrop:fe=>{fe.preventDefault(),D(!1),E.acceptFiles(fe.dataTransfer.files)},children:[l.jsx("div",{className:"hdivider composer-divider",...Y,title:C("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})]}),L!==void 0&&l.jsx("button",{className:"icon-button",onClick:L,title:C("common.dismissNotice"),children:"×"})]}),E.problem!==null&&l.jsxs("div",{className:"composer-problem",children:[l.jsx("span",{children:E.problem}),l.jsx("button",{className:"icon-button",onClick:E.dismissProblem,title:C("common.close"),children:"×"})]}),Ce&&l.jsx("div",{className:"composer-problem",role:"status",children:l.jsx("span",{children:C("composer.problem.draftTooLong")})}),E.items.length>0&&l.jsx("div",{className:"composer-chips",children:E.items.map(fe=>l.jsx(x1,{item:fe,onRemove:()=>pe(fe),onEdit:Me=>E.updateText(fe.id,Me),onDoneEditing:()=>{var Me;return(Me=M.current)==null?void 0:Me.focus()}},fe.id))}),l.jsxs("div",{className:`composer-field${Ae&&Xe?" composer-field-two":""}`,children:[l.jsx("textarea",{ref:M,className:"composer-input",value:p,rows:1,placeholder:C(ie?v?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:ie,onChange:fe=>d(fe.target.value),onKeyDown:K,onPaste:Z,spellCheck:!1}),l.jsxs("div",{className:"composer-field-actions",children:[Ae&&l.jsx("button",{className:"composer-icon composer-stop",onClick:de,disabled:ie,title:C("composer.stopTitle"),"aria-label":C("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:ue,disabled:ie||!Le||_!==null,title:_??C("composer.sendTitle"),"aria-label":C("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:me,type:"file",multiple:!0,hidden:!0,onChange:fe=>{fe.target.files!==null&&E.acceptFiles(fe.target.files),fe.target.value=""}}),l.jsx("button",{className:"icon-button composer-attach",onClick:()=>{var fe;return(fe=me.current)==null?void 0:fe.click()},disabled:ie,title:C("composer.attachTitle"),"aria-label":C("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"}),r]})]})}function x1({item:n,onRemove:s,onEdit:i,onDoneEditing:h}){const[v,R]=I.useState(!1);if(n.kind==="image"){const x=`${n.name} · ${rn(n.bytes)}`;return l.jsxs("figure",{className:"chip chip-image",title:x,children:[l.jsx("img",{src:n.dataUrl,alt:n.name,onClick:()=>R(!0)}),l.jsx("button",{className:"chip-remove",onClick:s,title:C("composer.chip.remove"),children:"×"}),v&&l.jsx(Sm,{src:n.dataUrl,caption:x,onClose:()=>R(!1)})]})}return n.kind==="file"?l.jsxs("div",{className:"chip chip-text chip-file",title:`${n.name} · ${rn(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:rn(n.bytes)})]}),l.jsx("button",{className:"chip-remove",onClick:s,title:C("composer.chip.remove"),children:"×"})]}):l.jsxs("div",{className:`chip chip-text${v?" chip-open":""}`,children:[l.jsxs("button",{className:"chip-toggle",onClick:()=>R(x=>!x),title:C("composer.chip.editHint"),"aria-expanded":v,children:[l.jsx("span",{className:"chip-icon",children:"¶"}),fw(n.number,n.lines),l.jsx("span",{className:"chip-chevron",children:v?"▾":"▸"})]}),l.jsx("button",{className:"chip-remove",onClick:s,title:C("composer.chip.remove"),children:"×"}),v&&l.jsx("textarea",{className:"chip-editor",value:n.text,onChange:x=>i(x.target.value),onKeyDown:x=>{x.key==="Escape"&&(x.preventDefault(),R(!1),h())},"aria-label":C("composer.chip.editorLabel",{number:n.number}),spellCheck:!1,autoFocus:!0})]})}var Ec={exports:{}},Cf;function k1(){return Cf||(Cf=1,(function(n,s){(function(i,h){n.exports=h()})(self,(()=>(()=>{var i={};return(()=>{var h=i;Object.defineProperty(h,"__esModule",{value:!0}),h.FitAddon=void 0,h.FitAddon=class{activate(v){this._terminal=v}dispose(){}fit(){const v=this.proposeDimensions();if(!v||!this._terminal||isNaN(v.cols)||isNaN(v.rows))return;const R=this._terminal._core;this._terminal.rows===v.rows&&this._terminal.cols===v.cols||(R._renderService.clear(),this._terminal.resize(v.cols,v.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const v=this._terminal._core,R=v._renderService.dimensions;if(R.css.cell.width===0||R.css.cell.height===0)return;const x=this._terminal.options.scrollback===0?0:v.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),c=parseInt(r.getPropertyValue("height")),g=Math.max(0,parseInt(r.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),u=c-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),y=g-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-x;return{cols:Math.max(2,Math.floor(y/R.css.cell.width)),rows:Math.max(1,Math.floor(u/R.css.cell.height))}}}})(),i})()))})(Ec)),Ec.exports}var E1=k1(),Lc={exports:{}},xf;function L1(){return xf||(xf=1,(function(n,s){(function(i,h){n.exports=h()})(self,(()=>(()=>{var i={6:(x,r)=>{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(r,"__esModule",{value:!0}),r.LinkComputer=r.WebLinkProvider=void 0,r.WebLinkProvider=class{constructor(_,u,y,S={}){this._terminal=_,this._regex=u,this._handler=y,this._options=S}provideLinks(_,u){const y=g.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:L}=u;this._options.hover(y,S,L)}},u)))}};class g{static computeLink(u,y,S,L){const f=new RegExp(y.source,(y.flags||"")+"g"),[a,m]=g._getWindowedLineStrings(u-1,S),p=a.join("");let d;const k=[];for(;d=f.exec(p);){const D=d[0];if(!c(D))continue;const[E,M]=g._mapStrIdx(S,m,0,d.index),[b,T]=g._mapStrIdx(S,E,M,D.length);if(E===-1||M===-1||b===-1||T===-1)continue;const N={start:{x:M+1,y:E+1},end:{x:T,y:b+1}};k.push({range:N,text:D,activate:L})}return k}static _getWindowedLineStrings(u,y){let S,L=u,f=u,a=0,m="";const p=[];if(S=y.buffer.active.getLine(u)){const d=S.translateToString(!0);if(S.isWrapped&&d[0]!==" "){for(a=0;(S=y.buffer.active.getLine(--L))&&a<2048&&(m=S.translateToString(!0),a+=m.length,p.push(m),S.isWrapped&&m.indexOf(" ")===-1););p.reverse()}for(p.push(d),a=0;(S=y.buffer.active.getLine(++f))&&S.isWrapped&&a<2048&&(m=S.translateToString(!0),a+=m.length,p.push(m),m.indexOf(" ")===-1););}return[p,L]}static _mapStrIdx(u,y,S,L){const f=u.buffer.active,a=f.getNullCell();let m=S;for(;L;){const p=f.getLine(y);if(!p)return[-1,-1];for(let d=m;d<p.length;++d){p.getCell(d,a);const k=a.getChars();if(a.getWidth()&&(L-=k.length||1,d===p.length-1&&k==="")){const D=f.getLine(y+1);D&&D.isWrapped&&(D.getCell(0,a),a.getWidth()===2&&(L+=1))}if(L<0)return[y,d]}y++,m=0}return[y,m]}}r.LinkComputer=g}},h={};function v(x){var r=h[x];if(r!==void 0)return r.exports;var c=h[x]={exports:{}};return i[x](c,c.exports,v),c.exports}var R={};return(()=>{var x=R;Object.defineProperty(x,"__esModule",{value:!0}),x.WebLinksAddon=void 0;const r=v(6),c=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(_,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")}x.WebLinksAddon=class{constructor(_=g,u={}){this._handler=_,this._options=u}activate(_){this._terminal=_;const u=this._options,y=u.urlRegex||c;this._linkProvider=this._terminal.registerLinkProvider(new r.WebLinkProvider(this._terminal,y,this._handler,u))}dispose(){var _;(_=this._linkProvider)==null||_.dispose()}}})(),R})()))})(Lc)),Lc.exports}var T1=L1(),Tc={exports:{}},kf;function R1(){return kf||(kf=1,(function(n,s){(function(i,h){n.exports=h()})(self,(()=>(()=>{var i={965:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GlyphRenderer=void 0;const g=c(374),_=c(509),u=c(855),y=c(859),S=c(381),L=11,f=L*Float32Array.BYTES_PER_ELEMENT;let a,m=0,p=0,d=0;class k extends y.Disposable{constructor(E,M,b,T){super(),this._terminal=E,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,g.throwIfFalsy)(N.getParameter(N.MAX_TEXTURE_IMAGE_UNITS))),_.TextureAtlas.maxTextureSize=(0,g.throwIfFalsy)(N.getParameter(N.MAX_TEXTURE_SIZE))),this._program=(0,g.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(Y){let X="";for(let G=1;G<Y;G++)X+=` else if (v_texpage == ${G}) { outColor = texture(u_texture[${G}], 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[${Y}];
78
+
79
+ out vec4 outColor;
80
+
81
+ void main() {
82
+ if (v_texpage == 0) {
83
+ outColor = texture(u_texture[0], v_texcoord);
84
+ } ${X}
85
+ }`})(_.TextureAtlas.maxAtlasPages))),this.register((0,y.toDisposable)((()=>N.deleteProgram(this._program)))),this._projectionLocation=(0,g.throwIfFalsy)(N.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,g.throwIfFalsy)(N.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,g.throwIfFalsy)(N.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=N.createVertexArray(),N.bindVertexArray(this._vertexArrayObject);const B=new Float32Array([0,0,1,0,0,1,1,1]),F=N.createBuffer();this.register((0,y.toDisposable)((()=>N.deleteBuffer(F)))),N.bindBuffer(N.ARRAY_BUFFER,F),N.bufferData(N.ARRAY_BUFFER,B,N.STATIC_DRAW),N.enableVertexAttribArray(0),N.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const O=new Uint8Array([0,1,2,3]),U=N.createBuffer();this.register((0,y.toDisposable)((()=>N.deleteBuffer(U)))),N.bindBuffer(N.ELEMENT_ARRAY_BUFFER,U),N.bufferData(N.ELEMENT_ARRAY_BUFFER,O,N.STATIC_DRAW),this._attributesBuffer=(0,g.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,f,0),N.vertexAttribDivisor(2,1),N.enableVertexAttribArray(3),N.vertexAttribPointer(3,2,N.FLOAT,!1,f,2*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(3,1),N.enableVertexAttribArray(4),N.vertexAttribPointer(4,1,N.FLOAT,!1,f,4*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(4,1),N.enableVertexAttribArray(5),N.vertexAttribPointer(5,2,N.FLOAT,!1,f,5*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(5,1),N.enableVertexAttribArray(6),N.vertexAttribPointer(6,2,N.FLOAT,!1,f,7*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(6,1),N.enableVertexAttribArray(1),N.vertexAttribPointer(1,2,N.FLOAT,!1,f,9*Float32Array.BYTES_PER_ELEMENT),N.vertexAttribDivisor(1,1),N.useProgram(this._program);const V=new Int32Array(_.TextureAtlas.maxAtlasPages);for(let Y=0;Y<_.TextureAtlas.maxAtlasPages;Y++)V[Y]=Y;N.uniform1iv(this._textureLocation,V),N.uniformMatrix4fv(this._projectionLocation,!1,S.PROJECTION_MATRIX),this._atlasTextures=[];for(let Y=0;Y<_.TextureAtlas.maxAtlasPages;Y++){const X=new S.GLTexture((0,g.throwIfFalsy)(N.createTexture()));this.register((0,y.toDisposable)((()=>N.deleteTexture(X.texture)))),N.activeTexture(N.TEXTURE0+Y),N.bindTexture(N.TEXTURE_2D,X.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[Y]=X}N.enable(N.BLEND),N.blendFunc(N.SRC_ALPHA,N.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(E,M,b,T,N,B,F,O,U){this._updateCell(this._vertices.attributes,E,M,b,T,N,B,F,O,U)}_updateCell(E,M,b,T,N,B,F,O,U,V){m=(b*this._terminal.cols+M)*L,T!==u.NULL_CELL_CODE&&T!==void 0?this._atlas&&(a=O&&O.length>1?this._atlas.getRasterizedGlyphCombinedChar(O,N,B,F,!1):this._atlas.getRasterizedGlyph(T,N,B,F,!1),p=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),N!==V&&a.offset.x>p?(d=a.offset.x-p,E[m]=-(a.offset.x-d)+this._dimensions.device.char.left,E[m+1]=-a.offset.y+this._dimensions.device.char.top,E[m+2]=(a.size.x-d)/this._dimensions.device.canvas.width,E[m+3]=a.size.y/this._dimensions.device.canvas.height,E[m+4]=a.texturePage,E[m+5]=a.texturePositionClipSpace.x+d/this._atlas.pages[a.texturePage].canvas.width,E[m+6]=a.texturePositionClipSpace.y,E[m+7]=a.sizeClipSpace.x-d/this._atlas.pages[a.texturePage].canvas.width,E[m+8]=a.sizeClipSpace.y):(E[m]=-a.offset.x+this._dimensions.device.char.left,E[m+1]=-a.offset.y+this._dimensions.device.char.top,E[m+2]=a.size.x/this._dimensions.device.canvas.width,E[m+3]=a.size.y/this._dimensions.device.canvas.height,E[m+4]=a.texturePage,E[m+5]=a.texturePositionClipSpace.x,E[m+6]=a.texturePositionClipSpace.y,E[m+7]=a.sizeClipSpace.x,E[m+8]=a.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,g.allowRescaling)(T,U,a.size.x,this._dimensions.device.cell.width)&&(E[m+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):E.fill(0,m,m+L-1-2)}clear(){const E=this._terminal,M=E.cols*E.rows*L;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<E.rows;T++)for(let N=0;N<E.cols;N++)this._vertices.attributes[b+9]=N/E.cols,this._vertices.attributes[b+10]=T/E.rows,b+=L}handleResize(){const E=this._gl;E.useProgram(this._program),E.viewport(0,0,E.canvas.width,E.canvas.height),E.uniform2f(this._resolutionLocation,E.canvas.width,E.canvas.height),this.clear()}render(E){if(!this._atlas)return;const 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<E.lineLengths.length;N++){const B=N*this._terminal.cols*L,F=this._vertices.attributes.subarray(B,B+E.lineLengths[N]*L);b.set(F,T),T+=F.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/L)}setAtlas(E){this._atlas=E;for(const M of this._atlasTextures)M.version=-1}_bindAtlasPageTexture(E,M,b){E.activeTexture(E.TEXTURE0+b),E.bindTexture(E.TEXTURE_2D,this._atlasTextures[b].texture),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texImage2D(E.TEXTURE_2D,0,E.RGBA,E.RGBA,E.UNSIGNED_BYTE,M.pages[b].canvas),E.generateMipmap(E.TEXTURE_2D),this._atlasTextures[b].version=M.pages[b].version}setDimensions(E){this._dimensions=E}}r.GlyphRenderer=k},742:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RectangleRenderer=void 0;const g=c(374),_=c(859),u=c(310),y=c(381),S=8*Float32Array.BYTES_PER_ELEMENT;class L{constructor(){this.attributes=new Float32Array(160),this.count=0}}let f=0,a=0,m=0,p=0,d=0,k=0,D=0;class E extends _.Disposable{constructor(b,T,N,B){super(),this._terminal=b,this._gl=T,this._dimensions=N,this._themeService=B,this._vertices=new L,this._verticesCursor=new L;const F=this._gl;this._program=(0,g.throwIfFalsy)((0,y.createProgram)(F,`#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)((()=>F.deleteProgram(this._program)))),this._projectionLocation=(0,g.throwIfFalsy)(F.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=F.createVertexArray(),F.bindVertexArray(this._vertexArrayObject);const O=new Float32Array([0,0,1,0,0,1,1,1]),U=F.createBuffer();this.register((0,_.toDisposable)((()=>F.deleteBuffer(U)))),F.bindBuffer(F.ARRAY_BUFFER,U),F.bufferData(F.ARRAY_BUFFER,O,F.STATIC_DRAW),F.enableVertexAttribArray(3),F.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const V=new Uint8Array([0,1,2,3]),Y=F.createBuffer();this.register((0,_.toDisposable)((()=>F.deleteBuffer(Y)))),F.bindBuffer(F.ELEMENT_ARRAY_BUFFER,Y),F.bufferData(F.ELEMENT_ARRAY_BUFFER,V,F.STATIC_DRAW),this._attributesBuffer=(0,g.throwIfFalsy)(F.createBuffer()),this.register((0,_.toDisposable)((()=>F.deleteBuffer(this._attributesBuffer)))),F.bindBuffer(F.ARRAY_BUFFER,this._attributesBuffer),F.enableVertexAttribArray(0),F.vertexAttribPointer(0,2,F.FLOAT,!1,S,0),F.vertexAttribDivisor(0,1),F.enableVertexAttribArray(1),F.vertexAttribPointer(1,2,F.FLOAT,!1,S,2*Float32Array.BYTES_PER_ELEMENT),F.vertexAttribDivisor(1,1),F.enableVertexAttribArray(2),F.vertexAttribPointer(2,4,F.FLOAT,!1,S,4*Float32Array.BYTES_PER_ELEMENT),F.vertexAttribDivisor(2,1),this._updateCachedColors(B.colors),this.register(this._themeService.onChangeColors((X=>{this._updateCachedColors(X),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 B,F,O,U,V,Y,X,G,P,$,H,q=1;for(B=0;B<T.rows;B++){for(O=-1,U=0,V=0,Y=!1,F=0;F<T.cols;F++)X=(B*T.cols+F)*u.RENDER_MODEL_INDICIES_PER_CELL,G=b.cells[X+u.RENDER_MODEL_BG_OFFSET],P=b.cells[X+u.RENDER_MODEL_FG_OFFSET],$=!!(67108864&P),(G!==U||P!==V&&(Y||$))&&((U!==0||Y&&V!==0)&&(H=8*q++,this._updateRectangle(N,H,V,U,O,F,B)),O=F,U=G,V=P,Y=$);(U!==0||Y&&V!==0)&&(H=8*q++,this._updateRectangle(N,H,V,U,O,T.cols,B))}N.count=q}updateCursor(b){const T=this._verticesCursor,N=b.cursor;if(!N||N.style==="block")return void(T.count=0);let B,F=0;N.style!=="bar"&&N.style!=="outline"||(B=8*F++,this._addRectangleFloat(T.attributes,B,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"||(B=8*F++,this._addRectangleFloat(T.attributes,B,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"&&(B=8*F++,this._addRectangleFloat(T.attributes,B,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),B=8*F++,this._addRectangleFloat(T.attributes,B,(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=F}_updateRectangle(b,T,N,B,F,O,U){if(67108864&N)switch(50331648&N){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&N].rgba;break;case 50331648:f=(16777215&N)<<8;break;default:f=this._themeService.colors.foreground.rgba}else switch(50331648&B){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&B].rgba;break;case 50331648:f=(16777215&B)<<8;break;default:f=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=F*this._dimensions.device.cell.width,m=U*this._dimensions.device.cell.height,p=(f>>24&255)/255,d=(f>>16&255)/255,k=(f>>8&255)/255,D=1,this._addRectangle(b.attributes,T,a,m,(O-F)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,p,d,k,D)}_addRectangle(b,T,N,B,F,O,U,V,Y,X){b[T]=N/this._dimensions.device.canvas.width,b[T+1]=B/this._dimensions.device.canvas.height,b[T+2]=F/this._dimensions.device.canvas.width,b[T+3]=O/this._dimensions.device.canvas.height,b[T+4]=U,b[T+5]=V,b[T+6]=Y,b[T+7]=X}_addRectangleFloat(b,T,N,B,F,O,U){b[T]=N/this._dimensions.device.canvas.width,b[T+1]=B/this._dimensions.device.canvas.height,b[T+2]=F/this._dimensions.device.canvas.width,b[T+3]=O/this._dimensions.device.canvas.height,b[T+4]=U[0],b[T+5]=U[1],b[T+6]=U[2],b[T+7]=U[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])}}r.RectangleRenderer=E},310:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderModel=r.COMBINED_CHAR_BIT_MASK=r.RENDER_MODEL_EXT_OFFSET=r.RENDER_MODEL_FG_OFFSET=r.RENDER_MODEL_BG_OFFSET=r.RENDER_MODEL_INDICIES_PER_CELL=void 0;const g=c(296);r.RENDER_MODEL_INDICIES_PER_CELL=4,r.RENDER_MODEL_BG_OFFSET=1,r.RENDER_MODEL_FG_OFFSET=2,r.RENDER_MODEL_EXT_OFFSET=3,r.COMBINED_CHAR_BIT_MASK=2147483648,r.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,g.createSelectionRenderModel)()}resize(_,u){const y=_*u*r.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:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.JoinedCellData=r.WebglRenderer=void 0;const g=c(820),_=c(274),u=c(627),y=c(457),S=c(56),L=c(374),f=c(345),a=c(859),m=c(147),p=c(782),d=c(855),k=c(965),D=c(742),E=c(310),M=c(733);class b extends a.Disposable{constructor(F,O,U,V,Y,X,G,P,$){super(),this._terminal=F,this._characterJoinerService=O,this._charSizeService=U,this._coreBrowserService=V,this._coreService=Y,this._decorationService=X,this._optionsService=G,this._themeService=P,this._cursorBlinkStateManager=new a.MutableDisposable,this._charAtlasDisposable=this.register(new a.MutableDisposable),this._observerDisposable=this.register(new a.MutableDisposable),this._model=new E.RenderModel,this._workCell=new p.CellData,this._workCell2=new p.CellData,this._rectangleRenderer=this.register(new a.MutableDisposable),this._glyphRenderer=this.register(new a.MutableDisposable),this._onChangeTextureAtlas=this.register(new f.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new f.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new f.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new f.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new f.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,G,this._themeService)],this.dimensions=(0,L.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(G.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const H={antialias:!1,depth:!1,preserveDrawingBuffer:$};if(this._gl=this._canvas.getContext("webgl2",H),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,g.addDisposableDomListener)(this._canvas,"webglcontextlost",(q=>{console.log("webglcontextlost event received"),q.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(q)}),3e3)}))),this.register((0,g.addDisposableDomListener)(this._canvas,"webglcontextrestored",(q=>{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,((q,ne)=>this._setCanvasDevicePixelDimensions(q,ne))),this.register(this._coreBrowserService.onWindowChange((q=>{this._observerDisposable.value=(0,S.observeDevicePixelDimensions)(this._canvas,q,((ne,re)=>this._setCanvasDevicePixelDimensions(ne,re)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,a.toDisposable)((()=>{var q;for(const ne of this._renderLayers)ne.dispose();(q=this._canvas.parentElement)==null||q.removeChild(this._canvas),(0,u.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var F;return(F=this._charAtlas)==null?void 0:F.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(F,O){var U,V,Y,X;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const G of this._renderLayers)G.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`,(U=this._rectangleRenderer.value)==null||U.setDimensions(this.dimensions),(V=this._rectangleRenderer.value)==null||V.handleResize(),(Y=this._glyphRenderer.value)==null||Y.setDimensions(this.dimensions),(X=this._glyphRenderer.value)==null||X.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var F;for(const O of this._renderLayers)O.handleBlur(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.pause(),this._requestRedrawViewport()}handleFocus(){var F;for(const O of this._renderLayers)O.handleFocus(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.resume(),this._requestRedrawViewport()}handleSelectionChanged(F,O,U){for(const V of this._renderLayers)V.handleSelectionChanged(this._terminal,F,O,U);this._model.selection.update(this._core,F,O,U),this._requestRedrawViewport()}handleCursorMove(){var F;for(const O of this._renderLayers)O.handleCursorMove(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.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 k.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var O;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const F=(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!==F&&(this._onChangeTextureAtlas.fire(F.pages[0].canvas),this._charAtlasDisposable.value=(0,a.getDisposeArrayDisposable)([(0,f.forwardEvent)(F.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,f.forwardEvent)(F.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=F,this._charAtlas.warmUp(),(O=this._glyphRenderer.value)==null||O.setAtlas(this._charAtlas)}_clearModel(F){var O;this._model.clear(),F&&((O=this._glyphRenderer.value)==null||O.clear())}clearTextureAtlas(){var F;(F=this._charAtlas)==null||F.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var F;this._clearModel(!0);for(const O of this._renderLayers)O.reset(this._terminal);(F=this._cursorBlinkStateManager.value)==null||F.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(F){return-1}deregisterCharacterJoiner(F){return!1}renderRows(F,O){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 U of this._renderLayers)U.handleGridChanged(this._terminal,F,O);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(F,O),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(F,O){const U=this._core;let V,Y,X,G,P,$,H,q,ne,re,ue,de,K,W,J=this._workCell;F=N(F,U.rows-1,0),O=N(O,U.rows-1,0);const Z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,pe=Z-U.buffer.ydisp,me=Math.min(this._terminal.buffer.active.cursorX,U.cols-1);let ie=-1;const Le=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let Ae=!1;for(Y=F;Y<=O;Y++)for(X=Y+U.buffer.ydisp,G=U.buffer.lines.get(X),this._model.lineLengths[Y]=0,P=this._characterJoinerService.getJoinedCharacters(X),K=0;K<U.cols;K++)if(V=this._cellColorResolver.result.bg,G.loadCell(K,J),K===0&&(V=this._cellColorResolver.result.bg),$=!1,H=K,P.length>0&&K===P[0][0]&&($=!0,q=P.shift(),J=new T(J,G.translateToString(!0,q[0],q[1]),q[1]-q[0]),H=q[1]-1),ne=J.getChars(),re=J.getCode(),de=(Y*U.cols+K)*E.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(J,K,X,this.dimensions.device.cell.width),Le&&X===Z&&(K===me&&(this._model.cursor={x:me,y:pe,width:J.getWidth(),style:this._coreBrowserService.isFocused?U.options.cursorStyle||"block":U.options.cursorInactiveStyle,cursorWidth:U.options.cursorWidth,dpr:this._devicePixelRatio},ie=me+J.getWidth()-1),K>=me&&K<=ie&&(this._coreBrowserService.isFocused&&(U.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&U.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),re!==d.NULL_CELL_CODE&&(this._model.lineLengths[Y]=K+1),(this._model.cells[de]!==re||this._model.cells[de+E.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[de+E.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[de+E.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(Ae=!0,ne.length>1&&(re|=E.COMBINED_CHAR_BIT_MASK),this._model.cells[de]=re,this._model.cells[de+E.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[de+E.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[de+E.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,ue=J.getWidth(),this._glyphRenderer.value.updateCell(K,Y,re,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,ne,ue,V),$))for(J=this._workCell,K++;K<H;K++)W=(Y*U.cols+K)*E.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(K,Y,d.NULL_CELL_CODE,0,0,0,d.NULL_CELL_CHAR,0,0),this._model.cells[W]=d.NULL_CELL_CODE,this._model.cells[W+E.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[W+E.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[W+E.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;Ae&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(F,O){this._canvas.width===F&&this._canvas.height===O||(this._canvas.width=F,this._canvas.height=O,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const F=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:F,end:F})}}r.WebglRenderer=b;class T extends m.AttributeData{constructor(F,O,U){super(),this.content=0,this.combinedData="",this.fg=F.fg,this.bg=F.bg,this.combinedData=O,this._width=U}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(F){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function N(B,F,O=0){return Math.max(Math.min(B,F),O)}r.JoinedCellData=T},381:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GLTexture=r.expandFloat32Array=r.createShader=r.createProgram=r.PROJECTION_MATRIX=void 0;const g=c(374);function _(u,y,S){const L=(0,g.throwIfFalsy)(u.createShader(y));if(u.shaderSource(L,S),u.compileShader(L),u.getShaderParameter(L,u.COMPILE_STATUS))return L;console.error(u.getShaderInfoLog(L)),u.deleteShader(L)}r.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),r.createProgram=function(u,y,S){const L=(0,g.throwIfFalsy)(u.createProgram());if(u.attachShader(L,(0,g.throwIfFalsy)(_(u,u.VERTEX_SHADER,y))),u.attachShader(L,(0,g.throwIfFalsy)(_(u,u.FRAGMENT_SHADER,S))),u.linkProgram(L),u.getProgramParameter(L,u.LINK_STATUS))return L;console.error(u.getProgramInfoLog(L)),u.deleteProgram(L)},r.createShader=_,r.expandFloat32Array=function(u,y){const S=Math.min(2*u.length,y),L=new Float32Array(S);for(let f=0;f<u.length;f++)L[f]=u[f];return L},r.GLTexture=class{constructor(u){this.texture=u,this.version=-1}}},592:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BaseRenderLayer=void 0;const g=c(627),_=c(237),u=c(374),y=c(859);class S extends y.Disposable{constructor(f,a,m,p,d,k,D,E){super(),this._container=a,this._alpha=d,this._coreBrowserService=k,this._optionsService=D,this._themeService=E,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${m}-layer`),this._canvas.style.zIndex=p.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((M=>{this._refreshCharAtlas(f,M),this.reset(f)}))),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(f){}handleFocus(f){}handleCursorMove(f){}handleGridChanged(f,a,m){}handleSelectionChanged(f,a,m,p=!1){}_setTransparency(f,a){if(a===this._alpha)return;const m=this._canvas;this._alpha=a,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,m),this._refreshCharAtlas(f,this._themeService.colors),this.handleGridChanged(f,0,f.rows-1)}_refreshCharAtlas(f,a){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,g.acquireTextureAtlas)(f,this._optionsService.rawOptions,a,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(f,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(f,this._themeService.colors)}_fillBottomLineAtCells(f,a,m=1){this._ctx.fillRect(f*this._deviceCellWidth,(a+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,m*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(f,a,m,p){this._alpha?this._ctx.clearRect(f*this._deviceCellWidth,a*this._deviceCellHeight,m*this._deviceCellWidth,p*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(f*this._deviceCellWidth,a*this._deviceCellHeight,m*this._deviceCellWidth,p*this._deviceCellHeight))}_fillCharTrueColor(f,a,m,p){this._ctx.font=this._getFont(f,!1,!1),this._ctx.textBaseline=_.TEXT_BASELINE,this._clipCell(m,p,a.getWidth()),this._ctx.fillText(a.getChars(),m*this._deviceCellWidth+this._deviceCharLeft,p*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(f,a,m){this._ctx.beginPath(),this._ctx.rect(f*this._deviceCellWidth,a*this._deviceCellHeight,m*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(f,a,m){return`${m?"italic":""} ${a?f.options.fontWeightBold:f.options.fontWeight} ${f.options.fontSize*this._coreBrowserService.dpr}px ${f.options.fontFamily}`}}r.BaseRenderLayer=S},733:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkRenderLayer=void 0;const g=c(197),_=c(237),u=c(592);class y extends u.BaseRenderLayer{constructor(L,f,a,m,p,d,k){super(a,L,"link",f,!0,p,d,k),this.register(m.onShowLinkUnderline((D=>this._handleShowLinkUnderline(D)))),this.register(m.onHideLinkUnderline((D=>this._handleHideLinkUnderline(D))))}resize(L,f){super.resize(L,f),this._state=void 0}reset(L){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const L=this._state.y2-this._state.y1-1;L>0&&this._clearCells(0,this._state.y1+1,this._state.cols,L),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(L){if(L.fg===_.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:L.fg!==void 0&&(0,g.is256Color)(L.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[L.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,L.y1===L.y2)this._fillBottomLineAtCells(L.x1,L.y1,L.x2-L.x1);else{this._fillBottomLineAtCells(L.x1,L.y1,L.cols-L.x1);for(let f=L.y1+1;f<L.y2;f++)this._fillBottomLineAtCells(0,f,L.cols);this._fillBottomLineAtCells(0,L.y2,L.x2)}this._state=L}_handleHideLinkUnderline(L){this._clearCurrentLink()}}r.LinkRenderLayer=y},820:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(c,g,_,u){c.addEventListener(g,_,u);let y=!1;return{dispose:()=>{y||(y=!0,c.removeEventListener(g,_,u))}}}},274:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellColorResolver=void 0;const g=c(855),_=c(160),u=c(374);let y,S=0,L=0,f=!1,a=!1,m=!1,p=0;r.CellColorResolver=class{constructor(d,k,D,E,M,b){this._terminal=d,this._optionService=k,this._selectionRenderModel=D,this._decorationService=E,this._coreBrowserService=M,this._themeService=b,this.result={fg:0,bg:0,ext:0}}resolve(d,k,D,E){if(this.result.bg=d.bg,this.result.fg=d.fg,this.result.ext=268435456&d.bg?d.extended.ext:0,L=0,S=0,a=!1,f=!1,m=!1,y=this._themeService.colors,p=0,d.getCode()!==g.NULL_CELL_CODE&&d.extended.underlineStyle===4){const M=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));p=k*E%(2*Math.round(M))}if(this._decorationService.forEachDecorationAtCell(k,D,"bottom",(M=>{M.backgroundColorRGB&&(L=M.backgroundColorRGB.rgba>>8&16777215,a=!0),M.foregroundColorRGB&&(S=M.foregroundColorRGB.rgba>>8&16777215,f=!0)})),m=this._selectionRenderModel.isCellSelected(this._terminal,k,D),m){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:L=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:L=(16777215&this.result.fg)<<8|255;break;default:L=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:L=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:L=(16777215&this.result.bg)<<8|255}L=_.rgba.blend(L,4294967040&(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else L=(this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(a=!0,y.selectionForeground&&(S=y.selectionForeground.rgba>>8&16777215,f=!0),(0,u.treatGlyphAsBackgroundColor)(d.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}f=!0}}this._decorationService.forEachDecorationAtCell(k,D,"top",(M=>{M.backgroundColorRGB&&(L=M.backgroundColorRGB.rgba>>8&16777215,a=!0),M.foregroundColorRGB&&(S=M.foregroundColorRGB.rgba>>8&16777215,f=!0)})),a&&(L=m?-16777216&d.bg&-134217729|L|50331648:-16777216&d.bg|L|50331648),f&&(S=-16777216&d.fg&-67108865|S|50331648),67108864&this.result.fg&&(a&&!f&&(S=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&y.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,f=!0),!a&&f&&(L=(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?L:this.result.bg,this.result.fg=f?S:this.result.fg,this.result.ext&=536870911,this.result.ext|=p<<29&3758096384}}},627:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.removeTerminalFromCache=r.acquireTextureAtlas=void 0;const g=c(509),_=c(197),u=[];r.acquireTextureAtlas=function(y,S,L,f,a,m,p,d){const k=(0,_.generateConfig)(f,a,m,p,S,L,d);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,k))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,k))return b.ownedBy.push(y),b.atlas}const D=y._core,E={atlas:new g.TextureAtlas(document,k,D.unicodeService),config:k,ownedBy:[y]};return u.push(E),E.atlas},r.removeTerminalFromCache=function(y){for(let S=0;S<u.length;S++){const L=u[S].ownedBy.indexOf(y);if(L!==-1){u[S].ownedBy.length===1?(u[S].atlas.dispose(),u.splice(S,1)):u[S].ownedBy.splice(L,1);break}}}},197:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.is256Color=r.configEquals=r.generateConfig=void 0;const g=c(160);r.generateConfig=function(_,u,y,S,L,f,a){const m={foreground:f.foreground,background:f.background,cursor:g.NULL_COLOR,cursorAccent:g.NULL_COLOR,selectionForeground:g.NULL_COLOR,selectionBackgroundTransparent:g.NULL_COLOR,selectionBackgroundOpaque:g.NULL_COLOR,selectionInactiveBackgroundTransparent:g.NULL_COLOR,selectionInactiveBackgroundOpaque:g.NULL_COLOR,ansi:f.ansi.slice(),contrastCache:f.contrastCache,halfContrastCache:f.halfContrastCache};return{customGlyphs:L.customGlyphs,devicePixelRatio:a,letterSpacing:L.letterSpacing,lineHeight:L.lineHeight,deviceCellWidth:_,deviceCellHeight:u,deviceCharWidth:y,deviceCharHeight:S,fontFamily:L.fontFamily,fontSize:L.fontSize,fontWeight:L.fontWeight,fontWeightBold:L.fontWeightBold,allowTransparency:L.allowTransparency,drawBoldTextInBrightColors:L.drawBoldTextInBrightColors,minimumContrastRatio:L.minimumContrastRatio,colors:m}},r.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},r.is256Color=function(_){return(50331648&_)==16777216||(50331648&_)==33554432}},237:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const g=c(399);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=g.isFirefox||g.isLegacyEdge?"bottom":"ideographic"},457:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CursorBlinkStateManager=void 0,r.CursorBlinkStateManager=class{constructor(c,g){this._renderCallback=c,this._coreBrowserService=g,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))))}_restartInterval(c=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const g=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,g>0)return void this._restartInterval(g)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){const g=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(g)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),c)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryDrawCustomChar=r.powerlineDefinitions=r.boxDrawingDefinitions=r.blockElementDefinitions=void 0;const g=c(374);r.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]]};r.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:(f,a)=>`M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a}`},"║":{1:(f,a)=>`M${.5-f},0 L${.5-f},1 M${.5+f},0 L${.5+f},1`},"╒":{1:(f,a)=>`M.5,1 L.5,${.5-a} L1,${.5-a} M.5,${.5+a} L1,${.5+a}`},"╓":{1:(f,a)=>`M${.5-f},1 L${.5-f},.5 L1,.5 M${.5+f},.5 L${.5+f},1`},"╔":{1:(f,a)=>`M1,${.5-a} L${.5-f},${.5-a} L${.5-f},1 M1,${.5+a} L${.5+f},${.5+a} L${.5+f},1`},"╕":{1:(f,a)=>`M0,${.5-a} L.5,${.5-a} L.5,1 M0,${.5+a} L.5,${.5+a}`},"╖":{1:(f,a)=>`M${.5+f},1 L${.5+f},.5 L0,.5 M${.5-f},.5 L${.5-f},1`},"╗":{1:(f,a)=>`M0,${.5+a} L${.5-f},${.5+a} L${.5-f},1 M0,${.5-a} L${.5+f},${.5-a} L${.5+f},1`},"╘":{1:(f,a)=>`M.5,0 L.5,${.5+a} L1,${.5+a} M.5,${.5-a} L1,${.5-a}`},"╙":{1:(f,a)=>`M1,.5 L${.5-f},.5 L${.5-f},0 M${.5+f},.5 L${.5+f},0`},"╚":{1:(f,a)=>`M1,${.5-a} L${.5+f},${.5-a} L${.5+f},0 M1,${.5+a} L${.5-f},${.5+a} L${.5-f},0`},"╛":{1:(f,a)=>`M0,${.5+a} L.5,${.5+a} L.5,0 M0,${.5-a} L.5,${.5-a}`},"╜":{1:(f,a)=>`M0,.5 L${.5+f},.5 L${.5+f},0 M${.5-f},.5 L${.5-f},0`},"╝":{1:(f,a)=>`M0,${.5-a} L${.5-f},${.5-a} L${.5-f},0 M0,${.5+a} L${.5+f},${.5+a} L${.5+f},0`},"╞":{1:(f,a)=>`M.5,0 L.5,1 M.5,${.5-a} L1,${.5-a} M.5,${.5+a} L1,${.5+a}`},"╟":{1:(f,a)=>`M${.5-f},0 L${.5-f},1 M${.5+f},0 L${.5+f},1 M${.5+f},.5 L1,.5`},"╠":{1:(f,a)=>`M${.5-f},0 L${.5-f},1 M1,${.5+a} L${.5+f},${.5+a} L${.5+f},1 M1,${.5-a} L${.5+f},${.5-a} L${.5+f},0`},"╡":{1:(f,a)=>`M.5,0 L.5,1 M0,${.5-a} L.5,${.5-a} M0,${.5+a} L.5,${.5+a}`},"╢":{1:(f,a)=>`M0,.5 L${.5-f},.5 M${.5-f},0 L${.5-f},1 M${.5+f},0 L${.5+f},1`},"╣":{1:(f,a)=>`M${.5+f},0 L${.5+f},1 M0,${.5+a} L${.5-f},${.5+a} L${.5-f},1 M0,${.5-a} L${.5-f},${.5-a} L${.5-f},0`},"╤":{1:(f,a)=>`M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a} M.5,${.5+a} L.5,1`},"╥":{1:(f,a)=>`M0,.5 L1,.5 M${.5-f},.5 L${.5-f},1 M${.5+f},.5 L${.5+f},1`},"╦":{1:(f,a)=>`M0,${.5-a} L1,${.5-a} M0,${.5+a} L${.5-f},${.5+a} L${.5-f},1 M1,${.5+a} L${.5+f},${.5+a} L${.5+f},1`},"╧":{1:(f,a)=>`M.5,0 L.5,${.5-a} M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a}`},"╨":{1:(f,a)=>`M0,.5 L1,.5 M${.5-f},.5 L${.5-f},0 M${.5+f},.5 L${.5+f},0`},"╩":{1:(f,a)=>`M0,${.5+a} L1,${.5+a} M0,${.5-a} L${.5-f},${.5-a} L${.5-f},0 M1,${.5-a} L${.5+f},${.5-a} L${.5+f},0`},"╪":{1:(f,a)=>`M.5,0 L.5,1 M0,${.5-a} L1,${.5-a} M0,${.5+a} L1,${.5+a}`},"╫":{1:(f,a)=>`M0,.5 L1,.5 M${.5-f},0 L${.5-f},1 M${.5+f},0 L${.5+f},1`},"╬":{1:(f,a)=>`M0,${.5+a} L${.5-f},${.5+a} L${.5-f},1 M1,${.5+a} L${.5+f},${.5+a} L${.5+f},1 M0,${.5-a} L${.5-f},${.5-a} L${.5-f},0 M1,${.5-a} L${.5+f},${.5-a} L${.5+f},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:(f,a)=>`M.5,1 L.5,${.5+a/.15*.5} C.5,${.5+a/.15*.5},.5,.5,1,.5`},"╮":{1:(f,a)=>`M.5,1 L.5,${.5+a/.15*.5} C.5,${.5+a/.15*.5},.5,.5,0,.5`},"╯":{1:(f,a)=>`M.5,0 L.5,${.5-a/.15*.5} C.5,${.5-a/.15*.5},.5,.5,0,.5`},"╰":{1:(f,a)=>`M.5,0 L.5,${.5-a/.15*.5} C.5,${.5-a/.15*.5},.5,.5,1,.5`}},r.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}},r.powerlineDefinitions[""]=r.powerlineDefinitions[""],r.powerlineDefinitions[""]=r.powerlineDefinitions[""],r.tryDrawCustomChar=function(f,a,m,p,d,k,D,E){const M=r.blockElementDefinitions[a];if(M)return(function(B,F,O,U,V,Y){for(let X=0;X<F.length;X++){const G=F[X],P=V/8,$=Y/8;B.fillRect(O+G.x*P,U+G.y*$,G.w*P,G.h*$)}})(f,M,m,p,d,k),!0;const b=_[a];if(b)return(function(B,F,O,U,V,Y){let X=u.get(F);X||(X=new Map,u.set(F,X));const G=B.fillStyle;if(typeof G!="string")throw new Error(`Unexpected fillStyle type "${G}"`);let P=X.get(G);if(!P){const $=F[0].length,H=F.length,q=B.canvas.ownerDocument.createElement("canvas");q.width=$,q.height=H;const ne=(0,g.throwIfFalsy)(q.getContext("2d")),re=new ImageData($,H);let ue,de,K,W;if(G.startsWith("#"))ue=parseInt(G.slice(1,3),16),de=parseInt(G.slice(3,5),16),K=parseInt(G.slice(5,7),16),W=G.length>7&&parseInt(G.slice(7,9),16)||1;else{if(!G.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${G}" when drawing pattern glyph`);[ue,de,K,W]=G.substring(5,G.length-1).split(",").map((J=>parseFloat(J)))}for(let J=0;J<H;J++)for(let Z=0;Z<$;Z++)re.data[4*(J*$+Z)]=ue,re.data[4*(J*$+Z)+1]=de,re.data[4*(J*$+Z)+2]=K,re.data[4*(J*$+Z)+3]=F[J][Z]*(255*W);ne.putImageData(re,0,0),P=(0,g.throwIfFalsy)(B.createPattern(q,null)),X.set(G,P)}B.fillStyle=P,B.fillRect(O,U,V,Y)})(f,b,m,p,d,k),!0;const T=r.boxDrawingDefinitions[a];if(T)return(function(B,F,O,U,V,Y,X){B.strokeStyle=B.fillStyle;for(const[G,P]of Object.entries(F)){let $;B.beginPath(),B.lineWidth=X*Number.parseInt(G),$=typeof P=="function"?P(.15,.15/Y*V):P;for(const H of $.split(" ")){const q=H[0],ne=S[q];if(!ne){console.error(`Could not find drawing instructions for "${q}"`);continue}const re=H.substring(1).split(",");re[0]&&re[1]&&ne(B,L(re,V,Y,O,U,!0,X))}B.stroke(),B.closePath()}})(f,T,m,p,d,k,E),!0;const N=r.powerlineDefinitions[a];return!!N&&((function(B,F,O,U,V,Y,X,G){const P=new Path2D;P.rect(O,U,V,Y),B.clip(P),B.beginPath();const $=X/12;B.lineWidth=G*$;for(const H of F.d.split(" ")){const q=H[0],ne=S[q];if(!ne){console.error(`Could not find drawing instructions for "${q}"`);continue}const re=H.substring(1).split(",");re[0]&&re[1]&&ne(B,L(re,V,Y,O,U,!1,G,(F.leftPadding??0)*($/2),(F.rightPadding??0)*($/2)))}F.type===1?(B.strokeStyle=B.fillStyle,B.stroke()):B.fill(),B.closePath()})(f,N,m,p,d,k,D,E),!0)};const u=new Map;function y(f,a,m=0){return Math.max(Math.min(f,a),m)}const S={C:(f,a)=>f.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]),L:(f,a)=>f.lineTo(a[0],a[1]),M:(f,a)=>f.moveTo(a[0],a[1])};function L(f,a,m,p,d,k,D,E=0,M=0){const b=f.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-E*D-M*D,k&&b[T]!==0&&(b[T]=y(Math.round(b[T]+.5)-.5,a,0)),b[T]+=p+E*D;for(let T=1;T<b.length;T+=2)b[T]*=m,k&&b[T]!==0&&(b[T]=y(Math.round(b[T]+.5)-.5,m,0)),b[T]+=d;return b}},56:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.observeDevicePixelDimensions=void 0;const g=c(859);r.observeDevicePixelDimensions=function(_,u,y){let S=new u.ResizeObserver((L=>{const f=L.find((p=>p.target===_));if(!f)return;if(!("devicePixelContentBoxSize"in f))return S==null||S.disconnect(),void(S=void 0);const a=f.devicePixelContentBoxSize[0].inlineSize,m=f.devicePixelContentBoxSize[0].blockSize;a>0&&m>0&&y(a,m)}));try{S.observe(_,{box:["device-pixel-content-box"]})}catch{S.disconnect(),S=void 0}return(0,g.toDisposable)((()=>S==null?void 0:S.disconnect()))}},374:(x,r)=>{function c(_){return 57508<=_&&_<=57558}function g(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},r.isPowerlineGlyph=c,r.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},r.isEmoji=g,r.allowRescaling=function(_,u,y,S){return u===1&&y>Math.ceil(1.5*S)&&_!==void 0&&_>255&&!g(_)&&!c(_)&&!(function(L){return 57344<=L&&L<=63743})(_)},r.treatGlyphAsBackgroundColor=function(_){return c(_)||(function(u){return 9472<=u&&u<=9631})(_)},r.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}}}},r.computeNextVariantOffset=function(_,u,y=0){return(_-(2*Math.round(u)-y))%(2*Math.round(u))}},296:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.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 L=_.buffers.active.ydisp,f=u[1]-L,a=y[1]-L,m=Math.max(f,0),p=Math.min(a,_.rows-1);m>=_.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=f,this.viewportEndRow=a,this.viewportCappedStartRow=m,this.viewportCappedEndRow=p,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)}}r.createSelectionRenderModel=function(){return new c}},509:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TextureAtlas=void 0;const g=c(237),_=c(860),u=c(374),y=c(160),S=c(345),L=c(485),f=c(385),a=c(147),m=c(855),p={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let d;class k{get pages(){return this._pages}constructor(T,N,B){this._document=T,this._config=N,this._unicodeService=B,this._didWarmUp=!1,this._cacheMap=new L.FourKeyMap,this._cacheMapCombined=new L.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 f.IdleTaskQueue;for(let N=33;N<126;N++)T.enqueue((()=>{if(!this._cacheMap.get(N,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT)){const B=this._drawToCache(N,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT);this._cacheMap.set(N,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT,B)}}))}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(k.maxAtlasPages&&this._pages.length>=Math.max(4,k.maxAtlasPages)){const N=this._pages.filter((X=>2*X.canvas.width<=(k.maxTextureSize||4096))).sort(((X,G)=>G.canvas.width!==X.canvas.width?G.canvas.width-X.canvas.width:G.percentageUsed-X.percentageUsed));let B=-1,F=0;for(let X=0;X<N.length;X++)if(N[X].canvas.width!==F)B=X,F=N[X].canvas.width;else if(X-B==3)break;const O=N.slice(B,B+4),U=O.map((X=>X.glyphs[0].texturePage)).sort(((X,G)=>X>G?1:-1)),V=this.pages.length-O.length,Y=this._mergePages(O,V);Y.version++;for(let X=U.length-1;X>=0;X--)this._deletePage(U[X]);this.pages.push(Y),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(Y.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 B=2*T[0].canvas.width,F=new D(this._document,B,T);for(const[O,U]of T.entries()){const V=O*U.canvas.width%B,Y=Math.floor(O/2)*U.canvas.height;F.ctx.drawImage(U.canvas,V,Y);for(const G of U.glyphs)G.texturePage=N,G.sizeClipSpace.x=G.size.x/B,G.sizeClipSpace.y=G.size.y/B,G.texturePosition.x+=V,G.texturePosition.y+=Y,G.texturePositionClipSpace.x=G.texturePosition.x/B,G.texturePositionClipSpace.y=G.texturePosition.y/B;this._onRemoveTextureAtlasCanvas.fire(U.canvas);const X=this._activePages.indexOf(U);X!==-1&&this._activePages.splice(X,1)}return F}_deletePage(T){this._pages.splice(T,1);for(let N=T;N<this._pages.length;N++){const B=this._pages[N];for(const F of B.glyphs)F.texturePage--;B.version++}}getRasterizedGlyphCombinedChar(T,N,B,F,O){return this._getFromCacheMap(this._cacheMapCombined,T,N,B,F,O)}getRasterizedGlyph(T,N,B,F,O){return this._getFromCacheMap(this._cacheMap,T,N,B,F,O)}_getFromCacheMap(T,N,B,F,O,U=!1){return d=T.get(N,B,F,O),d||(d=this._drawToCache(N,B,F,O,U),T.set(N,B,F,O,d)),d}_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,B,F){if(this._config.allowTransparency)return y.NULL_COLOR;let O;switch(T){case 16777216:case 33554432:O=this._getColorFromAnsiIndex(N);break;case 50331648:const U=a.AttributeData.toColorRGB(N);O=y.channels.toColor(U[0],U[1],U[2]);break;default:O=B?y.color.opaque(this._config.colors.foreground):this._config.colors.background}return O}_getForegroundColor(T,N,B,F,O,U,V,Y,X,G){const P=this._getMinimumContrastColor(T,N,B,F,O,U,V,X,Y,G);if(P)return P;let $;switch(O){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&X&&U<8&&(U+=8),$=this._getColorFromAnsiIndex(U);break;case 50331648:const H=a.AttributeData.toColorRGB(U);$=y.channels.toColor(H[0],H[1],H[2]);break;default:$=V?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&($=y.color.opaque($)),Y&&($=y.color.multiplyOpacity($,g.DIM_OPACITY)),$}_resolveBackgroundRgba(T,N,B){switch(T){case 16777216:case 33554432:return this._getColorFromAnsiIndex(N).rgba;case 50331648:return N<<8;default:return B?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(T,N,B,F){switch(T){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&F&&N<8&&(N+=8),this._getColorFromAnsiIndex(N).rgba;case 50331648:return N<<8;default:return B?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(T,N,B,F,O,U,V,Y,X,G){if(this._config.minimumContrastRatio===1||G)return;const P=this._getContrastCache(X),$=P.getColor(T,F);if($!==void 0)return $||void 0;const H=this._resolveBackgroundRgba(N,B,V),q=this._resolveForegroundRgba(O,U,V,Y),ne=y.rgba.ensureContrastRatio(H,q,this._config.minimumContrastRatio/(X?2:1));if(!ne)return void P.setColor(T,F,null);const re=y.channels.toColor(ne>>24&255,ne>>16&255,ne>>8&255);return P.setColor(T,F,re),re}_getContrastCache(T){return T?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(T,N,B,F,O=!1){const U=typeof T=="number"?String.fromCharCode(T):T,V=Math.min(this._config.deviceCellWidth*Math.max(U.length,2)+4,this._textureSize);this._tmpCanvas.width<V&&(this._tmpCanvas.width=V);const Y=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<Y&&(this._tmpCanvas.height=Y),this._tmpCtx.save(),this._workAttributeData.fg=B,this._workAttributeData.bg=N,this._workAttributeData.extended.ext=F,this._workAttributeData.isInvisible())return p;const X=!!this._workAttributeData.isBold(),G=!!this._workAttributeData.isInverse(),P=!!this._workAttributeData.isDim(),$=!!this._workAttributeData.isItalic(),H=!!this._workAttributeData.isUnderline(),q=!!this._workAttributeData.isStrikethrough(),ne=!!this._workAttributeData.isOverline();let re=this._workAttributeData.getFgColor(),ue=this._workAttributeData.getFgColorMode(),de=this._workAttributeData.getBgColor(),K=this._workAttributeData.getBgColorMode();if(G){const Se=re;re=de,de=Se;const Ne=ue;ue=K,K=Ne}const W=this._getBackgroundColor(K,de,G,P);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=X?this._config.fontWeightBold:this._config.fontWeight,Z=$?"italic":"";this._tmpCtx.font=`${Z} ${J} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=g.TEXT_BASELINE;const pe=U.length===1&&(0,u.isPowerlineGlyph)(U.charCodeAt(0)),me=U.length===1&&(0,u.isRestrictedPowerlineGlyph)(U.charCodeAt(0)),ie=this._getForegroundColor(N,K,de,B,ue,re,G,P,X,(0,u.treatGlyphAsBackgroundColor)(U.charCodeAt(0)));this._tmpCtx.fillStyle=ie.css;const Le=me?0:4;let Ae=!1;this._config.customGlyphs!==!1&&(Ae=(0,_.tryDrawCustomChar)(this._tmpCtx,U,Le,Le,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Xe,Ce=!pe;if(Xe=typeof T=="number"?this._unicodeService.wcwidth(T):this._unicodeService.getStringCellWidth(T),H){this._tmpCtx.save();const Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ne=Se%2==1?.5:0;if(this._tmpCtx.lineWidth=Se,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Ce=!1,this._tmpCtx.strokeStyle=`rgb(${a.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Ce=!1;let $e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&$e<8&&($e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex($e).css}this._tmpCtx.beginPath();const et=Le,tt=Math.ceil(Le+this._config.deviceCharHeight)-Ne-(O?2*Se:0),Je=tt+Se,lt=tt+2*Se;let ct=this._workAttributeData.getUnderlineVariantOffset();for(let $e=0;$e<Xe;$e++){this._tmpCtx.save();const Ze=et+$e*this._config.deviceCellWidth,Ve=et+($e+1)*this._config.deviceCellWidth,st=Ze+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Ze,tt),this._tmpCtx.lineTo(Ve,tt),this._tmpCtx.moveTo(Ze,lt),this._tmpCtx.lineTo(Ve,lt);break;case 3:const dt=Se<=1?lt:Math.ceil(Le+this._config.deviceCharHeight-Se/2)-Ne,Re=Se<=1?tt:Math.ceil(Le+this._config.deviceCharHeight+Se/2)-Ne,ze=new Path2D;ze.rect(Ze,tt,this._config.deviceCellWidth,lt-tt),this._tmpCtx.clip(ze),this._tmpCtx.moveTo(Ze-this._config.deviceCellWidth/2,Je),this._tmpCtx.bezierCurveTo(Ze-this._config.deviceCellWidth/2,Re,Ze,Re,Ze,Je),this._tmpCtx.bezierCurveTo(Ze,dt,st,dt,st,Je),this._tmpCtx.bezierCurveTo(st,Re,Ve,Re,Ve,Je),this._tmpCtx.bezierCurveTo(Ve,dt,Ve+this._config.deviceCellWidth/2,dt,Ve+this._config.deviceCellWidth/2,Je);break;case 4:const te=ct===0?0:ct>=Se?2*Se-ct:Se-ct;ct>=Se||te===0?(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(Ze+te,tt),this._tmpCtx.lineTo(Ve,tt)):(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(Ze,tt),this._tmpCtx.lineTo(Ze+te,tt),this._tmpCtx.moveTo(Ze+te+Se,tt),this._tmpCtx.lineTo(Ve,tt)),ct=(0,u.computeNextVariantOffset)(Ve-Ze,Se,ct);break;case 5:const le=.6,ke=.3,rt=Ve-Ze,Te=Math.floor(le*rt),We=Math.floor(ke*rt),ut=rt-Te-We;this._tmpCtx.setLineDash([Te,We,ut]),this._tmpCtx.moveTo(Ze,tt),this._tmpCtx.lineTo(Ve,tt);break;default:this._tmpCtx.moveTo(Ze,tt),this._tmpCtx.lineTo(Ve,tt)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Ae&&this._config.fontSize>=12&&!this._config.allowTransparency&&U!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const $e=this._tmpCtx.measureText(U);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in $e&&$e.actualBoundingBoxDescent>0){this._tmpCtx.save();const Ze=new Path2D;Ze.rect(et,tt-Math.ceil(Se/2),this._config.deviceCellWidth*Xe,lt-tt+Math.ceil(Se/2)),this._tmpCtx.clip(Ze),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=W.css,this._tmpCtx.strokeText(U,Le,Le+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(ne){const Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ne=Se%2==1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Le,Le+Ne),this._tmpCtx.lineTo(Le+this._config.deviceCharWidth*Xe,Le+Ne),this._tmpCtx.stroke()}if(Ae||this._tmpCtx.fillText(U,Le,Le+this._config.deviceCharHeight),U==="_"&&!this._config.allowTransparency){let Se=E(this._tmpCtx.getImageData(Le,Le,this._config.deviceCellWidth,this._config.deviceCellHeight),W,ie,Ce);if(Se)for(let Ne=1;Ne<=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(U,Le,Le+this._config.deviceCharHeight-Ne),Se=E(this._tmpCtx.getImageData(Le,Le,this._config.deviceCellWidth,this._config.deviceCellHeight),W,ie,Ce),Se);Ne++);}if(q){const Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Ne=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Le,Le+Math.floor(this._config.deviceCharHeight/2)-Ne),this._tmpCtx.lineTo(Le+this._config.deviceCharWidth*Xe,Le+Math.floor(this._config.deviceCharHeight/2)-Ne),this._tmpCtx.stroke()}this._tmpCtx.restore();const fe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Me;if(Me=this._config.allowTransparency?(function(Se){for(let Ne=0;Ne<Se.data.length;Ne+=4)if(Se.data[Ne+3]>0)return!1;return!0})(fe):E(fe,W,ie,Ce),Me)return p;const _e=this._findGlyphBoundingBox(fe,this._workBoundingBox,V,me,Ae,Le);let Ee,Fe;for(;;){if(this._activePages.length===0){const Se=this._createNewPage();Ee=Se,Fe=Se.currentRow,Fe.height=_e.size.y;break}Ee=this._activePages[this._activePages.length-1],Fe=Ee.currentRow;for(const Se of this._activePages)_e.size.y<=Se.currentRow.height&&(Ee=Se,Fe=Se.currentRow);for(let Se=this._activePages.length-1;Se>=0;Se--)for(const Ne of this._activePages[Se].fixedRows)Ne.height<=Fe.height&&_e.size.y<=Ne.height&&(Ee=this._activePages[Se],Fe=Ne);if(Fe.y+_e.size.y>=Ee.canvas.height||Fe.height>_e.size.y+2){let Se=!1;if(Ee.currentRow.y+Ee.currentRow.height+_e.size.y>=Ee.canvas.height){let Ne;for(const et of this._activePages)if(et.currentRow.y+et.currentRow.height+_e.size.y<et.canvas.height){Ne=et;break}if(Ne)Ee=Ne;else if(k.maxAtlasPages&&this._pages.length>=k.maxAtlasPages&&Fe.y+_e.size.y<=Ee.canvas.height&&Fe.height>=_e.size.y&&Fe.x+_e.size.x<=Ee.canvas.width)Se=!0;else{const et=this._createNewPage();Ee=et,Fe=et.currentRow,Fe.height=_e.size.y,Se=!0}}Se||(Ee.currentRow.height>0&&Ee.fixedRows.push(Ee.currentRow),Fe={x:0,y:Ee.currentRow.y+Ee.currentRow.height,height:_e.size.y},Ee.fixedRows.push(Fe),Ee.currentRow={x:0,y:Fe.y+Fe.height,height:0})}if(Fe.x+_e.size.x<=Ee.canvas.width)break;Fe===Ee.currentRow?(Fe.x=0,Fe.y+=Fe.height,Fe.height=0):Ee.fixedRows.splice(Ee.fixedRows.indexOf(Fe),1)}return _e.texturePage=this._pages.indexOf(Ee),_e.texturePosition.x=Fe.x,_e.texturePosition.y=Fe.y,_e.texturePositionClipSpace.x=Fe.x/Ee.canvas.width,_e.texturePositionClipSpace.y=Fe.y/Ee.canvas.height,_e.sizeClipSpace.x/=Ee.canvas.width,_e.sizeClipSpace.y/=Ee.canvas.height,Fe.height=Math.max(Fe.height,_e.size.y),Fe.x+=_e.size.x,Ee.ctx.putImageData(fe,_e.texturePosition.x-this._workBoundingBox.left,_e.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,_e.size.x,_e.size.y),Ee.addGlyph(_e),Ee.version++,_e}_findGlyphBoundingBox(T,N,B,F,O,U){N.top=0;const V=F?this._config.deviceCellHeight:this._tmpCanvas.height,Y=F?this._config.deviceCellWidth:B;let X=!1;for(let G=0;G<V;G++){for(let P=0;P<Y;P++){const $=G*this._tmpCanvas.width*4+4*P+3;if(T.data[$]!==0){N.top=G,X=!0;break}}if(X)break}N.left=0,X=!1;for(let G=0;G<U+Y;G++){for(let P=0;P<V;P++){const $=P*this._tmpCanvas.width*4+4*G+3;if(T.data[$]!==0){N.left=G,X=!0;break}}if(X)break}N.right=Y,X=!1;for(let G=U+Y-1;G>=U;G--){for(let P=0;P<V;P++){const $=P*this._tmpCanvas.width*4+4*G+3;if(T.data[$]!==0){N.right=G,X=!0;break}}if(X)break}N.bottom=V,X=!1;for(let G=V-1;G>=0;G--){for(let P=0;P<Y;P++){const $=G*this._tmpCanvas.width*4+4*P+3;if(T.data[$]!==0){N.bottom=G,X=!0;break}}if(X)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+U+(F||O?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-N.top+U+(F||O?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}r.TextureAtlas=k;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,B){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],B)for(const F of B)this._glyphs.push(...F.glyphs),this._usedPixels+=F._usedPixels;this.canvas=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 E(b,T,N,B){const F=T.rgba>>>24,O=T.rgba>>>16&255,U=T.rgba>>>8&255,V=N.rgba>>>24,Y=N.rgba>>>16&255,X=N.rgba>>>8&255,G=Math.floor((Math.abs(F-V)+Math.abs(O-Y)+Math.abs(U-X))/12);let P=!0;for(let $=0;$<b.data.length;$+=4)b.data[$]===F&&b.data[$+1]===O&&b.data[$+2]===U||B&&Math.abs(b.data[$]-F)+Math.abs(b.data[$+1]-O)+Math.abs(b.data[$+2]-U)<G?b.data[$+3]=0:P=!1;return P}function M(b,T,N){const B=b.createElement("canvas");return B.width=T,B.height=N,B}},160:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let c=0,g=0,_=0,u=0;var y,S,L,f,a;function m(d){const k=d.toString(16);return k.length<2?"0"+k:k}function p(d,k){return d<k?(k+.05)/(d+.05):(d+.05)/(k+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(d){d.toCss=function(k,D,E,M){return M!==void 0?`#${m(k)}${m(D)}${m(E)}${m(M)}`:`#${m(k)}${m(D)}${m(E)}`},d.toRgba=function(k,D,E,M=255){return(k<<24|D<<16|E<<8|M)>>>0},d.toColor=function(k,D,E,M){return{css:d.toCss(k,D,E,M),rgba:d.toRgba(k,D,E,M)}}})(y||(r.channels=y={})),(function(d){function k(D,E){return u=Math.round(255*E),[c,g,_]=a.toChannels(D.rgba),{css:y.toCss(c,g,_,u),rgba:y.toRgba(c,g,_,u)}}d.blend=function(D,E){if(u=(255&E.rgba)/255,u===1)return{css:E.css,rgba:E.rgba};const M=E.rgba>>24&255,b=E.rgba>>16&255,T=E.rgba>>8&255,N=D.rgba>>24&255,B=D.rgba>>16&255,F=D.rgba>>8&255;return c=N+Math.round((M-N)*u),g=B+Math.round((b-B)*u),_=F+Math.round((T-F)*u),{css:y.toCss(c,g,_),rgba:y.toRgba(c,g,_)}},d.isOpaque=function(D){return(255&D.rgba)==255},d.ensureContrastRatio=function(D,E,M){const b=a.ensureContrastRatio(D.rgba,E.rgba,M);if(b)return y.toColor(b>>24&255,b>>16&255,b>>8&255)},d.opaque=function(D){const E=(255|D.rgba)>>>0;return[c,g,_]=a.toChannels(E),{css:y.toCss(c,g,_),rgba:E}},d.opacity=k,d.multiplyOpacity=function(D,E){return u=255&D.rgba,k(D,u*E/255)},d.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(S||(r.color=S={})),(function(d){let k,D;try{const E=document.createElement("canvas");E.width=1,E.height=1;const M=E.getContext("2d",{willReadFrequently:!0});M&&(k=M,k.globalCompositeOperation="copy",D=k.createLinearGradient(0,0,1,1))}catch{}d.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return c=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),y.toColor(c,g,_);case 5:return c=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),u=parseInt(E.slice(4,5).repeat(2),16),y.toColor(c,g,_,u);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const M=E.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(M)return c=parseInt(M[1]),g=parseInt(M[2]),_=parseInt(M[3]),u=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),y.toColor(c,g,_,u);if(!k||!D)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=D,k.fillStyle=E,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[c,g,_,u]=k.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(c,g,_,u),css:E}}})(L||(r.css=L={})),(function(d){function k(D,E,M){const b=D/255,T=E/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))}d.relativeLuminance=function(D){return k(D>>16&255,D>>8&255,255&D)},d.relativeLuminance2=k})(f||(r.rgb=f={})),(function(d){function k(E,M,b){const T=E>>24&255,N=E>>16&255,B=E>>8&255;let F=M>>24&255,O=M>>16&255,U=M>>8&255,V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));for(;V<b&&(F>0||O>0||U>0);)F-=Math.max(0,Math.ceil(.1*F)),O-=Math.max(0,Math.ceil(.1*O)),U-=Math.max(0,Math.ceil(.1*U)),V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));return(F<<24|O<<16|U<<8|255)>>>0}function D(E,M,b){const T=E>>24&255,N=E>>16&255,B=E>>8&255;let F=M>>24&255,O=M>>16&255,U=M>>8&255,V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));for(;V<b&&(F<255||O<255||U<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),O=Math.min(255,O+Math.ceil(.1*(255-O))),U=Math.min(255,U+Math.ceil(.1*(255-U))),V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));return(F<<24|O<<16|U<<8|255)>>>0}d.blend=function(E,M){if(u=(255&M)/255,u===1)return M;const b=M>>24&255,T=M>>16&255,N=M>>8&255,B=E>>24&255,F=E>>16&255,O=E>>8&255;return c=B+Math.round((b-B)*u),g=F+Math.round((T-F)*u),_=O+Math.round((N-O)*u),y.toRgba(c,g,_)},d.ensureContrastRatio=function(E,M,b){const T=f.relativeLuminance(E>>8),N=f.relativeLuminance(M>>8);if(p(T,N)<b){if(N<T){const O=k(E,M,b),U=p(T,f.relativeLuminance(O>>8));if(U<b){const V=D(E,M,b);return U>p(T,f.relativeLuminance(V>>8))?O:V}return O}const B=D(E,M,b),F=p(T,f.relativeLuminance(B>>8));if(F<b){const O=k(E,M,b);return F>p(T,f.relativeLuminance(O>>8))?B:O}return B}},d.reduceLuminance=k,d.increaseLuminance=D,d.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(a||(r.rgba=a={})),r.toPaddedHex=m,r.contrastRatio=p},345:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let g=0;g<this._listeners.length;g++)if(this._listeners[g]===c)return void this._listeners.splice(g,1)}}})),this._event}fire(c,g){const _=[];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,g)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(c,g){return c((_=>g.fire(_)))},r.runAndSubscribe=function(c,g){return g(void 0),c((_=>g(_)))}},859:(x,r)=>{function c(g){for(const _ of g)_.dispose();g.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const g of this._disposables)g.dispose();this._disposables.length=0}register(g){return this._disposables.push(g),g}unregister(g){const _=this._disposables.indexOf(g);_!==-1&&this._disposables.splice(_,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(g){var _;this._isDisposed||g===this._value||((_=this._value)==null||_.dispose(),this._value=g)}clear(){this.value=void 0}dispose(){var g;this._isDisposed=!0,(g=this._value)==null||g.dispose(),this._value=void 0}},r.toDisposable=function(g){return{dispose:g}},r.disposeArray=c,r.getDisposeArrayDisposable=function(g){return{dispose:()=>c(g)}}},485:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.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={}}}r.TwoKeyMap=c,r.FourKeyMap=class{constructor(){this._data=new c}set(g,_,u,y,S){this._data.get(g,_)||this._data.set(g,_,new c),this._data.get(g,_).set(u,y,S)}get(g,_,u,y){var S;return(S=this._data.get(g,_))==null?void 0:S.get(u,y)}clear(){this._data.clear()}}},399:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;const c=r.isNode?"node":navigator.userAgent,g=r.isNode?"node":navigator.platform;r.isFirefox=c.includes("Firefox"),r.isLegacyEdge=c.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(c),r.getSafariVersion=function(){if(!r.isSafari)return 0;const _=c.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(g),r.isIpad=g==="iPad",r.isIphone=g==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(g),r.isLinux=g.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(c)},385:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const g=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 L=0,f=0,a=S.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(L=Date.now(),this._tasks[this._i]()||this._i++,L=Math.max(1,Date.now()-L),f=Math.max(L,f),m=S.timeRemaining(),1.5*f>m)return a-L<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-L))}ms`),void this._start();a=m}this.clear()}}class u extends _{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const L=Date.now()+S;return{timeRemaining:()=>Math.max(0,L-Date.now())}}}r.PriorityTaskQueue=u,r.IdleTaskQueue=!g.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(y){return requestIdleCallback(y)}_cancelCallback(y){cancelIdleCallback(y)}}:u,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(y){this._queue.clear(),this._queue.enqueue(y)}flush(){this._queue.flush()}}},147:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new g}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}}r.AttributeData=c;class g{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 g(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=g},782:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const g=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(L){const f=new y;return f.setFromCharData(L),f}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,g.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(L){this.fg=L[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(L[_.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(L[_.CHAR_DATA_CHAR_INDEX].length===2){const a=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const m=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(a-55296)+m-56320+65536|L[_.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|L[_.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=L[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|L[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=y},855:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},133:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},r.utf32ToString=function(c,g=0,_=c.length){let u="";for(let y=g;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},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,g){const _=c.length;if(!_)return 0;let u=0,y=0;if(this._interim){const S=c.charCodeAt(y++);56320<=S&&S<=57343?g[u++]=1024*(this._interim-55296)+S-56320+65536:(g[u++]=this._interim,g[u++]=S),this._interim=0}for(let S=y;S<_;++S){const L=c.charCodeAt(S);if(55296<=L&&L<=56319){if(++S>=_)return this._interim=L,u;const f=c.charCodeAt(S);56320<=f&&f<=57343?g[u++]=1024*(L-55296)+f-56320+65536:(g[u++]=L,g[u++]=f)}else L!==65279&&(g[u++]=L)}return u}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,g){const _=c.length;if(!_)return 0;let u,y,S,L,f=0,a=0,m=0;if(this.interim[0]){let k=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let E,M=0;for(;(E=63&this.interim[++M])&&M<4;)D<<=6,D|=E;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=b-M;for(;m<T;){if(m>=_)return 0;if(E=c[m++],(192&E)!=128){m--,k=!0;break}this.interim[M++]=E,D<<=6,D|=63&E}k||(b===2?D<128?m--:g[f++]=D:b===3?D<2048||D>=55296&&D<=57343||D===65279||(g[f++]=D):D<65536||D>1114111||(g[f++]=D)),this.interim.fill(0)}const p=_-4;let d=m;for(;d<_;){for(;!(!(d<p)||128&(u=c[d])||128&(y=c[d+1])||128&(S=c[d+2])||128&(L=c[d+3]));)g[f++]=u,g[f++]=y,g[f++]=S,g[f++]=L,d+=4;if(u=c[d++],u<128)g[f++]=u;else if((224&u)==192){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(a=(31&u)<<6|63&y,a<128){d--;continue}g[f++]=a}else if((240&u)==224){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,f;if(S=c[d++],(192&S)!=128){d--;continue}if(a=(15&u)<<12|(63&y)<<6|63&S,a<2048||a>=55296&&a<=57343||a===65279)continue;g[f++]=a}else if((248&u)==240){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,f;if(S=c[d++],(192&S)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,this.interim[2]=S,f;if(L=c[d++],(192&L)!=128){d--;continue}if(a=(7&u)<<18|(63&y)<<12|(63&S)<<6|63&L,a<65536||a>1114111)continue;g[f++]=a}}return f}}},776:function(x,r,c){var g=this&&this.__decorate||function(a,m,p,d){var k,D=arguments.length,E=D<3?m:d===null?d=Object.getOwnPropertyDescriptor(m,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(a,m,p,d);else for(var M=a.length-1;M>=0;M--)(k=a[M])&&(E=(D<3?k(E):D>3?k(m,p,E):k(m,p))||E);return D>3&&E&&Object.defineProperty(m,p,E),E},_=this&&this.__param||function(a,m){return function(p,d){m(p,d,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.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 L,f=r.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()))),L=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let m=0;m<a.length;m++)typeof a[m]=="function"&&(a[m]=a[m]())}_log(a,m,p){this._evalLazyOptionalParams(p),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...p)}trace(a,...m){var p;this._logLevel<=y.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,a,m)}debug(a,...m){var p;this._logLevel<=y.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,a,m)}info(a,...m){var p;this._logLevel<=y.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,a,m)}warn(a,...m){var p;this._logLevel<=y.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,a,m)}error(a,...m){var p;this._logLevel<=y.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,a,m)}};r.LogService=f=g([_(0,y.IOptionsService)],f),r.setTraceLogger=function(a){L=a},r.traceCall=function(a,m,p){if(typeof p.value!="function")throw new Error("not supported");const d=p.value;p.value=function(...k){if(L.logLevel!==y.LogLevelEnum.TRACE)return d.apply(this,k);L.trace(`GlyphRenderer#${d.name}(${k.map((E=>JSON.stringify(E))).join(", ")})`);const D=d.apply(this,k);return L.trace(`GlyphRenderer#${d.name} return`,D),D}}},726:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const c="di$target",g="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[g]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);const u=function(y,S,L){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,a,m){a[c]===a?a[g].push({id:f,index:m}):(a[g]=[{id:f,index:m}],a[c]=a)})(u,y,L)};return u.toString=()=>_,r.serviceRegistry.set(_,u),u}},97:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const g=c(726);var _;r.IBufferService=(0,g.createDecorator)("BufferService"),r.ICoreMouseService=(0,g.createDecorator)("CoreMouseService"),r.ICoreService=(0,g.createDecorator)("CoreService"),r.ICharsetService=(0,g.createDecorator)("CharsetService"),r.IInstantiationService=(0,g.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"})(_||(r.LogLevelEnum=_={})),r.ILogService=(0,g.createDecorator)("LogService"),r.IOptionsService=(0,g.createDecorator)("OptionsService"),r.IOscLinkService=(0,g.createDecorator)("OscLinkService"),r.IUnicodeService=(0,g.createDecorator)("UnicodeService"),r.IDecorationService=(0,g.createDecorator)("DecorationService")}},h={};function v(x){var r=h[x];if(r!==void 0)return r.exports;var c=h[x]={exports:{}};return i[x].call(c.exports,c,c.exports,v),c.exports}var R={};return(()=>{var x=R;Object.defineProperty(x,"__esModule",{value:!0}),x.WebglAddon=void 0;const r=v(345),c=v(859),g=v(399),_=v(666),u=v(776);class y extends c.Disposable{constructor(L){if(g.isSafari&&(0,g.getSafariVersion)()<16){const f={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",f))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=L,this._onChangeTextureAtlas=this.register(new r.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new r.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new r.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new r.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(L){const f=L._core;if(!L.element)return void this.register(f.onWillOpen((()=>this.activate(L))));this._terminal=L;const a=f.coreService,m=f.optionsService,p=f,d=p._renderService,k=p._characterJoinerService,D=p._charSizeService,E=p._coreBrowserService,M=p._decorationService,b=p._logService,T=p._themeService;(0,u.setTraceLogger)(b),this._renderer=this.register(new _.WebglRenderer(L,k,D,E,a,M,m,T,this._preserveDrawingBuffer)),this.register((0,r.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,r.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,r.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,r.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),d.setRenderer(this._renderer),this.register((0,c.toDisposable)((()=>{const N=this._terminal._core._renderService;N.setRenderer(this._terminal._core._createRenderer()),N.handleResize(L.cols,L.rows)})))}get textureAtlas(){var L;return(L=this._renderer)==null?void 0:L.textureAtlas}clearTextureAtlas(){var L;(L=this._renderer)==null||L.clearTextureAtlas()}}x.WebglAddon=y})(),R})()))})(Tc)),Tc.exports}var M1=R1(),Rc={exports:{}},Ef;function A1(){return Ef||(Ef=1,(function(n,s){(function(i,h){n.exports=h()})(globalThis,(()=>(()=>{var i={4567:function(x,r,c){var g=this&&this.__decorate||function(p,d,k,D){var E,M=arguments.length,b=M<3?d:D===null?D=Object.getOwnPropertyDescriptor(d,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,d,k,D);else for(var T=p.length-1;T>=0;T--)(E=p[T])&&(b=(M<3?E(b):M>3?E(d,k,b):E(d,k))||b);return M>3&&b&&Object.defineProperty(d,k,b),b},_=this&&this.__param||function(p,d){return function(k,D){d(k,D,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const u=c(9042),y=c(9924),S=c(844),L=c(4725),f=c(2585),a=c(3656);let m=r.AccessibilityManager=class extends S.Disposable{constructor(p,d,k,D){super(),this._terminal=p,this._coreBrowserService=k,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 E=0;E<this._terminal.rows;E++)this._rowElements[E]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[E]);if(this._topBoundaryFocusListener=E=>this._handleBoundaryFocus(E,0),this._bottomBoundaryFocusListener=E=>this._handleBoundaryFocus(E,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new 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((E=>this._handleResize(E.rows)))),this.register(this._terminal.onRender((E=>this._refreshRows(E.start,E.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((E=>this._handleChar(E)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
109
+ `)))),this.register(this._terminal.onA11yTab((E=>this._handleTab(E)))),this.register(this._terminal.onKey((E=>this._handleKey(E.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,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(p){for(let d=0;d<p;d++)this._handleChar(" ")}_handleChar(p){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==p&&(this._charsToAnnounce+=p):this._charsToAnnounce+=p,p===`
110
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=u.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(p){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(p)||this._charsToConsume.push(p)}_refreshRows(p,d){this._liveRegionDebouncer.refresh(p,d,this._terminal.rows)}_renderRows(p,d){const k=this._terminal.buffer,D=k.lines.length.toString();for(let E=p;E<=d;E++){const M=k.lines.get(k.ydisp+E),b=[],T=(M==null?void 0:M.translateToString(!0,void 0,void 0,b))||"",N=(k.ydisp+E+1).toString(),B=this._rowElements[E];B&&(T.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=T,this._rowColumns.set(B,b)),B.setAttribute("aria-posinset",N),B.setAttribute("aria-setsize",D))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(p,d){const k=p.target,D=this._rowElements[d===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(d===0?"1":`${this._terminal.buffer.lines.length}`)||p.relatedTarget!==D)return;let E,M;if(d===0?(E=k,M=this._rowElements.pop(),this._rowContainer.removeChild(M)):(E=this._rowElements.shift(),M=k,this._rowContainer.removeChild(E)),E.removeEventListener("focus",this._topBoundaryFocusListener),M.removeEventListener("focus",this._bottomBoundaryFocusListener),d===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(d===0?-1:1),this._rowElements[d===0?1:this._rowElements.length-2].focus(),p.preventDefault(),p.stopImmediatePropagation()}_handleSelectionChange(){var T;if(this._rowElements.length===0)return;const p=document.getSelection();if(!p)return;if(p.isCollapsed)return void(this._rowContainer.contains(p.anchorNode)&&this._terminal.clearSelection());if(!p.anchorNode||!p.focusNode)return void console.error("anchorNode and/or focusNode are null");let d={node:p.anchorNode,offset:p.anchorOffset},k={node:p.focusNode,offset:p.focusOffset};if((d.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||d.node===k.node&&d.offset>k.offset)&&([d,k]=[k,d]),d.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(d={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(d.node))return;const D=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(D)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:D,offset:((T=D.textContent)==null?void 0:T.length)??0}),!this._rowContainer.contains(k.node))return;const E=({node:N,offset:B})=>{const F=N instanceof Text?N.parentNode:N;let O=parseInt(F==null?void 0:F.getAttribute("aria-posinset"),10)-1;if(isNaN(O))return console.warn("row is invalid. Race condition?"),null;const U=this._rowColumns.get(F);if(!U)return console.warn("columns is null. Race condition?"),null;let V=B<U.length?U[B]:U.slice(-1)[0]+1;return V>=this._terminal.cols&&(++O,V=0),{row:O,column:V}},M=E(d),b=E(k);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(p){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let d=this._rowContainer.children.length;d<this._terminal.rows;d++)this._rowElements[d]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[d]);for(;this._rowElements.length>p;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const p=this._coreBrowserService.mainDocument.createElement("div");return p.setAttribute("role","listitem"),p.tabIndex=-1,this._refreshRowDimensions(p),p}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let p=0;p<this._terminal.rows;p++)this._refreshRowDimensions(this._rowElements[p])}}_refreshRowDimensions(p){p.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=m=g([_(1,f.IInstantiationService),_(2,L.ICoreBrowserService),_(3,L.IRenderService)],m)},3614:(x,r)=>{function c(y){return y.replace(/\r?\n/g,"\r")}function g(y,S){return S?"\x1B[200~"+y+"\x1B[201~":y}function _(y,S,L,f){y=g(y=c(y),L.decPrivateModes.bracketedPasteMode&&f.rawOptions.ignoreBracketedPasteMode!==!0),L.triggerDataEvent(y,!0),S.value=""}function u(y,S,L){const f=L.getBoundingClientRect(),a=y.clientX-f.left-10,m=y.clientY-f.top-10;S.style.width="20px",S.style.height="20px",S.style.left=`${a}px`,S.style.top=`${m}px`,S.style.zIndex="1000",S.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=c,r.bracketTextForPaste=g,r.copyHandler=function(y,S){y.clipboardData&&y.clipboardData.setData("text/plain",S.selectionText),y.preventDefault()},r.handlePasteEvent=function(y,S,L,f){y.stopPropagation(),y.clipboardData&&_(y.clipboardData.getData("text/plain"),S,L,f)},r.paste=_,r.moveTextAreaUnderMouseCursor=u,r.rightClickHandler=function(y,S,L,f,a){u(y,S,L),a&&f.rightClickSelect(y),S.value=f.selectionText,S.select()}},7239:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const g=c(1505);r.ColorContrastCache=class{constructor(){this._color=new g.TwoKeyMap,this._css=new g.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:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(c,g,_,u){c.addEventListener(g,_,u);let y=!1;return{dispose:()=>{y||(y=!0,c.removeEventListener(g,_,u))}}}},3551:function(x,r,c){var g=this&&this.__decorate||function(m,p,d,k){var D,E=arguments.length,M=E<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,d):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(m,p,d,k);else for(var b=m.length-1;b>=0;b--)(D=m[b])&&(M=(E<3?D(M):E>3?D(p,d,M):D(p,d))||M);return E>3&&M&&Object.defineProperty(p,d,M),M},_=this&&this.__param||function(m,p){return function(d,k){p(d,k,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;const u=c(3656),y=c(8460),S=c(844),L=c(2585),f=c(4725);let a=r.Linkifier=class extends S.Disposable{get currentLink(){return this._currentLink}constructor(m,p,d,k,D){super(),this._element=m,this._mouseService=p,this._renderService=d,this._bufferService=k,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 E;this._lastMouseEvent=void 0,(E=this._activeProviderReplies)==null||E.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(m){this._lastMouseEvent=m;const p=this._positionFromMouseEvent(m,this._element,this._mouseService);if(!p)return;this._isMouseOut=!1;const d=m.composedPath();for(let k=0;k<d.length;k++){const D=d[k];if(D.classList.contains("xterm"))break;if(D.classList.contains("xterm-hover"))return}this._lastBufferCell&&p.x===this._lastBufferCell.x&&p.y===this._lastBufferCell.y||(this._handleHover(p),this._lastBufferCell=p)}_handleHover(m){if(this._activeLine!==m.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(m,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,m)||(this._clearCurrentLink(),this._askForLink(m,!0))}_askForLink(m,p){var k,D;this._activeProviderReplies&&p||((k=this._activeProviderReplies)==null||k.forEach((E=>{E==null||E.forEach((M=>{M.link.dispose&&M.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=m.y);let d=!1;for(const[E,M]of this._linkProviderService.linkProviders.entries())p?(D=this._activeProviderReplies)!=null&&D.get(E)&&(d=this._checkLinkProviderResult(E,m,d)):M.provideLinks(m.y,(b=>{var N,B;if(this._isMouseOut)return;const T=b==null?void 0:b.map((F=>({link:F})));(N=this._activeProviderReplies)==null||N.set(E,T),d=this._checkLinkProviderResult(E,m,d),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(m.y,this._activeProviderReplies)}))}_removeIntersectingLinks(m,p){const d=new Set;for(let k=0;k<p.size;k++){const D=p.get(k);if(D)for(let E=0;E<D.length;E++){const M=D[E],b=M.link.range.start.y<m?0:M.link.range.start.x,T=M.link.range.end.y>m?this._bufferService.cols:M.link.range.end.x;for(let N=b;N<=T;N++){if(d.has(N)){D.splice(E--,1);break}d.add(N)}}}}_checkLinkProviderResult(m,p,d){var E;if(!this._activeProviderReplies)return d;const k=this._activeProviderReplies.get(m);let D=!1;for(let M=0;M<m;M++)this._activeProviderReplies.has(M)&&!this._activeProviderReplies.get(M)||(D=!0);if(!D&&k){const M=k.find((b=>this._linkAtPosition(b.link,p)));M&&(d=!0,this._handleNewLink(M))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!d)for(let M=0;M<this._activeProviderReplies.size;M++){const b=(E=this._activeProviderReplies.get(M))==null?void 0:E.find((T=>this._linkAtPosition(T.link,p)));if(b){d=!0,this._handleNewLink(b);break}}return d}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(m){if(!this._currentLink)return;const p=this._positionFromMouseEvent(m,this._element,this._mouseService);p&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,p)&&this._currentLink.link.activate(m,this._currentLink.link.text)}_clearCurrentLink(m,p){this._currentLink&&this._lastMouseEvent&&(!m||!p||this._currentLink.link.range.start.y>=m&&this._currentLink.link.range.end.y<=p)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,S.disposeArray)(this._linkCacheDisposables))}_handleNewLink(m){if(!this._lastMouseEvent)return;const p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._linkAtPosition(m.link,p)&&(this._currentLink=m,this._currentLink.state={decorations:{underline:m.link.decorations===void 0||m.link.decorations.underline,pointerCursor:m.link.decorations===void 0||m.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,m.link,this._lastMouseEvent),m.link.decorations={},Object.defineProperties(m.link.decorations,{pointerCursor:{get:()=>{var d,k;return(k=(d=this._currentLink)==null?void 0:d.state)==null?void 0:k.decorations.pointerCursor},set:d=>{var k;(k=this._currentLink)!=null&&k.state&&this._currentLink.state.decorations.pointerCursor!==d&&(this._currentLink.state.decorations.pointerCursor=d,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",d))}},underline:{get:()=>{var d,k;return(k=(d=this._currentLink)==null?void 0:d.state)==null?void 0:k.decorations.underline},set:d=>{var k,D,E;(k=this._currentLink)!=null&&k.state&&((E=(D=this._currentLink)==null?void 0:D.state)==null?void 0:E.decorations.underline)!==d&&(this._currentLink.state.decorations.underline=d,this._currentLink.state.isHovered&&this._fireUnderlineEvent(m.link,d))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((d=>{if(!this._currentLink)return;const k=d.start===0?0:d.start+1+this._bufferService.buffer.ydisp,D=this._bufferService.buffer.ydisp+1+d.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=D&&(this._clearCurrentLink(k,D),this._lastMouseEvent)){const E=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);E&&this._askForLink(E,!1)}}))))}_linkHover(m,p,d){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!0),this._currentLink.state.decorations.pointerCursor&&m.classList.add("xterm-cursor-pointer")),p.hover&&p.hover(d,p.text)}_fireUnderlineEvent(m,p){const d=m.range,k=this._bufferService.buffer.ydisp,D=this._createLinkUnderlineEvent(d.start.x-1,d.start.y-k-1,d.end.x,d.end.y-k-1,void 0);(p?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(D)}_linkLeave(m,p,d){var k;(k=this._currentLink)!=null&&k.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!1),this._currentLink.state.decorations.pointerCursor&&m.classList.remove("xterm-cursor-pointer")),p.leave&&p.leave(d,p.text)}_linkAtPosition(m,p){const d=m.range.start.y*this._bufferService.cols+m.range.start.x,k=m.range.end.y*this._bufferService.cols+m.range.end.x,D=p.y*this._bufferService.cols+p.x;return d<=D&&D<=k}_positionFromMouseEvent(m,p,d){const k=d.getCoords(m,p,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(m,p,d,k,D){return{x1:m,y1:p,x2:d,y2:k,cols:this._bufferService.cols,fg:D}}};r.Linkifier=a=g([_(1,f.IMouseService),_(2,f.IRenderService),_(3,L.IBufferService),_(4,f.ILinkProviderService)],a)},9042:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(x,r,c){var g=this&&this.__decorate||function(f,a,m,p){var d,k=arguments.length,D=k<3?a:p===null?p=Object.getOwnPropertyDescriptor(a,m):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,a,m,p);else for(var E=f.length-1;E>=0;E--)(d=f[E])&&(D=(k<3?d(D):k>3?d(a,m,D):d(a,m))||D);return k>3&&D&&Object.defineProperty(a,m,D),D},_=this&&this.__param||function(f,a){return function(m,p){a(m,p,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const u=c(511),y=c(2585);let S=r.OscLinkProvider=class{constructor(f,a,m){this._bufferService=f,this._optionsService=a,this._oscLinkService=m}provideLinks(f,a){var T;const m=this._bufferService.buffer.lines.get(f-1);if(!m)return void a(void 0);const p=[],d=this._optionsService.rawOptions.linkHandler,k=new u.CellData,D=m.getTrimmedLength();let E=-1,M=-1,b=!1;for(let N=0;N<D;N++)if(M!==-1||m.hasContent(N)){if(m.loadCell(N,k),k.hasExtendedAttrs()&&k.extended.urlId){if(M===-1){M=N,E=k.extended.urlId;continue}b=k.extended.urlId!==E}else M!==-1&&(b=!0);if(b||M!==-1&&N===D-1){const B=(T=this._oscLinkService.getLinkData(E))==null?void 0:T.uri;if(B){const F={start:{x:M+1,y:f},end:{x:N+(b||N!==D-1?0:1),y:f}};let O=!1;if(!(d!=null&&d.allowNonHttpProtocols))try{const U=new URL(B);["http:","https:"].includes(U.protocol)||(O=!0)}catch{O=!0}O||p.push({text:B,range:F,activate:(U,V)=>d?d.activate(U,V,F):L(0,V),hover:(U,V)=>{var Y;return(Y=d==null?void 0:d.hover)==null?void 0:Y.call(d,U,V,F)},leave:(U,V)=>{var Y;return(Y=d==null?void 0:d.leave)==null?void 0:Y.call(d,U,V,F)}})}b=!1,k.hasExtendedAttrs()&&k.extended.urlId?(M=N,E=k.extended.urlId):(M=-1,E=-1)}}a(p)}};function L(f,a){if(confirm(`Do you want to navigate to ${a}?
111
+
112
+ WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=S=g([_(0,y.IBufferService),_(1,y.IOptionsService),_(2,y.IOscLinkService)],S)},6193:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(c,g){this._renderCallback=c,this._coreBrowserService=g,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(c){return this._refreshCallbacks.push(c),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(c,g,_){this._rowCount=_,c=c!==void 0?c:0,g=g!==void 0?g:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,g):g,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const c=Math.max(this._rowStart,0),g=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,g),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const c of this._refreshCallbacks)c(0);this._refreshCallbacks=[]}}},3236:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const g=c(3614),_=c(3656),u=c(3551),y=c(9042),S=c(3730),L=c(1680),f=c(3107),a=c(5744),m=c(2950),p=c(1296),d=c(428),k=c(4269),D=c(5114),E=c(8934),M=c(3230),b=c(9312),T=c(4725),N=c(6731),B=c(8055),F=c(8969),O=c(8460),U=c(844),V=c(6114),Y=c(8437),X=c(2584),G=c(7399),P=c(5941),$=c(9074),H=c(2585),q=c(5435),ne=c(4567),re=c(779);class ue extends F.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(K={}){super(K),this.browser=V,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new U.MutableDisposable),this._onCursorMove=this.register(new O.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new O.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new O.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new O.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new O.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new O.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new O.EventEmitter),this._onBlur=this.register(new O.EventEmitter),this._onA11yCharEmitter=this.register(new O.EventEmitter),this._onA11yTabEmitter=this.register(new O.EventEmitter),this._onWillOpen=this.register(new O.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance($.DecorationService),this._instantiationService.setService(H.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(re.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,O.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,O.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,O.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,O.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((W=>this._afterResize(W.cols,W.rows)))),this.register((0,U.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 pe=B.color.toColorRGB(J==="ansi"?this._themeService.colors.ansi[W.index]:this._themeService.colors[J]);this.coreService.triggerDataEvent(`${X.C0.ESC}]${Z};${(0,P.toRgbString)(pe)}${X.C1_ESCAPED.ST}`);break;case 1:if(J==="ansi")this._themeService.modifyColors((me=>me.ansi[W.index]=B.channels.toColor(...W.color)));else{const me=J;this._themeService.modifyColors((ie=>ie[me]=B.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(X.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(X.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,pe=W.getWidth(J),me=this._renderService.dimensions.css.cell.width*pe,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,Le=J*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Le+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=me+"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,g.copyHandler)(W,this._selectionService)})));const K=W=>(0,g.handlePasteEvent)(W,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",K)),this.register((0,_.addDisposableDomListener)(this.element,"paste",K)),V.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(W=>{W.button===2&&(0,g.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(W=>{(0,g.rightClickHandler)(W,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),V.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(W=>{W.button===1&&(0,g.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),V.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(d.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(k.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(m.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(E.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(L.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(f.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(p.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const K=this,W=this.element;function J(me){const ie=K._mouseService.getMouseReportCoords(me,K.screenElement);if(!ie)return!1;let Le,Ae;switch(me.overrideType||me.type){case"mousemove":Ae=32,me.buttons===void 0?(Le=3,me.button!==void 0&&(Le=me.button<3?me.button:3)):Le=1&me.buttons?0:4&me.buttons?1:2&me.buttons?2:3;break;case"mouseup":Ae=0,Le=me.button<3?me.button:3;break;case"mousedown":Ae=1,Le=me.button<3?me.button:3;break;case"wheel":if(K._customWheelEventHandler&&K._customWheelEventHandler(me)===!1||K.viewport.getLinesScrolled(me)===0)return!1;Ae=me.deltaY<0?0:1,Le=4;break;default:return!1}return!(Ae===void 0||Le===void 0||Le>4)&&K.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:Le,action:Ae,ctrl:me.ctrlKey,alt:me.altKey,shift:me.shiftKey})}const Z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},pe={mouseup:me=>(J(me),me.buttons||(this._document.removeEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.removeEventListener("mousemove",Z.mousedrag)),this.cancel(me)),wheel:me=>(J(me),this.cancel(me,!0)),mousedrag:me=>{me.buttons&&J(me)},mousemove:me=>{me.buttons||J(me)}};this.register(this.coreMouseService.onProtocolChange((me=>{me?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(me)),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&me?Z.mousemove||(W.addEventListener("mousemove",pe.mousemove),Z.mousemove=pe.mousemove):(W.removeEventListener("mousemove",Z.mousemove),Z.mousemove=null),16&me?Z.wheel||(W.addEventListener("wheel",pe.wheel,{passive:!1}),Z.wheel=pe.wheel):(W.removeEventListener("wheel",Z.wheel),Z.wheel=null),2&me?Z.mouseup||(Z.mouseup=pe.mouseup):(this._document.removeEventListener("mouseup",Z.mouseup),Z.mouseup=null),4&me?Z.mousedrag||(Z.mousedrag=pe.mousedrag):(this._document.removeEventListener("mousemove",Z.mousedrag),Z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(W,"mousedown",(me=>{if(me.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(me))return J(me),Z.mouseup&&this._document.addEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.addEventListener("mousemove",Z.mousedrag),this.cancel(me)}))),this.register((0,_.addDisposableDomListener)(W,"wheel",(me=>{if(!Z.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(me)===!1)return!1;if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(me);if(ie===0)return;const Le=X.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(me.deltaY<0?"A":"B");let Ae="";for(let Xe=0;Xe<Math.abs(ie);Xe++)Ae+=Le;return this.coreService.triggerDataEvent(Ae,!0),this.cancel(me,!0)}return this.viewport.handleWheel(me)?this.cancel(me):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(W,"touchstart",(me=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(me),this.cancel(me)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(W,"touchmove",(me=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(me)?void 0:this.cancel(me)}),{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,g.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,G.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!==X.C0.ETX&&J.key!==X.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(Y.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(X.C0.ESC+"[I"):this.coreService.triggerDataEvent(X.C0.ESC+"[O")}_reportWindowsOptions(K){if(this._renderService)switch(K){case q.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(`${X.C0.ESC}[4;${J};${W}t`);break;case q.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Z=this._renderService.dimensions.css.cell.width.toFixed(0),pe=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${X.C0.ESC}[6;${pe};${Z}t`)}}cancel(K,W){if(this.options.cancelEvents||W)return K.preventDefault(),K.stopPropagation(),!1}}r.Terminal=ue},9924:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(c,g=1e3){this._renderCallback=c,this._debounceThresholdMS=g,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(c,g,_){this._rowCount=_,c=c!==void 0?c:0,g=g!==void 0?g:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,g):g;const 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),g=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(c,g)}}},1680:function(x,r,c){var g=this&&this.__decorate||function(m,p,d,k){var D,E=arguments.length,M=E<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,d):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(m,p,d,k);else for(var b=m.length-1;b>=0;b--)(D=m[b])&&(M=(E<3?D(M):E>3?D(p,d,M):D(p,d))||M);return E>3&&M&&Object.defineProperty(p,d,M),M},_=this&&this.__param||function(m,p){return function(d,k){p(d,k,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const u=c(3656),y=c(4725),S=c(8460),L=c(844),f=c(2585);let a=r.Viewport=class extends L.Disposable{constructor(m,p,d,k,D,E,M,b){super(),this._viewportElement=m,this._scrollArea=p,this._bufferService=d,this._optionsService=k,this._charSizeService=D,this._renderService=E,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(m){this._viewportElement.style.backgroundColor=m.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(m){if(m)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const p=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==p&&(this._lastRecordedBufferHeight=p,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const m=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==m&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=m),this._refreshAnimationFrame=null}syncScrollArea(m=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(m);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(m)}_handleScroll(m){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const p=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:p,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const m=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(m*(this._smoothScrollState.target-this._smoothScrollState.origin)),m<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(m,p){const d=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(p<0&&this._viewportElement.scrollTop!==0||p>0&&d<this._lastRecordedBufferHeight)||(m.cancelable&&m.preventDefault(),!1)}handleWheel(m){const p=this._getPixelsScrolled(m);return p!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+p:this._smoothScrollState.target+=p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=p,this._bubbleScroll(m,p))}scrollLines(m){if(m!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const p=m*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!1})}_getPixelsScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let p=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_LINE?p*=this._currentRowHeight:m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._currentRowHeight*this._bufferService.rows),p}getBufferElements(m,p){var b;let d,k="";const D=[],E=p??this._bufferService.buffer.lines.length,M=this._bufferService.buffer.lines;for(let T=m;T<E;T++){const N=M.get(T);if(!N)continue;const B=(b=M.get(T+1))==null?void 0:b.isWrapped;if(k+=N.translateToString(!B),!B||T===M.length-1){const F=document.createElement("div");F.textContent=k,D.push(F),k.length>0&&(d=F),k=""}}return{bufferElements:D,cursorElement:d}}getLinesScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let p=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(p/=this._currentRowHeight+0,this._wheelPartialScroll+=p,p=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._bufferService.rows),p}_applyScrollModifier(m,p){const d=this._optionsService.rawOptions.fastScrollModifier;return d==="alt"&&p.altKey||d==="ctrl"&&p.ctrlKey||d==="shift"&&p.shiftKey?m*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:m*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(m){this._lastTouchY=m.touches[0].pageY}handleTouchMove(m){const p=this._lastTouchY-m.touches[0].pageY;return this._lastTouchY=m.touches[0].pageY,p!==0&&(this._viewportElement.scrollTop+=p,this._bubbleScroll(m,p))}};r.Viewport=a=g([_(2,f.IBufferService),_(3,f.IOptionsService),_(4,y.ICharSizeService),_(5,y.IRenderService),_(6,y.ICoreBrowserService),_(7,y.IThemeService)],a)},3107:function(x,r,c){var g=this&&this.__decorate||function(f,a,m,p){var d,k=arguments.length,D=k<3?a:p===null?p=Object.getOwnPropertyDescriptor(a,m):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,a,m,p);else for(var E=f.length-1;E>=0;E--)(d=f[E])&&(D=(k<3?d(D):k>3?d(a,m,D):d(a,m))||D);return k>3&&D&&Object.defineProperty(a,m,D),D},_=this&&this.__param||function(f,a){return function(m,p){a(m,p,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const u=c(4725),y=c(844),S=c(2585);let L=r.BufferDecorationRenderer=class extends y.Disposable{constructor(f,a,m,p,d){super(),this._screenElement=f,this._bufferService=a,this._coreBrowserService=m,this._decorationService=p,this._renderService=d,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((k=>this._removeDecoration(k)))),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 f of this._decorationService.decorations)this._renderDecoration(f);this._dimensionsChanged=!1}_renderDecoration(f){this._refreshStyle(f),this._dimensionsChanged&&this._refreshXPosition(f)}_createElement(f){var p;const a=this._coreBrowserService.mainDocument.createElement("div");a.classList.add("xterm-decoration"),a.classList.toggle("xterm-decoration-top-layer",((p=f==null?void 0:f.options)==null?void 0:p.layer)==="top"),a.style.width=`${Math.round((f.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,a.style.height=(f.options.height||1)*this._renderService.dimensions.css.cell.height+"px",a.style.top=(f.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 m=f.options.x??0;return m&&m>this._bufferService.cols&&(a.style.display="none"),this._refreshXPosition(f,a),a}_refreshStyle(f){const a=f.marker.line-this._bufferService.buffers.active.ydisp;if(a<0||a>=this._bufferService.rows)f.element&&(f.element.style.display="none",f.onRenderEmitter.fire(f.element));else{let m=this._decorationElements.get(f);m||(m=this._createElement(f),f.element=m,this._decorationElements.set(f,m),this._container.appendChild(m),f.onDispose((()=>{this._decorationElements.delete(f),m.remove()}))),m.style.top=a*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",f.onRenderEmitter.fire(m)}}_refreshXPosition(f,a=f.element){if(!a)return;const m=f.options.x??0;(f.options.anchor||"left")==="right"?a.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":a.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(f){var a;(a=this._decorationElements.get(f))==null||a.remove(),this._decorationElements.delete(f),f.dispose()}};r.BufferDecorationRenderer=L=g([_(1,S.IBufferService),_(2,u.ICoreBrowserService),_(3,S.IDecorationService),_(4,u.IRenderService)],L)},5871:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(c){if(c.options.overviewRulerOptions){for(const g of this._zones)if(g.color===c.options.overviewRulerOptions.color&&g.position===c.options.overviewRulerOptions.position){if(this._lineIntersectsZone(g,c.marker.line))return;if(this._lineAdjacentToZone(g,c.marker.line,c.options.overviewRulerOptions.position))return void this._addLineToZone(g,c.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=c.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=c.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=c.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=c.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:c.options.overviewRulerOptions.color,position:c.options.overviewRulerOptions.position,startBufferLine:c.marker.line,endBufferLine:c.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(c){this._linePadding=c}_lineIntersectsZone(c,g){return g>=c.startBufferLine&&g<=c.endBufferLine}_lineAdjacentToZone(c,g,_){return g>=c.startBufferLine-this._linePadding[_||"full"]&&g<=c.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(c,g){c.startBufferLine=Math.min(c.startBufferLine,g),c.endBufferLine=Math.max(c.endBufferLine,g)}}},5744:function(x,r,c){var g=this&&this.__decorate||function(d,k,D,E){var M,b=arguments.length,T=b<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,D):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(d,k,D,E);else for(var N=d.length-1;N>=0;N--)(M=d[N])&&(T=(b<3?M(T):b>3?M(k,D,T):M(k,D))||T);return b>3&&T&&Object.defineProperty(k,D,T),T},_=this&&this.__param||function(d,k){return function(D,E){k(D,E,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const u=c(5871),y=c(4725),S=c(844),L=c(2585),f={full:0,left:0,center:0,right:0},a={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let p=r.OverviewRulerRenderer=class extends S.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(d,k,D,E,M,b,T){var B;super(),this._viewportElement=d,this._screenElement=k,this._bufferService=D,this._decorationService=E,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(),(B=this._viewportElement.parentElement)==null||B.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 F;(F=this._canvas)==null||F.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const d=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);a.full=this._canvas.width,a.left=d,a.center=k,a.right=d,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=a.left,m.right=a.left+a.center}_refreshDrawHeightConstants(){f.full=Math.round(2*this._coreBrowserService.dpr);const d=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(d,12),6)*this._coreBrowserService.dpr);f.left=k,f.center=k,f.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.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 k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const d=this._colorZoneStore.zones;for(const k of d)k.position!=="full"&&this._renderColorZone(k);for(const k of d)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(d){this._ctx.fillStyle=d.color,this._ctx.fillRect(m[d.position||"full"],Math.round((this._canvas.height-1)*(d.startBufferLine/this._bufferService.buffers.active.lines.length)-f[d.position||"full"]/2),a[d.position||"full"],Math.round((this._canvas.height-1)*((d.endBufferLine-d.startBufferLine)/this._bufferService.buffers.active.lines.length)+f[d.position||"full"]))}_queueRefresh(d,k){this._shouldUpdateDimensions=d||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=p=g([_(2,L.IBufferService),_(3,L.IDecorationService),_(4,y.IRenderService),_(5,L.IOptionsService),_(6,y.ICoreBrowserService)],p)},2950:function(x,r,c){var g=this&&this.__decorate||function(f,a,m,p){var d,k=arguments.length,D=k<3?a:p===null?p=Object.getOwnPropertyDescriptor(a,m):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(f,a,m,p);else for(var E=f.length-1;E>=0;E--)(d=f[E])&&(D=(k<3?d(D):k>3?d(a,m,D):d(a,m))||D);return k>3&&D&&Object.defineProperty(a,m,D),D},_=this&&this.__param||function(f,a){return function(m,p){a(m,p,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const u=c(4725),y=c(2585),S=c(2584);let L=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(f,a,m,p,d,k){this._textarea=f,this._compositionView=a,this._bufferService=m,this._optionsService=p,this._coreService=d,this._renderService=k,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(f){this._compositionView.textContent=f.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(f){if(this._isComposing||this._isSendingComposition){if(f.keyCode===229||f.keyCode===16||f.keyCode===17||f.keyCode===18)return!1;this._finalizeComposition(!1)}return f.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(f){if(this._compositionView.classList.remove("active"),this._isComposing=!1,f){const a={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,a.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(a.start,a.end):this._textarea.value.substring(a.start),m.length>0&&this._coreService.triggerDataEvent(m,!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 f=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const a=this._textarea.value,m=a.replace(f,"");this._dataAlreadySent=m,a.length>f.length?this._coreService.triggerDataEvent(m,!0):a.length<f.length?this._coreService.triggerDataEvent(`${S.C0.DEL}`,!0):a.length===f.length&&a!==f&&this._coreService.triggerDataEvent(a,!0)}}),0)}updateCompositionElements(f){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const a=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),m=this._renderService.dimensions.css.cell.height,p=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,d=a*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=d+"px",this._compositionView.style.top=p+"px",this._compositionView.style.height=m+"px",this._compositionView.style.lineHeight=m+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=d+"px",this._textarea.style.top=p+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}f||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=L=g([_(2,y.IBufferService),_(3,y.IOptionsService),_(4,y.ICoreService),_(5,u.IRenderService)],L)},9806:(x,r)=>{function c(g,_,u){const y=u.getBoundingClientRect(),S=g.getComputedStyle(u),L=parseInt(S.getPropertyValue("padding-left")),f=parseInt(S.getPropertyValue("padding-top"));return[_.clientX-y.left-L,_.clientY-y.top-f]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=c,r.getCoords=function(g,_,u,y,S,L,f,a,m){if(!L)return;const p=c(g,_,u);return p?(p[0]=Math.ceil((p[0]+(m?f/2:0))/f),p[1]=Math.ceil(p[1]/a),p[0]=Math.min(Math.max(p[0],1),y+(m?1:0)),p[1]=Math.min(Math.max(p[1],1),S),p):void 0}},9504:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const g=c(2584);function _(a,m,p,d){const k=a-u(a,p),D=m-u(m,p),E=Math.abs(k-D)-(function(M,b,T){let N=0;const B=M-u(M,T),F=b-u(b,T);for(let O=0;O<Math.abs(B-F);O++){const U=y(M,b)==="A"?-1:1,V=T.buffer.lines.get(B+U*O);V!=null&&V.isWrapped&&N++}return N})(a,m,p);return f(E,L(y(a,m),d))}function u(a,m){let p=0,d=m.buffer.lines.get(a),k=d==null?void 0:d.isWrapped;for(;k&&a>=0&&a<m.rows;)p++,d=m.buffer.lines.get(--a),k=d==null?void 0:d.isWrapped;return p}function y(a,m){return a>m?"A":"B"}function S(a,m,p,d,k,D){let E=a,M=m,b="";for(;E!==p||M!==d;)E+=k?1:-1,k&&E>D.cols-1?(b+=D.buffer.translateBufferLineToString(M,!1,a,E),E=0,a=0,M++):!k&&E<0&&(b+=D.buffer.translateBufferLineToString(M,!1,0,a+1),E=D.cols-1,a=E,M--);return b+D.buffer.translateBufferLineToString(M,!1,a,E)}function L(a,m){const p=m?"O":"[";return g.C0.ESC+p+a}function f(a,m){a=Math.floor(a);let p="";for(let d=0;d<a;d++)p+=m;return p}r.moveToCellSequence=function(a,m,p,d){const k=p.buffer.x,D=p.buffer.y;if(!p.buffer.hasScrollback)return(function(b,T,N,B,F,O){return _(T,B,F,O).length===0?"":f(S(b,T,b,T-u(T,F),!1,F).length,L("D",O))})(k,D,0,m,p,d)+_(D,m,p,d)+(function(b,T,N,B,F,O){let U;U=_(T,B,F,O).length>0?B-u(B,F):T;const V=B,Y=(function(X,G,P,$,H,q){let ne;return ne=_(P,$,H,q).length>0?$-u($,H):G,X<P&&ne<=$||X>=P&&ne<$?"C":"D"})(b,T,N,B,F,O);return f(S(b,U,N,V,Y==="C",F).length,L(Y,O))})(k,D,a,m,p,d);let E;if(D===m)return E=k>a?"D":"C",f(Math.abs(k-a),L(E,d));E=D>m?"D":"C";const M=Math.abs(D-m);return f((function(b,T){return T.cols-b})(D>m?a:k,p)+(M-1)*p.cols+1+((D>m?k:a)-1),L(E,d))}},1296:function(x,r,c){var g=this&&this.__decorate||function(O,U,V,Y){var X,G=arguments.length,P=G<3?U:Y===null?Y=Object.getOwnPropertyDescriptor(U,V):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(O,U,V,Y);else for(var $=O.length-1;$>=0;$--)(X=O[$])&&(P=(G<3?X(P):G>3?X(U,V,P):X(U,V))||P);return G>3&&P&&Object.defineProperty(U,V,P),P},_=this&&this.__param||function(O,U){return function(V,Y){U(V,Y,O)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const u=c(3787),y=c(2550),S=c(2223),L=c(6171),f=c(6052),a=c(4725),m=c(8055),p=c(8460),d=c(844),k=c(2585),D="xterm-dom-renderer-owner-",E="xterm-rows",M="xterm-fg-",b="xterm-bg-",T="xterm-focus",N="xterm-selection";let B=1,F=r.DomRenderer=class extends d.Disposable{constructor(O,U,V,Y,X,G,P,$,H,q,ne,re,ue){super(),this._terminal=O,this._document=U,this._element=V,this._screenElement=Y,this._viewportElement=X,this._helperContainer=G,this._linkifier2=P,this._charSizeService=H,this._optionsService=q,this._bufferService=ne,this._coreBrowserService=re,this._themeService=ue,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,f.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new p.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(E),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(N),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,L.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((de=>this._injectCss(de)))),this._injectCss(this._themeService.colors),this._rowFactory=$.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((de=>this._handleLinkHover(de)))),this.register(this._linkifier2.onHideLinkUnderline((de=>this._handleLinkLeave(de)))),this.register((0,d.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 O=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*O,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*O),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/O),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/O),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 V of this._rowElements)V.style.width=`${this.dimensions.css.canvas.width}px`,V.style.height=`${this.dimensions.css.cell.height}px`,V.style.lineHeight=`${this.dimensions.css.cell.height}px`,V.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const U=`${this._terminalSelector} .${E} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=U,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(O){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let U=`${this._terminalSelector} .${E} { color: ${O.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;U+=`${this._terminalSelector} .${E} .xterm-dim { color: ${m.color.multiplyOpacity(O.foreground,.5).css};}`,U+=`${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 V=`blink_underline_${this._terminalClass}`,Y=`blink_bar_${this._terminalClass}`,X=`blink_block_${this._terminalClass}`;U+=`@keyframes ${V} { 50% { border-bottom-style: hidden; }}`,U+=`@keyframes ${Y} { 50% { box-shadow: none; }}`,U+=`@keyframes ${X} { 0% { background-color: ${O.cursor.css}; color: ${O.cursorAccent.css}; } 50% { background-color: inherit; color: ${O.cursor.css}; }}`,U+=`${this._terminalSelector} .${E}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${E}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${E}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block { background-color: ${O.cursor.css}; color: ${O.cursorAccent.css};}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${O.cursor.css} !important; color: ${O.cursorAccent.css} !important;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${O.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${O.cursor.css} inset;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${O.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,U+=`${this._terminalSelector} .${N} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${N} div { position: absolute; background-color: ${O.selectionBackgroundOpaque.css};}${this._terminalSelector} .${N} div { position: absolute; background-color: ${O.selectionInactiveBackgroundOpaque.css};}`;for(const[G,P]of O.ansi.entries())U+=`${this._terminalSelector} .${M}${G} { color: ${P.css}; }${this._terminalSelector} .${M}${G}.xterm-dim { color: ${m.color.multiplyOpacity(P,.5).css}; }${this._terminalSelector} .${b}${G} { background-color: ${P.css}; }`;U+=`${this._terminalSelector} .${M}${S.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(O.background).css}; }${this._terminalSelector} .${M}${S.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(O.background),.5).css}; }${this._terminalSelector} .${b}${S.INVERTED_DEFAULT_COLOR} { background-color: ${O.foreground.css}; }`,this._themeStyleElement.textContent=U}_setDefaultSpacing(){const O=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${O}px`,this._rowFactory.defaultSpacing=O}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(O,U){for(let V=this._rowElements.length;V<=U;V++){const Y=this._document.createElement("div");this._rowContainer.appendChild(Y),this._rowElements.push(Y)}for(;this._rowElements.length>U;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(O,U){this._refreshRowElements(O,U),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(O,U,V){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(O,U,V),this.renderRows(0,this._bufferService.rows-1),!O||!U)return;this._selectionRenderModel.update(this._terminal,O,U,V);const Y=this._selectionRenderModel.viewportStartRow,X=this._selectionRenderModel.viewportEndRow,G=this._selectionRenderModel.viewportCappedStartRow,P=this._selectionRenderModel.viewportCappedEndRow;if(G>=this._bufferService.rows||P<0)return;const $=this._document.createDocumentFragment();if(V){const H=O[0]>U[0];$.appendChild(this._createSelectionElement(G,H?U[0]:O[0],H?O[0]:U[0],P-G+1))}else{const H=Y===G?O[0]:0,q=G===X?U[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(G,H,q));const ne=P-G-1;if($.appendChild(this._createSelectionElement(G+1,0,this._bufferService.cols,ne)),G!==P){const re=X===P?U[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(P,0,re))}}this._selectionContainer.appendChild($)}_createSelectionElement(O,U,V,Y=1){const X=this._document.createElement("div"),G=U*this.dimensions.css.cell.width;let P=this.dimensions.css.cell.width*(V-U);return G+P>this.dimensions.css.canvas.width&&(P=this.dimensions.css.canvas.width-G),X.style.height=Y*this.dimensions.css.cell.height+"px",X.style.top=O*this.dimensions.css.cell.height+"px",X.style.left=`${G}px`,X.style.width=`${P}px`,X}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 O of this._rowElements)O.replaceChildren()}renderRows(O,U){const V=this._bufferService.buffer,Y=V.ybase+V.y,X=Math.min(V.x,this._bufferService.cols-1),G=this._optionsService.rawOptions.cursorBlink,P=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let H=O;H<=U;H++){const q=H+V.ydisp,ne=this._rowElements[H],re=V.lines.get(q);if(!ne||!re)break;ne.replaceChildren(...this._rowFactory.createRow(re,q,q===Y,P,$,X,G,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${D}${this._terminalClass}`}_handleLinkHover(O){this._setCellUnderline(O.x1,O.x2,O.y1,O.y2,O.cols,!0)}_handleLinkLeave(O){this._setCellUnderline(O.x1,O.x2,O.y1,O.y2,O.cols,!1)}_setCellUnderline(O,U,V,Y,X,G){V<0&&(O=0),Y<0&&(U=0);const P=this._bufferService.rows-1;V=Math.max(Math.min(V,P),0),Y=Math.max(Math.min(Y,P),0),X=Math.min(X,this._bufferService.cols);const $=this._bufferService.buffer,H=$.ybase+$.y,q=Math.min($.x,X-1),ne=this._optionsService.rawOptions.cursorBlink,re=this._optionsService.rawOptions.cursorStyle,ue=this._optionsService.rawOptions.cursorInactiveStyle;for(let de=V;de<=Y;++de){const K=de+$.ydisp,W=this._rowElements[de],J=$.lines.get(K);if(!W||!J)break;W.replaceChildren(...this._rowFactory.createRow(J,K,K===H,re,ue,q,ne,this.dimensions.css.cell.width,this._widthCache,G?de===V?O:0:-1,G?(de===Y?U:X)-1:-1))}}};r.DomRenderer=F=g([_(7,k.IInstantiationService),_(8,a.ICharSizeService),_(9,k.IOptionsService),_(10,k.IBufferService),_(11,a.ICoreBrowserService),_(12,a.IThemeService)],F)},3787:function(x,r,c){var g=this&&this.__decorate||function(E,M,b,T){var N,B=arguments.length,F=B<3?M:T===null?T=Object.getOwnPropertyDescriptor(M,b):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(E,M,b,T);else for(var O=E.length-1;O>=0;O--)(N=E[O])&&(F=(B<3?N(F):B>3?N(M,b,F):N(M,b))||F);return B>3&&F&&Object.defineProperty(M,b,F),F},_=this&&this.__param||function(E,M){return function(b,T){M(b,T,E)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const u=c(2223),y=c(643),S=c(511),L=c(2585),f=c(8055),a=c(4725),m=c(4269),p=c(6171),d=c(3734);let k=r.DomRendererRowFactory=class{constructor(E,M,b,T,N,B,F){this._document=E,this._characterJoinerService=M,this._optionsService=b,this._coreBrowserService=T,this._coreService=N,this._decorationService=B,this._themeService=F,this._workCell=new S.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(E,M,b){this._selectionStart=E,this._selectionEnd=M,this._columnSelectMode=b}createRow(E,M,b,T,N,B,F,O,U,V,Y){const X=[],G=this._characterJoinerService.getJoinedCharacters(M),P=this._themeService.colors;let $,H=E.getNoBgTrimmedLength();b&&H<B+1&&(H=B+1);let q=0,ne="",re=0,ue=0,de=0,K=!1,W=0,J=!1,Z=0;const pe=[],me=V!==-1&&Y!==-1;for(let ie=0;ie<H;ie++){E.loadCell(ie,this._workCell);let Le=this._workCell.getWidth();if(Le===0)continue;let Ae=!1,Xe=ie,Ce=this._workCell;if(G.length>0&&ie===G[0][0]){Ae=!0;const Ve=G.shift();Ce=new m.JoinedCellData(this._workCell,E.translateToString(!0,Ve[0],Ve[1]),Ve[1]-Ve[0]),Xe=Ve[1]-1,Le=Ce.getWidth()}const fe=this._isCellInSelection(ie,M),Me=b&&ie===B,_e=me&&ie>=V&&ie<=Y;let Ee=!1;this._decorationService.forEachDecorationAtCell(ie,M,void 0,(Ve=>{Ee=!0}));let Fe=Ce.getChars()||y.WHITESPACE_CELL_CHAR;if(Fe===" "&&(Ce.isUnderline()||Ce.isOverline())&&(Fe=" "),Z=Le*O-U.get(Fe,Ce.isBold(),Ce.isItalic()),$){if(q&&(fe&&J||!fe&&!J&&Ce.bg===re)&&(fe&&J&&P.selectionForeground||Ce.fg===ue)&&Ce.extended.ext===de&&_e===K&&Z===W&&!Me&&!Ae&&!Ee){Ce.isInvisible()?ne+=y.WHITESPACE_CELL_CHAR:ne+=Fe,q++;continue}q&&($.textContent=ne),$=this._document.createElement("span"),q=0,ne=""}else $=this._document.createElement("span");if(re=Ce.bg,ue=Ce.fg,de=Ce.extended.ext,K=_e,W=Z,J=fe,Ae&&B>=ie&&B<=Xe&&(B=ie),!this._coreService.isCursorHidden&&Me&&this._coreService.isCursorInitialized){if(pe.push("xterm-cursor"),this._coreBrowserService.isFocused)F&&pe.push("xterm-cursor-blink"),pe.push(T==="bar"?"xterm-cursor-bar":T==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(N)switch(N){case"outline":pe.push("xterm-cursor-outline");break;case"block":pe.push("xterm-cursor-block");break;case"bar":pe.push("xterm-cursor-bar");break;case"underline":pe.push("xterm-cursor-underline")}}if(Ce.isBold()&&pe.push("xterm-bold"),Ce.isItalic()&&pe.push("xterm-italic"),Ce.isDim()&&pe.push("xterm-dim"),ne=Ce.isInvisible()?y.WHITESPACE_CELL_CHAR:Ce.getChars()||y.WHITESPACE_CELL_CHAR,Ce.isUnderline()&&(pe.push(`xterm-underline-${Ce.extended.underlineStyle}`),ne===" "&&(ne=" "),!Ce.isUnderlineColorDefault()))if(Ce.isUnderlineColorRGB())$.style.textDecorationColor=`rgb(${d.AttributeData.toColorRGB(Ce.getUnderlineColor()).join(",")})`;else{let Ve=Ce.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ce.isBold()&&Ve<8&&(Ve+=8),$.style.textDecorationColor=P.ansi[Ve].css}Ce.isOverline()&&(pe.push("xterm-overline"),ne===" "&&(ne=" ")),Ce.isStrikethrough()&&pe.push("xterm-strikethrough"),_e&&($.style.textDecoration="underline");let Se=Ce.getFgColor(),Ne=Ce.getFgColorMode(),et=Ce.getBgColor(),tt=Ce.getBgColorMode();const Je=!!Ce.isInverse();if(Je){const Ve=Se;Se=et,et=Ve;const st=Ne;Ne=tt,tt=st}let lt,ct,$e,Ze=!1;switch(this._decorationService.forEachDecorationAtCell(ie,M,void 0,(Ve=>{Ve.options.layer!=="top"&&Ze||(Ve.backgroundColorRGB&&(tt=50331648,et=Ve.backgroundColorRGB.rgba>>8&16777215,lt=Ve.backgroundColorRGB),Ve.foregroundColorRGB&&(Ne=50331648,Se=Ve.foregroundColorRGB.rgba>>8&16777215,ct=Ve.foregroundColorRGB),Ze=Ve.options.layer==="top")})),!Ze&&fe&&(lt=this._coreBrowserService.isFocused?P.selectionBackgroundOpaque:P.selectionInactiveBackgroundOpaque,et=lt.rgba>>8&16777215,tt=50331648,Ze=!0,P.selectionForeground&&(Ne=50331648,Se=P.selectionForeground.rgba>>8&16777215,ct=P.selectionForeground)),Ze&&pe.push("xterm-decoration-top"),tt){case 16777216:case 33554432:$e=P.ansi[et],pe.push(`xterm-bg-${et}`);break;case 50331648:$e=f.channels.toColor(et>>16,et>>8&255,255&et),this._addStyle($,`background-color:#${D((et>>>0).toString(16),"0",6)}`);break;default:Je?($e=P.foreground,pe.push(`xterm-bg-${u.INVERTED_DEFAULT_COLOR}`)):$e=P.background}switch(lt||Ce.isDim()&&(lt=f.color.multiplyOpacity($e,.5)),Ne){case 16777216:case 33554432:Ce.isBold()&&Se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Se+=8),this._applyMinimumContrast($,$e,P.ansi[Se],Ce,lt,void 0)||pe.push(`xterm-fg-${Se}`);break;case 50331648:const Ve=f.channels.toColor(Se>>16&255,Se>>8&255,255&Se);this._applyMinimumContrast($,$e,Ve,Ce,lt,ct)||this._addStyle($,`color:#${D(Se.toString(16),"0",6)}`);break;default:this._applyMinimumContrast($,$e,P.foreground,Ce,lt,ct)||Je&&pe.push(`xterm-fg-${u.INVERTED_DEFAULT_COLOR}`)}pe.length&&($.className=pe.join(" "),pe.length=0),Me||Ae||Ee?$.textContent=ne:q++,Z!==this.defaultSpacing&&($.style.letterSpacing=`${Z}px`),X.push($),ie=Xe}return $&&q&&($.textContent=ne),X}_applyMinimumContrast(E,M,b,T,N,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,p.treatGlyphAsBackgroundColor)(T.getCode()))return!1;const F=this._getContrastCache(T);let O;if(N||B||(O=F.getColor(M.rgba,b.rgba)),O===void 0){const U=this._optionsService.rawOptions.minimumContrastRatio/(T.isDim()?2:1);O=f.color.ensureContrastRatio(N||M,B||b,U),F.setColor((N||M).rgba,(B||b).rgba,O??null)}return!!O&&(this._addStyle(E,`color:${O.css}`),!0)}_getContrastCache(E){return E.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(E,M){E.setAttribute("style",`${E.getAttribute("style")||""}${M};`)}_isCellInSelection(E,M){const b=this._selectionStart,T=this._selectionEnd;return!(!b||!T)&&(this._columnSelectMode?b[0]<=T[0]?E>=b[0]&&M>=b[1]&&E<T[0]&&M<=T[1]:E<b[0]&&M>=b[1]&&E>=T[0]&&M<=T[1]:M>b[1]&&M<T[1]||b[1]===T[1]&&M===b[1]&&E>=b[0]&&E<T[0]||b[1]<T[1]&&M===T[1]&&E<T[0]||b[1]<T[1]&&M===b[1]&&E>=b[0])}};function D(E,M,b){for(;E.length<b;)E=M+E;return E}r.DomRendererRowFactory=k=g([_(1,a.ICharacterJoinerService),_(2,L.IOptionsService),_(3,a.ICoreBrowserService),_(4,L.ICoreService),_(5,L.IDecorationService),_(6,a.IThemeService)],k)},2550:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(c,g){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=c.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const _=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),g.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(c,g,_,u){c===this._font&&g===this._fontSize&&_===this._weight&&u===this._weightBold||(this._font=c,this._fontSize=g,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,g,_){let u=0;if(!g&&!_&&c.length===1&&(u=c.charCodeAt(0))<256){if(this._flat[u]!==-9999)return this._flat[u];const L=this._measure(c,0);return L>0&&(this._flat[u]=L),L}let y=c;g&&(y+="B"),_&&(y+="I");let S=this._holey.get(y);if(S===void 0){let L=0;g&&(L|=1),_&&(L|=2),S=this._measure(c,L),S>0&&this._holey.set(y,S)}return S}_measure(c,g){const _=this._measureElements[g];return _.textContent=c.repeat(32),_.offsetWidth/32}}},2223:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const g=c(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=g.isFirefox||g.isLegacyEdge?"bottom":"ideographic"},6171:(x,r)=>{function c(_){return 57508<=_&&_<=57558}function g(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(r,"__esModule",{value:!0}),r.computeNextVariantOffset=r.createRenderDimensions=r.treatGlyphAsBackgroundColor=r.allowRescaling=r.isEmoji=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},r.isPowerlineGlyph=c,r.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},r.isEmoji=g,r.allowRescaling=function(_,u,y,S){return u===1&&y>Math.ceil(1.5*S)&&_!==void 0&&_>255&&!g(_)&&!c(_)&&!(function(L){return 57344<=L&&L<=63743})(_)},r.treatGlyphAsBackgroundColor=function(_){return c(_)||(function(u){return 9472<=u&&u<=9631})(_)},r.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}}}},r.computeNextVariantOffset=function(_,u,y=0){return(_-(2*Math.round(u)-y))%(2*Math.round(u))}},6052:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.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 L=_.buffers.active.ydisp,f=u[1]-L,a=y[1]-L,m=Math.max(f,0),p=Math.min(a,_.rows-1);m>=_.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=S,this.viewportStartRow=f,this.viewportEndRow=a,this.viewportCappedStartRow=m,this.viewportCappedEndRow=p,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)}}r.createSelectionRenderModel=function(){return new c}},456:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(c){this._bufferService=c,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?c%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)-1]:[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[Math.max(c,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const c=this.selectionStart,g=this.selectionEnd;return!(!c||!g)&&(c[1]>g[1]||c[1]===g[1]&&c[0]>g[0])}handleTrim(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(x,r,c){var g=this&&this.__decorate||function(p,d,k,D){var E,M=arguments.length,b=M<3?d:D===null?D=Object.getOwnPropertyDescriptor(d,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,d,k,D);else for(var T=p.length-1;T>=0;T--)(E=p[T])&&(b=(M<3?E(b):M>3?E(d,k,b):E(d,k))||b);return M>3&&b&&Object.defineProperty(d,k,b),b},_=this&&this.__param||function(p,d){return function(k,D){d(k,D,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const u=c(2585),y=c(8460),S=c(844);let L=r.CharSizeService=class extends S.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(p,d,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new y.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new a(p,d,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const p=this._measureStrategy.measure();p.width===this.width&&p.height===this.height||(this.width=p.width,this.height=p.height,this._onCharSizeChange.fire())}};r.CharSizeService=L=g([_(2,u.IOptionsService)],L);class f extends S.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(d,k){d!==void 0&&d>0&&k!==void 0&&k>0&&(this._result.width=d,this._result.height=k)}}class a extends f{constructor(d,k,D){super(),this._document=d,this._parentElement=k,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 m extends f{constructor(d){super(),this._optionsService=d,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const d=this._ctx.measureText("W");return this._validateAndSet(d.width,d.fontBoundingBoxAscent+d.fontBoundingBoxDescent),this._result}}},4269:function(x,r,c){var g=this&&this.__decorate||function(m,p,d,k){var D,E=arguments.length,M=E<3?p:k===null?k=Object.getOwnPropertyDescriptor(p,d):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(m,p,d,k);else for(var b=m.length-1;b>=0;b--)(D=m[b])&&(M=(E<3?D(M):E>3?D(p,d,M):D(p,d))||M);return E>3&&M&&Object.defineProperty(p,d,M),M},_=this&&this.__param||function(m,p){return function(d,k){p(d,k,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const u=c(3734),y=c(643),S=c(511),L=c(2585);class f extends u.AttributeData{constructor(p,d,k){super(),this.content=0,this.combinedData="",this.fg=p.fg,this.bg=p.bg,this.combinedData=d,this._width=k}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()]}}r.JoinedCellData=f;let a=r.CharacterJoinerService=class Dm{constructor(p){this._bufferService=p,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new S.CellData}register(p){const d={id:this._nextCharacterJoinerId++,handler:p};return this._characterJoiners.push(d),d.id}deregister(p){for(let d=0;d<this._characterJoiners.length;d++)if(this._characterJoiners[d].id===p)return this._characterJoiners.splice(d,1),!0;return!1}getJoinedCharacters(p){if(this._characterJoiners.length===0)return[];const d=this._bufferService.buffer.lines.get(p);if(!d||d.length===0)return[];const k=[],D=d.translateToString(!0);let E=0,M=0,b=0,T=d.getFg(0),N=d.getBg(0);for(let B=0;B<d.getTrimmedLength();B++)if(d.loadCell(B,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==T||this._workCell.bg!==N){if(B-E>1){const F=this._getJoinedRanges(D,b,M,d,E);for(let O=0;O<F.length;O++)k.push(F[O])}E=B,b=M,T=this._workCell.fg,N=this._workCell.bg}M+=this._workCell.getChars().length||y.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-E>1){const B=this._getJoinedRanges(D,b,M,d,E);for(let F=0;F<B.length;F++)k.push(B[F])}return k}_getJoinedRanges(p,d,k,D,E){const M=p.substring(d,k);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 B=0;B<N.length;B++)Dm._mergeRanges(b,N[B])}catch(N){console.error(N)}return this._stringRangesToCellRanges(b,D,E),b}_stringRangesToCellRanges(p,d,k){let D=0,E=!1,M=0,b=p[D];if(b){for(let T=k;T<this._bufferService.cols;T++){const N=d.getWidth(T),B=d.getString(T).length||y.WHITESPACE_CELL_CHAR.length;if(N!==0){if(!E&&b[0]<=M&&(b[0]=T,E=!0),b[1]<=M){if(b[1]=T,b=p[++D],!b)break;b[0]<=M?(b[0]=T,E=!0):E=!1}M+=B}}b&&(b[1]=this._bufferService.cols)}}static _mergeRanges(p,d){let k=!1;for(let D=0;D<p.length;D++){const E=p[D];if(k){if(d[1]<=E[0])return p[D-1][1]=d[1],p;if(d[1]<=E[1])return p[D-1][1]=Math.max(d[1],E[1]),p.splice(D,1),p;p.splice(D,1),D--}else{if(d[1]<=E[0])return p.splice(D,0,d),p;if(d[1]<=E[1])return E[0]=Math.min(d[0],E[0]),p;d[0]<E[1]&&(E[0]=Math.min(d[0],E[0]),k=!0)}}return k?p[p.length-1][1]=d[1]:p.push(d),p}};r.CharacterJoinerService=a=g([_(0,L.IBufferService)],a)},5114:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;const g=c(844),_=c(8460),u=c(3656);class y extends g.Disposable{constructor(f,a,m){super(),this._textarea=f,this._window=a,this.mainDocument=m,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((p=>this._screenDprMonitor.setWindow(p)))),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(f){this._window!==f&&(this._window=f,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}}r.CoreBrowserService=y;class S extends g.Disposable{constructor(f){super(),this._parentWindow=f,this._windowResizeListener=this.register(new g.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,g.toDisposable)((()=>this.clearListener())))}setWindow(f){this._parentWindow=f,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 f;this._outerListener&&((f=this._resolutionMediaMatchList)==null||f.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:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;const g=c(844);class _ extends g.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,g.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)}}}}r.LinkProviderService=_},8934:function(x,r,c){var g=this&&this.__decorate||function(L,f,a,m){var p,d=arguments.length,k=d<3?f:m===null?m=Object.getOwnPropertyDescriptor(f,a):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(L,f,a,m);else for(var D=L.length-1;D>=0;D--)(p=L[D])&&(k=(d<3?p(k):d>3?p(f,a,k):p(f,a))||k);return d>3&&k&&Object.defineProperty(f,a,k),k},_=this&&this.__param||function(L,f){return function(a,m){f(a,m,L)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const u=c(4725),y=c(9806);let S=r.MouseService=class{constructor(L,f){this._renderService=L,this._charSizeService=f}getCoords(L,f,a,m,p){return(0,y.getCoords)(window,L,f,a,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,p)}getMouseReportCoords(L,f){const a=(0,y.getCoordsRelativeToElement)(window,L,f);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])}}};r.MouseService=S=g([_(0,u.IRenderService),_(1,u.ICharSizeService)],S)},3230:function(x,r,c){var g=this&&this.__decorate||function(p,d,k,D){var E,M=arguments.length,b=M<3?d:D===null?D=Object.getOwnPropertyDescriptor(d,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,d,k,D);else for(var T=p.length-1;T>=0;T--)(E=p[T])&&(b=(M<3?E(b):M>3?E(d,k,b):E(d,k))||b);return M>3&&b&&Object.defineProperty(d,k,b),b},_=this&&this.__param||function(p,d){return function(k,D){d(k,D,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const u=c(6193),y=c(4725),S=c(8460),L=c(844),f=c(7226),a=c(2585);let m=r.RenderService=class extends L.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(p,d,k,D,E,M,b,T){super(),this._rowCount=p,this._charSizeService=D,this._renderer=this.register(new L.MutableDisposable),this._pausedResizeTask=new f.DebouncedIdleTask,this._observerDisposable=this.register(new L.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,B)=>this._renderRows(N,B)),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(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(E.onDecorationRegistered((()=>this._fullRefresh()))),this.register(E.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(M.cols,M.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(M.buffer.y,M.buffer.y,!0)))),this.register(T.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(b.window,d),this.register(b.onWindowChange((N=>this._registerIntersectionObserver(N,d))))}_registerIntersectionObserver(p,d){if("IntersectionObserver"in p){const k=new p.IntersectionObserver((D=>this._handleIntersectionChange(D[D.length-1])),{threshold:0});k.observe(d),this._observerDisposable.value=(0,L.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(p){this._isPaused=p.isIntersecting===void 0?p.intersectionRatio===0:!p.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(p,d,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(p,d,this._rowCount))}_renderRows(p,d){this._renderer.value&&(p=Math.min(p,this._rowCount-1),d=Math.min(d,this._rowCount-1),this._renderer.value.renderRows(p,d),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:p,end:d}),this._onRender.fire({start:p,end:d}),this._isNextRenderRedrawOnly=!0)}resize(p,d){this._rowCount=d,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(p){this._renderer.value=p,this._renderer.value&&(this._renderer.value.onRequestRedraw((d=>this.refreshRows(d.start,d.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(p){return this._renderDebouncer.addRefreshCallback(p)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var p,d;this._renderer.value&&((d=(p=this._renderer.value).clearTextureAtlas)==null||d.call(p),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(p,d){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var k;return(k=this._renderer.value)==null?void 0:k.handleResize(p,d)})):this._renderer.value.handleResize(p,d),this._fullRefresh())}handleCharSizeChanged(){var p;(p=this._renderer.value)==null||p.handleCharSizeChanged()}handleBlur(){var p;(p=this._renderer.value)==null||p.handleBlur()}handleFocus(){var p;(p=this._renderer.value)==null||p.handleFocus()}handleSelectionChanged(p,d,k){var D;this._selectionState.start=p,this._selectionState.end=d,this._selectionState.columnSelectMode=k,(D=this._renderer.value)==null||D.handleSelectionChanged(p,d,k)}handleCursorMove(){var p;(p=this._renderer.value)==null||p.handleCursorMove()}clear(){var p;(p=this._renderer.value)==null||p.clear()}};r.RenderService=m=g([_(2,a.IOptionsService),_(3,y.ICharSizeService),_(4,a.IDecorationService),_(5,a.IBufferService),_(6,y.ICoreBrowserService),_(7,y.IThemeService)],m)},9312:function(x,r,c){var g=this&&this.__decorate||function(b,T,N,B){var F,O=arguments.length,U=O<3?T:B===null?B=Object.getOwnPropertyDescriptor(T,N):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(b,T,N,B);else for(var V=b.length-1;V>=0;V--)(F=b[V])&&(U=(O<3?F(U):O>3?F(T,N,U):F(T,N))||U);return O>3&&U&&Object.defineProperty(T,N,U),U},_=this&&this.__param||function(b,T){return function(N,B){T(N,B,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const u=c(9806),y=c(9504),S=c(456),L=c(4725),f=c(8460),a=c(844),m=c(6114),p=c(4841),d=c(511),k=c(2585),D=" ",E=new RegExp(D,"g");let M=r.SelectionService=class extends a.Disposable{constructor(b,T,N,B,F,O,U,V,Y){super(),this._element=b,this._screenElement=T,this._linkifier=N,this._bufferService=B,this._coreService=F,this._mouseService=O,this._optionsService=U,this._renderService=V,this._coreBrowserService=Y,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new d.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new f.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new f.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new f.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=X=>this._handleMouseMove(X),this._mouseUpListener=X=>this._handleMouseUp(X),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((X=>this._handleTrim(X))),this.register(this._bufferService.buffers.onBufferActivate((X=>this._handleBufferActivate(X)))),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,B=[];if(this._activeSelectionMode===3){if(b[0]===T[0])return"";const F=b[0]<T[0]?b[0]:T[0],O=b[0]<T[0]?T[0]:b[0];for(let U=b[1];U<=T[1];U++){const V=N.translateBufferLineToString(U,!0,F,O);B.push(V)}}else{const F=b[1]===T[1]?T[0]:void 0;B.push(N.translateBufferLineToString(b[1],!0,b[0],F));for(let O=b[1]+1;O<=T[1]-1;O++){const U=N.lines.get(O),V=N.translateBufferLineToString(O,!0);U!=null&&U.isWrapped?B[B.length-1]+=V:B.push(V)}if(b[1]!==T[1]){const O=N.lines.get(T[1]),U=N.translateBufferLineToString(T[1],!0,0,T[0]);O&&O.isWrapped?B[B.length-1]+=U:B.push(U)}}return B.map((F=>F.replace(E," "))).join(m.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()))),m.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,B=this._model.finalSelectionEnd;return!!(N&&B&&T)&&this._areCoordsInSelection(T,N,B)}isCellInSelection(b,T){const N=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!N||!B)&&this._areCoordsInSelection([b,T],N,B)}_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 F,O;const N=(O=(F=this._linkifier.currentLink)==null?void 0:F.link)==null?void 0:O.range;if(N)return this._model.selectionStart=[N.start.x-1,N.start.y-1],this._model.selectionStartLength=(0,p.getRangeLength)(N,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(b);return!!B&&(this._selectWordAt(B,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 m.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&&!(m.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 B=N.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}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 B=(0,y.moveToCellSequence)(N[0]-1,N[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!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 B=0;T>=B;B++){const F=b.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?N--:F>1&&T!==B&&(N+=F-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,B=!0){if(b[0]>=this._bufferService.cols)return;const F=this._bufferService.buffer,O=F.lines.get(b[1]);if(!O)return;const U=F.translateBufferLineToString(b[1],!1);let V=this._convertViewportColToCharacterIndex(O,b[0]),Y=V;const X=b[0]-V;let G=0,P=0,$=0,H=0;if(U.charAt(V)===" "){for(;V>0&&U.charAt(V-1)===" ";)V--;for(;Y<U.length&&U.charAt(Y+1)===" ";)Y++}else{let re=b[0],ue=b[0];O.getWidth(re)===0&&(G++,re--),O.getWidth(ue)===2&&(P++,ue++);const de=O.getString(ue).length;for(de>1&&(H+=de-1,Y+=de-1);re>0&&V>0&&!this._isCharWordSeparator(O.loadCell(re-1,this._workCell));){O.loadCell(re-1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===0?(G++,re--):K>1&&($+=K-1,V-=K-1),V--,re--}for(;ue<O.length&&Y+1<U.length&&!this._isCharWordSeparator(O.loadCell(ue+1,this._workCell));){O.loadCell(ue+1,this._workCell);const K=this._workCell.getChars().length;this._workCell.getWidth()===2?(P++,ue++):K>1&&(H+=K-1,Y+=K-1),Y++,ue++}}Y++;let q=V+X-G+$,ne=Math.min(this._bufferService.cols,Y-V+G+P-$-H);if(T||U.slice(V,Y).trim()!==""){if(N&&q===0&&O.getCodePoint(0)!==32){const re=F.lines.get(b[1]-1);if(re&&O.isWrapped&&re.getCodePoint(this._bufferService.cols-1)!==32){const ue=this._getWordAt([this._bufferService.cols-1,b[1]-1],!1,!0,!1);if(ue){const de=this._bufferService.cols-ue.start;q-=de,ne+=de}}}if(B&&q+ne===this._bufferService.cols&&O.getCodePoint(this._bufferService.cols-1)!==32){const re=F.lines.get(b[1]+1);if(re!=null&&re.isWrapped&&re.getCodePoint(0)!==32){const ue=this._getWordAt([0,b[1]+1],!1,!1,!0);ue&&(ne+=ue.length)}}return{start:q,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,p.getRangeLength)(N,this._bufferService.cols)}};r.SelectionService=M=g([_(3,k.IBufferService),_(4,k.ICoreService),_(5,L.IMouseService),_(6,k.IOptionsService),_(7,L.IRenderService),_(8,L.ICoreBrowserService)],M)},4725:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const g=c(8343);r.ICharSizeService=(0,g.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,g.createDecorator)("CoreBrowserService"),r.IMouseService=(0,g.createDecorator)("MouseService"),r.IRenderService=(0,g.createDecorator)("RenderService"),r.ISelectionService=(0,g.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,g.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,g.createDecorator)("ThemeService"),r.ILinkProviderService=(0,g.createDecorator)("LinkProviderService")},6731:function(x,r,c){var g=this&&this.__decorate||function(M,b,T,N){var B,F=arguments.length,O=F<3?b:N===null?N=Object.getOwnPropertyDescriptor(b,T):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(M,b,T,N);else for(var U=M.length-1;U>=0;U--)(B=M[U])&&(O=(F<3?B(O):F>3?B(b,T,O):B(b,T))||O);return F>3&&O&&Object.defineProperty(b,T,O),O},_=this&&this.__param||function(M,b){return function(T,N){b(T,N,M)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const u=c(7239),y=c(8055),S=c(8460),L=c(844),f=c(2585),a=y.css.toColor("#ffffff"),m=y.css.toColor("#000000"),p=y.css.toColor("#ffffff"),d=y.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.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],B=b[T/6%6|0],F=b[T%6];M.push({css:y.channels.toCss(N,B,F),rgba:y.channels.toRgba(N,B,F)})}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=r.ThemeService=class extends L.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:m,cursor:p,cursorAccent:d,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:y.color.blend(m,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:y.color.blend(m,k),ansi:r.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=E(M.foreground,a),b.background=E(M.background,m),b.cursor=E(M.cursor,p),b.cursorAccent=E(M.cursorAccent,d),b.selectionBackgroundTransparent=E(M.selectionBackground,k),b.selectionBackgroundOpaque=y.color.blend(b.background,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundTransparent=E(M.selectionInactiveBackground,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundOpaque=y.color.blend(b.background,b.selectionInactiveBackgroundTransparent),b.selectionForeground=M.selectionForeground?E(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=r.DEFAULT_ANSI_COLORS.slice(),b.ansi[0]=E(M.black,r.DEFAULT_ANSI_COLORS[0]),b.ansi[1]=E(M.red,r.DEFAULT_ANSI_COLORS[1]),b.ansi[2]=E(M.green,r.DEFAULT_ANSI_COLORS[2]),b.ansi[3]=E(M.yellow,r.DEFAULT_ANSI_COLORS[3]),b.ansi[4]=E(M.blue,r.DEFAULT_ANSI_COLORS[4]),b.ansi[5]=E(M.magenta,r.DEFAULT_ANSI_COLORS[5]),b.ansi[6]=E(M.cyan,r.DEFAULT_ANSI_COLORS[6]),b.ansi[7]=E(M.white,r.DEFAULT_ANSI_COLORS[7]),b.ansi[8]=E(M.brightBlack,r.DEFAULT_ANSI_COLORS[8]),b.ansi[9]=E(M.brightRed,r.DEFAULT_ANSI_COLORS[9]),b.ansi[10]=E(M.brightGreen,r.DEFAULT_ANSI_COLORS[10]),b.ansi[11]=E(M.brightYellow,r.DEFAULT_ANSI_COLORS[11]),b.ansi[12]=E(M.brightBlue,r.DEFAULT_ANSI_COLORS[12]),b.ansi[13]=E(M.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),b.ansi[14]=E(M.brightCyan,r.DEFAULT_ANSI_COLORS[14]),b.ansi[15]=E(M.brightWhite,r.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]=E(M.extendedAnsi[N],r.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 E(M,b){if(M!==void 0)try{return y.css.toColor(M)}catch{}return b}r.ThemeService=D=g([_(0,f.IOptionsService)],D)},6349:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const g=c(8460),_=c(844);class u extends _.Disposable{constructor(S){super(),this._maxLength=S,this.onDeleteEmitter=this.register(new g.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new g.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new g.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(S){if(this._maxLength===S)return;const L=new Array(S);for(let f=0;f<Math.min(S,this.length);f++)L[f]=this._array[this._getCyclicIndex(f)];this._array=L,this._maxLength=S,this._startIndex=0}get length(){return this._length}set length(S){if(S>this._length)for(let L=this._length;L<S;L++)this._array[L]=void 0;this._length=S}get(S){return this._array[this._getCyclicIndex(S)]}set(S,L){this._array[this._getCyclicIndex(S)]=L}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,L,...f){if(L){for(let a=S;a<this._length-L;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+L)];this._length-=L,this.onDeleteEmitter.fire({index:S,amount:L})}for(let a=this._length-1;a>=S;a--)this._array[this._getCyclicIndex(a+f.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<f.length;a++)this._array[this._getCyclicIndex(S+a)]=f[a];if(f.length&&this.onInsertEmitter.fire({index:S,amount:f.length}),this._length+f.length>this._maxLength){const a=this._length+f.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=f.length}trimStart(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)}shiftElements(S,L,f){if(!(L<=0)){if(S<0||S>=this._length)throw new Error("start argument out of range");if(S+f<0)throw new Error("Cannot shift elements in list beyond index 0");if(f>0){for(let m=L-1;m>=0;m--)this.set(S+m+f,this.get(S+m));const a=S+L+f-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<L;a++)this.set(S+a+f,this.get(S+a))}}_getCyclicIndex(S){return(this._startIndex+S)%this._maxLength}}r.CircularList=u},1439:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function c(g,_=5){if(typeof g!="object")return g;const u=Array.isArray(g)?[]:{};for(const y in g)u[y]=_<=1?g[y]:g[y]&&c(g[y],_-1);return u}},8055:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let c=0,g=0,_=0,u=0;var y,S,L,f,a;function m(d){const k=d.toString(16);return k.length<2?"0"+k:k}function p(d,k){return d<k?(k+.05)/(d+.05):(d+.05)/(k+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(d){d.toCss=function(k,D,E,M){return M!==void 0?`#${m(k)}${m(D)}${m(E)}${m(M)}`:`#${m(k)}${m(D)}${m(E)}`},d.toRgba=function(k,D,E,M=255){return(k<<24|D<<16|E<<8|M)>>>0},d.toColor=function(k,D,E,M){return{css:d.toCss(k,D,E,M),rgba:d.toRgba(k,D,E,M)}}})(y||(r.channels=y={})),(function(d){function k(D,E){return u=Math.round(255*E),[c,g,_]=a.toChannels(D.rgba),{css:y.toCss(c,g,_,u),rgba:y.toRgba(c,g,_,u)}}d.blend=function(D,E){if(u=(255&E.rgba)/255,u===1)return{css:E.css,rgba:E.rgba};const M=E.rgba>>24&255,b=E.rgba>>16&255,T=E.rgba>>8&255,N=D.rgba>>24&255,B=D.rgba>>16&255,F=D.rgba>>8&255;return c=N+Math.round((M-N)*u),g=B+Math.round((b-B)*u),_=F+Math.round((T-F)*u),{css:y.toCss(c,g,_),rgba:y.toRgba(c,g,_)}},d.isOpaque=function(D){return(255&D.rgba)==255},d.ensureContrastRatio=function(D,E,M){const b=a.ensureContrastRatio(D.rgba,E.rgba,M);if(b)return y.toColor(b>>24&255,b>>16&255,b>>8&255)},d.opaque=function(D){const E=(255|D.rgba)>>>0;return[c,g,_]=a.toChannels(E),{css:y.toCss(c,g,_),rgba:E}},d.opacity=k,d.multiplyOpacity=function(D,E){return u=255&D.rgba,k(D,u*E/255)},d.toColorRGB=function(D){return[D.rgba>>24&255,D.rgba>>16&255,D.rgba>>8&255]}})(S||(r.color=S={})),(function(d){let k,D;try{const E=document.createElement("canvas");E.width=1,E.height=1;const M=E.getContext("2d",{willReadFrequently:!0});M&&(k=M,k.globalCompositeOperation="copy",D=k.createLinearGradient(0,0,1,1))}catch{}d.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return c=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),y.toColor(c,g,_);case 5:return c=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),u=parseInt(E.slice(4,5).repeat(2),16),y.toColor(c,g,_,u);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const M=E.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(M)return c=parseInt(M[1]),g=parseInt(M[2]),_=parseInt(M[3]),u=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),y.toColor(c,g,_,u);if(!k||!D)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=D,k.fillStyle=E,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[c,g,_,u]=k.getImageData(0,0,1,1).data,u!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:y.toRgba(c,g,_,u),css:E}}})(L||(r.css=L={})),(function(d){function k(D,E,M){const b=D/255,T=E/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))}d.relativeLuminance=function(D){return k(D>>16&255,D>>8&255,255&D)},d.relativeLuminance2=k})(f||(r.rgb=f={})),(function(d){function k(E,M,b){const T=E>>24&255,N=E>>16&255,B=E>>8&255;let F=M>>24&255,O=M>>16&255,U=M>>8&255,V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));for(;V<b&&(F>0||O>0||U>0);)F-=Math.max(0,Math.ceil(.1*F)),O-=Math.max(0,Math.ceil(.1*O)),U-=Math.max(0,Math.ceil(.1*U)),V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));return(F<<24|O<<16|U<<8|255)>>>0}function D(E,M,b){const T=E>>24&255,N=E>>16&255,B=E>>8&255;let F=M>>24&255,O=M>>16&255,U=M>>8&255,V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));for(;V<b&&(F<255||O<255||U<255);)F=Math.min(255,F+Math.ceil(.1*(255-F))),O=Math.min(255,O+Math.ceil(.1*(255-O))),U=Math.min(255,U+Math.ceil(.1*(255-U))),V=p(f.relativeLuminance2(F,O,U),f.relativeLuminance2(T,N,B));return(F<<24|O<<16|U<<8|255)>>>0}d.blend=function(E,M){if(u=(255&M)/255,u===1)return M;const b=M>>24&255,T=M>>16&255,N=M>>8&255,B=E>>24&255,F=E>>16&255,O=E>>8&255;return c=B+Math.round((b-B)*u),g=F+Math.round((T-F)*u),_=O+Math.round((N-O)*u),y.toRgba(c,g,_)},d.ensureContrastRatio=function(E,M,b){const T=f.relativeLuminance(E>>8),N=f.relativeLuminance(M>>8);if(p(T,N)<b){if(N<T){const O=k(E,M,b),U=p(T,f.relativeLuminance(O>>8));if(U<b){const V=D(E,M,b);return U>p(T,f.relativeLuminance(V>>8))?O:V}return O}const B=D(E,M,b),F=p(T,f.relativeLuminance(B>>8));if(F<b){const O=k(E,M,b);return F>p(T,f.relativeLuminance(O>>8))?B:O}return B}},d.reduceLuminance=k,d.increaseLuminance=D,d.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(a||(r.rgba=a={})),r.toPaddedHex=m,r.contrastRatio=p},8969:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const g=c(844),_=c(2585),u=c(4348),y=c(7866),S=c(744),L=c(7302),f=c(6975),a=c(8460),m=c(1753),p=c(1480),d=c(7994),k=c(9282),D=c(5435),E=c(5981),M=c(2660);let b=!1;class T extends g.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new a.EventEmitter),this._onScroll.event((B=>{var F;(F=this._onScrollApi)==null||F.fire(B.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(B){for(const F in B)this.optionsService.options[F]=B[F]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new g.MutableDisposable),this._onBinary=this.register(new 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 L.OptionsService(B)),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(f.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(m.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(p.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(d.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((F=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((F=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new E.WriteBuffer(((F,O)=>this._inputHandler.parse(F,O)))),this.register((0,a.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,F){this._writeBuffer.write(B,F)}writeSync(B,F){this._logService.logLevel<=_.LogLevelEnum.WARN&&!b&&(this._logService.warn("writeSync is unreliable and will be removed soon."),b=!0),this._writeBuffer.writeSync(B,F)}input(B,F=!0){this.coreService.triggerDataEvent(B,F)}resize(B,F){isNaN(B)||isNaN(F)||(B=Math.max(B,S.MINIMUM_COLS),F=Math.max(F,S.MINIMUM_ROWS),this._bufferService.resize(B,F))}scroll(B,F=!1){this._bufferService.scroll(B,F)}scrollLines(B,F,O){this._bufferService.scrollLines(B,F,O)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const F=B-this._bufferService.buffer.ydisp;F!==0&&this.scrollLines(F)}registerEscHandler(B,F){return this._inputHandler.registerEscHandler(B,F)}registerDcsHandler(B,F){return this._inputHandler.registerDcsHandler(B,F)}registerCsiHandler(B,F){return this._inputHandler.registerCsiHandler(B,F)}registerOscHandler(B,F){return this._inputHandler.registerOscHandler(B,F)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const F=this.optionsService.rawOptions.windowsPty;F&&F.buildNumber!==void 0&&F.buildNumber!==void 0?B=F.backend==="conpty"&&F.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,g.toDisposable)((()=>{for(const F of B)F.dispose()}))}}}r.CoreTerminal=T},8460:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=c=>(this._listeners.push(c),{dispose:()=>{if(!this._disposed){for(let g=0;g<this._listeners.length;g++)if(this._listeners[g]===c)return void this._listeners.splice(g,1)}}})),this._event}fire(c,g){const _=[];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,g)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(c,g){return c((_=>g.fire(_)))},r.runAndSubscribe=function(c,g){return g(void 0),c((_=>g(_)))}},5435:function(x,r,c){var g=this&&this.__decorate||function(G,P,$,H){var q,ne=arguments.length,re=ne<3?P:H===null?H=Object.getOwnPropertyDescriptor(P,$):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")re=Reflect.decorate(G,P,$,H);else for(var ue=G.length-1;ue>=0;ue--)(q=G[ue])&&(re=(ne<3?q(re):ne>3?q(P,$,re):q(P,$))||re);return ne>3&&re&&Object.defineProperty(P,$,re),re},_=this&&this.__param||function(G,P){return function($,H){P($,H,G)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const u=c(2584),y=c(7116),S=c(2015),L=c(844),f=c(482),a=c(8437),m=c(8460),p=c(643),d=c(511),k=c(3734),D=c(2585),E=c(1480),M=c(6242),b=c(6351),T=c(5941),N={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function F(G,P){if(G>24)return P.setWinLines||!1;switch(G){case 1:return!!P.restoreWin;case 2:return!!P.minimizeWin;case 3:return!!P.setWinPosition;case 4:return!!P.setWinSizePixels;case 5:return!!P.raiseWin;case 6:return!!P.lowerWin;case 7:return!!P.refreshWin;case 8:return!!P.setWinSizeChars;case 9:return!!P.maximizeWin;case 10:return!!P.fullscreenWin;case 11:return!!P.getWinState;case 13:return!!P.getWinPosition;case 14:return!!P.getWinSizePixels;case 15:return!!P.getScreenSizePixels;case 16:return!!P.getCellSizePixels;case 18:return!!P.getWinSizeChars;case 19:return!!P.getScreenSizeChars;case 20:return!!P.getIconTitle;case 21:return!!P.getWinTitle;case 22:return!!P.pushTitle;case 23:return!!P.popTitle;case 24:return!!P.setWinLines}return!1}var O;(function(G){G[G.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",G[G.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(O||(r.WindowsOptionsReportType=O={}));let U=0;class V extends L.Disposable{getAttrData(){return this._curAttrData}constructor(P,$,H,q,ne,re,ue,de,K=new S.EscapeSequenceParser){super(),this._bufferService=P,this._charsetService=$,this._coreService=H,this._logService=q,this._optionsService=ne,this._oscLinkService=re,this._coreMouseService=ue,this._unicodeService=de,this._parser=K,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new f.StringToUtf32,this._utf8Decoder=new f.Utf8ToUtf32,this._workCell=new d.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 m.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new m.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new m.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new m.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new m.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new m.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new m.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new m.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new m.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new m.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new m.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 Y(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(P,$,H,q){this._parseStack.paused=!0,this._parseStack.cursorStartX=P,this._parseStack.cursorStartY=$,this._parseStack.decodedLength=H,this._parseStack.position=q}_logSlowResolvingAsync(P){this._logService.logLevel<=D.LogLevelEnum.WARN&&Promise.race([P,new Promise((($,H)=>setTimeout((()=>H("#SLOW_TIMEOUT")),5e3)))]).catch(($=>{if($!=="#SLOW_TIMEOUT")throw $;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(P,$){let H,q=this._activeBuffer.x,ne=this._activeBuffer.y,re=0;const ue=this._parseStack.paused;if(ue){if(H=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,$))return this._logSlowResolvingAsync(H),H;q=this._parseStack.cursorStartX,ne=this._parseStack.cursorStartY,this._parseStack.paused=!1,P.length>B&&(re=this._parseStack.position+B)}if(this._logService.logLevel<=D.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof P=="string"?` "${P}"`:` "${Array.prototype.map.call(P,(W=>String.fromCharCode(W))).join("")}"`),typeof P=="string"?P.split("").map((W=>W.charCodeAt(0))):P),this._parseBuffer.length<P.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(P.length,B))),ue||this._dirtyRowTracker.clearRange(),P.length>B)for(let W=re;W<P.length;W+=B){const J=W+B<P.length?W+B:P.length,Z=typeof P=="string"?this._stringDecoder.decode(P.substring(W,J),this._parseBuffer):this._utf8Decoder.decode(P.subarray(W,J),this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,Z))return this._preserveStack(q,ne,Z,W),this._logSlowResolvingAsync(H),H}else if(!ue){const W=typeof P=="string"?this._stringDecoder.decode(P,this._parseBuffer):this._utf8Decoder.decode(P,this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,W))return this._preserveStack(q,ne,W,0),this._logSlowResolvingAsync(H),H}this._activeBuffer.x===q&&this._activeBuffer.y===ne||this._onCursorMove.fire();const de=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(de,this._bufferService.rows-1))}print(P,$,H){let q,ne;const re=this._charsetService.charset,ue=this._optionsService.rawOptions.screenReaderMode,de=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&&H-$>0&&Z.getWidth(this._activeBuffer.x-1)===2&&Z.setCellFromCodepoint(this._activeBuffer.x-1,0,1,J);let pe=this._parser.precedingJoinState;for(let me=$;me<H;++me){if(q=P[me],q<127&&re){const Xe=re[String.fromCharCode(q)];Xe&&(q=Xe.charCodeAt(0))}const ie=this._unicodeService.charProperties(q,pe);ne=E.UnicodeService.extractWidth(ie);const Le=E.UnicodeService.extractShouldJoin(ie),Ae=Le?E.UnicodeService.extractWidth(pe):0;if(pe=ie,ue&&this._onA11yChar.fire((0,f.stringFromCodePoint)(q)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+ne-Ae>de){if(K){const Xe=Z;let Ce=this._activeBuffer.x-Ae;for(this._activeBuffer.x=Ae,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),Ae>0&&Z instanceof a.BufferLine&&Z.copyCellsFrom(Xe,Ce,0,Ae,!1);Ce<de;)Xe.setCellFromCodepoint(Ce++,0,1,J)}else if(this._activeBuffer.x=de-1,ne===2)continue}if(Le&&this._activeBuffer.x){const Xe=Z.getWidth(this._activeBuffer.x-1)?1:2;Z.addCodepointToCell(this._activeBuffer.x-Xe,q,ne);for(let Ce=ne-Ae;--Ce>=0;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,J)}else if(W&&(Z.insertCells(this._activeBuffer.x,ne-Ae,this._activeBuffer.getNullCell(J)),Z.getWidth(de-1)===2&&Z.setCellFromCodepoint(de-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,J)),Z.setCellFromCodepoint(this._activeBuffer.x++,q,ne,J),ne>0)for(;--ne;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,J)}this._parser.precedingJoinState=pe,this._activeBuffer.x<de&&H-$>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(P,$){return P.final!=="t"||P.prefix||P.intermediates?this._parser.registerCsiHandler(P,$):this._parser.registerCsiHandler(P,(H=>!F(H.params[0],this._optionsService.rawOptions.windowOptions)||$(H)))}registerDcsHandler(P,$){return this._parser.registerDcsHandler(P,new b.DcsHandler($))}registerEscHandler(P,$){return this._parser.registerEscHandler(P,$)}registerOscHandler(P,$){return this._parser.registerOscHandler(P,new M.OscHandler($))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var P;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&P.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);$.hasWidth(this._activeBuffer.x)&&!$.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const P=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-P),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(P=this._bufferService.cols-1){this._activeBuffer.x=Math.min(P,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(P,$){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=P,this._activeBuffer.y=this._activeBuffer.scrollTop+$):(this._activeBuffer.x=P,this._activeBuffer.y=$),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(P,$){this._restrictCursor(),this._setCursor(this._activeBuffer.x+P,this._activeBuffer.y+$)}cursorUp(P){const $=this._activeBuffer.y-this._activeBuffer.scrollTop;return $>=0?this._moveCursor(0,-Math.min($,P.params[0]||1)):this._moveCursor(0,-(P.params[0]||1)),!0}cursorDown(P){const $=this._activeBuffer.scrollBottom-this._activeBuffer.y;return $>=0?this._moveCursor(0,Math.min($,P.params[0]||1)):this._moveCursor(0,P.params[0]||1),!0}cursorForward(P){return this._moveCursor(P.params[0]||1,0),!0}cursorBackward(P){return this._moveCursor(-(P.params[0]||1),0),!0}cursorNextLine(P){return this.cursorDown(P),this._activeBuffer.x=0,!0}cursorPrecedingLine(P){return this.cursorUp(P),this._activeBuffer.x=0,!0}cursorCharAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(P){return this._setCursor(P.length>=2?(P.params[1]||1)-1:0,(P.params[0]||1)-1),!0}charPosAbsolute(P){return this._setCursor((P.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(P){return this._moveCursor(P.params[0]||1,0),!0}linePosAbsolute(P){return this._setCursor(this._activeBuffer.x,(P.params[0]||1)-1),!0}vPositionRelative(P){return this._moveCursor(0,P.params[0]||1),!0}hVPosition(P){return this.cursorPosition(P),!0}tabClear(P){const $=P.params[0];return $===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:$===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=P.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(P){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=P.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(P){const $=P.params[0];return $===1&&(this._curAttrData.bg|=536870912),$!==2&&$!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(P,$,H,q=!1,ne=!1){const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);re.replaceCells($,H,this._activeBuffer.getNullCell(this._eraseAttrData()),ne),q&&(re.isWrapped=!1)}_resetBufferLine(P,$=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+P);H&&(H.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),$),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+P),H.isWrapped=!1)}eraseInDisplay(P,$=!1){let H;switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);H<this._bufferService.rows;H++)this._resetBufferLine(H,$);this._dirtyRowTracker.markDirty(H);break;case 1:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H,0,this._activeBuffer.x+1,!0,$),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(H+1).isWrapped=!1);H--;)this._resetBufferLine(H,$);this._dirtyRowTracker.markDirty(0);break;case 2:for(H=this._bufferService.rows,this._dirtyRowTracker.markDirty(H-1);H--;)this._resetBufferLine(H,$);this._dirtyRowTracker.markDirty(0);break;case 3:const q=this._activeBuffer.lines.length-this._bufferService.rows;q>0&&(this._activeBuffer.lines.trimStart(q),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-q,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-q,0),this._onScroll.fire(0))}return!0}eraseInLine(P,$=!1){switch(this._restrictCursor(this._bufferService.cols),P.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,$);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,$)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(P){this._restrictCursor();let $=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y,q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,ne=this._bufferService.rows-1+this._activeBuffer.ybase-q+1;for(;$--;)this._activeBuffer.lines.splice(ne-1,1),this._activeBuffer.lines.splice(H,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(P){this._restrictCursor();let $=P.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y;let q;for(q=this._bufferService.rows-1-this._activeBuffer.scrollBottom,q=this._bufferService.rows-1+this._activeBuffer.ybase-q;$--;)this._activeBuffer.lines.splice(H,1),this._activeBuffer.lines.splice(q,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(P){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.insertCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(P){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.deleteCells(this._activeBuffer.x,P.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(P){let $=P.params[0]||1;for(;$--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(P){let $=P.params[0]||1;for(;$--;)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(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=P.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);q.deleteCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=P.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);q.insertCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=P.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);q.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(P){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=P.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);q.deleteCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),q.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(P){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(P.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(P){const $=this._parser.precedingJoinState;if(!$)return!0;const H=P.params[0]||1,q=E.UnicodeService.extractWidth($),ne=this._activeBuffer.x-q,re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(ne),ue=new Uint32Array(re.length*H);let de=0;for(let W=0;W<re.length;){const J=re.codePointAt(W)||0;ue[de++]=J,W+=J>65535?2:1}let K=de;for(let W=1;W<H;++W)ue.copyWithin(K,0,de),K+=de;return this.print(ue,0,K),!0}sendDeviceAttributesPrimary(P){return P.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(P){return P.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(P.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(u.C0.ESC+"[>83;40003;0c")),!0}_is(P){return(this._optionsService.rawOptions.termName+"").indexOf(P)===0}setMode(P){for(let $=0;$<P.length;$++)switch(P.params[$]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(P){for(let $=0;$<P.length;$++)switch(P.params[$]){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(P){for(let $=0;$<P.length;$++)switch(P.params[$]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(P){for(let $=0;$<P.length;$++)switch(P.params[$]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),P.params[$]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(P,$){const H=this._coreService.decPrivateModes,{activeProtocol:q,activeEncoding:ne}=this._coreMouseService,re=this._coreService,{buffers:ue,cols:de}=this._bufferService,{active:K,alt:W}=ue,J=this._optionsService.rawOptions,Z=Le=>Le?1:2,pe=P.params[0];return me=pe,ie=$?pe===2?4:pe===4?Z(re.modes.insertMode):pe===12?3:pe===20?Z(J.convertEol):0:pe===1?Z(H.applicationCursorKeys):pe===3?J.windowOptions.setWinLines?de===80?2:de===132?1:0:0:pe===6?Z(H.origin):pe===7?Z(H.wraparound):pe===8?3:pe===9?Z(q==="X10"):pe===12?Z(J.cursorBlink):pe===25?Z(!re.isCursorHidden):pe===45?Z(H.reverseWraparound):pe===66?Z(H.applicationKeypad):pe===67?4:pe===1e3?Z(q==="VT200"):pe===1002?Z(q==="DRAG"):pe===1003?Z(q==="ANY"):pe===1004?Z(H.sendFocus):pe===1005?4:pe===1006?Z(ne==="SGR"):pe===1015?4:pe===1016?Z(ne==="SGR_PIXELS"):pe===1048?1:pe===47||pe===1047||pe===1049?Z(K===W):pe===2004?Z(H.bracketedPasteMode):0,re.triggerDataEvent(`${u.C0.ESC}[${$?"":"?"}${me};${ie}$y`),!0;var me,ie}_updateAttrColor(P,$,H,q,ne){return $===2?(P|=50331648,P&=-16777216,P|=k.AttributeData.fromColorRGB([H,q,ne])):$===5&&(P&=-50331904,P|=33554432|255&H),P}_extractColor(P,$,H){const q=[0,0,-1,0,0,0];let ne=0,re=0;do{if(q[re+ne]=P.params[$+re],P.hasSubParams($+re)){const ue=P.getSubParams($+re);let de=0;do q[1]===5&&(ne=1),q[re+de+1+ne]=ue[de];while(++de<ue.length&&de+re+1+ne<q.length);break}if(q[1]===5&&re+ne>=2||q[1]===2&&re+ne>=5)break;q[1]&&(ne=1)}while(++re+$<P.length&&re+ne<q.length);for(let ue=2;ue<q.length;++ue)q[ue]===-1&&(q[ue]=0);switch(q[0]){case 38:H.fg=this._updateAttrColor(H.fg,q[1],q[3],q[4],q[5]);break;case 48:H.bg=this._updateAttrColor(H.bg,q[1],q[3],q[4],q[5]);break;case 58:H.extended=H.extended.clone(),H.extended.underlineColor=this._updateAttrColor(H.extended.underlineColor,q[1],q[3],q[4],q[5])}return re}_processUnderline(P,$){$.extended=$.extended.clone(),(!~P||P>5)&&(P=1),$.extended.underlineStyle=P,$.fg|=268435456,P===0&&($.fg&=-268435457),$.updateExtended()}_processSGR0(P){P.fg=a.DEFAULT_ATTR_DATA.fg,P.bg=a.DEFAULT_ATTR_DATA.bg,P.extended=P.extended.clone(),P.extended.underlineStyle=0,P.extended.underlineColor&=-67108864,P.updateExtended()}charAttributes(P){if(P.length===1&&P.params[0]===0)return this._processSGR0(this._curAttrData),!0;const $=P.length;let H;const q=this._curAttrData;for(let ne=0;ne<$;ne++)H=P.params[ne],H>=30&&H<=37?(q.fg&=-50331904,q.fg|=16777216|H-30):H>=40&&H<=47?(q.bg&=-50331904,q.bg|=16777216|H-40):H>=90&&H<=97?(q.fg&=-50331904,q.fg|=16777224|H-90):H>=100&&H<=107?(q.bg&=-50331904,q.bg|=16777224|H-100):H===0?this._processSGR0(q):H===1?q.fg|=134217728:H===3?q.bg|=67108864:H===4?(q.fg|=268435456,this._processUnderline(P.hasSubParams(ne)?P.getSubParams(ne)[0]:1,q)):H===5?q.fg|=536870912:H===7?q.fg|=67108864:H===8?q.fg|=1073741824:H===9?q.fg|=2147483648:H===2?q.bg|=134217728:H===21?this._processUnderline(2,q):H===22?(q.fg&=-134217729,q.bg&=-134217729):H===23?q.bg&=-67108865:H===24?(q.fg&=-268435457,this._processUnderline(0,q)):H===25?q.fg&=-536870913:H===27?q.fg&=-67108865:H===28?q.fg&=-1073741825:H===29?q.fg&=2147483647:H===39?(q.fg&=-67108864,q.fg|=16777215&a.DEFAULT_ATTR_DATA.fg):H===49?(q.bg&=-67108864,q.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):H===38||H===48||H===58?ne+=this._extractColor(P,ne,q):H===53?q.bg|=1073741824:H===55?q.bg&=-1073741825:H===59?(q.extended=q.extended.clone(),q.extended.underlineColor=-1,q.updateExtended()):H===100?(q.fg&=-67108864,q.fg|=16777215&a.DEFAULT_ATTR_DATA.fg,q.bg&=-67108864,q.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",H);return!0}deviceStatus(P){switch(P.params[0]){case 5:this._coreService.triggerDataEvent(`${u.C0.ESC}[0n`);break;case 6:const $=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[${$};${H}R`)}return!0}deviceStatusPrivate(P){if(P.params[0]===6){const $=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${u.C0.ESC}[?${$};${H}R`)}return!0}softReset(P){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=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(P){const $=P.params[0]||1;switch($){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const H=$%2==1;return this._optionsService.options.cursorBlink=H,!0}setScrollRegion(P){const $=P.params[0]||1;let H;return(P.length<2||(H=P.params[1])>this._bufferService.rows||H===0)&&(H=this._bufferService.rows),H>$&&(this._activeBuffer.scrollTop=$-1,this._activeBuffer.scrollBottom=H-1,this._setCursor(0,0)),!0}windowOptions(P){if(!F(P.params[0],this._optionsService.rawOptions.windowOptions))return!0;const $=P.length>1?P.params[1]:0;switch(P.params[0]){case 14:$!==2&&this._onRequestWindowsOptionsReport.fire(O.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(O.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:$!==0&&$!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),$!==0&&$!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:$!==0&&$!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),$!==0&&$!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(P){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(P){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(P){return this._windowTitle=P,this._onTitleChange.fire(P),!0}setIconName(P){return this._iconName=P,!0}setOrReportIndexedColor(P){const $=[],H=P.split(";");for(;H.length>1;){const q=H.shift(),ne=H.shift();if(/^\d+$/.exec(q)){const re=parseInt(q);if(X(re))if(ne==="?")$.push({type:0,index:re});else{const ue=(0,T.parseColor)(ne);ue&&$.push({type:1,index:re,color:ue})}}}return $.length&&this._onColor.fire($),!0}setHyperlink(P){const $=P.split(";");return!($.length<2)&&($[1]?this._createHyperlink($[0],$[1]):!$[0]&&this._finishHyperlink())}_createHyperlink(P,$){this._getCurrentLinkId()&&this._finishHyperlink();const H=P.split(":");let q;const ne=H.findIndex((re=>re.startsWith("id=")));return ne!==-1&&(q=H[ne].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:q,uri:$}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(P,$){const H=P.split(";");for(let q=0;q<H.length&&!($>=this._specialColors.length);++q,++$)if(H[q]==="?")this._onColor.fire([{type:0,index:this._specialColors[$]}]);else{const ne=(0,T.parseColor)(H[q]);ne&&this._onColor.fire([{type:1,index:this._specialColors[$],color:ne}])}return!0}setOrReportFgColor(P){return this._setOrReportSpecialColor(P,0)}setOrReportBgColor(P){return this._setOrReportSpecialColor(P,1)}setOrReportCursorColor(P){return this._setOrReportSpecialColor(P,2)}restoreIndexedColor(P){if(!P)return this._onColor.fire([{type:2}]),!0;const $=[],H=P.split(";");for(let q=0;q<H.length;++q)if(/^\d+$/.exec(H[q])){const ne=parseInt(H[q]);X(ne)&&$.push({type:2,index:ne})}return $.length&&this._onColor.fire($),!0}restoreFgColor(P){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(P){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(P){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,y.DEFAULT_CHARSET),!0}selectCharset(P){return P.length!==2?(this.selectDefaultCharset(),!0):(P[0]==="/"||this._charsetService.setgCharset(N[P[0]],y.CHARSETS[P[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 P=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,P,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=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(P){return this._charsetService.setgLevel(P),!0}screenAlignmentPattern(){const P=new d.CellData;P.content=4194373,P.fg=this._curAttrData.fg,P.bg=this._curAttrData.bg,this._setCursor(0,0);for(let $=0;$<this._bufferService.rows;++$){const H=this._activeBuffer.ybase+this._activeBuffer.y+$,q=this._activeBuffer.lines.get(H);q&&(q.fill(P),q.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(P,$){const H=this._bufferService.buffer,q=this._optionsService.rawOptions;return(ne=>(this._coreService.triggerDataEvent(`${u.C0.ESC}${ne}${u.C0.ESC}\\`),!0))(P==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:P==='"p'?'P1$r61;1"p':P==="r"?`P1$r${H.scrollTop+1};${H.scrollBottom+1}r`:P==="m"?"P1$r0m":P===" q"?`P1$r${{block:2,underline:4,bar:6}[q.cursorStyle]-(q.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(P,$){this._dirtyRowTracker.markRangeDirty(P,$)}}r.InputHandler=V;let Y=class{constructor(G){this._bufferService=G,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(G){G<this.start?this.start=G:G>this.end&&(this.end=G)}markRangeDirty(G,P){G>P&&(U=G,G=P,P=U),G<this.start&&(this.start=G),P>this.end&&(this.end=P)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function X(G){return 0<=G&&G<256}Y=g([_(0,D.IBufferService)],Y)},844:(x,r)=>{function c(g){for(const _ of g)_.dispose();g.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const g of this._disposables)g.dispose();this._disposables.length=0}register(g){return this._disposables.push(g),g}unregister(g){const _=this._disposables.indexOf(g);_!==-1&&this._disposables.splice(_,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(g){var _;this._isDisposed||g===this._value||((_=this._value)==null||_.dispose(),this._value=g)}clear(){this.value=void 0}dispose(){var g;this._isDisposed=!0,(g=this._value)==null||g.dispose(),this._value=void 0}},r.toDisposable=function(g){return{dispose:g}},r.disposeArray=c,r.getDisposeArrayDisposable=function(g){return{dispose:()=>c(g)}}},1505:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.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={}}}r.TwoKeyMap=c,r.FourKeyMap=class{constructor(){this._data=new c}set(g,_,u,y,S){this._data.get(g,_)||this._data.set(g,_,new c),this._data.get(g,_).set(u,y,S)}get(g,_,u,y){var S;return(S=this._data.get(g,_))==null?void 0:S.get(u,y)}clear(){this._data.clear()}}},6114:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;const c=r.isNode?"node":navigator.userAgent,g=r.isNode?"node":navigator.platform;r.isFirefox=c.includes("Firefox"),r.isLegacyEdge=c.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(c),r.getSafariVersion=function(){if(!r.isSafari)return 0;const _=c.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(g),r.isIpad=g==="iPad",r.isIphone=g==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(g),r.isLinux=g.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(c)},6106:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let c=0;r.SortedList=class{constructor(g){this._getKey=g,this._array=[]}clear(){this._array.length=0}insert(g){this._array.length!==0?(c=this._search(this._getKey(g)),this._array.splice(c,0,g)):this._array.push(g)}delete(g){if(this._array.length===0)return!1;const _=this._getKey(g);if(_===void 0||(c=this._search(_),c===-1)||this._getKey(this._array[c])!==_)return!1;do if(this._array[c]===g)return this._array.splice(c,1),!0;while(++c<this._array.length&&this._getKey(this._array[c])===_);return!1}*getKeyIterator(g){if(this._array.length!==0&&(c=this._search(g),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===g))do yield this._array[c];while(++c<this._array.length&&this._getKey(this._array[c])===g)}forEachByKey(g,_){if(this._array.length!==0&&(c=this._search(g),!(c<0||c>=this._array.length)&&this._getKey(this._array[c])===g))do _(this._array[c]);while(++c<this._array.length&&this._getKey(this._array[c])===g)}values(){return[...this._array].values()}_search(g){let _=0,u=this._array.length-1;for(;u>=_;){let y=_+u>>1;const S=this._getKey(this._array[y]);if(S>g)u=y-1;else{if(!(S<g)){for(;y>0&&this._getKey(this._array[y-1])===g;)y--;return y}_=y+1}}return _}}},7226:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const g=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 L=0,f=0,a=S.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(L=Date.now(),this._tasks[this._i]()||this._i++,L=Math.max(1,Date.now()-L),f=Math.max(L,f),m=S.timeRemaining(),1.5*f>m)return a-L<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-L))}ms`),void this._start();a=m}this.clear()}}class u extends _{_requestCallback(S){return setTimeout((()=>S(this._createDeadline(16))))}_cancelCallback(S){clearTimeout(S)}_createDeadline(S){const L=Date.now()+S;return{timeRemaining:()=>Math.max(0,L-Date.now())}}}r.PriorityTaskQueue=u,r.IdleTaskQueue=!g.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(y){return requestIdleCallback(y)}_cancelCallback(y){cancelIdleCallback(y)}}:u,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(y){this._queue.clear(),this._queue.enqueue(y)}flush(){this._queue.flush()}}},9282:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const g=c(643);r.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[g.CHAR_DATA_CODE_INDEX]!==g.NULL_CELL_CODE&&y[g.CHAR_DATA_CODE_INDEX]!==g.WHITESPACE_CELL_CODE)}},3734:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class c{constructor(){this.fg=0,this.bg=0,this.extended=new g}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}}r.AttributeData=c;class g{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 g(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=g},9092:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const g=c(6349),_=c(7226),u=c(3734),y=c(8437),S=c(4634),L=c(511),f=c(643),a=c(4863),m=c(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(p,d,k){this._hasScrollback=p,this._optionsService=d,this._bufferService=k,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=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=L.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]),this._whitespaceCell=L.CellData.fromCharData([0,f.WHITESPACE_CELL_CHAR,f.WHITESPACE_CELL_WIDTH,f.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 g.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(p){return p?(this._nullCell.fg=p.fg,this._nullCell.bg=p.bg,this._nullCell.extended=p.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell}getWhitespaceCell(p){return p?(this._whitespaceCell.fg=p.fg,this._whitespaceCell.bg=p.bg,this._whitespaceCell.extended=p.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell}getBlankLine(p,d){return new y.BufferLine(this._bufferService.cols,this.getNullCell(p),d)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const p=this.ybase+this.y-this.ydisp;return p>=0&&p<this._rows}_getCorrectBufferLength(p){if(!this._hasScrollback)return p;const d=p+this._optionsService.rawOptions.scrollback;return d>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:d}fillViewportRows(p){if(this.lines.length===0){p===void 0&&(p=y.DEFAULT_ATTR_DATA);let d=this._rows;for(;d--;)this.lines.push(this.getBlankLine(p))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new g.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(p,d){const k=this.getNullCell(y.DEFAULT_ATTR_DATA);let D=0;const E=this._getCorrectBufferLength(d);if(E>this.lines.maxLength&&(this.lines.maxLength=E),this.lines.length>0){if(this._cols<p)for(let b=0;b<this.lines.length;b++)D+=+this.lines.get(b).resize(p,k);let M=0;if(this._rows<d)for(let b=this._rows;b<d;b++)this.lines.length<d+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(p,k)):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(p,k)));else for(let b=this._rows;b>d;b--)this.lines.length>d+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(E<this.lines.maxLength){const b=this.lines.length-E;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=E}this.x=Math.min(this.x,p-1),this.y=Math.min(this.y,d-1),M&&(this.y+=M),this.savedX=Math.min(this.savedX,p-1),this.scrollTop=0}if(this.scrollBottom=d-1,this._isReflowEnabled&&(this._reflow(p,d),this._cols>p))for(let M=0;M<this.lines.length;M++)D+=+this.lines.get(M).resize(p,k);this._cols=p,this._rows=d,this._memoryCleanupQueue.clear(),D>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let p=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,p=!1);let d=0;for(;this._memoryCleanupPosition<this.lines.length;)if(d+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),d>100)return!0;return p}get _isReflowEnabled(){const p=this._optionsService.rawOptions.windowsPty;return p&&p.buildNumber?this._hasScrollback&&p.backend==="conpty"&&p.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(p,d){this._cols!==p&&(p>this._cols?this._reflowLarger(p,d):this._reflowSmaller(p,d))}_reflowLarger(p,d){const k=(0,S.reflowLargerGetLinesToRemove)(this.lines,this._cols,p,this.ybase+this.y,this.getNullCell(y.DEFAULT_ATTR_DATA));if(k.length>0){const D=(0,S.reflowLargerCreateNewLayout)(this.lines,k);(0,S.reflowLargerApplyNewLayout)(this.lines,D.layout),this._reflowLargerAdjustViewport(p,d,D.countRemoved)}}_reflowLargerAdjustViewport(p,d,k){const D=this.getNullCell(y.DEFAULT_ATTR_DATA);let E=k;for(;E-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<d&&this.lines.push(new y.BufferLine(p,D))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(p,d){const k=this.getNullCell(y.DEFAULT_ATTR_DATA),D=[];let E=0;for(let M=this.lines.length-1;M>=0;M--){let b=this.lines.get(M);if(!b||!b.isWrapped&&b.getTrimmedLength()<=p)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 B=T[T.length-1].getTrimmedLength(),F=(0,S.reflowSmallerGetNewLineLengths)(T,this._cols,p),O=F.length-T.length;let U;U=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+O):Math.max(0,this.lines.length-this.lines.maxLength+O);const V=[];for(let H=0;H<O;H++){const q=this.getBlankLine(y.DEFAULT_ATTR_DATA,!0);V.push(q)}V.length>0&&(D.push({start:M+T.length+E,newLines:V}),E+=V.length),T.push(...V);let Y=F.length-1,X=F[Y];X===0&&(Y--,X=F[Y]);let G=T.length-O-1,P=B;for(;G>=0;){const H=Math.min(P,X);if(T[Y]===void 0)break;if(T[Y].copyCellsFrom(T[G],P-H,X-H,H,!0),X-=H,X===0&&(Y--,X=F[Y]),P-=H,P===0){G--;const q=Math.max(G,0);P=(0,S.getWrappedLineTrimmedLength)(T,q,this._cols)}}for(let H=0;H<T.length;H++)F[H]<p&&T[H].setCell(F[H],k);let $=O-U;for(;$-- >0;)this.ybase===0?this.y<d-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+E)-d&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+O,this.ybase+d-1)}if(D.length>0){const M=[],b=[];for(let Y=0;Y<this.lines.length;Y++)b.push(this.lines.get(Y));const T=this.lines.length;let N=T-1,B=0,F=D[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+E);let O=0;for(let Y=Math.min(this.lines.maxLength-1,T+E-1);Y>=0;Y--)if(F&&F.start>N+O){for(let X=F.newLines.length-1;X>=0;X--)this.lines.set(Y--,F.newLines[X]);Y++,M.push({index:N+1,amount:F.newLines.length}),O+=F.newLines.length,F=D[++B]}else this.lines.set(Y,b[N--]);let U=0;for(let Y=M.length-1;Y>=0;Y--)M[Y].index+=U,this.lines.onInsertEmitter.fire(M[Y]),U+=M[Y].amount;const V=Math.max(0,T+E-this.lines.maxLength);V>0&&this.lines.onTrimEmitter.fire(V)}}translateBufferLineToString(p,d,k=0,D){const E=this.lines.get(p);return E?E.translateToString(d,k,D):""}getWrappedRangeForLine(p){let d=p,k=p;for(;d>0&&this.lines.get(d).isWrapped;)d--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:d,last:k}}setupTabStops(p){for(p!=null?this.tabs[p]||(p=this.prevStop(p)):(this.tabs={},p=0);p<this._cols;p+=this._optionsService.rawOptions.tabStopWidth)this.tabs[p]=!0}prevStop(p){for(p==null&&(p=this.x);!this.tabs[--p]&&p>0;);return p>=this._cols?this._cols-1:p<0?0:p}nextStop(p){for(p==null&&(p=this.x);!this.tabs[++p]&&p<this._cols;);return p>=this._cols?this._cols-1:p<0?0:p}clearMarkers(p){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].line===p&&(this.markers[d].dispose(),this.markers.splice(d--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].dispose(),this.markers.splice(p--,1);this._isClearing=!1}addMarker(p){const d=new a.Marker(p);return this.markers.push(d),d.register(this.lines.onTrim((k=>{d.line-=k,d.line<0&&d.dispose()}))),d.register(this.lines.onInsert((k=>{d.line>=k.index&&(d.line+=k.amount)}))),d.register(this.lines.onDelete((k=>{d.line>=k.index&&d.line<k.index+k.amount&&d.dispose(),d.line>k.index&&(d.line-=k.amount)}))),d.register(d.onDispose((()=>this._removeMarker(d)))),d}_removeMarker(p){this._isClearing||this.markers.splice(this.markers.indexOf(p),1)}}},8437:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const g=c(3734),_=c(511),u=c(643),y=c(482);r.DEFAULT_ATTR_DATA=Object.freeze(new g.AttributeData);let S=0;class L{constructor(a,m,p=!1){this.isWrapped=p,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*a);const d=m||_.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]);for(let k=0;k<a;++k)this.setCell(k,d);this.length=a}get(a){const m=this._data[3*a+0],p=2097151&m;return[this._data[3*a+1],2097152&m?this._combined[a]:p?(0,y.stringFromCodePoint)(p):"",m>>22,2097152&m?this._combined[a].charCodeAt(this._combined[a].length-1):p]}set(a,m){this._data[3*a+1]=m[u.CHAR_DATA_ATTR_INDEX],m[u.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[a]=m[1],this._data[3*a+0]=2097152|a|m[u.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*a+0]=m[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[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 m=this._data[3*a+0];return 2097152&m?this._combined[a].charCodeAt(this._combined[a].length-1):2097151&m}isCombined(a){return 2097152&this._data[3*a+0]}getString(a){const m=this._data[3*a+0];return 2097152&m?this._combined[a]:2097151&m?(0,y.stringFromCodePoint)(2097151&m):""}isProtected(a){return 536870912&this._data[3*a+2]}loadCell(a,m){return S=3*a,m.content=this._data[S+0],m.fg=this._data[S+1],m.bg=this._data[S+2],2097152&m.content&&(m.combinedData=this._combined[a]),268435456&m.bg&&(m.extended=this._extendedAttrs[a]),m}setCell(a,m){2097152&m.content&&(this._combined[a]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[a]=m.extended),this._data[3*a+0]=m.content,this._data[3*a+1]=m.fg,this._data[3*a+2]=m.bg}setCellFromCodepoint(a,m,p,d){268435456&d.bg&&(this._extendedAttrs[a]=d.extended),this._data[3*a+0]=m|p<<22,this._data[3*a+1]=d.fg,this._data[3*a+2]=d.bg}addCodepointToCell(a,m,p){let d=this._data[3*a+0];2097152&d?this._combined[a]+=(0,y.stringFromCodePoint)(m):2097151&d?(this._combined[a]=(0,y.stringFromCodePoint)(2097151&d)+(0,y.stringFromCodePoint)(m),d&=-2097152,d|=2097152):d=m|4194304,p&&(d&=-12582913,d|=p<<22),this._data[3*a+0]=d}insertCells(a,m,p){if((a%=this.length)&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,p),m<this.length-a){const d=new _.CellData;for(let k=this.length-a-m-1;k>=0;--k)this.setCell(a+m+k,this.loadCell(a+k,d));for(let k=0;k<m;++k)this.setCell(a+k,p)}else for(let d=a;d<this.length;++d)this.setCell(d,p);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,p)}deleteCells(a,m,p){if(a%=this.length,m<this.length-a){const d=new _.CellData;for(let k=0;k<this.length-a-m;++k)this.setCell(a+k,this.loadCell(a+m+k,d));for(let k=this.length-m;k<this.length;++k)this.setCell(k,p)}else for(let d=a;d<this.length;++d)this.setCell(d,p);a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,p),this.getWidth(a)!==0||this.hasContent(a)||this.setCellFromCodepoint(a,0,1,p)}replaceCells(a,m,p,d=!1){if(d)for(a&&this.getWidth(a-1)===2&&!this.isProtected(a-1)&&this.setCellFromCodepoint(a-1,0,1,p),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,p);a<m&&a<this.length;)this.isProtected(a)||this.setCell(a,p),a++;else for(a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,p),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,p);a<m&&a<this.length;)this.setCell(a++,p)}resize(a,m){if(a===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const p=3*a;if(a>this.length){if(this._data.buffer.byteLength>=4*p)this._data=new Uint32Array(this._data.buffer,0,p);else{const d=new Uint32Array(p);d.set(this._data),this._data=d}for(let d=this.length;d<a;++d)this.setCell(d,m)}else{this._data=this._data.subarray(0,p);const d=Object.keys(this._combined);for(let D=0;D<d.length;D++){const E=parseInt(d[D],10);E>=a&&delete this._combined[E]}const k=Object.keys(this._extendedAttrs);for(let D=0;D<k.length;D++){const E=parseInt(k[D],10);E>=a&&delete this._extendedAttrs[E]}}return this.length=a,4*p*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,m=!1){if(m)for(let p=0;p<this.length;++p)this.isProtected(p)||this.setCell(p,a);else{this._combined={},this._extendedAttrs={};for(let p=0;p<this.length;++p)this.setCell(p,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 m in a._combined)this._combined[m]=a._combined[m];this._extendedAttrs={};for(const m in a._extendedAttrs)this._extendedAttrs[m]=a._extendedAttrs[m];this.isWrapped=a.isWrapped}clone(){const a=new L(0);a._data=new Uint32Array(this._data),a.length=this.length;for(const m in this._combined)a._combined[m]=this._combined[m];for(const m in this._extendedAttrs)a._extendedAttrs[m]=this._extendedAttrs[m];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,m,p,d,k){const D=a._data;if(k)for(let M=d-1;M>=0;M--){for(let b=0;b<3;b++)this._data[3*(p+M)+b]=D[3*(m+M)+b];268435456&D[3*(m+M)+2]&&(this._extendedAttrs[p+M]=a._extendedAttrs[m+M])}else for(let M=0;M<d;M++){for(let b=0;b<3;b++)this._data[3*(p+M)+b]=D[3*(m+M)+b];268435456&D[3*(m+M)+2]&&(this._extendedAttrs[p+M]=a._extendedAttrs[m+M])}const E=Object.keys(a._combined);for(let M=0;M<E.length;M++){const b=parseInt(E[M],10);b>=m&&(this._combined[b-m+p]=a._combined[b])}}translateToString(a,m,p,d){m=m??0,p=p??this.length,a&&(p=Math.min(p,this.getTrimmedLength())),d&&(d.length=0);let k="";for(;m<p;){const D=this._data[3*m+0],E=2097151&D,M=2097152&D?this._combined[m]:E?(0,y.stringFromCodePoint)(E):u.WHITESPACE_CELL_CHAR;if(k+=M,d)for(let b=0;b<M.length;++b)d.push(m);m+=D>>22||1}return d&&d.push(m),k}}r.BufferLine=L},4841:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(c,g){if(c.start.y>c.end.y)throw new Error(`Buffer range end (${c.end.x}, ${c.end.y}) cannot be before start (${c.start.x}, ${c.start.y})`);return g*(c.end.y-c.start.y)+(c.end.x-c.start.x+1)}},4634:(x,r)=>{function c(g,_,u){if(_===g.length-1)return g[_].getTrimmedLength();const y=!g[_].hasContent(u-1)&&g[_].getWidth(u-1)===1,S=g[_+1].getWidth(0)===2;return y&&S?u-1:u}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(g,_,u,y,S){const L=[];for(let f=0;f<g.length-1;f++){let a=f,m=g.get(++a);if(!m.isWrapped)continue;const p=[g.get(f)];for(;a<g.length&&m.isWrapped;)p.push(m),m=g.get(++a);if(y>=f&&y<a){f+=p.length-1;continue}let d=0,k=c(p,d,_),D=1,E=0;for(;D<p.length;){const b=c(p,D,_),T=b-E,N=u-k,B=Math.min(T,N);p[d].copyCellsFrom(p[D],E,k,B,!1),k+=B,k===u&&(d++,k=0),E+=B,E===b&&(D++,E=0),k===0&&d!==0&&p[d-1].getWidth(u-1)===2&&(p[d].copyCellsFrom(p[d-1],u-1,k++,1,!1),p[d-1].setCell(u-1,S))}p[d].replaceCells(k,u,S);let M=0;for(let b=p.length-1;b>0&&(b>d||p[b].getTrimmedLength()===0);b--)M++;M>0&&(L.push(f+p.length-M),L.push(M)),f+=p.length-1}return L},r.reflowLargerCreateNewLayout=function(g,_){const u=[];let y=0,S=_[y],L=0;for(let f=0;f<g.length;f++)if(S===f){const a=_[++y];g.onDeleteEmitter.fire({index:f-L,amount:a}),f+=a-1,L+=a,S=_[++y]}else u.push(f);return{layout:u,countRemoved:L}},r.reflowLargerApplyNewLayout=function(g,_){const u=[];for(let y=0;y<_.length;y++)u.push(g.get(_[y]));for(let y=0;y<u.length;y++)g.set(y,u[y]);g.length=_.length},r.reflowSmallerGetNewLineLengths=function(g,_,u){const y=[],S=g.map(((m,p)=>c(g,p,_))).reduce(((m,p)=>m+p));let L=0,f=0,a=0;for(;a<S;){if(S-a<u){y.push(S-a);break}L+=u;const m=c(g,f,_);L>m&&(L-=m,f++);const p=g[f].getWidth(L-1)===2;p&&L--;const d=p?u-1:u;y.push(d),a+=d}return y},r.getWrappedLineTrimmedLength=c},5295:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const g=c(8460),_=c(844),u=c(9092);class y extends _.Disposable{constructor(L,f){super(),this._optionsService=L,this._bufferService=f,this._onBufferActivate=this.register(new g.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new 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(L){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(L),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(L,f){this._normal.resize(L,f),this._alt.resize(L,f),this.setupTabStops(L)}setupTabStops(L){this._normal.setupTabStops(L),this._alt.setupTabStops(L)}}r.BufferSet=y},511:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const g=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(L){const f=new y;return f.setFromCharData(L),f}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,g.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(L){this.fg=L[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(L[_.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(L[_.CHAR_DATA_CHAR_INDEX].length===2){const a=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const m=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(a-55296)+m-56320+65536|L[_.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=L[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|L[_.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=L[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|L[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=y},643:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const g=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 g.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}}r.Marker=u,u._nextId=1},7116:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.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:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(x,r)=>{var c,g,_;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.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||(r.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="Ÿ"})(g||(r.C1=g={})),(function(u){u.ST=`${c.ESC}\\`})(_||(r.C1_ESCAPED=_={}))},7399:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const g=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:["'",'"']};r.evaluateKeyboardEvent=function(u,y,S,L){const f={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"?f.key=y?g.C0.ESC+"OA":g.C0.ESC+"[A":u.key==="UIKeyInputLeftArrow"?f.key=y?g.C0.ESC+"OD":g.C0.ESC+"[D":u.key==="UIKeyInputRightArrow"?f.key=y?g.C0.ESC+"OC":g.C0.ESC+"[C":u.key==="UIKeyInputDownArrow"&&(f.key=y?g.C0.ESC+"OB":g.C0.ESC+"[B");break;case 8:f.key=u.ctrlKey?"\b":g.C0.DEL,u.altKey&&(f.key=g.C0.ESC+f.key);break;case 9:if(u.shiftKey){f.key=g.C0.ESC+"[Z";break}f.key=g.C0.HT,f.cancel=!0;break;case 13:f.key=u.altKey?g.C0.ESC+g.C0.CR:g.C0.CR,f.cancel=!0;break;case 27:f.key=g.C0.ESC,u.altKey&&(f.key=g.C0.ESC+g.C0.ESC),f.cancel=!0;break;case 37:if(u.metaKey)break;a?(f.key=g.C0.ESC+"[1;"+(a+1)+"D",f.key===g.C0.ESC+"[1;3D"&&(f.key=g.C0.ESC+(S?"b":"[1;5D"))):f.key=y?g.C0.ESC+"OD":g.C0.ESC+"[D";break;case 39:if(u.metaKey)break;a?(f.key=g.C0.ESC+"[1;"+(a+1)+"C",f.key===g.C0.ESC+"[1;3C"&&(f.key=g.C0.ESC+(S?"f":"[1;5C"))):f.key=y?g.C0.ESC+"OC":g.C0.ESC+"[C";break;case 38:if(u.metaKey)break;a?(f.key=g.C0.ESC+"[1;"+(a+1)+"A",S||f.key!==g.C0.ESC+"[1;3A"||(f.key=g.C0.ESC+"[1;5A")):f.key=y?g.C0.ESC+"OA":g.C0.ESC+"[A";break;case 40:if(u.metaKey)break;a?(f.key=g.C0.ESC+"[1;"+(a+1)+"B",S||f.key!==g.C0.ESC+"[1;3B"||(f.key=g.C0.ESC+"[1;5B")):f.key=y?g.C0.ESC+"OB":g.C0.ESC+"[B";break;case 45:u.shiftKey||u.ctrlKey||(f.key=g.C0.ESC+"[2~");break;case 46:f.key=a?g.C0.ESC+"[3;"+(a+1)+"~":g.C0.ESC+"[3~";break;case 36:f.key=a?g.C0.ESC+"[1;"+(a+1)+"H":y?g.C0.ESC+"OH":g.C0.ESC+"[H";break;case 35:f.key=a?g.C0.ESC+"[1;"+(a+1)+"F":y?g.C0.ESC+"OF":g.C0.ESC+"[F";break;case 33:u.shiftKey?f.type=2:u.ctrlKey?f.key=g.C0.ESC+"[5;"+(a+1)+"~":f.key=g.C0.ESC+"[5~";break;case 34:u.shiftKey?f.type=3:u.ctrlKey?f.key=g.C0.ESC+"[6;"+(a+1)+"~":f.key=g.C0.ESC+"[6~";break;case 112:f.key=a?g.C0.ESC+"[1;"+(a+1)+"P":g.C0.ESC+"OP";break;case 113:f.key=a?g.C0.ESC+"[1;"+(a+1)+"Q":g.C0.ESC+"OQ";break;case 114:f.key=a?g.C0.ESC+"[1;"+(a+1)+"R":g.C0.ESC+"OR";break;case 115:f.key=a?g.C0.ESC+"[1;"+(a+1)+"S":g.C0.ESC+"OS";break;case 116:f.key=a?g.C0.ESC+"[15;"+(a+1)+"~":g.C0.ESC+"[15~";break;case 117:f.key=a?g.C0.ESC+"[17;"+(a+1)+"~":g.C0.ESC+"[17~";break;case 118:f.key=a?g.C0.ESC+"[18;"+(a+1)+"~":g.C0.ESC+"[18~";break;case 119:f.key=a?g.C0.ESC+"[19;"+(a+1)+"~":g.C0.ESC+"[19~";break;case 120:f.key=a?g.C0.ESC+"[20;"+(a+1)+"~":g.C0.ESC+"[20~";break;case 121:f.key=a?g.C0.ESC+"[21;"+(a+1)+"~":g.C0.ESC+"[21~";break;case 122:f.key=a?g.C0.ESC+"[23;"+(a+1)+"~":g.C0.ESC+"[23~";break;case 123:f.key=a?g.C0.ESC+"[24;"+(a+1)+"~":g.C0.ESC+"[24~";break;default:if(!u.ctrlKey||u.shiftKey||u.altKey||u.metaKey)if(S&&!L||!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?f.key=u.key:u.key&&u.ctrlKey&&(u.key==="_"&&(f.key=g.C0.US),u.key==="@"&&(f.key=g.C0.NUL)):u.keyCode===65&&(f.type=1);else{const m=_[u.keyCode],p=m==null?void 0:m[u.shiftKey?1:0];if(p)f.key=g.C0.ESC+p;else if(u.keyCode>=65&&u.keyCode<=90){const d=u.ctrlKey?u.keyCode-64:u.keyCode+32;let k=String.fromCharCode(d);u.shiftKey&&(k=k.toUpperCase()),f.key=g.C0.ESC+k}else if(u.keyCode===32)f.key=g.C0.ESC+(u.ctrlKey?g.C0.NUL:" ");else if(u.key==="Dead"&&u.code.startsWith("Key")){let d=u.code.slice(3,4);u.shiftKey||(d=d.toLowerCase()),f.key=g.C0.ESC+d,f.cancel=!0}}else u.keyCode>=65&&u.keyCode<=90?f.key=String.fromCharCode(u.keyCode-64):u.keyCode===32?f.key=g.C0.NUL:u.keyCode>=51&&u.keyCode<=55?f.key=String.fromCharCode(u.keyCode-51+27):u.keyCode===56?f.key=g.C0.DEL:u.keyCode===219?f.key=g.C0.ESC:u.keyCode===220?f.key=g.C0.FS:u.keyCode===221&&(f.key=g.C0.GS)}return f}},482:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},r.utf32ToString=function(c,g=0,_=c.length){let u="";for(let y=g;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},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(c,g){const _=c.length;if(!_)return 0;let u=0,y=0;if(this._interim){const S=c.charCodeAt(y++);56320<=S&&S<=57343?g[u++]=1024*(this._interim-55296)+S-56320+65536:(g[u++]=this._interim,g[u++]=S),this._interim=0}for(let S=y;S<_;++S){const L=c.charCodeAt(S);if(55296<=L&&L<=56319){if(++S>=_)return this._interim=L,u;const f=c.charCodeAt(S);56320<=f&&f<=57343?g[u++]=1024*(L-55296)+f-56320+65536:(g[u++]=L,g[u++]=f)}else L!==65279&&(g[u++]=L)}return u}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(c,g){const _=c.length;if(!_)return 0;let u,y,S,L,f=0,a=0,m=0;if(this.interim[0]){let k=!1,D=this.interim[0];D&=(224&D)==192?31:(240&D)==224?15:7;let E,M=0;for(;(E=63&this.interim[++M])&&M<4;)D<<=6,D|=E;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=b-M;for(;m<T;){if(m>=_)return 0;if(E=c[m++],(192&E)!=128){m--,k=!0;break}this.interim[M++]=E,D<<=6,D|=63&E}k||(b===2?D<128?m--:g[f++]=D:b===3?D<2048||D>=55296&&D<=57343||D===65279||(g[f++]=D):D<65536||D>1114111||(g[f++]=D)),this.interim.fill(0)}const p=_-4;let d=m;for(;d<_;){for(;!(!(d<p)||128&(u=c[d])||128&(y=c[d+1])||128&(S=c[d+2])||128&(L=c[d+3]));)g[f++]=u,g[f++]=y,g[f++]=S,g[f++]=L,d+=4;if(u=c[d++],u<128)g[f++]=u;else if((224&u)==192){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(a=(31&u)<<6|63&y,a<128){d--;continue}g[f++]=a}else if((240&u)==224){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,f;if(S=c[d++],(192&S)!=128){d--;continue}if(a=(15&u)<<12|(63&y)<<6|63&S,a<2048||a>=55296&&a<=57343||a===65279)continue;g[f++]=a}else if((248&u)==240){if(d>=_)return this.interim[0]=u,f;if(y=c[d++],(192&y)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,f;if(S=c[d++],(192&S)!=128){d--;continue}if(d>=_)return this.interim[0]=u,this.interim[1]=y,this.interim[2]=S,f;if(L=c[d++],(192&L)!=128){d--;continue}if(a=(7&u)<<18|(63&y)<<12|(63&S)<<6|63&L,a<65536||a>1114111)continue;g[f++]=a}}return f}}},225:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const g=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;r.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(L,f){let a,m=0,p=f.length-1;if(L<f[0][0]||L>f[p][1])return!1;for(;p>=m;)if(a=m+p>>1,L>f[a][1])m=a+1;else{if(!(L<f[a][0]))return!0;p=a-1}return!1})(S,u)?0:S>=131072&&S<=196605||S>=196608&&S<=262141?2:1}charProperties(S,L){let f=this.wcwidth(S),a=f===0&&L!==0;if(a){const m=g.UnicodeService.extractWidth(L);m===0?a=!1:m>f&&(f=m)}return g.UnicodeService.createPropertyValue(0,f,a)}}},5981:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const g=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 g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(S,L){if(L!==void 0&&this._syncCalls>L)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 f;for(this._isSyncWriting=!0;f=this._writeBuffer.shift();){this._action(f);const a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(S,L){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(L),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=S.length,this._writeBuffer.push(S),this._callbacks.push(L)}_innerWrite(S=0,L=!0){const f=S||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const a=this._writeBuffer[this._bufferOffset],m=this._action(a,L);if(m){const d=k=>Date.now()-f>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(f,k);return void m.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(d)}const p=this._callbacks[this._bufferOffset];if(p&&p(),this._bufferOffset++,this._pendingData-=a.length,Date.now()-f>=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()}}r.WriteBuffer=u},5941:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const c=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,g=/^[\da-f]+$/;function _(u,y){const S=u.toString(16),L=S.length<2?"0"+S:S;switch(y){case 4:return S[0];case 8:return L;case 12:return(L+L).slice(0,3);default:return L+L}}r.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 L=S[1]?15:S[4]?255:S[7]?4095:65535;return[Math.round(parseInt(S[1]||S[4]||S[7]||S[10],16)/L*255),Math.round(parseInt(S[2]||S[5]||S[8]||S[11],16)/L*255),Math.round(parseInt(S[3]||S[6]||S[9]||S[12],16)/L*255)]}}else if(y.indexOf("#")===0&&(y=y.slice(1),g.exec(y)&&[3,6,9,12].includes(y.length))){const S=y.length/3,L=[0,0,0];for(let f=0;f<3;++f){const a=parseInt(y.slice(S*f,S*f+S),16);L[f]=S===1?a<<4:S===2?a:S===3?a>>4:a>>8}return L}},r.toRgbString=function(u,y=16){const[S,L,f]=u;return`rgb:${_(S,y)}/${_(L,y)}/${_(f,y)}`}},5770:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const g=c(482),_=c(8742),u=c(5770),y=[];r.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(L,f){this._handlers[L]===void 0&&(this._handlers[L]=[]);const a=this._handlers[L];return a.push(f),{dispose:()=>{const m=a.indexOf(f);m!==-1&&a.splice(m,1)}}}clearHandler(L){this._handlers[L]&&delete this._handlers[L]}setHandlerFallback(L){this._handlerFb=L}reset(){if(this._active.length)for(let L=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;L>=0;--L)this._active[L].unhook(!1);this._stack.paused=!1,this._active=y,this._ident=0}hook(L,f){if(this.reset(),this._ident=L,this._active=this._handlers[L]||y,this._active.length)for(let a=this._active.length-1;a>=0;a--)this._active[a].hook(f);else this._handlerFb(this._ident,"HOOK",f)}put(L,f,a){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(L,f,a);else this._handlerFb(this._ident,"PUT",(0,g.utf32ToString)(L,f,a))}unhook(L,f=!0){if(this._active.length){let a=!1,m=this._active.length-1,p=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,a=f,p=this._stack.fallThrough,this._stack.paused=!1),!p&&a===!1){for(;m>=0&&(a=this._active[m].unhook(L),a!==!0);m--)if(a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,a;m--}for(;m>=0;m--)if(a=this._active[m].unhook(!1),a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,a}else this._handlerFb(this._ident,"UNHOOK",L);this._active=y,this._ident=0}};const S=new _.Params;S.addParam(0),r.DcsHandler=class{constructor(L){this._handler=L,this._data="",this._params=S,this._hitLimit=!1}hook(L){this._params=L.length>1||L.params[0]?L.clone():S,this._data="",this._hitLimit=!1}put(L,f,a){this._hitLimit||(this._data+=(0,g.utf32ToString)(L,f,a),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(L){let f=!1;if(this._hitLimit)f=!1;else if(L&&(f=this._handler(this._data,this._params),f instanceof Promise))return f.then((a=>(this._params=S,this._data="",this._hitLimit=!1,a)));return this._params=S,this._data="",this._hitLimit=!1,f}}},2015:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const g=c(844),_=c(8742),u=c(6242),y=c(6351);class S{constructor(m){this.table=new Uint8Array(m)}setDefault(m,p){this.table.fill(m<<4|p)}add(m,p,d,k){this.table[p<<8|m]=d<<4|k}addMany(m,p,d,k){for(let D=0;D<m.length;D++)this.table[p<<8|m[D]]=d<<4|k}}r.TransitionTable=S;const L=160;r.VT500_TRANSITION_TABLE=(function(){const a=new S(4095),m=Array.apply(null,Array(256)).map(((M,b)=>b)),p=(M,b)=>m.slice(M,b),d=p(32,127),k=p(0,24);k.push(25),k.push.apply(k,p(28,32));const D=p(0,14);let E;for(E in a.setDefault(1,0),a.addMany(d,0,2,0),D)a.addMany([24,26,153,154],E,3,0),a.addMany(p(128,144),E,3,0),a.addMany(p(144,152),E,3,0),a.add(156,E,0,0),a.add(27,E,11,1),a.add(157,E,4,8),a.addMany([152,158,159],E,0,7),a.add(155,E,11,3),a.add(144,E,11,9);return a.addMany(k,0,3,0),a.addMany(k,1,3,1),a.add(127,1,0,1),a.addMany(k,8,0,8),a.addMany(k,3,3,3),a.add(127,3,0,3),a.addMany(k,4,3,4),a.add(127,4,0,4),a.addMany(k,6,3,6),a.addMany(k,5,3,5),a.add(127,5,0,5),a.addMany(k,2,3,2),a.add(127,2,0,2),a.add(93,1,4,8),a.addMany(d,8,5,8),a.add(127,8,5,8),a.addMany([156,27,24,26,7],8,6,0),a.addMany(p(28,32),8,0,8),a.addMany([88,94,95],1,0,7),a.addMany(d,7,0,7),a.addMany(k,7,0,7),a.add(156,7,0,0),a.add(127,7,0,7),a.add(91,1,11,3),a.addMany(p(64,127),3,7,0),a.addMany(p(48,60),3,8,4),a.addMany([60,61,62,63],3,9,4),a.addMany(p(48,60),4,8,4),a.addMany(p(64,127),4,7,0),a.addMany([60,61,62,63],4,0,6),a.addMany(p(32,64),6,0,6),a.add(127,6,0,6),a.addMany(p(64,127),6,0,0),a.addMany(p(32,48),3,9,5),a.addMany(p(32,48),5,9,5),a.addMany(p(48,64),5,0,6),a.addMany(p(64,127),5,7,0),a.addMany(p(32,48),4,9,5),a.addMany(p(32,48),1,9,2),a.addMany(p(32,48),2,9,2),a.addMany(p(48,127),2,10,0),a.addMany(p(48,80),1,10,0),a.addMany(p(81,88),1,10,0),a.addMany([89,90,92],1,10,0),a.addMany(p(96,127),1,10,0),a.add(80,1,11,9),a.addMany(k,9,0,9),a.add(127,9,0,9),a.addMany(p(28,32),9,0,9),a.addMany(p(32,48),9,9,12),a.addMany(p(48,60),9,8,10),a.addMany([60,61,62,63],9,9,10),a.addMany(k,11,0,11),a.addMany(p(32,128),11,0,11),a.addMany(p(28,32),11,0,11),a.addMany(k,10,0,10),a.add(127,10,0,10),a.addMany(p(28,32),10,0,10),a.addMany(p(48,60),10,8,10),a.addMany([60,61,62,63],10,0,11),a.addMany(p(32,48),10,9,12),a.addMany(k,12,0,12),a.add(127,12,0,12),a.addMany(p(28,32),12,0,12),a.addMany(p(32,48),12,9,12),a.addMany(p(48,64),12,0,11),a.addMany(p(64,127),12,12,13),a.addMany(p(64,127),10,12,13),a.addMany(p(64,127),9,12,13),a.addMany(k,13,13,13),a.addMany(d,13,13,13),a.add(127,13,0,13),a.addMany([27,156,24,26],13,14,0),a.add(L,0,2,0),a.add(L,8,5,8),a.add(L,6,0,6),a.add(L,11,0,11),a.add(L,13,13,13),a})();class f extends g.Disposable{constructor(m=r.VT500_TRANSITION_TABLE){super(),this._transitions=m,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=(p,d,k)=>{},this._executeHandlerFb=p=>{},this._csiHandlerFb=(p,d)=>{},this._escHandlerFb=p=>{},this._errorHandlerFb=p=>p,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,g.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(m,p=[64,126]){let d=0;if(m.prefix){if(m.prefix.length>1)throw new Error("only one byte as prefix supported");if(d=m.prefix.charCodeAt(0),d&&60>d||d>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(m.intermediates){if(m.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let D=0;D<m.intermediates.length;++D){const E=m.intermediates.charCodeAt(D);if(32>E||E>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");d<<=8,d|=E}}if(m.final.length!==1)throw new Error("final must be a single byte");const k=m.final.charCodeAt(0);if(p[0]>k||k>p[1])throw new Error(`final must be in range ${p[0]} .. ${p[1]}`);return d<<=8,d|=k,d}identToString(m){const p=[];for(;m;)p.push(String.fromCharCode(255&m)),m>>=8;return p.reverse().join("")}setPrintHandler(m){this._printHandler=m}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(m,p){const d=this._identifier(m,[48,126]);this._escHandlers[d]===void 0&&(this._escHandlers[d]=[]);const k=this._escHandlers[d];return k.push(p),{dispose:()=>{const D=k.indexOf(p);D!==-1&&k.splice(D,1)}}}clearEscHandler(m){this._escHandlers[this._identifier(m,[48,126])]&&delete this._escHandlers[this._identifier(m,[48,126])]}setEscHandlerFallback(m){this._escHandlerFb=m}setExecuteHandler(m,p){this._executeHandlers[m.charCodeAt(0)]=p}clearExecuteHandler(m){this._executeHandlers[m.charCodeAt(0)]&&delete this._executeHandlers[m.charCodeAt(0)]}setExecuteHandlerFallback(m){this._executeHandlerFb=m}registerCsiHandler(m,p){const d=this._identifier(m);this._csiHandlers[d]===void 0&&(this._csiHandlers[d]=[]);const k=this._csiHandlers[d];return k.push(p),{dispose:()=>{const D=k.indexOf(p);D!==-1&&k.splice(D,1)}}}clearCsiHandler(m){this._csiHandlers[this._identifier(m)]&&delete this._csiHandlers[this._identifier(m)]}setCsiHandlerFallback(m){this._csiHandlerFb=m}registerDcsHandler(m,p){return this._dcsParser.registerHandler(this._identifier(m),p)}clearDcsHandler(m){this._dcsParser.clearHandler(this._identifier(m))}setDcsHandlerFallback(m){this._dcsParser.setHandlerFallback(m)}registerOscHandler(m,p){return this._oscParser.registerHandler(m,p)}clearOscHandler(m){this._oscParser.clearHandler(m)}setOscHandlerFallback(m){this._oscParser.setHandlerFallback(m)}setErrorHandler(m){this._errorHandler=m}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(m,p,d,k,D){this._parseStack.state=m,this._parseStack.handlers=p,this._parseStack.handlerPos=d,this._parseStack.transition=k,this._parseStack.chunkPos=D}parse(m,p,d){let k,D=0,E=0,M=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,M=this._parseStack.chunkPos+1;else{if(d===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(d===!1&&T>-1){for(;T>=0&&(k=b[T](this._params),k!==!0);T--)if(k instanceof Promise)return this._parseStack.handlerPos=T,k}this._parseStack.handlers=[];break;case 4:if(d===!1&&T>-1){for(;T>=0&&(k=b[T](),k!==!0);T--)if(k instanceof Promise)return this._parseStack.handlerPos=T,k}this._parseStack.handlers=[];break;case 6:if(D=m[this._parseStack.chunkPos],k=this._dcsParser.unhook(D!==24&&D!==26,d),k)return k;D===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(D=m[this._parseStack.chunkPos],k=this._oscParser.end(D!==24&&D!==26,d),k)return k;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<p;++b){switch(D=m[b],E=this._transitions.table[this.currentState<<8|(D<160?D:L)],E>>4){case 2:for(let O=b+1;;++O){if(O>=p||(D=m[O])<32||D>126&&D<L){this._printHandler(m,b,O),b=O-1;break}if(++O>=p||(D=m[O])<32||D>126&&D<L){this._printHandler(m,b,O),b=O-1;break}if(++O>=p||(D=m[O])<32||D>126&&D<L){this._printHandler(m,b,O),b=O-1;break}if(++O>=p||(D=m[O])<32||D>126&&D<L){this._printHandler(m,b,O),b=O-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&&(k=T[N](this._params),k!==!0);N--)if(k instanceof Promise)return this._preserveStack(3,T,N,E,b),k;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<p&&(D=m[b])>47&&D<60);b--;break;case 9:this._collect<<=8,this._collect|=D;break;case 10:const B=this._escHandlers[this._collect<<8|D];let F=B?B.length-1:-1;for(;F>=0&&(k=B[F](),k!==!0);F--)if(k instanceof Promise)return this._preserveStack(4,B,F,E,b),k;F<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 O=b+1;;++O)if(O>=p||(D=m[O])===24||D===26||D===27||D>127&&D<L){this._dcsParser.put(m,b,O),b=O-1;break}break;case 14:if(k=this._dcsParser.unhook(D!==24&&D!==26),k)return this._preserveStack(6,[],0,E,b),k;D===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let O=b+1;;O++)if(O>=p||(D=m[O])<32||D>127&&D<L){this._oscParser.put(m,b,O),b=O-1;break}break;case 6:if(k=this._oscParser.end(D!==24&&D!==26),k)return this._preserveStack(5,[],0,E,b),k;D===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&E}}}r.EscapeSequenceParser=f},6242:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const g=c(5770),_=c(482),u=[];r.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 L=this._handlers[y];return L.push(S),{dispose:()=>{const f=L.indexOf(S);f!==-1&&L.splice(f,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,L){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(y,S,L);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(y,S,L))}start(){this.reset(),this._state=1}put(y,S,L){if(this._state!==3){if(this._state===1)for(;S<L;){const f=y[S++];if(f===59){this._state=2,this._start();break}if(f<48||57<f)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+f-48}this._state===2&&L-S>0&&this._put(y,S,L)}}end(y,S=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let L=!1,f=this._active.length-1,a=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,L=S,a=this._stack.fallThrough,this._stack.paused=!1),!a&&L===!1){for(;f>=0&&(L=this._active[f].end(y),L!==!0);f--)if(L instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,L;f--}for(;f>=0;f--)if(L=this._active[f].end(!1),L instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,L}else this._handlerFb(this._id,"END",y);this._active=u,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(y){this._handler=y,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(y,S,L){this._hitLimit||(this._data+=(0,_.utf32ToString)(y,S,L),this._data.length>g.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((L=>(this._data="",this._hitLimit=!1,L)));return this._data="",this._hitLimit=!1,S}}},8742:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const c=2147483647;class g{static fromArray(u){const y=new g;if(!u.length)return y;for(let S=Array.isArray(u[0])?1:0;S<u.length;++S){const L=u[S];if(Array.isArray(L))for(let f=0;f<L.length;++f)y.addSubParam(L[f]);else y.addParam(L)}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 g(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,L=255&this._subParamsIdx[y];L-S>0&&u.push(Array.prototype.slice.call(this._subParams,S,L))}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,L=255&this._subParamsIdx[y];L-S>0&&(u[y]=this._subParams.slice(S,L))}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,L=S[y-1];S[y-1]=~L?Math.min(10*L+u,c):u}}r.Params=g},5741:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()}loadAddon(c,g){const _={instance:g,dispose:g.dispose,isDisposed:!1};this._addons.push(_),g.dispose=()=>this._wrappedAddonDispose(_),g.activate(c)}_wrappedAddonDispose(c){if(c.isDisposed)return;let g=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===c){g=_;break}if(g===-1)throw new Error("Could not dispose an addon that has not been loaded");c.isDisposed=!0,c.dispose.apply(c.instance),this._addons.splice(g,1)}}},8771:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const g=c(3785),_=c(511);r.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 g.BufferLineApiView(y)}getNullCell(){return new _.CellData}}},3785:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const g=c(511);r.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 g.CellData)}translateToString(_,u,y){return this._line.translateToString(_,u,y)}}},8285:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const g=c(8771),_=c(8460),u=c(844);class y extends u.Disposable{constructor(L){super(),this._core=L,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new g.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new g.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}r.BufferNamespaceApi=y},7975:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(c){this._core=c}registerCsiHandler(c,g){return this._core.registerCsiHandler(c,(_=>g(_.toArray())))}addCsiHandler(c,g){return this.registerCsiHandler(c,g)}registerDcsHandler(c,g){return this._core.registerDcsHandler(c,((_,u)=>g(_,u.toArray())))}addDcsHandler(c,g){return this.registerDcsHandler(c,g)}registerEscHandler(c,g){return this._core.registerEscHandler(c,g)}addEscHandler(c,g){return this.registerEscHandler(c,g)}registerOscHandler(c,g){return this._core.registerOscHandler(c,g)}addOscHandler(c,g){return this.registerOscHandler(c,g)}}},7090:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.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(x,r,c){var g=this&&this.__decorate||function(a,m,p,d){var k,D=arguments.length,E=D<3?m:d===null?d=Object.getOwnPropertyDescriptor(m,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(a,m,p,d);else for(var M=a.length-1;M>=0;M--)(k=a[M])&&(E=(D<3?k(E):D>3?k(m,p,E):k(m,p))||E);return D>3&&E&&Object.defineProperty(m,p,E),E},_=this&&this.__param||function(a,m){return function(p,d){m(p,d,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const u=c(8460),y=c(844),S=c(5295),L=c(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let f=r.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,r.MINIMUM_COLS),this.rows=Math.max(a.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new S.BufferSet(a,this))}resize(a,m){this.cols=a,this.rows=m,this.buffers.resize(a,m),this._onResize.fire({cols:a,rows:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(a,m=!1){const p=this.buffer;let d;d=this._cachedBlankLine,d&&d.length===this.cols&&d.getFg(0)===a.fg&&d.getBg(0)===a.bg||(d=p.getBlankLine(a,m),this._cachedBlankLine=d),d.isWrapped=m;const k=p.ybase+p.scrollTop,D=p.ybase+p.scrollBottom;if(p.scrollTop===0){const E=p.lines.isFull;D===p.lines.length-1?E?p.lines.recycle().copyFrom(d):p.lines.push(d.clone()):p.lines.splice(D+1,0,d.clone()),E?this.isUserScrolling&&(p.ydisp=Math.max(p.ydisp-1,0)):(p.ybase++,this.isUserScrolling||p.ydisp++)}else{const E=D-k+1;p.lines.shiftElements(k+1,E-1,-1),p.lines.set(D,d.clone())}this.isUserScrolling||(p.ydisp=p.ybase),this._onScroll.fire(p.ydisp)}scrollLines(a,m,p){const d=this.buffer;if(a<0){if(d.ydisp===0)return;this.isUserScrolling=!0}else a+d.ydisp>=d.ybase&&(this.isUserScrolling=!1);const k=d.ydisp;d.ydisp=Math.max(Math.min(d.ydisp+a,d.ybase),0),k!==d.ydisp&&(m||this._onScroll.fire(d.ydisp))}};r.BufferService=f=g([_(0,L.IOptionsService)],f)},7994:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(c){this.glevel=c,this.charset=this._charsets[c]}setgCharset(c,g){this._charsets[c]=g,this.glevel===c&&(this.charset=g)}}},1753:function(x,r,c){var g=this&&this.__decorate||function(d,k,D,E){var M,b=arguments.length,T=b<3?k:E===null?E=Object.getOwnPropertyDescriptor(k,D):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(d,k,D,E);else for(var N=d.length-1;N>=0;N--)(M=d[N])&&(T=(b<3?M(T):b>3?M(k,D,T):M(k,D))||T);return b>3&&T&&Object.defineProperty(k,D,T),T},_=this&&this.__param||function(d,k){return function(D,E){k(D,E,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const u=c(2585),y=c(8460),S=c(844),L={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:d=>d.button!==4&&d.action===1&&(d.ctrl=!1,d.alt=!1,d.shift=!1,!0)},VT200:{events:19,restrict:d=>d.action!==32},DRAG:{events:23,restrict:d=>d.action!==32||d.button!==3},ANY:{events:31,restrict:d=>!0}};function f(d,k){let D=(d.ctrl?16:0)|(d.shift?4:0)|(d.alt?8:0);return d.button===4?(D|=64,D|=d.action):(D|=3&d.button,4&d.button&&(D|=64),8&d.button&&(D|=128),d.action===32?D|=32:d.action!==0||k||(D|=3)),D}const a=String.fromCharCode,m={DEFAULT:d=>{const k=[f(d,!1)+32,d.col+32,d.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${a(k[0])}${a(k[1])}${a(k[2])}`},SGR:d=>{const k=d.action===0&&d.button!==4?"m":"M";return`\x1B[<${f(d,!0)};${d.col};${d.row}${k}`},SGR_PIXELS:d=>{const k=d.action===0&&d.button!==4?"m":"M";return`\x1B[<${f(d,!0)};${d.x};${d.y}${k}`}};let p=r.CoreMouseService=class extends S.Disposable{constructor(d,k){super(),this._bufferService=d,this._coreService=k,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(L))this.addProtocol(D,L[D]);for(const D of Object.keys(m))this.addEncoding(D,m[D]);this.reset()}addProtocol(d,k){this._protocols[d]=k}addEncoding(d,k){this._encodings[d]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(d){if(!this._protocols[d])throw new Error(`unknown protocol "${d}"`);this._activeProtocol=d,this._onProtocolChange.fire(this._protocols[d].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(d){if(!this._encodings[d])throw new Error(`unknown encoding "${d}"`);this._activeEncoding=d}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(d){if(d.col<0||d.col>=this._bufferService.cols||d.row<0||d.row>=this._bufferService.rows||d.button===4&&d.action===32||d.button===3&&d.action!==32||d.button!==4&&(d.action===2||d.action===3)||(d.col++,d.row++,d.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,d,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(d))return!1;const k=this._encodings[this._activeEncoding](d);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=d,!0}explainEvents(d){return{down:!!(1&d),up:!!(2&d),drag:!!(4&d),move:!!(8&d),wheel:!!(16&d)}}_equalEvents(d,k,D){if(D){if(d.x!==k.x||d.y!==k.y)return!1}else if(d.col!==k.col||d.row!==k.row)return!1;return d.button===k.button&&d.action===k.action&&d.ctrl===k.ctrl&&d.alt===k.alt&&d.shift===k.shift}};r.CoreMouseService=p=g([_(0,u.IBufferService),_(1,u.ICoreService)],p)},6975:function(x,r,c){var g=this&&this.__decorate||function(p,d,k,D){var E,M=arguments.length,b=M<3?d:D===null?D=Object.getOwnPropertyDescriptor(d,k):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(p,d,k,D);else for(var T=p.length-1;T>=0;T--)(E=p[T])&&(b=(M<3?E(b):M>3?E(d,k,b):E(d,k))||b);return M>3&&b&&Object.defineProperty(d,k,b),b},_=this&&this.__param||function(p,d){return function(k,D){d(k,D,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const u=c(1439),y=c(8460),S=c(844),L=c(2585),f=Object.freeze({insertMode:!1}),a=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let m=r.CoreService=class extends S.Disposable{constructor(p,d,k){super(),this._bufferService=p,this._logService=d,this._optionsService=k,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)(f),this.decPrivateModes=(0,u.clone)(a)}reset(){this.modes=(0,u.clone)(f),this.decPrivateModes=(0,u.clone)(a)}triggerDataEvent(p,d=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;d&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),d&&this._onUserInput.fire(),this._logService.debug(`sending data "${p}"`,(()=>p.split("").map((D=>D.charCodeAt(0))))),this._onData.fire(p)}triggerBinaryEvent(p){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${p}"`,(()=>p.split("").map((d=>d.charCodeAt(0))))),this._onBinary.fire(p))}};r.CoreService=m=g([_(0,L.IBufferService),_(1,L.ILogService),_(2,L.IOptionsService)],m)},9074:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const g=c(8055),_=c(8460),u=c(844),y=c(6106);let S=0,L=0;class f extends u.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new y.SortedList((p=>p==null?void 0:p.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(p){if(p.marker.isDisposed)return;const d=new a(p);if(d){const k=d.marker.onDispose((()=>d.dispose()));d.onDispose((()=>{d&&(this._decorations.delete(d)&&this._onDecorationRemoved.fire(d),k.dispose())})),this._decorations.insert(d),this._onDecorationRegistered.fire(d)}return d}reset(){for(const p of this._decorations.values())p.dispose();this._decorations.clear()}*getDecorationsAtCell(p,d,k){let D=0,E=0;for(const M of this._decorations.getKeyIterator(d))D=M.options.x??0,E=D+(M.options.width??1),p>=D&&p<E&&(!k||(M.options.layer??"bottom")===k)&&(yield M)}forEachDecorationAtCell(p,d,k,D){this._decorations.forEachByKey(d,(E=>{S=E.options.x??0,L=S+(E.options.width??1),p>=S&&p<L&&(!k||(E.options.layer??"bottom")===k)&&D(E)}))}}r.DecorationService=f;class a extends u.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=g.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=g.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(p){super(),this.options=p,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=p.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const g=c(2585),_=c(8343);class u{constructor(...S){this._entries=new Map;for(const[L,f]of S)this.set(L,f)}set(S,L){const f=this._entries.get(S);return this._entries.set(S,L),f}forEach(S){for(const[L,f]of this._entries.entries())S(L,f)}has(S){return this._entries.has(S)}get(S){return this._entries.get(S)}}r.ServiceCollection=u,r.InstantiationService=class{constructor(){this._services=new u,this._services.set(g.IInstantiationService,this)}setService(y,S){this._services.set(y,S)}getService(y){return this._services.get(y)}createInstance(y,...S){const L=(0,_.getServiceDependencies)(y).sort(((m,p)=>m.index-p.index)),f=[];for(const m of L){const p=this._services.get(m.id);if(!p)throw new Error(`[createInstance] ${y.name} depends on UNKNOWN service ${m.id}.`);f.push(p)}const a=L.length>0?L[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,...f)}}},7866:function(x,r,c){var g=this&&this.__decorate||function(a,m,p,d){var k,D=arguments.length,E=D<3?m:d===null?d=Object.getOwnPropertyDescriptor(m,p):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(a,m,p,d);else for(var M=a.length-1;M>=0;M--)(k=a[M])&&(E=(D<3?k(E):D>3?k(m,p,E):k(m,p))||E);return D>3&&E&&Object.defineProperty(m,p,E),E},_=this&&this.__param||function(a,m){return function(p,d){m(p,d,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.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 L,f=r.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()))),L=this}_updateLogLevel(){this._logLevel=S[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let m=0;m<a.length;m++)typeof a[m]=="function"&&(a[m]=a[m]())}_log(a,m,p){this._evalLazyOptionalParams(p),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...p)}trace(a,...m){var p;this._logLevel<=y.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,a,m)}debug(a,...m){var p;this._logLevel<=y.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,a,m)}info(a,...m){var p;this._logLevel<=y.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,a,m)}warn(a,...m){var p;this._logLevel<=y.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,a,m)}error(a,...m){var p;this._logLevel<=y.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,a,m)}};r.LogService=f=g([_(0,y.IOptionsService)],f),r.setTraceLogger=function(a){L=a},r.traceCall=function(a,m,p){if(typeof p.value!="function")throw new Error("not supported");const d=p.value;p.value=function(...k){if(L.logLevel!==y.LogLevelEnum.TRACE)return d.apply(this,k);L.trace(`GlyphRenderer#${d.name}(${k.map((E=>JSON.stringify(E))).join(", ")})`);const D=d.apply(this,k);return L.trace(`GlyphRenderer#${d.name} return`,D),D}}},7302:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const g=c(8460),_=c(844),u=c(6114);r.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(f){super(),this._onOptionChange=this.register(new g.EventEmitter),this.onOptionChange=this._onOptionChange.event;const a={...r.DEFAULT_OPTIONS};for(const m in f)if(m in a)try{const p=f[m];a[m]=this._sanitizeAndValidateOption(m,p)}catch(p){console.error(p)}this.rawOptions=a,this.options={...a},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(f,a){return this.onOptionChange((m=>{m===f&&a(this.rawOptions[f])}))}onMultipleOptionChange(f,a){return this.onOptionChange((m=>{f.indexOf(m)!==-1&&a()}))}_setupOptions(){const f=m=>{if(!(m in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);return this.rawOptions[m]},a=(m,p)=>{if(!(m in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);p=this._sanitizeAndValidateOption(m,p),this.rawOptions[m]!==p&&(this.rawOptions[m]=p,this._onOptionChange.fire(m))};for(const m in this.rawOptions){const p={get:f.bind(this,m),set:a.bind(this,m)};Object.defineProperty(this.options,m,p)}}_sanitizeAndValidateOption(f,a){switch(f){case"cursorStyle":if(a||(a=r.DEFAULT_OPTIONS[f]),!(function(m){return m==="block"||m==="underline"||m==="bar"})(a))throw new Error(`"${a}" is not a valid value for ${f}`);break;case"wordSeparator":a||(a=r.DEFAULT_OPTIONS[f]);break;case"fontWeight":case"fontWeightBold":if(typeof a=="number"&&1<=a&&a<=1e3)break;a=y.includes(a)?a:r.DEFAULT_OPTIONS[f];break;case"cursorWidth":a=Math.floor(a);case"lineHeight":case"tabStopWidth":if(a<1)throw new Error(`${f} 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(`${f} cannot be less than 0, value: ${a}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(a<=0)throw new Error(`${f} cannot be less than or equal to 0, value: ${a}`);break;case"rows":case"cols":if(!a&&a!==0)throw new Error(`${f} must be numeric, value: ${a}`);break;case"windowsPty":a=a??{}}return a}}r.OptionsService=S},2660:function(x,r,c){var g=this&&this.__decorate||function(S,L,f,a){var m,p=arguments.length,d=p<3?L:a===null?a=Object.getOwnPropertyDescriptor(L,f):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(S,L,f,a);else for(var k=S.length-1;k>=0;k--)(m=S[k])&&(d=(p<3?m(d):p>3?m(L,f,d):m(L,f))||d);return p>3&&d&&Object.defineProperty(L,f,d),d},_=this&&this.__param||function(S,L){return function(f,a){L(f,a,S)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const u=c(2585);let y=r.OscLinkService=class{constructor(S){this._bufferService=S,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(S){const L=this._bufferService.buffer;if(S.id===void 0){const k=L.addMarker(L.ybase+L.y),D={data:S,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(D,k))),this._dataByLinkId.set(D.id,D),D.id}const f=S,a=this._getEntryIdKey(f),m=this._entriesWithId.get(a);if(m)return this.addLineToLink(m.id,L.ybase+L.y),m.id;const p=L.addMarker(L.ybase+L.y),d={id:this._nextId++,key:this._getEntryIdKey(f),data:f,lines:[p]};return p.onDispose((()=>this._removeMarkerFromLink(d,p))),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(S,L){const f=this._dataByLinkId.get(S);if(f&&f.lines.every((a=>a.line!==L))){const a=this._bufferService.buffer.addMarker(L);f.lines.push(a),a.onDispose((()=>this._removeMarkerFromLink(f,a)))}}getLinkData(S){var L;return(L=this._dataByLinkId.get(S))==null?void 0:L.data}_getEntryIdKey(S){return`${S.id};;${S.uri}`}_removeMarkerFromLink(S,L){const f=S.lines.indexOf(L);f!==-1&&(S.lines.splice(f,1),S.lines.length===0&&(S.data.id!==void 0&&this._entriesWithId.delete(S.key),this._dataByLinkId.delete(S.id)))}};r.OscLinkService=y=g([_(0,u.IBufferService)],y)},8343:(x,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const c="di$target",g="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[g]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);const u=function(y,S,L){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,a,m){a[c]===a?a[g].push({id:f,index:m}):(a[g]=[{id:f,index:m}],a[c]=a)})(u,y,L)};return u.toString=()=>_,r.serviceRegistry.set(_,u),u}},2585:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const g=c(8343);var _;r.IBufferService=(0,g.createDecorator)("BufferService"),r.ICoreMouseService=(0,g.createDecorator)("CoreMouseService"),r.ICoreService=(0,g.createDecorator)("CoreService"),r.ICharsetService=(0,g.createDecorator)("CharsetService"),r.IInstantiationService=(0,g.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"})(_||(r.LogLevelEnum=_={})),r.ILogService=(0,g.createDecorator)("LogService"),r.IOptionsService=(0,g.createDecorator)("OptionsService"),r.IOscLinkService=(0,g.createDecorator)("OscLinkService"),r.IUnicodeService=(0,g.createDecorator)("UnicodeService"),r.IDecorationService=(0,g.createDecorator)("DecorationService")},1480:(x,r,c)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const g=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,L,f=!1){return(16777215&S)<<3|(3&L)<<1|(f?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new g.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 L=0,f=0;const a=S.length;for(let m=0;m<a;++m){let p=S.charCodeAt(m);if(55296<=p&&p<=56319){if(++m>=a)return L+this.wcwidth(p);const D=S.charCodeAt(m);56320<=D&&D<=57343?p=1024*(p-55296)+D-56320+65536:L+=this.wcwidth(D)}const d=this.charProperties(p,f);let k=u.extractWidth(d);u.extractShouldJoin(d)&&(k-=u.extractWidth(f)),L+=k,f=d}return L}charProperties(S,L){return this._activeProvider.charProperties(S,L)}}r.UnicodeService=u}},h={};function v(x){var r=h[x];if(r!==void 0)return r.exports;var c=h[x]={exports:{}};return i[x].call(c.exports,c,c.exports,v),c.exports}var R={};return(()=>{var x=R;Object.defineProperty(x,"__esModule",{value:!0}),x.Terminal=void 0;const r=v(9042),c=v(3236),g=v(844),_=v(5741),u=v(8285),y=v(7975),S=v(7090),L=["cols","rows"];class f extends g.Disposable{constructor(m){super(),this._core=this.register(new c.Terminal(m)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const p=k=>this._core.options[k],d=(k,D)=>{this._checkReadonlyOptions(k),this._core.options[k]=D};for(const k in this._core.options){const D={get:p.bind(this,k),set:d.bind(this,k)};Object.defineProperty(this._publicOptions,k,D)}}_checkReadonlyOptions(m){if(L.includes(m))throw new Error(`Option "${m}" 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 m=this._core.coreService.decPrivateModes;let p="none";switch(this._core.coreMouseService.activeProtocol){case"X10":p="x10";break;case"VT200":p="vt200";break;case"DRAG":p="drag";break;case"ANY":p="any"}return{applicationCursorKeysMode:m.applicationCursorKeys,applicationKeypadMode:m.applicationKeypad,bracketedPasteMode:m.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:p,originMode:m.origin,reverseWraparoundMode:m.reverseWraparound,sendFocusMode:m.sendFocus,wraparoundMode:m.wraparound}}get options(){return this._publicOptions}set options(m){for(const p in m)this._publicOptions[p]=m[p]}blur(){this._core.blur()}focus(){this._core.focus()}input(m,p=!0){this._core.input(m,p)}resize(m,p){this._verifyIntegers(m,p),this._core.resize(m,p)}open(m){this._core.open(m)}attachCustomKeyEventHandler(m){this._core.attachCustomKeyEventHandler(m)}attachCustomWheelEventHandler(m){this._core.attachCustomWheelEventHandler(m)}registerLinkProvider(m){return this._core.registerLinkProvider(m)}registerCharacterJoiner(m){return this._checkProposedApi(),this._core.registerCharacterJoiner(m)}deregisterCharacterJoiner(m){this._checkProposedApi(),this._core.deregisterCharacterJoiner(m)}registerMarker(m=0){return this._verifyIntegers(m),this._core.registerMarker(m)}registerDecoration(m){return this._checkProposedApi(),this._verifyPositiveIntegers(m.x??0,m.width??0,m.height??0),this._core.registerDecoration(m)}hasSelection(){return this._core.hasSelection()}select(m,p,d){this._verifyIntegers(m,p,d),this._core.select(m,p,d)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(m,p){this._verifyIntegers(m,p),this._core.selectLines(m,p)}dispose(){super.dispose()}scrollLines(m){this._verifyIntegers(m),this._core.scrollLines(m)}scrollPages(m){this._verifyIntegers(m),this._core.scrollPages(m)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(m){this._verifyIntegers(m),this._core.scrollToLine(m)}clear(){this._core.clear()}write(m,p){this._core.write(m,p)}writeln(m,p){this._core.write(m),this._core.write(`\r
116
+ `,p)}paste(m){this._core.paste(m)}refresh(m,p){this._verifyIntegers(m,p),this._core.refresh(m,p)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(m){this._addonManager.loadAddon(this,m)}static get strings(){return r}_verifyIntegers(...m){for(const p of m)if(p===1/0||isNaN(p)||p%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...m){for(const p of m)if(p&&(p===1/0||isNaN(p)||p%1!=0||p<0))throw new Error("This API only accepts positive integers")}}x.Terminal=f})(),R})()))})(Rc)),Rc.exports}var N1=A1();function D1(n){return n.toLowerCase().startsWith("win")}function I1(n){return n.keyCode===86&&n.ctrlKey&&!n.shiftKey&&!n.altKey&&!n.metaKey}const j1=8,P1=100,O1=80,Lf=6,Tf=.02,B1=.95,F1=50;function H1(n,s){return Math.hypot(n,s)>j1}function $1(n,s){const i=n[n.length-1];if(i===void 0||s-i.t>O1)return 0;const h=n.filter(x=>i.t-x.t<=P1),v=h[0];if(v===void 0||h.length<2||i.t===v.t)return 0;const R=(v.y-i.y)/(i.t-v.t);return Math.max(-Lf,Math.min(Lf,R))}function U1(n,s){if(Math.abs(n)<Tf)return{delta:0,velocity:0};const i=Math.max(0,Math.min(F1,s)),h=n*B1**(i/16);return{delta:n*i,velocity:Math.abs(h)<Tf?0:h}}function W1(n){const s=Math.trunc(n);return{pixels:s,rest:n-s}}const z1=60;function V1(){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"}},Mf={dark:1,light:4.5};function Im({terminalId:n,connection:s,active:i,theme:h,autoFocus:v=!0,pasteOnCtrlV:R=!1}){const x=I.useRef(null),r=I.useRef(null),c=I.useRef(null),g=I.useRef(h);return g.current=h,I.useEffect(()=>{const _=x.current;if(_===null)return;const u=new N1.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[g.current],minimumContrastRatio:Mf[g.current]});r.current=u;const y=new E1.FitAddon;c.current=y,u.loadAddon(y),u.loadAddon(new T1.WebLinksAddon),u.open(_);let S=!1;const L=()=>{if(!(S||V1()!=="webgl")){S=!0;try{const J=new M1.WebglAddon;J.onContextLoss(()=>J.dispose()),u.loadAddon(J)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let f={cols:0,rows:0},a;const m=()=>_.clientWidth>0&&_.clientHeight>0,p=J=>{const{cols:Z,rows:pe}=u;Z<=0||pe<=0||!J&&Z===f.cols&&pe===f.rows||(f={cols:Z,rows:pe},s.send({type:"resize",terminalId:n,cols:Z,rows:pe}))};let d={atBottom:!0,line:0},k=!1;const D=()=>{if(k||!m())return;const J=u.buffer.active;d={atBottom:J.viewportY>=J.baseY,line:J.viewportY}},E=()=>{const J=u.buffer.active;if(J.baseY===0)return;const Z=d.atBottom?J.baseY:Math.min(d.line,J.baseY);u.scrollToLine(Z>0?Z-1:Z+1),u.scrollToLine(Z)},M=u.onRender(D),b=u.onScroll(D);let T=m();const N=()=>{if(m()){try{y.fit()}catch{return}k&&(E(),k=!1),u.cols>0&&u.rows>0&&L(),p(!1)}},B=()=>{window.clearTimeout(a),a=window.setTimeout(N,z1)},F=new ResizeObserver(()=>{const J=m();k=!0,J&&!T&&E(),T=J,B()});F.observe(_),window.addEventListener("resize",B);let O=null,U=0,V=0;const Y=(J,Z,pe)=>{const me=u.element;if(me===void 0)return;const ie=W1(V+J);V=ie.rest,ie.pixels!==0&&me.dispatchEvent(new WheelEvent("wheel",{deltaY:ie.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:Z,clientY:pe,bubbles:!0,cancelable:!0}))},X=()=>{window.cancelAnimationFrame(U),U=0},G=(J,Z,pe)=>{let me=J,ie=performance.now();const Le=Ae=>{if(!m()){U=0;return}const Xe=U1(me,Ae-ie);ie=Ae,Y(Xe.delta,Z,pe),me=Xe.velocity,U=me===0?0:window.requestAnimationFrame(Le)};U=window.requestAnimationFrame(Le)},P=(J,Z)=>{for(let pe=0;pe<J.length;pe++){const me=J.item(pe);if(me!==null&&me.identifier===Z)return me}return null},$=J=>{X(),V=0;const Z=J.touches.length===1?J.touches.item(0):null;O=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}]}},H=J=>{if(J.stopPropagation(),O===null)return;const Z=P(J.touches,O.id);if(Z===null)return;if(!O.moving){if(!H1(Z.clientX-O.startX,Z.clientY-O.startY))return;O.moving=!0}J.cancelable&&J.preventDefault();const pe=O.lastY-Z.clientY;O.lastX=Z.clientX,O.lastY=Z.clientY,O.samples.push({t:J.timeStamp,y:Z.clientY}),O.samples.length>32&&O.samples.shift(),Y(pe,Z.clientX,Z.clientY)},q=J=>{if(O===null||P(J.changedTouches,O.id)===null)return;const Z=O;if(O=null,!Z.moving)return;const pe=$1(Z.samples,J.timeStamp);pe!==0&&G(pe,Z.lastX,Z.lastY)},ne=()=>{O=null};_.addEventListener("touchstart",$,{capture:!0,passive:!0}),_.addEventListener("touchmove",H,{capture:!0,passive:!1}),_.addEventListener("touchend",q,{capture:!0,passive:!0}),_.addEventListener("touchcancel",ne,{capture:!0,passive:!0});const re=()=>{if(!(document.visibilityState!=="visible"||!m())){try{y.fit()}catch{return}p(!0)}};window.addEventListener("focus",re),document.addEventListener("visibilitychange",re),R&&u.attachCustomKeyEventHandler(J=>!I1(J));const ue=u.onData(J=>{s.send({type:"input",terminalId:n,data:J})}),de=s.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-- ${C("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-- ${C("terminal.exited",{code:J.exitCode})} --\x1B[0m\r
119
+ `);break}}),K=()=>{if(m())try{y.fit()}catch{}const J=u.cols>0?u.cols:80,Z=u.rows>0?u.rows:24;f={cols:J,rows:Z},s.send({type:"terminal.attach",terminalId:n,cols:J,rows:Z})};K();const W=s.onReopen(K);return()=>{window.clearTimeout(a),window.removeEventListener("resize",B),window.removeEventListener("focus",re),document.removeEventListener("visibilitychange",re),F.disconnect(),X(),_.removeEventListener("touchstart",$,{capture:!0}),_.removeEventListener("touchmove",H,{capture:!0}),_.removeEventListener("touchend",q,{capture:!0}),_.removeEventListener("touchcancel",ne,{capture:!0}),M.dispose(),b.dispose(),ue.dispose(),de(),W(),s.send({type:"terminal.detach",terminalId:n}),u.dispose(),r.current=null,c.current=null}},[n,s,R]),I.useEffect(()=>{const _=r.current;_!==null&&(_.options.theme=Rf[h],_.options.minimumContrastRatio=Mf[h])},[h]),I.useEffect(()=>{if(!i)return;const _=r.current,u=c.current;if(_===null||u===null)return;const y=window.setTimeout(()=>{const S=x.current;if(!(S===null||S.clientWidth===0||S.clientHeight===0)){try{u.fit()}catch{return}v&&_.focus(),_.cols>0&&_.rows>0&&s.send({type:"resize",terminalId:n,cols:_.cols,rows:_.rows})}},0);return()=>window.clearTimeout(y)},[i,v,n,s]),l.jsx("div",{className:`terminal-surface${i?"":" terminal-surface-hidden"}`,ref:x})}function q1(){return l.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[l.jsx("path",{d:"M1.5 8s2.4-4.5 6.5-4.5S14.5 8 14.5 8s-2.4 4.5-6.5 4.5S1.5 8 1.5 8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M2.5 13.5l11-11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function Ta({title:n,onHide:s,confirmText:i}){const[h,v]=I.useState(!1);return l.jsxs("span",{className:"section-hide",children:[l.jsx("button",{className:"icon-button",onClick:R=>{R.stopPropagation(),i===null?s():v(!0)},title:n,"aria-label":n,children:l.jsx(q1,{})}),h&&i!==null&&l.jsxs("span",{className:"section-hide-confirm",role:"alert",children:[l.jsx("span",{children:i}),l.jsx("button",{className:"link-button",onClick:()=>{v(!1),s()},children:C("settings.panels.consoleConfirmYes")}),l.jsx("button",{className:"link-button",onClick:()=>v(!1),children:C("common.cancel")})]})]})}const K1=typeof navigator<"u"&&D1(navigator.platform);function G1({connection:n,shells:s,activeShellId:i,cwd:h,shellName:v,theme:R,onSelect:x,onOpen:r,onCloseShell:c,onCollapse:g,onHide:_,hideCount:u=0}){const y=v??C("console.name"),S=s.find(L=>L.terminalId===i)??s[0]??null;return l.jsxs("section",{className:"console-pane",children:[l.jsxs("header",{className:"console-header",children:[l.jsxs("div",{className:"strip-tabs",children:[s.map((L,f)=>l.jsxs("div",{className:`strip-tab${L.terminalId===(S==null?void 0:S.terminalId)?" is-active":""}${L.alive?"":" is-dead"}`,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>x(L.terminalId),title:L.alive?C("console.tab.title",{shell:L.label.length>0?L.label:y,number:f+1,cwd:h}):C("console.tab.exited",{code:L.exitCode??"?"}),children:C("console.tab.label",{number:f+1})}),l.jsx("button",{className:"strip-tab-close",onClick:()=>c(L.terminalId),title:C("console.tab.close"),children:"×"})]},L.terminalId)),v!==null&&l.jsx("button",{className:"strip-tab-new",onClick:r,title:C("console.openAnother",{shell:y,cwd:h}),children:"+"})]}),l.jsx("span",{className:"strip-spacer"}),l.jsx("button",{className:"icon-button",onClick:g,title:C("console.collapse"),children:"▾"}),_!==void 0&&l.jsx(Ta,{title:C("settings.hide.console"),onHide:_,confirmText:u===0?null:C("settings.panels.consoleConfirm",{count:u})})]}),l.jsx("div",{className:"console-body",children:s.length===0?l.jsx("div",{className:"console-empty",children:v===null?l.jsx("p",{className:"panel-note",children:C("console.noShell")}):l.jsx("button",{className:"link-button",onClick:r,children:C("console.openIn",{shell:y,cwd:h})})}):l.jsx("div",{className:"terminal-stack",children:s.map(L=>l.jsx(Im,{terminalId:L.terminalId,connection:n,active:L.terminalId===(S==null?void 0:S.terminalId),theme:R,pasteOnCtrlV:K1},L.terminalId))})})]})}const Y1=.75,X1=.9;function Tn(n){if(n<1e3)return String(n);if(n<1e6){const s=n/1e3;return`${s<100?Hr(s,1):Math.round(s)}k`}return`${Hr(n/1e6,2)}M`}function Q1({usage:n,source:s,instructionsFile:i,fallbackWindow:h=null,compact:v=!1,statusLineState:R=null,onConfigure:x}){const{lastRequestTokens:r,contextWindow:c}=n;if(x!==void 0&&R!==null&&Ry(s,{state:R}))return l.jsxs("div",{className:`meter meter-idle${v?" meter-compact":""}`,title:My(R),children:[l.jsx("span",{className:"meter-label",children:C("meter.label")}),l.jsx("span",{className:`meter-bar${v?" meter-bar-inline":""}`}),l.jsx("span",{className:"meter-value",children:C("meter.unmeasured")}),l.jsx("button",{className:"link-button",onClick:x,children:C("meter.configure")})]});if(s===null)return l.jsxs("div",{className:`meter meter-idle${v?" meter-compact":""}`,title:C("meter.noTokensTitle"),children:[l.jsx("span",{className:"meter-label",children:C("meter.label")}),l.jsx("span",{className:`meter-bar${v?" meter-bar-inline":""}`}),l.jsx("span",{className:"meter-value",children:C("meter.noTokens")})]});if(!Ty(s,n)){const S=Ny(i,s),L=Ly(s,n,h);return l.jsxs("div",{className:`meter meter-idle${v?" meter-compact":""}`,title:S,children:[l.jsx("span",{className:"meter-label",children:C("meter.label")}),l.jsx("span",{className:`meter-bar${v?" meter-bar-inline":""}`}),l.jsxs("span",{className:"meter-value",children:[C("meter.unmeasured"),L!==null&&l.jsxs("span",{className:"meter-dim",children:[" / ",Tn(L)]})]})]})}const g=c!==null&&c>0?Math.min(r/c,1):null,_=g===null?"unknown":g>=X1?"danger":g>=Y1?"warn":"ok",u=c===null?"":` / ${Tn(c)}${n.contextWindowEstimated?"+":""}`,y=Ay(s,n);if(v){const S=[n.lastModel===null?null:n.lastModel,y,g===null?C("meter.unknownModelShort"):C("meter.windowPercent",{percent:Math.round(g*100)}),C("meter.output",{tokens:Tn(n.lastOutputTokens)}),s==="status-line"?C("meter.responses",{count:n.assistantMessages}):C("meter.sessionTotals",{output:Tn(n.totalOutputTokens),cache:Tn(n.totalCacheReadTokens),count:n.assistantMessages})].filter(L=>L!==null).join(" · ");return l.jsxs("div",{className:"meter meter-compact",title:S,children:[l.jsx("span",{className:"meter-label",children:C("meter.label")}),g!==null&&l.jsx("span",{className:"meter-bar meter-bar-inline",children:l.jsx("span",{className:`meter-fill meter-fill-${_}`,style:{width:`${g*100}%`}})}),l.jsxs("span",{className:"meter-value",children:[Tn(r),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:C("meter.label")}),l.jsxs("span",{className:"meter-value",children:[Tn(r),c!==null&&l.jsxs("span",{className:"meter-dim",title:n.lastModel===null?void 0:y!==null?C("meter.modelWithOrigin",{model:n.lastModel,origin:y}):n.lastModel,children:[" ","/ ",Tn(c),n.contextWindowEstimated&&"+"]})]})]}),g!==null?l.jsx("div",{className:"meter-bar",title:C("meter.windowPercent",{percent:Math.round(g*100)}),children:l.jsx("div",{className:`meter-fill meter-fill-${_}`,style:{width:`${g*100}%`}})}):l.jsx("div",{className:"meter-note",title:n.lastModel??void 0,children:C("meter.unknownModel")}),l.jsxs("div",{className:"meter-row meter-row-dim",children:[l.jsx("span",{title:C("meter.lastResponseTitle"),children:C("meter.output",{tokens:Tn(n.lastOutputTokens)})}),l.jsx("span",{title:C("meter.sessionTitle"),children:C("meter.sessionTotals",{output:Tn(n.totalOutputTokens),cache:Tn(n.totalCacheReadTokens),count:n.assistantMessages})})]})]})}const Mc=["s","m","l"],jm="m",J1="agent-workbench.thread-font",Z1="agent-workbench.notes-font",eb="s",tb={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function Af(n){return C(tb[n])}function Pm(n){const s=Mc.indexOf(n);return Mc[(s+1)%Mc.length]??jm}function nb(n){return n==="s"||n==="m"||n==="l"?n:null}function Ra(n){return C("threadFont.title",{current:Af(n),next:Af(Pm(n))})}const sb=200;function Om(n){return Math.max(sb,n)}function rb(n){return n.hasMore&&!n.loading&&n.searching!==!0&&n.scrollTop<n.previousScrollTop&&n.scrollTop<=Om(n.clientHeight)}function ib(n,s,i){return n<0&&s<=Om(i)}function ob(n,s){return Math.max(0,s-n)}function ab(n,s){return n===null||s.length===0||s[0]===n?!1:s.includes(n)}function Bm({agents:n,preselected:s,anchor:i,label:h=C("agentMenu.openWith"),onPick:v,onClose:R}){const x=I.useMemo(()=>hm(n),[n]),[r,c]=I.useState(()=>By(x,s)),[g,_]=I.useState(null),u=I.useRef(null),y=I.useRef([]);return I.useLayoutEffect(()=>{const S=u.current;if(S===null)return;const L=i.getBoundingClientRect(),f=S.getBoundingClientRect();_(Hy({left:L.left,top:L.top,bottom:L.bottom},{width:f.width,height:f.height},{width:window.innerWidth,height:window.innerHeight}))},[i]),I.useEffect(()=>{var S;(S=y.current[r])==null||S.focus()},[r,g]),I.useEffect(()=>{const S=a=>{if(!(a.altKey||a.ctrlKey||a.metaKey)){if(a.key==="Escape"){a.preventDefault(),a.stopPropagation(),R(),i.focus();return}if(a.key==="ArrowDown"||a.key==="ArrowUp"){a.preventDefault(),a.stopPropagation(),c(m=>Fy(m,a.key==="ArrowDown"?1:-1,x.length));return}if(a.key==="Enter"){a.preventDefault(),a.stopPropagation();const m=x[r];m!==void 0&&v(m.id);return}a.key==="Tab"&&R()}},L=a=>{var p;const m=a.target;m instanceof Node&&((p=u.current)!=null&&p.contains(m)||i.contains(m))||R()},f=a=>{$y(a.target,i,u.current)&&R()};return window.addEventListener("keydown",S,!0),document.addEventListener("pointerdown",L,!0),window.addEventListener("scroll",f,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("keydown",S,!0),document.removeEventListener("pointerdown",L,!0),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",R)}},[r,i,x,R,v]),bm.createPortal(l.jsx("div",{ref:u,className:"agent-menu",role:"menu","aria-label":h,style:g===null?{left:0,top:0,visibility:"hidden"}:{left:`${g.left}px`,top:`${g.top}px`},children:x.map((S,L)=>l.jsxs("button",{ref:f=>{y.current[L]=f},className:`agent-menu-item${L===r?" agent-menu-item-active":""}`,role:"menuitem",tabIndex:L===r?0:-1,onMouseEnter:()=>c(L),onClick:()=>v(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 Fm({targets:n,className:s,text:i,blockedReason:h=null,onPick:v}){const[R,x]=I.useState(!1),r=I.useRef(null),c=I.useCallback(()=>x(!1),[]),g=I.useCallback(_=>{x(!1),v(_)},[v]);return n.length===0?null:l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:r,className:s,onClick:()=>x(_=>!_),disabled:h!==null,"aria-haspopup":"menu","aria-expanded":R,title:h??Uy(),children:i}),R&&r.current!==null&&l.jsx(Bm,{agents:n,preselected:null,anchor:r.current,label:C("continue.menuLabel"),onPick:g,onClose:c})]})}function Hm(n){switch(n.notice){case"compacted":return n.detail==="auto"?C("thread.notice.compactedAuto"):C("thread.notice.compacted");case"interrupted":return C("thread.notice.interrupted");case"error":return n.detail.length>0?C("thread.notice.error",{detail:n.detail}):C("thread.notice.errorNoDetail")}}const $m="agent-workbench.locale",Um="auto";function lb(n){return n==="auto"||nm(n)?n:null}function Wm(n){const s=n.trim().replace(/_/g,"-").toLowerCase();if(s.length===0)return null;const i=gu.find(R=>R.toLowerCase()===s);if(i!==void 0)return i;const[h="",...v]=s.split("-");return h==="zh"?v.includes("hant")||v.some(x=>x==="tw"||x==="hk"||x==="mo")?null:Ac("zh-CN"):Ac(h==="pt"?"pt-BR":h)}function Ac(n){return nm(n)?n:null}function zm(n,s){if(n!=="auto")return n;for(const i of s){const h=Wm(i);if(h!==null)return h}return"en"}function Vm(n,s){for(const i of s)if(Wm(i)===n)try{if(Intl.DateTimeFormat.supportedLocalesOf([i]).length>0)return i}catch{}return Z0(n)}let Ma=Um;const nu=new Set;function yu(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function cb(){return zm("auto",yu())}async function qm(n){const s=yu(),i=zm(n,s);await rm(i,Vm(i,s))}async function ub(){Ma=mt($m,Um,lb);try{await qm(Ma)}catch{await rm("en",Vm("en",yu()))}document.documentElement.lang=Qc(),sm(()=>{document.documentElement.lang=Qc()})}async function hb(n){await qm(n),Ma=n,ht($m,n);for(const s of nu)s()}function db(n){return nu.add(n),()=>nu.delete(n)}function fb(){return Ma}function Yi(){return I.useSyncExternalStore(sm,Qc)}function pb(){return I.useSyncExternalStore(db,fb)}const Km=String.raw`https?:\/\/[^\s<>"'\`]+`,mb=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${Km})`].join("|")),gb=/^(https?:|mailto:)/i,_b=new RegExp(Km);function vb(n){const s=_b.exec(n);if(s===null||s.index===void 0)return null;const i=Gm(s[0]);return{index:s.index,length:i.length,href:i}}function va(n,s){let i=0;for(const h of n)h===s&&(i+=1);return i}function Gm(n){let s=n;for(;;){const i=s.slice(-1);if(i.length===0)return s;if(".,;:!?".includes(i)){s=s.slice(0,-1);continue}if(i===")"&&va(s,"(")<va(s,")")){s=s.slice(0,-1);continue}if(i==="]"&&va(s,"[")<va(s,"]")){s=s.slice(0,-1);continue}return s}}function yb(n){const s=mb.exec(n);if(s===null||s.index===void 0)return null;const i=s[0],h=s.index,v=(x,r=i.length)=>({index:h,length:r,token:x});if(i.startsWith("`"))return v({kind:"code",text:i.slice(1,-1)});if(i.startsWith("**")||i.startsWith("__"))return v({kind:"strong",text:i.slice(2,-2)});if(i.startsWith("~~"))return v({kind:"del",text:i.slice(2,-2)});if(i.startsWith("*"))return v({kind:"em",text:i.slice(1,-1)});if(i.startsWith("[")){const x=i.indexOf("]("),r=i.slice(1,x),c=i.slice(x+2,-1);return gb.test(c)?v({kind:"link",label:r,href:c}):v({kind:"plain",text:i})}const R=Gm(i);return v({kind:"link",label:R,href:R},R.length)}function Es(n,s,i){if(s.length===0)return[n];const h=n.toLowerCase(),v=s.toLowerCase(),R=[];let x=0,r=h.indexOf(v),c=0;for(;r!==-1;)r>x&&R.push(n.slice(x,r)),R.push(l.jsx("mark",{children:n.slice(r,r+s.length)},`${i}-m${c++}`)),x=r+s.length,r=h.indexOf(v,x);return x<n.length&&R.push(n.slice(x)),R}const wb=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/;function bb(n,s){const i=wb.exec(n);if(i===null)return null;const h=i[2]??"",v=s(h);return v===null?null:{label:i[1]??"",href:h,open:v}}function Br(n,s,i,h){const v=[];let R=n,x=0;for(;R.length>0;){const r=yb(R);if(r===null){v.push(...Es(R,s,`${i}-${x++}`));break}r.index>0&&v.push(...Es(R.slice(0,r.index),s,`${i}-${x++}`));const c=`${i}-i${x++}`,{token:g}=r;switch(g.kind){case"code":v.push(l.jsx("code",{children:g.text},c));break;case"strong":v.push(l.jsx("strong",{children:Es(g.text,s,c)},c));break;case"del":v.push(l.jsx("del",{children:Es(g.text,s,c)},c));break;case"em":v.push(l.jsx("em",{children:Es(g.text,s,c)},c));break;case"link":v.push(l.jsx("a",{href:g.href,target:"_blank",rel:"noreferrer noopener",children:Es(g.label,s,c)},c));break;default:{const _=h===void 0?null:bb(g.text,h);if(_!==null){v.push(l.jsx("button",{className:"md-local-link",onClick:_.open,title:_.href,children:Es(_.label,s,c)},c));break}v.push(l.jsx("span",{children:Es(g.text,s,c)},c));break}}R=R.slice(r.index+r.length)}return v}function Sb({code:n,language:s}){const[i,h]=I.useState(null),[v,R]=I.useState(!1),x=I.useRef(null);I.useEffect(()=>()=>{x.current!==null&&window.clearTimeout(x.current)},[]);const r=()=>{navigator.clipboard.writeText(n).then(()=>{R(!0),x.current!==null&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>R(!1),1200)}).catch(()=>R(!1))};return I.useEffect(()=>{let c=!0;return Bn(async()=>{const{highlightCode:g}=await import("./highlight-BxIlYHXS.js");return{highlightCode:g}},[]).then(({highlightCode:g})=>{c&&h(g(n,s))}).catch(()=>{c&&h(null)}),()=>{c=!1}},[n,s]),l.jsxs("div",{className:"md-code-wrap",children:[l.jsx("pre",{className:"md-code hljs",children:i===null?l.jsx("code",{children:n}):l.jsx("code",{dangerouslySetInnerHTML:{__html:i}})}),l.jsxs("div",{className:"md-code-tools","data-search-skip":"",children:[s!==null&&l.jsx("span",{className:"md-code-lang",children:s}),l.jsx("button",{className:"md-code-copy",onClick:r,title:C(v?"common.copied":"common.copyCode"),"aria-label":C("common.copyCode"),children:v?"✓":"⧉"})]})]})}const Nf=/^(#{1,6})\s+(.*)$/,Nc=/^\s{0,3}[-*+]\s+(.*)$/,Bi=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,ya=/^>\s?(.*)$/,Dc=/^\s*```(\S*)\s*$/,Df=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,Ic=/^\s*\|.*\|\s*$/,Cb=/^\s*\|[\s:|-]+\|\s*$/;function If(n){return n.trim().replace(/^\||\|$/g,"").split("|").map(s=>s.trim())}function wu({text:n,needle:s="",localLink:i}){var x,r;const h=n.split(`
120
+ `),v=[];let R=0;for(;R<h.length;){const c=h[R]??"",g=`b${R}`,_=Dc.exec(c);if(_!==null){const S=(_[1]??"").length>0?_[1]:null,L=[];for(R+=1;R<h.length&&!Dc.test(h[R]??"");)L.push(h[R]??""),R+=1;R+=1,v.push({key:g,node:l.jsx(Sb,{code:L.join(`
121
+ `),language:S},g)});continue}if(c.trim().length===0){R+=1;continue}if(Df.test(c)){v.push({key:g,node:l.jsx("hr",{className:"md-rule"},g)}),R+=1;continue}const u=Nf.exec(c);if(u!==null){const S=Math.min((u[1]??"#").length,6);v.push({key:g,node:l.jsx("p",{className:`md-heading md-h${S}`,children:Br(u[2]??"",s,g,i)},g)}),R+=1;continue}if(Ic.test(c)&&Cb.test(h[R+1]??"")){const S=If(c);R+=2;const L=[];for(;R<h.length&&Ic.test(h[R]??"");)L.push(If(h[R]??"")),R+=1;v.push({key:g,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((f,a)=>l.jsx("th",{children:Br(f,s,`${g}-h${a}`,i)},a))})}),l.jsx("tbody",{children:L.map((f,a)=>l.jsx("tr",{children:f.map((m,p)=>l.jsx("td",{children:Br(m,s,`${g}-${a}-${p}`,i)},p))},a))})]})},g)});continue}if(ya.test(c)){const S=[];for(;R<h.length&&ya.test(h[R]??"");)S.push(((x=ya.exec(h[R]??""))==null?void 0:x[1])??""),R+=1;v.push({key:g,node:l.jsx("blockquote",{className:"md-quote",children:Br(S.join(`
122
+ `),s,g,i)},g)});continue}if(Nc.test(c)||Bi.test(c)){const S=Bi.test(c),L=S?Number(((r=Bi.exec(c))==null?void 0:r[1])??"1"):1,f=[];for(;R<h.length;){const m=h[R]??"",p=Nc.exec(m),d=Bi.exec(m);if(S&&d!==null)f.push(d[2]??"");else if(!S&&p!==null)f.push(p[1]??"");else if(f.length>0&&/^\s{2,}\S/.test(m)&&p===null&&d===null)f[f.length-1]=`${f[f.length-1]??""} ${m.trim()}`;else break;R+=1}const a=f.map((m,p)=>l.jsx("li",{children:Br(m,s,`${g}-l${p}`,i)},p));v.push({key:g,node:S?l.jsx("ol",{className:"md-list",start:L===1?void 0:L,children:a},g):l.jsx("ul",{className:"md-list",children:a},g)});continue}const y=[];for(;R<h.length;){const S=h[R]??"";if(S.trim().length===0||Dc.test(S)||Nf.test(S)||Nc.test(S)||Bi.test(S)||ya.test(S)||Df.test(S)||Ic.test(S))break;y.push(S),R+=1}v.push({key:g,node:l.jsx("p",{className:"md-paragraph",children:Br(y.join(`
123
+ `),s,g,i)},g)})}return l.jsx("div",{className:"md",children:v.map(c=>c.node)})}const Ym=[{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 jc(n){const s=Ym.find(i=>i.names.includes(n));return s===void 0?{key:`name:${n}`,known:!1}:{key:s.key,known:!0}}function xb(n,s,i){const h=Ym.find(v=>v.key===n);return h===void 0?C("tools.run.callsTo",{count:s,name:i}):C(h.run,{count:s})}function kt(n){if(!G_(n.key))return n.key;let s;if(n.params!==void 0){const i={};for(const[h,v]of Object.entries(n.params))i[h]=typeof v=="object"?kt(v):v;s=i}return C(`server.${n.key}`,s)}const Pc={model:null,effort:null,contextWindow:null},kb=200,Eb=2e4,Lb={},Tb={},jf=[];function su(n,s,i){return`${n}:${i}:${s}`}function Rb(n,s){const[i,h]=I.useState([]),[v,R]=I.useState(yc),[x,r]=I.useState(Pc),[c,g]=I.useState("waiting"),[_,u]=I.useState(!1),[y,S]=I.useState(!1),[L,f]=I.useState({}),[a,m]=I.useState(null),[p,d]=I.useState(null),[k,D]=I.useState(!1),[E,M]=I.useState(jf),[b,T]=I.useState({}),[N,B]=I.useState({}),F=(s===null?void 0:b[s])??Lb,O=(s===null?void 0:N[s])??Tb,U=I.useRef(new Set),V=I.useRef(new Map),Y=I.useRef(new Set),X=I.useCallback((ue,de,K)=>{B(W=>({...W,[ue]:{...W[ue]??{},[de]:K}}))},[]),G=I.useCallback(ue=>{B(de=>{let K=!1;const W={};for(const[J,Z]of Object.entries(de))if(ue in Z){const pe={...Z};delete pe[ue],W[J]=pe,K=!0}else W[J]=Z;return K?W:de})},[]),P=I.useCallback((ue,de)=>{B(K=>{const W=K[ue];if(W===void 0||!(de in W))return K;const J={...W};return delete J[de],{...K,[ue]:J}})},[]);I.useEffect(()=>{for(const ue of i)for(const de of ue.parts){if(de.kind!=="tool-result")continue;Y.current.add(de.toolUseId);const K=V.current.get(de.toolUseId);K!==void 0&&(window.clearTimeout(K),V.current.delete(de.toolUseId)),G(de.toolUseId)}},[i,G]),I.useEffect(()=>{const ue=V.current;return()=>{for(const de of ue.values())window.clearTimeout(de);ue.clear()}},[]);const $=I.useRef(null);I.useEffect(()=>{if(s===null){h([]),R(yc),r(Pc),g("waiting"),u(!1),$.current=null;return}h([]),R(yc),r(Pc),g("waiting"),u(!1),S(!1),f({}),m(null),d(null),D(!1),M(jf),U.current.clear(),$.current=null;const ue=n.onMessage(K=>{var W;switch(K.type){case"conversation.reset":if(K.terminalId!==s)break;h(K.events),R(K.usage),r(K.defaults),m(K.permissionMode),d(K.waitingFor),D(K.openToolCall),M(K.subagents),g(K.state),u(K.hasMore),S(!1),$.current=((W=K.events[0])==null?void 0:W.eventId)??null;break;case"conversation.append":{if(K.terminalId!==s)break;h(J=>{var me;const Z=new Set(J.map(ie=>ie.eventId)),pe=K.events.filter(ie=>!Z.has(ie.eventId));return pe.length===0?J:($.current===null&&($.current=((me=pe[0])==null?void 0:me.eventId)??null),[...J,...pe])}),R(K.usage),K.permissionMode!==null&&m(K.permissionMode),g("live");break}case"conversation.page":{if(K.terminalId!==s)break;h(J=>{var me;const Z=new Set(J.map(ie=>ie.eventId)),pe=K.events.filter(ie=>!Z.has(ie.eventId));return pe.length===0?J:($.current=((me=pe[0])==null?void 0:me.eventId)??$.current,[...pe,...J])}),u(K.hasMore),S(!1);break}case"conversation.turns":{if(K.terminalId!==s)break;const J=new Map(K.turns.map(Z=>[Z.eventId,Z.durationMs]));h(Z=>Z.map(pe=>{const me=J.get(pe.eventId);return me===void 0?pe:{...pe,durationMs:me}}));break}case"conversation.parts":{if(K.terminalId!==s)break;const J=new Map(K.updates.map(Z=>[Z.eventId,Z.parts]));h(Z=>Z.map(pe=>{const me=J.get(pe.eventId);return me===void 0?pe:{...pe,parts:me}}));break}case"conversation.imageData":{if(K.terminalId!==s)break;const J=su(K.eventId,K.index,K.source);f(Z=>({...Z,[J]:K.data===null?null:`data:${K.mediaType};base64,${K.data}`}));break}case"conversation.state":if(K.terminalId!==s)break;g(K.state);break;case"conversation.mode":if(K.terminalId!==s)break;m(K.mode);break;case"conversation.waiting":if(K.terminalId!==s)break;d(K.waitingFor);break;case"conversation.toolCall":if(K.terminalId!==s)break;D(K.open);break;case"conversation.subagents":if(K.terminalId!==s)break;M(K.subagents);break;case"error":{if(K.code!=="answer-failed"||s===null)break;for(const[J,Z]of V.current)window.clearTimeout(Z),V.current.delete(J),T(pe=>{const me=pe[s];if(me===void 0||!(J in me))return pe;const ie={...me};return delete ie[J],{...pe,[s]:ie}}),X(s,J,kt(K.text));break}}});n.send({type:"conversation.subscribe",terminalId:s});const de=n.onReopen(()=>{n.send({type:"conversation.subscribe",terminalId:s})});return()=>{ue(),de(),n.send({type:"conversation.unsubscribe",terminalId:s})}},[n,s,X]);const H=I.useCallback(()=>{const ue=$.current;s===null||ue===null||y||(S(!0),n.send({type:"conversation.loadMore",terminalId:s,beforeEventId:ue,limit:kb}))},[n,s,y]),q=I.useCallback((ue,de,K)=>{if(s===null)return;const W=su(ue,de,K);U.current.has(W)||(U.current.add(W),n.send({type:"conversation.image",terminalId:s,eventId:ue,index:de,source:K}))},[n,s]),ne=I.useCallback((ue,de)=>{if(s===null)return;T(W=>{const J=W[s]??{};return ue in J?W:{...W,[s]:{...J,[ue]:de}}}),P(s,ue),n.send({type:"agent.answer",terminalId:s,toolUseId:ue,selections:de});const K=window.setTimeout(()=>{Y.current.has(ue)||(T(W=>{const J=W[s];if(J===void 0||!(ue in J))return W;const Z={...J};return delete Z[ue],{...W,[s]:Z}}),X(s,ue,C("conversation.answerUnconfirmed")))},Eb);V.current.set(ue,K)},[n,s,X,P]),re=I.useCallback(ue=>{s!==null&&n.send({type:"agent.mode",terminalId:s,mode:ue})},[n,s]);return{events:i,usage:v,defaults:x,state:c,permissionMode:a,waitingFor:p,openToolCall:k,subagents:E,hasMore:_,loadingMore:y,loadMore:H,images:L,requestImage:q,answer:ne,answered:F,answerFailed:O,setPermissionMode:re}}const Pf=80,Of=5;function wa(n){return!Array.isArray(n)}function Bf(n){const s=[];for(const i of n.parts){if(i.kind!=="tool-call")return null;s.push(i.name)}return s.length>0?s:null}function Mb(n){const s=[];let i=0;for(;i<n.length;){const h=n[i];if(h===void 0)break;const v=Bf(h),R=v===null?null:jc(v[0]??"");if(!(v!==null&&R!==null&&v.every(_=>jc(_).key===R.key))||v===null||R===null){s.push({kind:"card",card:h}),i+=1;continue}const r=[h];let c=v.length,g=i+1;for(;g<n.length;){const _=n[g];if(_===void 0)break;const u=Bf(_);if(u===null||!u.every(y=>jc(y).key===R.key))break;r.push(_),c+=u.length,g+=1}if(c<2){s.push({kind:"card",card:h}),i+=1;continue}s.push({kind:"tools",id:`tools-${h.event.eventId}`,summary:xb(R.key,c,v[0]??""),at:h.event.at,cards:r}),i=g}return s}function Ab(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(s=>`${s.question} ${s.options.map(i=>i.label).join(" ")}`).join(`
124
+ `);case"notice":return Hm(n);case"thinking":case"image":return""}}function Ff(n,s){const i=[];for(const h of n.parts)if(i.push(Ab(h)),h.kind==="tool-call"){const v=s.get(h.toolUseId);v!==void 0&&i.push(v.text)}return i.join(`
125
+ `)}function Ms(n,s){if(s.length===0)return l.jsx(l.Fragment,{children:n});const i=n.toLowerCase(),h=s.toLowerCase(),v=[];let R=0,x=i.indexOf(h),r=0;for(;x!==-1;)x>R&&v.push(l.jsx("span",{children:n.slice(R,x)},r++)),v.push(l.jsx("mark",{children:n.slice(x,x+s.length)},r++)),R=x+s.length,x=i.indexOf(h,R);return R<n.length&&v.push(l.jsx("span",{children:n.slice(R)},r++)),l.jsx(l.Fragment,{children:v})}function Xm(n,s){const i=[];let h=n,v=0;for(;h.length>0;){const R=vb(h);if(R===null){i.push(l.jsx("span",{children:Ms(h,s)},v++));break}R.index>0&&i.push(l.jsx("span",{children:Ms(h.slice(0,R.index),s)},v++)),i.push(l.jsx("a",{href:R.href,target:"_blank",rel:"noreferrer noopener",children:Ms(R.href,s)},v++)),h=h.slice(R.index+R.length)}return l.jsx(l.Fragment,{children:i})}function Nb({view:n,terminalId:s,onRewind:i,questionsAnswerable:h,contextWindowSource:v,instructionsFile:R,onGoToCli:x,cliPresence:r,exitCode:c,onWakeCli:g,waking:_,discovering:u=!1,toolCallNotice:y=null,serverClosed:S=null,statusLineState:L=null,onConfigureStatusLine:f,threadFont:a,continueTargets:m=[],continueBlockedReason:p=null,onContinue:d,searchRequest:k=null,onSearchRequestApplied:D,activity:E=null,receipt:M=null,clock:b=null}){const{events:T,usage:N,defaults:B,state:F,waitingFor:O,subagents:U,hasMore:V,loadingMore:Y,loadMore:X,images:G,requestImage:P,answer:$,answered:H,answerFailed:q}=n,ne=Yi(),[re,ue]=I.useState(""),[de,K]=I.useState(0),[W,J]=I.useState(null);I.useEffect(()=>{k!==null&&(ue(k.query),D==null||D(k.seq))},[k,D]);const Z=I.useRef(null),pe=I.useRef(new Map),me=I.useRef(!0),[ie,Le]=I.useState(!1),[Ae,Xe]=I.useState(0),{cards:Ce,results:fe}=I.useMemo(()=>{const te=new Map,le=new Set;for(const rt of T)for(const Te of rt.parts)Te.kind==="tool-result"?te.set(Te.toolUseId,Te):(Te.kind==="tool-call"||Te.kind==="question")&&le.add(Te.toolUseId);const ke=[];for(const rt of T){const Te=rt.parts.filter(We=>We.kind!=="thinking"&&!(We.kind==="tool-result"&&le.has(We.toolUseId)));Te.length!==0&&ke.push({event:rt,parts:Te})}return{cards:ke,results:te}},[T]),Me=I.useMemo(()=>Mb(Ce),[Ce,ne]),_e=re.trim(),Ee=I.useMemo(()=>{if(_e.length===0)return[];const te=_e.toLowerCase();return Ce.filter(le=>Ff(le,fe).toLowerCase().includes(te)).map(le=>le.event.eventId)},[Ce,fe,_e,ne]);I.useEffect(()=>{K(0)},[_e]);const Fe=I.useMemo(()=>new Set(Ee),[Ee]),Se=Ee[de]??null;I.useEffect(()=>{var te;Se!==null&&((te=pe.current.get(Se))==null||te.scrollIntoView({block:"center"}))},[Se]),I.useLayoutEffect(()=>{me.current=!0,Le(!1),Xe(0)},[s]);const Ne=I.useCallback(()=>{const te=Z.current;if(te===null)return;const le=te.scrollHeight-te.scrollTop-te.clientHeight>Pf;Le(le),le||Xe(0)},[]),et=I.useRef(null),tt=I.useRef(0),Je=I.useRef(0);I.useLayoutEffect(()=>{const te=et.current,le=T.map(rt=>rt.eventId);et.current=le[0]??null;const ke=Z.current;ke===null||!ab(te,le)||(ke.scrollTop=ob(tt.current,ke.scrollHeight))},[T]),I.useLayoutEffect(()=>{const te=Z.current;te!==null&&me.current&&_e.length===0&&(te.scrollTop=te.scrollHeight),Ne()},[Ce.length,_e,Ne]),I.useLayoutEffect(()=>{const te=Z.current;te!==null&&(tt.current=te.scrollHeight-te.scrollTop,Je.current=te.scrollTop)});const lt=I.useRef(null),ct=I.useCallback(()=>{var le;const te=((le=T[0])==null?void 0:le.eventId)??null;te===null||lt.current===te||(lt.current=te,X())},[T,X]),$e=I.useRef(null);I.useEffect(()=>{var rt;const te=((rt=Ce[Ce.length-1])==null?void 0:rt.event.eventId)??null,le=$e.current;if($e.current=te,le===null||te===le||me.current&&_e.length===0)return;const ke=Ce.findIndex(Te=>Te.event.eventId===le);ke!==-1&&Xe(Te=>Te+(Ce.length-1-ke))},[Ce,_e]);const Ze=I.useCallback(()=>{const te=Z.current;if(te===null)return;const le=te.scrollHeight-te.scrollTop-te.clientHeight;me.current=le<=Pf,Ne();const ke=rb({scrollTop:te.scrollTop,previousScrollTop:Je.current,clientHeight:te.clientHeight,hasMore:V,loading:Y,searching:_e.length>0});Je.current=te.scrollTop,tt.current=te.scrollHeight-te.scrollTop,ke&&ct()},[Ne,V,Y,ct,_e]),Ve=I.useCallback(te=>{const le=Z.current;le===null||!V||Y||_e.length>0||ib(te.deltaY,le.scrollTop,le.clientHeight)&&ct()},[V,Y,ct,_e]),st=I.useCallback(()=>{const te=Z.current;te!==null&&(te.scrollTop=te.scrollHeight,me.current=!0,Le(!1),Xe(0))},[]),dt=I.useCallback((te,le)=>{le===null?pe.current.delete(te):pe.current.set(te,le)},[]),Re=I.useCallback(te=>{const le=Ff(te,fe);navigator.clipboard.writeText(le).then(()=>{J(te.event.eventId),window.setTimeout(()=>J(null),1200)}).catch(()=>J(null))},[fe,ne]),ze=te=>{Ee.length!==0&&K(le=>(le+te+Ee.length)%Ee.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:C("thread.search.placeholder"),value:re,onChange:te=>ue(te.target.value),onKeyDown:te=>{te.key==="Enter"&&ze(te.shiftKey?-1:1),te.stopPropagation()},spellCheck:!1}),_e.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-matches",children:Ee.length===0?C("thread.search.none"):`${de+1}/${Ee.length}`}),l.jsx("button",{className:"icon-button",onClick:()=>ze(-1),disabled:Ee.length===0,title:C("thread.search.previous"),children:"↑"}),l.jsx("button",{className:"icon-button",onClick:()=>ze(1),disabled:Ee.length===0,title:C("thread.search.next"),children:"↓"})]}),l.jsx("span",{className:"conversation-spacer"}),d!==void 0&&l.jsx(Fm,{targets:m,className:"icon-button conversation-continue",text:C("thread.continueWith"),blockedReason:p,onPick:d}),a!==void 0&&l.jsx("button",{className:"icon-button thread-font-button",onClick:a.cycle,title:Ra(a.size),"aria-label":Ra(a.size),children:l.jsxs("span",{"aria-hidden":"true",children:["a",l.jsx("span",{className:"thread-font-big",children:"A"})]})}),l.jsx(Q1,{usage:N,source:v,instructionsFile:R,fallbackWindow:B.contextWindow,compact:!0,statusLineState:L,onConfigure:f})]}),l.jsxs("div",{className:"conversation-scroll-frame",children:[l.jsxs("div",{className:"conversation-scroll",ref:Z,onScroll:Ze,onWheel:Ve,children:[V&&l.jsxs("button",{className:`conversation-more${Y?" conversation-more-loading":""}`,onClick:X,disabled:Y,"aria-busy":Y,children:[Y&&l.jsx("span",{className:"conversation-more-spinner","aria-hidden":"true"}),C(Y?"thread.loadingMore":"thread.loadEarlier")]}),Ce.length===0&&l.jsxs("p",{className:"conversation-empty",children:[F==="unavailable"?C("thread.empty.unavailable"):F==="no-transcript"?Xy():C(F==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),F==="waiting"&&u&&l.jsxs(l.Fragment,{children:[l.jsx("br",{}),Qy()]})]}),Me.map(te=>{if(te.kind==="card")return l.jsx(Hf,{card:te.card,results:fe,needle:_e,isMatch:te.card.event.eventId===Se,copied:W===te.card.event.eventId,images:G,onRequestImage:P,onCopy:()=>Re(te.card),onRewind:i,register:dt,answered:H,answerFailed:q,answerable:h,onAnswer:$},te.card.event.eventId);const le=te.cards.some(ke=>Fe.has(ke.event.eventId));return l.jsx(Hb,{summary:te.summary,at:te.at,open:le,children:te.cards.map(ke=>l.jsx(Hf,{card:ke,results:fe,needle:_e,isMatch:ke.event.eventId===Se,copied:W===ke.event.eventId,images:G,onRequestImage:P,onCopy:()=>Re(ke),onRewind:i,register:dt,answered:H,answerFailed:q,answerable:h,onAnswer:$},ke.event.eventId))},te.id)})]}),ie&&l.jsxs("button",{className:`conversation-jump${Ae>0?" has-unseen":""}`,onClick:st,title:Ae>0?C("thread.jumpToEndNew",{count:Ae}):C("thread.jumpToEnd"),"aria-label":Ae>0?C("thread.jumpToEndNew",{count:Ae}):C("thread.jumpToEnd"),children:[l.jsx("span",{"aria-hidden":"true",children:"↓"}),Ae>0&&l.jsx("span",{className:"conversation-jump-count",children:Ae>99?"99+":Ae})]})]}),l.jsx(Ib,{live:r==="live"&&S===null,activity:E,waitingFor:O,receipt:M,events:T,clock:b,subagents:U}),S!==null&&(S.state==="relaunching"||r==="live")?l.jsx(Ob,{text:S.text,relaunching:S.state==="relaunching",onRelaunch:g}):r==="live"?O===null&&y!==null?l.jsx(Fb,{notice:y,onGoToCli:x}):l.jsx(Bb,{waitingFor:O,questionsAnswerable:h,onGoToCli:x}):l.jsx(Pb,{presence:r,exitCode:c,waking:_,onWake:g})]})}const Db=1e3;function Ib({live:n,activity:s,waitingFor:i,receipt:h,events:v,clock:R,subagents:x}){const[,r]=I.useState(0),c=Date.now(),g=l1({live:n,activity:s,waitingFor:i,receipt:h,events:v,clock:R,now:c}),_=n?x:[],u=g!==null||_.length>0;return I.useEffect(()=>{if(!u)return;const y=window.setInterval(()=>r(S=>S+1),Db);return()=>window.clearInterval(y)},[u]),u?l.jsxs("div",{className:"thread-status",children:[g!==null&&l.jsxs("div",{className:`thread-status-row thread-status-${g.kind}`,children:[l.jsx(jb,{kind:g.kind}),l.jsx("span",{className:"thread-status-text",children:c1(g,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:u1(_,c)})]})]}):null}function jb({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 Pb({presence:n,exitCode:s,waking:i,onWake:h}){const v=n==="sleeping"?C("thread.wake.sleeping"):s===null?C("thread.wake.exited"):C("thread.wake.exitedWithCode",{code:s});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:v}),l.jsx("button",{className:"primary-button primary-button-small",onClick:h,disabled:i,children:C(i?"thread.wake.opening":"thread.wake.open")})]})}function Ob({text:n,relaunching:s,onRelaunch:i}){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:i,disabled:s,children:s?nw():tw()})]})}function Bb({waitingFor:n,questionsAnswerable:s,onGoToCli:i}){if(n===null)return null;const h=fm(n,s);return l.jsxs("div",{className:"conversation-waiting",role:"status",children:[l.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),l.jsx("span",{children:h}),l.jsx("button",{className:"link-button",onClick:i,children:C("thread.goToCli")})]})}function Fb({notice:n,onGoToCli:s}){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:s,children:C("thread.goToCli")})]})}function Hf({card:n,results:s,needle:i,isMatch:h,copied:v,images:R,onRequestImage:x,onCopy:r,onRewind:c,register:g,answered:_,answerFailed:u,answerable:y,onAnswer:S}){const{event:L}=n,f=L.role==="user",a=m=>{const p=_[m.toolUseId];return p!==void 0?p:s.has(m.toolUseId)?[]:null};return l.jsxs("article",{ref:m=>g(L.eventId,m),className:`turn turn-${L.role}${h?" turn-match":""}`,children:[l.jsxs("div",{className:"turn-actions",children:[l.jsx("button",{className:"icon-button",onClick:r,title:C("thread.copyMessage"),children:v?"✓":"⧉"}),f&&c!==void 0&&l.jsx("button",{className:"icon-button",onClick:c,title:C("thread.rewind"),children:"↩"})]}),n.parts.map((m,p)=>l.jsx(Ub,{part:m,eventId:L.eventId,mine:f,result:m.kind==="tool-call"?s.get(m.toolUseId)??null:null,needle:i,images:R,onRequestImage:x,answeredAt:m.kind==="question"?a(m):null,failure:m.kind==="question"?u[m.toolUseId]??null:null,answerable:y,onAnswer:S},p)),l.jsx($b,{event:L,mine:f})]})}function Hb({summary:n,at:s,open:i,children:h}){const v=s>0?wm(s):"";return l.jsxs("details",{className:"tool-group",open:i,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}),v.length>0&&l.jsx("span",{className:"tool-group-time",children:v})]}),l.jsx("div",{className:"tool-group-body",children:h})]})}function $b({event:n,mine:s}){const i=n.at>0?wm(n.at):"",h=[];return n.durationMs!==null&&h.push(Aw(n.durationMs)),n.effort!==null&&h.push(C("thread.turn.effort",{effort:n.effort})),l.jsxs("div",{className:"turn-meta",children:[s&&l.jsx("span",{className:"turn-who",children:C("thread.turn.you")}),i.length>0&&l.jsx("span",{children:i}),n.queued&&l.jsx("span",{className:"turn-queued",title:C("thread.turn.queuedTitle"),children:C("thread.turn.queued")}),h.map(v=>l.jsx("span",{className:"turn-meta-bit",children:v},v))]})}function Ub({part:n,eventId:s,mine:i,result:h,needle:v,images:R,onRequestImage:x,answeredAt:r,failure:c,answerable:g,onAnswer:_}){switch(n.kind){case"text":return i?l.jsx(zb,{text:n.text,truncated:n.truncated,needle:v}):l.jsxs("div",{className:"part-text",children:[l.jsx(wu,{text:n.text,needle:v}),n.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]})]});case"image":return l.jsx(qb,{eventId:s,index:n.index,source:n.source,src:R[su(s,n.index,n.source)],onRequest:x});case"thinking":return null;case"notice":return l.jsx("div",{className:`turn-notice turn-notice-${n.notice}`,children:Ms(Hm(n),v)});case"question":return l.jsx(Wb,{part:n,answeredAt:r,failure:c,answerable:g,onAnswer:_,needle:v});case"tool-call":{const u=v.length>0&&`${n.name} ${n.input} ${(h==null?void 0:h.text)??""}`.toLowerCase().includes(v.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}),h!==null&&h.isError&&l.jsx("span",{className:"tool-error",children:C("thread.tool.error")}),h!==null&&h.imageCount>0&&l.jsx("span",{className:"tool-images",children:C("thread.tool.images",{count:h.imageCount})})]}),l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:C("thread.tool.input")}),l.jsxs("pre",{className:"tool-pre",children:[Ms(n.input,v),n.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]})]})]}),h!==null&&l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:C("thread.tool.result")}),l.jsxs("pre",{className:`tool-pre${h.isError?" tool-pre-error":""}`,children:[h.text.length>0?Ms(h.text,v):h.imageCount>0?C("thread.tool.imagesNotSent",{count:h.imageCount}):C("thread.tool.noOutput"),h.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]})]})]})]})}case"tool-result":return l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:C("thread.tool.orphanResult")}),l.jsx("pre",{className:`tool-pre${n.isError?" tool-pre-error":""}`,children:Ms(n.text,v)})]})}}function Wb({part:n,answeredAt:s,failure:i,answerable:h,onAnswer:v,needle:R}){var D;const[x,r]=I.useState(()=>n.questions.map(()=>[])),[c,g]=I.useState(null),[_,u]=I.useState(""),y=s!==null,S=y||!h,L=s??x,f=n.questions.length===1&&((D=n.questions[0])==null?void 0:D.multiSelect)===!1,a=L.every(E=>wa(E)?E.text.trim().length>0:E.length>0),m=E=>E===void 0||wa(E)?[]:E,p=(E,M)=>{if(S)return;const b=n.questions[E];if(b!==void 0){if(f){v(n.toolUseId,[[M]]);return}g(T=>T===E?null:T),r(T=>T.map((N,B)=>{if(B!==E)return N;const F=m(N);return b.multiSelect?F.includes(M)?F.filter(O=>O!==M):[...F,M]:[M]}))}},d=E=>{const M=_.trim();if(M.length===0||S)return;const b={kind:"free",text:M};if(f){v(n.toolUseId,[b]);return}r(T=>T.map((N,B)=>B===E?b:N)),g(null),u("")},k=E=>{if(S)return;const M=L[E];u(M!==void 0&&wa(M)?M.text:""),g(E)};return l.jsxs("div",{className:`question${y?" question-done":""}`,children:[n.questions.map((E,M)=>{const b=L[M],T=b!==void 0&&wa(b)?b.text:null;return l.jsxs("div",{className:"question-item",children:[l.jsxs("div",{className:"question-head",children:[E.header.length>0&&l.jsx("span",{className:"question-header",children:E.header}),l.jsx("span",{className:"question-text",children:Ms(E.question,R)}),E.multiSelect&&l.jsx("span",{className:"question-hint",children:C("thread.question.multi")})]}),l.jsxs("div",{className:"question-options",children:[E.options.map((N,B)=>{const F=m(b).includes(B);return l.jsxs("button",{type:"button",className:`question-option${F?" question-option-picked":""}`,disabled:S,onClick:()=>p(M,B),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})]},B)}),c===M&&!S?l.jsxs("div",{className:"question-write",children:[l.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:_,placeholder:C("thread.question.placeholder"),onChange:N=>u(N.target.value),onKeyDown:N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),d(M)),N.key==="Escape"&&g(null),N.stopPropagation()}}),l.jsxs("div",{className:"question-write-actions",children:[l.jsx("button",{type:"button",className:"question-send",disabled:_.trim().length===0,onClick:()=>d(M),children:C(f?"thread.question.send":"thread.question.useText")}),l.jsx("button",{type:"button",className:"question-write-cancel",onClick:()=>g(null),children:C("common.cancel")})]})]}):l.jsxs("button",{type:"button",className:`question-option question-option-write${T!==null?" question-option-picked":""}`,disabled:S,onClick:()=>k(M),children:[l.jsx("span",{className:"question-option-label",children:T!==null?T:C("thread.question.writeOther")}),T===null&&l.jsx("span",{className:"question-option-desc",children:C("thread.question.writeOtherHint")})]})]})]},M)}),l.jsxs("div",{className:"question-foot",children:[i!==null&&l.jsx("span",{className:"question-failed",children:i}),y?l.jsx("span",{className:"question-sent",children:C("thread.question.answered")}):h?l.jsxs(l.Fragment,{children:[!f&&l.jsx("button",{type:"button",className:"question-send",disabled:!a,onClick:()=>v(n.toolUseId,x),children:C("thread.question.sendAnswers")}),l.jsx("span",{className:"question-note",children:C(f?"thread.question.pickOne":"thread.question.pickEach")})]}):l.jsx("span",{className:"question-note",children:C("thread.question.answerInCli")})]})]})}function zb({text:n,truncated:s,needle:i}){const h=Sw(n,s),v=h.length===1?h[0]:void 0;if(v!==void 0&&v.kind==="text")return l.jsx($f,{text:n,truncated:s,needle:i});const R=h.length-1;return l.jsx("div",{className:"part-own",children:h.map((x,r)=>x.kind==="text"?l.jsx($f,{text:x.text,truncated:s&&r===R,needle:i},r):l.jsx(Vb,{number:x.number,text:x.text,complete:x.complete,needle:i},r))})}function Vb({number:n,text:s,complete:i,needle:h}){const[v,R]=I.useState(!1),x=h.length>0&&s.toLowerCase().includes(h.toLowerCase()),r=v||x;return l.jsxs("div",{className:`thread-pasted${r?" thread-pasted-open":""}`,children:[l.jsxs("button",{className:"thread-pasted-toggle",onClick:()=>R(c=>!c),"aria-expanded":r,children:[l.jsx("span",{className:"chip-icon",children:"¶"}),C("thread.pasted",{number:n,count:La(s)}),!i&&l.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]}),l.jsx("span",{className:"chip-chevron",children:r?"▾":"▸"})]}),r&&l.jsx("div",{className:"thread-pasted-text part-mine",children:Xm(s,h)})]})}function $f({text:n,truncated:s,needle:i}){const[h,v]=I.useState(!1),R=n.split(`
126
+ `),x=i.length>0&&n.toLowerCase().includes(i.toLowerCase()),r=R.length>=Of&&!x,c=r&&!h?R.slice(0,Of-1).join(`
127
+ `):n;return l.jsxs("div",{className:"part-text part-mine",children:[Xm(c,i),s&&l.jsxs("span",{className:"part-truncated",children:[" ",C("thread.truncated")]}),r&&l.jsx("button",{className:"fold-toggle",onClick:()=>v(g=>!g),children:h?C("thread.fold.less"):C("thread.fold.more",{count:R.length})})]})}function qb({eventId:n,index:s,source:i,src:h,onRequest:v}){const[R,x]=I.useState(!1);return I.useEffect(()=>{h===void 0&&v(n,s,i)},[h,n,s,i,v]),h===void 0?l.jsx("div",{className:"conversation-image-placeholder",children:C("thread.image.loading")}):h===null?l.jsx("div",{className:"conversation-image-placeholder",children:C("thread.image.gone")}):l.jsxs(l.Fragment,{children:[l.jsx("img",{className:"conversation-image",src:h,alt:C("thread.image.alt"),onClick:()=>x(!0),title:C("thread.image.openTitle")}),R&&l.jsx(Sm,{src:h,caption:C("thread.image.alt"),onClose:()=>x(!1)})]})}function Uf({connection:n,title:s,confirmLabel:i,confirmTitle:h,onChoose:v,onClose:R}){const[x,r]=I.useState(null),[c,g]=I.useState(null),[_,u]=I.useState(!1),[y,S]=I.useState(""),L=I.useRef(null),f=I.useRef(null);I.useEffect(()=>{const d=n.onMessage(k=>{if(k.type==="picker.listing"){L.current=k.listing.pickerId,r(k.listing),g(null),u(!1),S("");return}k.type==="error"&&k.code==="picker-failed"&&g(kt(k.text))});return n.send({type:"picker.open"}),()=>{d();const k=L.current;k!==null&&n.send({type:"picker.close",pickerId:k})}},[n]),I.useEffect(()=>{const d=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),R())};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[R]),I.useEffect(()=>{var d;_&&((d=f.current)==null||d.focus())},[_]);const a=I.useCallback(d=>{const k=L.current;k!==null&&n.send({type:"picker.enter",pickerId:k,name:d})},[n]),m=I.useCallback(d=>{const k=L.current;k!==null&&n.send({type:"picker.root",pickerId:k,rootIndex:d})},[n]),p=I.useCallback(()=>{const d=L.current,k=y.trim();d===null||k.length===0||n.send({type:"picker.create",pickerId:d,name:k})},[n,y]);return l.jsx("div",{className:"modal-backdrop",onClick:R,children:l.jsxs("div",{className:"modal picker-modal",role:"dialog","aria-label":s,onClick:d=>d.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:s}),l.jsx("button",{className:"icon-button",onClick:R,title:C("common.close"),children:"×"})]}),x===null?l.jsx("p",{className:"panel-note",children:C("picker.loading")}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"picker-roots",children:x.roots.map((d,k)=>l.jsx("button",{className:"picker-root",onClick:()=>m(k),title:C("picker.goTo",{root:d}),children:d},d))}),l.jsx("p",{className:"picker-path",title:x.path,children:x.path}),l.jsxs("div",{className:"picker-list",children:[x.canGoUp&&l.jsxs("button",{className:"picker-entry picker-up",onClick:()=>a(".."),children:["‹ ",C("picker.up")]}),x.entries.length===0&&!x.canGoUp&&l.jsx("p",{className:"panel-note",children:C("picker.empty")}),x.entries.map(d=>l.jsx("button",{className:"picker-entry",onClick:()=>a(d),children:d},d)),x.truncated&&l.jsx("p",{className:"panel-note",children:C("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:f,className:"picker-create-input",value:y,placeholder:C("picker.newFolderName"),onChange:d=>S(d.target.value),onKeyDown:d=>{d.key==="Enter"&&p(),d.key==="Escape"&&(d.stopPropagation(),u(!1)),d.stopPropagation()},spellCheck:!1}),l.jsx("button",{className:"link-button",onClick:p,children:C("picker.create")}),l.jsx("button",{className:"link-button",onClick:()=>u(!1),children:C("common.cancel")})]}):l.jsx("button",{className:"link-button",onClick:()=>u(!0),children:C("picker.createHere")}),l.jsx("span",{className:"composer-spacer"}),l.jsx("button",{className:"picker-open",onClick:()=>v(x.pickerId,x.path),title:h(x.path),children:i})]})]})]})})}function Kb(n,s){return pu(n)&&s!==null&&s.sessions>0}function Gb(){return C("search.mode.titles")}function Yb(){return C("search.mode.conversations")}function Xb(){return C("search.mode.conversationsTitle")}function Qb(n){return C(n==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function Jb(){return C("search.tooShort",{min:qp})}function Zb(n){return[...n.trim()].length<qp}function eS(){return C("search.off")}function tS(n){const s=new Map;for(const i of n){const h=`${i.agent}:${i.sessionId}`;let v=s.get(h);v===void 0&&(v={key:h,agent:i.agent,sessionId:i.sessionId,title:i.title,titleHit:null,hits:[],lastAt:null},s.set(h,v)),i.eventId===null?v.titleHit=i:v.hits.push(i),i.at!==null&&(v.lastAt=Math.max(v.lastAt??0,i.at))}return[...s.values()]}const nS=40;function Qm(n,s=nS){const i=n.matchStart+n.matchLength;let h=n.snippet.slice(0,n.matchStart);if(h.length>s){let v=h.length-s;const R=h.charCodeAt(v);R>=56320&&R<=57343&&(v+=1),h=`…${h.slice(v)}`}return{before:h,match:n.snippet.slice(n.matchStart,i),after:n.snippet.slice(i)}}function sS(n){return n.role==="user"?C("search.role.user"):n.role==="assistant"?C("search.role.assistant"):C("search.role.title")}function Jm(n){return Qm(n).match.trim()}function rS(n){const s=n.hits[0]??n.titleHit;return s===null?"":Jm(s)}const ru=n=>C("search.sessions",{count:n});function iS(n,s){return{query:s.query,hits:n===null?[...s.hits]:[...n.hits,...s.hits],sessionsScanned:s.sessionsScanned,sessionsTotal:s.sessionsTotal,truncated:null}}function oS(n){const{result:s}=n;if(n.searching&&n.error===null){if(s===null)return C("search.status.searching");const h={count:s.sessionsTotal,scanned:s.sessionsScanned};return s.hits.length===0?C("search.status.progress",h):C("search.status.progressFound",{...h,found:Wf(s)})}if(n.error!==null)return n.error;if(s===null)return null;const i=s.hits.length===0?C("search.status.none"):Wf(s);if(s.truncated===null&&s.hits.length===0&&s.sessionsScanned>0)return C("search.status.noneIn",{sessions:ru(s.sessionsScanned)});if(s.truncated==="results")return C("search.status.truncatedResults",{found:i});if(s.truncated==="time"){const h=Math.max(0,s.sessionsTotal-s.sessionsScanned);return C("search.status.truncatedTime",{found:i,seconds:Math.round(h0/1e3),left:ru(h)})}return C("search.status.done",{found:i})}function Wf(n){const s=new Set(n.hits.map(i=>`${i.agent}:${i.sessionId}`)).size;return C("search.found",{hits:C("search.hits",{count:n.hits.length}),sessions:ru(s)})}function aS(n,s){const i=s.terminals.find(h=>h.kind==="agent"&&h.agent===n.agent&&h.sessionId===n.sessionId);if(i!==void 0)return{kind:"activate",terminalId:i.terminalId};for(const h of s.projects){const v=h.sessions.find(R=>R.agent===n.agent&&R.sessionId===n.sessionId);if(v!==void 0)return Jc(v)&&h.cwdExists&&s.canResume(v.agent)?{kind:"resume",cwd:Qp(v.cwd,h.cwd,s.platform),session:v}:{kind:"copy"}}return{kind:"copy"}}const lS=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function Ft(n,s,i){const h=im(n,s),v=[];let R=0;for(const x of h.matchAll(lS)){const r=x.index??0;r>R&&v.push(Ca(h.slice(R,r),s));const c=x[1];if(c===void 0)v.push(I.createElement("br",{key:v.length}));else{const g=Ca(x[2]??"",s);v.push(I.createElement(c,{key:v.length},g))}R=r+x[0].length}return R<h.length&&v.push(Ca(h.slice(R),s)),v.length===1?v[0]:v}const zf="0.5.1",Vf="agent-workbench.support-notice",cS=3e4;function uS(n){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(n)?n:null}function hS(n,s){return n!==s}function dS(){return[{keys:"Alt + T",description:C("shortcuts.app.newTab")},{keys:"Alt + W",description:C("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:C("shortcuts.app.switchTab")},{keys:"Alt + P",description:C("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:C("shortcuts.app.previousTab")}]}function fS({agent:n,onClose:s}){return I.useEffect(()=>{const i=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),s())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[s]),l.jsx("div",{className:"modal-backdrop",onClick:s,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":C("shortcuts.ariaLabel"),onClick:i=>i.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:C("shortcuts.title")}),l.jsx("button",{className:"icon-button",onClick:s,title:C("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("h3",{className:"modal-section",children:C("shortcuts.section.app")}),l.jsx(Oc,{shortcuts:dS()}),l.jsx("h3",{className:"modal-section",children:C("shortcuts.section.composer")}),l.jsx(Oc,{shortcuts:ky(n!==null&&n.capabilities.imagesByPath!==null)}),n!==null&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:C("shortcuts.section.cli")}),l.jsx("p",{className:"modal-hint",children:Ft("shortcuts.cliHint")}),l.jsx(Oc,{shortcuts:Ur[n.id].shortcuts}),Ur[n.id].shortcutsNote!==null&&l.jsx("p",{className:"modal-hint",children:Ur[n.id].shortcutsNote})]}),l.jsx("p",{className:"modal-hint",children:Ft("shortcuts.browserReserved")}),l.jsx("p",{className:"modal-hint",children:Ft("shortcuts.altNumber")}),l.jsxs("p",{className:"modal-hint support-hint",children:[l.jsx("span",{"aria-hidden":"true",children:"☕"})," ",C("support.notice")," ",l.jsx("a",{href:Zp,target:"_blank",rel:"noreferrer noopener",children:C("support.link")})]})]})]})})}function Oc({shortcuts:n}){return l.jsx("dl",{className:"shortcut-list",children:n.map(s=>l.jsxs("div",{className:"shortcut-row",children:[l.jsx("dt",{children:l.jsx("kbd",{children:s.keys})}),l.jsx("dd",{children:s.description})]},s.keys))})}const pS=1e3,mS=5e3;function gS({info:n,agentLabel:s,onRefresh:i,onClose:h}){const[v,R]=I.useState(!1),[x,r]=I.useState(!1),c=I.useRef(null),g=I.useRef(null);I.useEffect(()=>{const L=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),h())};return window.addEventListener("keydown",L,!0),()=>window.removeEventListener("keydown",L,!0)},[h]),I.useEffect(()=>{r(!1)},[n]),I.useEffect(()=>()=>{c.current!==null&&window.clearTimeout(c.current),g.current!==null&&window.clearTimeout(g.current)},[]);const _=L=>{navigator.clipboard.writeText(L).then(()=>{R(!0),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>R(!1),pS)}).catch(()=>R(!1))},u=()=>{r(!0),i(),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>r(!1),mS)},y=n.state==="active",S=C("statusLine.title",{agent:s});return l.jsx("div",{className:"modal-backdrop",onClick:h,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":S,onClick:L=>L.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:S}),l.jsx("button",{className:"icon-button",onClick:h,title:C("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:`status-line-state${y?" status-line-state-active":""}`,children:wy(n.state)}),l.jsx("p",{className:"modal-hint",children:C("statusLine.benefit")}),l.jsx("h3",{className:"modal-section",children:C("statusLine.lineSection")}),n.fragment===null?l.jsx("p",{className:"modal-hint",children:by()}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:Ft("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:C("statusLine.copyTitle"),children:v?l.jsxs(l.Fragment,{children:["✓ ",C("statusLine.copied")]}):C("statusLine.copy")})]})]}),l.jsx("h3",{className:"modal-section",children:C("statusLine.whereSection")}),l.jsx("p",{className:"status-line-path",children:n.settingsPath}),l.jsx("p",{className:"modal-hint",children:C("statusLine.whereHint")}),l.jsx("h3",{className:"modal-section",children:C("statusLine.scriptSection")}),l.jsx("p",{className:"modal-hint",children:C("statusLine.scriptHint")}),l.jsx("p",{className:"status-line-path",children:n.scriptPath}),l.jsx("p",{className:"modal-hint",children:Ft("statusLine.runsEverywhere")}),l.jsxs("div",{className:"status-line-actions",children:[l.jsx("button",{className:"primary-button",onClick:u,disabled:x,children:C(x?"statusLine.checking":"statusLine.check")}),l.jsx("span",{className:"modal-hint",children:C("statusLine.checkHint")})]})]})]})})}function _S(){const[n,s]=I.useState(()=>hS(mt(Vf,null,uS),zf));return I.useEffect(()=>{if(!n)return;ht(Vf,zf);const i=window.setTimeout(()=>s(!1),cS);return()=>window.clearTimeout(i)},[n]),n?l.jsxs("div",{className:"banner banner-support",role:"status",children:[l.jsx("span",{children:C("support.notice")}),l.jsx("a",{className:"banner-support-link",href:Zp,target:"_blank",rel:"noreferrer noopener",onClick:()=>s(!1),children:C("support.link")}),l.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>s(!1),children:C("support.dismiss")})]}):null}function iu({agent:n,agents:s}){return l.jsx("span",{className:"agent-badge",title:Gi(n,s),children:ay(n)})}const vS=500,qf=10;function yS(n){const s=I.useRef(null),i=I.useRef(null),h=I.useRef(!1),v=I.useRef(n);v.current=n;const R=I.useCallback(()=>{s.current!==null&&window.clearTimeout(s.current),s.current=null,i.current=null},[]),x=I.useCallback(_=>{_.pointerType==="mouse"||_.button!==0||(R(),h.current=!1,i.current={x:_.clientX,y:_.clientY},s.current=window.setTimeout(()=>{s.current=null,h.current=!0,v.current()},vS))},[R]),r=I.useCallback(_=>{const u=i.current;u!==null&&(Math.abs(_.clientX-u.x)>qf||Math.abs(_.clientY-u.y)>qf)&&R()},[R]),c=I.useCallback(_=>{(h.current||s.current!==null)&&_.preventDefault()},[]),g=I.useCallback(_=>{h.current&&(h.current=!1,_.preventDefault(),_.stopPropagation())},[]);return{onPointerDown:x,onPointerMove:r,onPointerUp:R,onPointerCancel:R,onContextMenu:c,onClickCapture:g}}function wS({onLongPress:n,...s}){const i=yS(n);return l.jsx("button",{...s,...i})}function bu({className:n,text:s,title:i,disabled:h,offerAgentChoice:v,agents:R,agent:x,onOpen:r}){var L;const[c,g]=I.useState(!1),_=I.useRef(null),u=I.useCallback(()=>g(!1),[]),y=I.useCallback(f=>{g(!1),r(f)},[r]);if(!v)return l.jsx("button",{className:n,onClick:()=>r(),disabled:h,title:i,children:s});const S=((L=R.find(f=>f.id===x))==null?void 0:L.label)??null;return l.jsxs("span",{className:"split-button",children:[l.jsx("button",{className:`${n} split-button-main`,onClick:()=>r(x??void 0),disabled:h,title:S===null?i:C("agentMenu.titleWithAgent",{title:i,label:S}),children:s}),l.jsx("button",{ref:_,className:`${n} split-button-arrow`,onClick:()=>g(f=>!f),disabled:h,"aria-haspopup":"menu","aria-expanded":c,title:C("agentMenu.chooseTitle"),children:"▾"}),c&&_.current!==null&&l.jsx(Bm,{agents:R,preselected:x,anchor:_.current,onPick:y,onClose:u})]})}function bS(n){const s=new Date(n);return s.setHours(0,0,0,0),s.getTime()}function Zm(n,s,i,h){const v=new Set;for(const R of n)for(const x of R.sessions)x.agent===s&&(x.archived||x.updatedAt<i&&(h.has(x.sessionId)||v.add(x.sessionId)));return[...v]}function SS(n,s,i,h){const v=[];for(const r of n)for(const c of r.sessions)v.includes(c.agent)||v.push(c.agent);const R=h,x=r=>{const c=R.indexOf(r);return c===-1?h.length:c};return v.sort((r,c)=>x(r)-x(c)).map(r=>({agent:r,count:Zm(n,r,s,i).length})).filter(r=>r.count>0)}function eg(n,s){const i=new Set;let h=0;for(const v of n.sessions)if(!v.archived){if(s.has(v.sessionId)){h+=1;continue}i.add(v.sessionId)}return{sessionIds:[...i],blocked:h}}function CS(n){const{sessionIds:s,blocked:i}=n;if(s.length===0)return C("archive.allBlocked",{count:i});const h=C("archive.confirm",{count:s.length});return i===0?h:C("archive.withBlocked",{confirm:h,blocked:C("archive.blockedStays",{count:i})})}const Kf=12;function xS(n){let s=2166136261;for(let i=0;i<n.length;i+=1)s^=n.charCodeAt(i),s=Math.imul(s,16777619);return s>>>0}function nr(n){const s=n.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${xS(s)%Kf*(360/Kf)} var(--project-color-s) var(--project-color-l))`}function qr(){return C("vault.name")}function kS(){return C("vault.privacy")}function ES(){return C("vault.archived")}function LS(){return C("vault.mark.copy")}function Gf(){return C("vault.mark.copyTitle")}function TS(){return C("vault.mark.partial")}function RS(){return C("vault.mark.partialTitle")}function tg(n){return C("vault.sessions",{count:n})}function Su(n){return n==="measuring"||n==="writing"||n==="moving"}function MS(n){const s=n.progress;switch(n.state){case"measuring":return s===null?C("vault.state.measuring"):C("vault.state.measuringProgress",{done:s.done,total:s.total});case"writing":return s===null?C("vault.state.writing"):C("vault.state.writingProgress",{done:s.done,total:s.total});case"moving":return C("vault.state.moving");default:return n.enabled?C("vault.state.on"):C("vault.state.off")}}function AS(n){if(n===null||!n.enabled)return null;const s=[qr(),tg(n.sessions)];return n.state==="writing"?s.push(n.progress===null?C("vault.line.copying"):C("vault.line.copyingProgress",{done:n.progress.done,total:n.progress.total})):n.state==="moving"?s.push(C("vault.line.moving")):n.state==="measuring"?s.push(C("vault.line.measuring")):s.push(n.lastPassAt===null?C("vault.line.neverCopied"):Hn(n.lastPassAt)),n.pending>0&&s.push(C("vault.line.pending",{count:n.pending})),s.join(" · ")}function NS(n){return n===null?qr():n.enabled?C("vault.button.on"):C("vault.button.off")}function DS(n){return n.enabled?"enabled":Su(n.state)?"busy":n.measurement!==null?"measured":n.passSessions>0?"existing":"needs-measure"}function IS(n,s){return Su(n.state)?C("vault.busy"):s?null:C("vault.indexNotReady")}function jS(n){return Su(n.state)?C("vault.busy"):null}function PS(n){return C("vault.previousDir",{dir:n})}function OS(n){const s=[];return n.skippedEmpty>0&&s.push(C("vault.note.empty",{count:n.skippedEmpty})),n.unsupported>0&&s.push(C("vault.note.unsupported",{count:n.unsupported})),n.failed>0&&s.push(n.failureReasons.length>0?C("vault.note.failedWithReasons",{count:n.failed,reasons:n.failureReasons.map(kt).join("; ")}):C("vault.note.failed",{count:n.failed})),s.length===0?null:C("vault.note.notCopied",{parts:s.join(" · ")})}function BS(n,s){const i=n.byAgent.map(R=>({agent:R.agent,label:Gi(R.agent,s),sessions:R.sessions,bytes:R.eventBytes+R.imageBytes,images:R.images,imageBytes:R.imageBytes,skippedArchived:R.skippedArchived,note:OS(R)})),h=i.reduce((R,x)=>({sessions:R.sessions+x.sessions,bytes:R.bytes+x.bytes,images:R.images+x.images,skippedArchived:R.skippedArchived+x.skippedArchived}),{sessions:0,bytes:n.memoryBytes,images:0,skippedArchived:0}),v=Hn(n.measuredAt);return{rows:i,memoryProjects:n.memoryProjects,memoryBytes:n.memoryBytes,total:h,summary:v.length>0?C("vault.measure.summary",{when:v,duration:zi(n.durationMs)}):C("vault.measure.summaryNoWhen",{duration:zi(n.durationMs)})}}function FS(n){const s=n.storage==="vault";return{copy:s,partial:s&&n.partial}}function HS(n){switch(n){case"exporting":return C("vault.export.exporting");case"done":return C("vault.export.done");default:return C("vault.export.idle")}}const $S=1e3;function Yf({hit:n}){const{before:s,match:i,after:h}=Qm(n);return l.jsxs(l.Fragment,{children:[s,l.jsx("mark",{children:i}),h]})}function US({project:n,openSessionIds:s,onConfirm:i,onCancel:h}){const v=eg(n,s);return l.jsxs("div",{className:"project-archive-confirm",role:"group",children:[l.jsx("span",{className:"archive-history-text",children:CS(v)}),v.sessionIds.length>0&&l.jsx("button",{className:"link-button",onClick:i,children:C("sidebar.action.archive")}),l.jsx("button",{className:"link-button",onClick:h,children:v.sessionIds.length>0?C("common.cancel"):C("common.close")})]})}function Bc(n){if(n.cwd.length===0)return n.fallbackName;const s=n.cwd.split(/[\\/]/).filter(i=>i.length>0);return s[s.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 WS(){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 zS({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 VS({candidates:n,agents:s,onArchiveAgent:i,onClose:h,anchorRef:v}){const[R,x]=I.useState(null),r=I.useRef(null);return I.useEffect(()=>{const c=u=>{var y,S;return u instanceof Node&&(((y=r.current)==null?void 0:y.contains(u))===!0||((S=v.current)==null?void 0:S.contains(u))===!0)},g=u=>{u.key!=="Escape"||!c(document.activeElement)||(u.preventDefault(),u.stopPropagation(),h())},_=u=>{c(u.target)||h()};return window.addEventListener("keydown",g,!0),document.addEventListener("pointerdown",_,!0),()=>{window.removeEventListener("keydown",g,!0),document.removeEventListener("pointerdown",_,!0)}},[v,h]),l.jsxs("div",{ref:r,className:"archive-history",role:"region","aria-label":C("sidebar.history.region"),children:[l.jsxs("div",{className:"archive-history-header",children:[l.jsx("span",{children:C("sidebar.history.heading")}),l.jsx("button",{className:"icon-button",onClick:h,title:C("common.closeEsc"),children:"×"})]}),n.map(({agent:c,count:g})=>{const _=Gi(c,s);return R===c?l.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[l.jsx("span",{className:"archive-history-text",children:C("sidebar.history.confirm",{count:g,label:_})}),l.jsx("button",{className:"link-button",onClick:()=>i(c),children:C("sidebar.action.archive")}),l.jsx("button",{className:"link-button",onClick:()=>x(null),children:C("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:C("sidebar.history.count",{count:g})})]}),l.jsx("button",{className:"link-button",onClick:()=>x(c),children:C("sidebar.action.archive")})]},c)})]})}function qS({projects:n,indexStatus:s,disabled:i,openSessionIds:h,openBlocked:v,onOpenProject:R,agents:x,offerAgentChoice:r,agentForProject:c,onOpenSession:g,canResume:_,platform:u,onRefresh:y,onArchive:S,onHide:L,width:f,onNewProject:a,vault:m,onOpenVault:p,onOpenVaultSession:d,onExportProject:k,exporting:D,lastExported:E,onContinueSession:M,globalSearch:b,onOpenSearchHit:T}){const[N,B]=I.useState(new Set),[F,O]=I.useState(null);I.useEffect(()=>{const te=E===null?0:E.at+$S-Date.now();if(E===null||te<=0)return;O(E.projectKey);const le=window.setTimeout(()=>O(null),te);return()=>window.clearTimeout(le)},[E]);const U=te=>D.has(te)?"exporting":F===te?"done":"idle",V=AS(m),[Y,X]=I.useState(""),[G,P]=I.useState(!1),[$,H]=I.useState(new Set),[q,ne]=I.useState("titles"),re=b===null?"titles":q,[ue,de]=I.useState(!1),K=b!==null&&re==="conversations"&&Y.trim().length>0&&(ue||b.submitted!==null),W=(b==null?void 0:b.result)??null,J=I.useMemo(()=>K&&W!==null?tS(W.hits):[],[K,W]),Z=te=>{ne(te),de(!1),b==null||b.clear()},pe=()=>{if(b!==null){if(Zb(Y)){de(!0),b.clear();return}de(!1),b.search(Y.trim(),G)}},me=(b==null?void 0:b.submitted)??null,ie=b==null?void 0:b.search;I.useEffect(()=>{re!=="conversations"||me===null||ie===void 0||me.includeArchived!==G&&ie(me.query,G)},[re,me,ie,G]);const Le=I.useMemo(()=>n.reduce((te,le)=>te+le.sessions.filter(ke=>ke.archived).length,0),[n]),Ae=I.useMemo(()=>{const te=re==="titles"?Y.trim().toLowerCase():"";return n.map(le=>{const ke=G?le.sessions:le.sessions.filter(We=>!We.archived);if(ke.length===0)return null;if(te.length===0)return{...le,sessions:ke};if(Bc(le).toLowerCase().includes(te)||le.cwd.toLowerCase().includes(te))return{...le,sessions:ke};const Te=ke.filter(We=>Fn(We.title,We.titleSource).toLowerCase().includes(te));return Te.length>0?{...le,sessions:Te}:null}).filter(le=>le!==null)},[n,Y,G,re]),Xe=re==="titles"&&Y.trim().length>0,Ce=te=>te.archived||!h.has(te.sessionId),[fe,Me]=I.useState(!1),_e=I.useRef(null),Ee=bS(Date.now()),Fe=I.useMemo(()=>x.map(te=>te.id),[x]),Se=I.useMemo(()=>SS(n,Ee,h,Fe),[n,Ee,h,Fe]),[Ne,et]=I.useState(null);I.useEffect(()=>{Se.length===0&&Me(!1)},[Se.length]);const tt=I.useCallback(()=>Me(!1),[]),Je=te=>{const le=Zm(n,te,Ee,h);le.length>0&&(S(le,!0),et({what:Gi(te,x),sessionIds:le})),Me(!1)},[lt,ct]=I.useState(null),$e=te=>{const le=eg(te,h);le.sessionIds.length>0&&(S(le.sessionIds,!0),et({what:Bc(te),sessionIds:le.sessionIds})),ct(null)},Ze=()=>{Ne!==null&&S(Ne.sessionIds,!1),et(null)},Ve=te=>{H(le=>{const ke=new Set(le);return ke.has(te)?ke.delete(te):ke.add(te),ke})},st=I.useMemo(()=>{const te=[];for(const le of Ae)for(const ke of le.sessions)$.has(ke.sessionId)&&te.push(ke);return te},[Ae,$]),dt=te=>{const le=st.filter(ke=>te?Ce(ke):!0).map(ke=>ke.sessionId);le.length>0&&S(le,te),H(new Set)},Re=te=>{B(le=>{const ke=new Set(le);return ke.has(te)?ke.delete(te):ke.add(te),ke})},ze=s.state==="scanning";return l.jsxs("aside",{className:"sidebar",style:{width:`${f}px`},children:[l.jsxs("div",{className:"sidebar-header",children:[l.jsx("input",{className:"sidebar-filter",type:"search",placeholder:Qb(re),value:Y,onChange:te=>{X(te.target.value),re==="conversations"&&(de(!1),te.target.value.trim().length===0&&(b==null||b.clear()))},onKeyDown:te=>{re!=="conversations"||te.key!=="Enter"||(te.preventDefault(),pe())},spellCheck:!1}),l.jsx("button",{className:"icon-button",onClick:a,title:C("sidebar.newProject"),disabled:i,children:"+"}),l.jsx("button",{className:"icon-button",onClick:y,title:C("sidebar.reindex"),disabled:ze,children:"⟳"}),l.jsx("button",{className:`icon-button${(m==null?void 0:m.enabled)===!0?" icon-button-on":""}`,onClick:p,title:NS(m),"aria-label":qr(),children:l.jsx(WS,{})}),l.jsx("button",{className:"icon-button",onClick:L,title:C("sidebar.hide"),children:"«"})]}),b!==null&&l.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":C("sidebar.searchMode.label"),children:[l.jsx("button",{className:`sidebar-search-mode-option${re==="titles"?" is-on":""}`,"aria-pressed":re==="titles",onClick:()=>Z("titles"),title:C("sidebar.searchMode.titlesTitle"),children:Gb()}),l.jsx("button",{className:`sidebar-search-mode-option${re==="conversations"?" is-on":""}`,"aria-pressed":re==="conversations",onClick:()=>Z("conversations"),title:Xb(),children:Yb()})]}),ze&&l.jsx("div",{className:"sidebar-progress",children:C("sidebar.indexing",{scanned:s.scannedFiles,total:s.totalFiles})}),(Le>0||Se.length>0)&&l.jsxs("div",{className:"sidebar-archive-bar",children:[Le>0&&l.jsx("button",{className:`sidebar-archived-toggle${G?" is-on":""}`,onClick:()=>P(te=>!te),title:C("sidebar.archived.toggleTitle"),children:G?C("sidebar.archived.hide",{count:Le}):C("sidebar.archived.show",{count:Le})}),Se.length>0&&l.jsx("button",{ref:_e,className:`link-button sidebar-archive-history${fe?" is-on":""}`,onClick:()=>Me(te=>!te),"aria-expanded":fe,title:C("sidebar.history.buttonTitle"),children:C("sidebar.history.button")})]}),fe&&Se.length>0&&l.jsx(VS,{candidates:Se,agents:x,onArchiveAgent:Je,onClose:tt,anchorRef:_e}),Ne!==null&&!fe&&l.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[l.jsx("span",{className:"archive-history-text",children:C("sidebar.undo.text",{count:Ne.sessionIds.length,what:Ne.what})}),l.jsx("button",{className:"link-button",onClick:Ze,children:C("sidebar.action.undo")}),l.jsx("button",{className:"icon-button",onClick:()=>et(null),title:C("sidebar.undo.dismissTitle"),children:"×"})]}),V!==null&&l.jsx("button",{className:`sidebar-vault-line${(m==null?void 0:m.lastError)!=null?" is-problem":""}`,onClick:p,title:(m==null?void 0:m.lastError)!=null?C("sidebar.vaultLine.lastError",{error:kt(m.lastError)}):C("sidebar.vaultLine.title"),children:V}),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:eS()}),l.jsx("p",{className:`search-status${b.error!==null?" is-problem":""}`,role:"status",children:ue?Jb():oS(b)}),!ue&&J.map(te=>{const le=te.hits[0]??te.titleHit;return le===null?null:l.jsxs("div",{className:"search-group",children:[l.jsxs("button",{className:"search-group-title",onClick:()=>T(le,rS(te)),title:Fn(te.title),children:[l.jsx(iu,{agent:te.agent,agents:x}),te.titleHit!==null?l.jsx(Yf,{hit:te.titleHit}):Fn(te.title)]}),te.hits.map(ke=>l.jsxs("button",{className:"search-hit",onClick:()=>T(ke,Jm(ke)),children:[l.jsx("span",{className:"search-hit-snippet",children:l.jsx(Yf,{hit:ke})}),l.jsxs("span",{className:"search-hit-meta",children:[sS(ke),ke.at!==null?` · ${Hn(ke.at)}`:""]})]},ke.eventId??"titulo"))]},te.key)})]}),!K&&Ae.length===0&&!ze&&l.jsx("p",{className:"sidebar-empty",children:n.length===0?C("sidebar.empty.noProjects"):C("sidebar.empty.noMatch")}),!K&&Ae.map(te=>{const le=N.has(te.key)||Xe,ke=!i&&te.cwdExists,rt=v(te.cwd);return l.jsxs("div",{className:"project",children:[l.jsxs("div",{className:"project-row",children:[l.jsxs("button",{className:"project-toggle",onClick:()=>Re(te.key),title:te.cwd.length>0?te.cwd:te.fallbackName,children:[l.jsx("span",{className:`chevron${le?" chevron-open":""}`,children:"›"}),l.jsx("span",{className:"project-swatch",style:{background:nr(te.cwd)},"aria-hidden":"true"}),l.jsx("span",{className:"project-name",children:Bc(te)}),l.jsx("span",{className:"project-count",children:te.sessions.length})]}),l.jsxs("span",{className:"project-actions",children:[k!==null&&l.jsx("button",{className:`icon-button project-action${U(te.key)!=="idle"?" project-action-busy":""}`,onClick:()=>k(te.key),disabled:U(te.key)==="exporting",title:HS(U(te.key)),"aria-label":C("sidebar.project.export"),children:l.jsx(zS,{done:U(te.key)==="done"})}),l.jsx("button",{className:`icon-button project-action${lt===te.key?" project-action-busy":""}`,onClick:()=>ct(Te=>Te===te.key?null:te.key),title:C("sidebar.project.archiveTitle"),"aria-label":C("sidebar.project.archive"),"aria-expanded":lt===te.key,children:l.jsx(Xf,{out:!1})})]}),l.jsx(bu,{className:"icon-button",text:"+",title:rt?pm():te.cwdExists?C("sidebar.project.newSession"):C("sidebar.project.folderGone"),disabled:!ke||rt,offerAgentChoice:r,agents:x,agent:r?c(te):null,onOpen:Te=>R(te.cwd,Te)})]}),!te.cwdExists&&l.jsx("div",{className:"project-missing",title:te.cwd,children:C("sidebar.project.missing")}),lt===te.key&&l.jsx(US,{project:te,openSessionIds:h,onConfirm:()=>$e(te),onCancel:()=>ct(null)}),le&&l.jsx("ul",{className:"session-list",children:te.sessions.map(Te=>{const We=$.has(Te.sessionId),ut=!Ce(Te),Mt=Gy(Te.agent,x,r),Pt=FS(Te),rs=Jc(Te)&&_(Te.agent),As=Pt.copy?d!==null:ke&&rs;return l.jsxs("li",{className:`session-row${Te.archived?" session-archived":""}${We?" session-selected":""}`,children:[l.jsxs(wS,{className:"session-item",onLongPress:()=>Ve(Te.sessionId),onClick:gn=>{if(gn.ctrlKey||gn.metaKey){Ve(Te.sessionId);return}if(Pt.copy){d==null||d(Te);return}Jc(Te)&&(Te.archived&&S([Te.sessionId],!1),g(Qp(Te.cwd,te.cwd,u),Te))},disabled:!As,title:Pt.copy?`${Fn(Te.title,Te.titleSource)}
128
+ ${d===null?C("remote.onlyOnHost"):Gf()}`:Mt.unavailableTitle??Fn(Te.title,Te.titleSource),children:[l.jsxs("span",{className:"session-title",children:[Mt.badge&&l.jsx(iu,{agent:Te.agent,agents:x}),Pt.copy&&l.jsx("span",{className:"session-vault-mark",title:Gf(),children:LS()}),Pt.partial&&l.jsx("span",{className:"session-partial-mark",title:RS(),children:TS()}),Fn(Te.title,Te.titleSource)]}),l.jsx("span",{className:"session-meta",children:Hn(Te.updatedAt)})]}),l.jsx(Fm,{targets:dm(x,Te.agent,Te.partial),className:"icon-button session-continue",text:"↪",onPick:gn=>M(Te,gn)}),l.jsx("button",{className:"icon-button session-action",onClick:()=>S([Te.sessionId],!Te.archived),disabled:ut,title:Te.archived?C("sidebar.session.restore"):C(ut?"sidebar.session.blocked":"sidebar.session.archive"),children:l.jsx(Xf,{out:Te.archived})})]},`${Te.agent}:${Te.sessionId}`)})})]},te.key)})]}),st.length>0&&l.jsxs("div",{className:"sidebar-selection",children:[l.jsx("span",{children:C("sidebar.selection.count",{count:st.length})}),st.some(te=>!te.archived)&&l.jsx("button",{className:"link-button",onClick:()=>dt(!0),children:C("sidebar.action.archive")}),st.some(te=>te.archived)&&l.jsx("button",{className:"link-button",onClick:()=>dt(!1),children:C("sidebar.action.restore")}),l.jsx("button",{className:"link-button",onClick:()=>H(new Set),children:C("common.cancel")})]})]})}function ou({x:n,y:s,items:i,onClose:h,anchor:v=null}){const R=I.useRef(null),[x,r]=I.useState({left:n,top:s});return I.useLayoutEffect(()=>{const c=R.current;if(c===null)return;const{width:g,height:_}=c.getBoundingClientRect();r({left:Math.max(4,Math.min(n,window.innerWidth-g-4)),top:Math.max(4,Math.min(s,window.innerHeight-_-4))})},[n,s]),I.useEffect(()=>{const c=_=>{_.key==="Escape"&&(_.stopPropagation(),h())},g=_=>{var y;const u=_.target;u instanceof Node&&((y=R.current)!=null&&y.contains(u)||v!=null&&v.contains(u))||h()};return window.addEventListener("keydown",c,!0),window.addEventListener("pointerdown",g,!0),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("keydown",c,!0),window.removeEventListener("pointerdown",g,!0),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[v,h]),l.jsx("div",{ref:R,className:"context-menu",style:{left:`${x.left}px`,top:`${x.top}px`},onPointerDown:c=>c.stopPropagation(),children:i.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(),h()},children:[c.checked!==void 0&&l.jsx("span",{className:"context-menu-check","aria-hidden":"true",children:c.checked?"✓":""}),c.label]},c.label))})}function ng({listLabel:n,docs:s,active:i,tooltipOf:h,labelOf:v=c=>c.title,onShowList:R,onSelect:x,onClose:r}){return l.jsxs("div",{className:"panel-subhead doc-strip",children:[l.jsx("button",{className:`doc-strip-list${i===null?" is-active":""}`,onClick:R,title:C("docs.backToList"),children:i===null?n:`← ${n}`}),l.jsx("div",{className:"strip-tabs doc-tabs",children:s.map(c=>l.jsxs("div",{className:`strip-tab${c.key===i?" is-active":""}`,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>x(c.key),title:h(c),children:v(c)}),l.jsx("button",{className:"strip-tab-close",onClick:()=>r(c.key),title:C("docs.tab.close"),children:"×"})]},c.key))})]})}function Qf(n){let s="";for(let i=0;i<n.length;i++){const h=n[i]??"",v=h.toLowerCase();s+=v.length===h.length?v:h}return s}function KS(n,s){if(s.length===0)return[];const i=Qf(n),h=Qf(s),v=[];let R=i.indexOf(h);for(;R!==-1;)v.push(R),R=i.indexOf(h,R+h.length);return v}function Jf(n,s,i){for(let R=0;R<n.length;R++){const x=n[R]??0;if(i==="start"?s<x:s<=x){const r=R===0?0:n[R-1]??0;return{node:R,offset:s-r}}}const h=Math.max(0,n.length-1),v=h===0?0:n[h-1]??0;return{node:h,offset:(n[h]??0)-v}}function GS(n,s,i){return s===0?0:(n+i+s)%s}function YS(n){return/\.(md|markdown)$/i.test(n)}function XS(n,s){var R;const i=((R=s.split("#")[0])==null?void 0:R.split("?")[0])??"";if(i.length===0)return null;let h;try{h=decodeURIComponent(i)}catch{return null}if(/^[a-z][a-z0-9+.-]*:/i.test(h)||h.startsWith("/")||h.startsWith("\\"))return null;const v=n.split("/").slice(0,-1);for(const x of h.replace(/\\/g,"/").split("/")){if(x.includes(":"))return null;if(!(x===""||x===".")){if(x===".."){if(v.length===0)return null;v.pop();continue}v.push(x)}}return v.length===0?null:v.join("/")}function QS({text:n,language:s}){const[i,h]=I.useState(null);I.useEffect(()=>{if(s===null){h(null);return}let R=!1;return Bn(async()=>{const{highlightCode:x}=await import("./highlight-BxIlYHXS.js");return{highlightCode:x}},[]).then(({highlightCode:x})=>{R||h(x(n,s))}).catch(()=>{R||h(null)}),()=>{R=!0,h(null)}},[n,s]);const v=I.useMemo(()=>n.split(`
129
+ `).length,[n]);return l.jsxs("div",{className:"preview",children:[l.jsx("div",{className:"preview-gutter","aria-hidden":"true","data-search-skip":"",children:Array.from({length:v},(R,x)=>l.jsx("span",{children:x+1},x))}),i!==null?l.jsx("pre",{className:"preview-code hljs",dangerouslySetInnerHTML:{__html:i}}):l.jsx("pre",{className:"preview-code",children:n})]})}function Zf({onInsert:n,onOpenWithSystem:s}){const[i,h]=I.useState(!1),v=I.useRef(null);I.useEffect(()=>()=>{v.current!==null&&window.clearTimeout(v.current)},[]);const R=()=>{n==null||n(),h(!0),v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>h(!1),1200)};return l.jsxs("div",{className:"preview-actions",children:[n!==void 0&&l.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:R,children:C(i?"files.pathInserted":"files.preview.insertPath")}),s!==null&&l.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:s,children:C("files.menu.openWithSystem")})]})}const au="doc-search",lu="doc-search-current";function cu(){const n=CSS.highlights,s=window.Highlight;return n===void 0||typeof s!="function"?null:n}function ep(n){const s=window.Highlight;return new s(...n)}function tp(){const n=cu();n==null||n.delete(au),n==null||n.delete(lu)}function JS(n,s){if(s===null)return;const i=n.getBoundingClientRect(),h=s.getBoundingClientRect();(i.top<h.top+16||i.bottom>h.bottom-16)&&(s.scrollTop+=i.top-h.top-h.height/3),(i.left<h.left||i.right>h.right)&&(s.scrollLeft+=i.left-h.left-48)}function ZS(n,s,i,h){const[v,R]=I.useState(0),[x,r]=I.useState(0),[c,g]=I.useState(0),_=I.useRef([]);I.useEffect(()=>{const y=n.current;if(y===null||i.length===0)return;let S=0;const L=new MutationObserver(()=>{S===0&&(S=window.requestAnimationFrame(()=>{S=0,g(f=>f+1)}))});return L.observe(y,{childList:!0,subtree:!0,characterData:!0}),()=>{L.disconnect(),S!==0&&window.cancelAnimationFrame(S)}},[n,i,h]),I.useEffect(()=>{const y=n.current;if(_.current=[],y===null||i.length===0){tp(),R(0),r(0);return}const S=[],L=[];let f="";const a=document.createTreeWalker(y,NodeFilter.SHOW_TEXT,{acceptNode:p=>{var d;return(d=p.parentElement)!=null&&d.closest("[data-search-skip]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let p=a.nextNode();p!==null;p=a.nextNode()){const d=p;S.push(d),f+=d.data,L.push(f.length)}_.current=KS(f,i).map(p=>{const d=Jf(L,p,"start"),k=Jf(L,p+i.length,"end"),D=document.createRange();return D.setStart(S[d.node],d.offset),D.setEnd(S[k.node],k.offset),D}),R(_.current.length),r(p=>p<_.current.length?p:0);const m=cu();return m!==null&&_.current.length>0?m.set(au,ep(_.current)):m==null||m.delete(au),tp},[n,i,c,h]),I.useEffect(()=>{r(0)},[i]),I.useEffect(()=>{const y=_.current[x],S=cu();if(y===void 0){S==null||S.delete(lu);return}S==null||S.set(lu,ep([y])),JS(y,s.current)},[x,v,c,h,i,s]);const u=I.useCallback(y=>r(S=>GS(S,v,y)),[v]);return{count:v,index:x,step:u}}function sg({doc:n,content:s,readingText:i,truncatedText:h,onReload:v,onModeChange:R,onOpenWithSystem:x,onInsert:r,onOpenLink:c,initialScroll:g,onScrollChange:_}){const[u,y]=I.useState(""),S=I.useRef(null),L=I.useRef(null),f=(s==null?void 0:s.loaded)??null,a=f===null?"":f.kind==="file"?f.preview.text:f.plan.text,m=f!==null&&f.kind==="file"&&f.preview.binary,p=f!==null&&(f.kind==="file"?f.preview.truncated:f.plan.truncated),d=f!==null&&(f.kind==="plan"||f.preview.language==="markdown"||YS(f.preview.path)),k=d&&(n.mode??"formatted")==="formatted",D=f!==null&&f.kind==="file"?f.preview.language:"markdown",E=u.trim(),M=ZS(L,S,E,`${k?"f":"s"}:${a.length}:${a.slice(0,64)}`),b=I.useRef(!1);I.useLayoutEffect(()=>{b.current||f===null||(b.current=!0,g!==void 0&&S.current!==null&&(S.current.scrollTop=g))},[f,g]);const T=c===void 0||f===null||f.kind!=="file"?void 0:B=>{const F=XS(n.key,B);return F===null?null:()=>c(F)},N=f!==null&&!m;return l.jsxs("div",{className:"panel-body doc-viewer",children:[l.jsxs("div",{className:"doc-toolbar",children:[l.jsx("input",{className:"conversation-search-input",type:"search",placeholder:C("docs.search.placeholder"),value:u,disabled:!N,onChange:B=>y(B.target.value),onKeyDown:B=>{B.key==="Enter"&&M.step(B.shiftKey?-1:1),B.key==="Escape"&&y(""),B.stopPropagation()},spellCheck:!1}),E.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-matches",children:M.count===0?C("thread.search.none"):`${M.index+1}/${M.count}`}),l.jsx("button",{className:"icon-button",onClick:()=>M.step(-1),disabled:M.count===0,title:C("thread.search.previous"),children:"↑"}),l.jsx("button",{className:"icon-button",onClick:()=>M.step(1),disabled:M.count===0,title:C("thread.search.next"),children:"↓"})]}),d&&l.jsxs("div",{className:"doc-mode",role:"group","aria-label":C("docs.mode.label"),children:[l.jsx("button",{className:k?"is-active":"","aria-pressed":k,onClick:()=>R("formatted"),children:C("docs.mode.formatted")}),l.jsx("button",{className:k?"":"is-active","aria-pressed":!k,onClick:()=>R("source"),children:C("docs.mode.source")})]}),l.jsx("button",{className:"icon-button",onClick:v,disabled:(s==null?void 0:s.loading)===!0,title:C("docs.reload"),children:"⟳"})]}),(s==null?void 0:s.failed)===!0&&f!==null&&l.jsx("p",{className:"panel-note doc-note",children:C("docs.reloadFailed")}),f===null?l.jsx("p",{className:"panel-note",children:(s==null?void 0:s.failed)===!0?C("docs.failed"):i}):m?l.jsxs("div",{className:"preview-fallback",children:[l.jsx("p",{className:"panel-note",children:C("files.preview.binary")}),l.jsx(Zf,{onInsert:r,onOpenWithSystem:x})]}):l.jsxs("div",{className:"panel-scroll",ref:S,onScroll:B=>_(B.currentTarget.scrollTop),children:[l.jsx("div",{ref:L,className:k?"plan-body":"doc-source",children:k?l.jsx(wu,{text:a,localLink:T}):l.jsx(QS,{text:a,language:D})}),p&&l.jsxs("div",{className:"preview-fallback",children:[l.jsx("p",{className:"panel-note",children:h}),f.kind==="file"&&l.jsx(Zf,{onInsert:r,onOpenWithSystem:x})]})]})]})}function Cu(){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 eC(){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 tC({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 nC(){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 sC(){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 rg({className:n,title:s,doneTitle:i,icon:h,onAction:v}){const[R,x]=I.useState(!1),r=I.useRef(null);I.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]);const c=g=>{g.stopPropagation(),v(),x(!0),r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>x(!1),1200)};return l.jsx("button",{className:R?`${n} tree-action-done`:n,onClick:c,title:R?i:s,children:R?l.jsx(sC,{}):h})}function rC({className:n,title:s,onCopy:i}){return l.jsx(rg,{className:n,title:s,doneTitle:C("common.copied"),icon:l.jsx(eC,{}),onAction:i})}function xu({className:n,title:s,onInsert:i}){return l.jsx(rg,{className:n,title:s,doneTitle:C("files.pathInserted"),icon:l.jsx(nC,{}),onAction:i})}function iC({view:n,cwd:s,platform:i,onInsert:h,onInsertPath:v,onReveal:R,docs:x}){const{listings:r,loading:c,refresh:g,query:_,setQuery:u,showHidden:y,toggleHidden:S}=n,L=Yi(),[f,a]=I.useState(null),m=i==="win32"?"\\":"/",p=I.useCallback(V=>{const Y=V.split("/").join(m);return s.length===0?Y:s.endsWith(m)?`${s}${Y}`:`${s}${m}${Y}`},[s,m]),d=I.useCallback(V=>{navigator.clipboard.writeText(V).catch(()=>{})},[]),k=I.useCallback(V=>v(`"${p(V)}"`),[p,v]),D=I.useCallback((V,Y)=>{V.preventDefault(),V.stopPropagation(),a({x:V.clientX,y:V.clientY,items:[{label:C("files.menu.copyAbsolute"),onSelect:()=>d(p(Y))},{label:C("files.menu.copyRelative"),onSelect:()=>d(Y)},...h===void 0?[]:[{label:C("files.menu.insertMention"),onSelect:()=>h(`@${Y}`)}],...R===null?[]:[{label:C("files.menu.openWithSystem"),onSelect:()=>R(Y)}]]})},[p,d,h,R,L]),E=x.active===null?null:x.docs.find(V=>V.key===x.active)??null,M=E===null?void 0:x.content(E.key),b=E!==null&&M===void 0;I.useEffect(()=>{b&&E!==null&&x.reload(E.key)},[b,E==null?void 0:E.key]);const T=I.useCallback(V=>x.open({key:V,title:V.split("/").pop()??V}),[x]),N=I.useMemo(()=>({...n,openFile:T}),[n,T]),B=V=>{var X;const Y=(X=x.content(V.key))==null?void 0:X.loaded;return(Y==null?void 0:Y.kind)==="file"?`${V.key} · ${rn(Y.preview.sizeBytes)}`:V.key},F=x.docs.length>0?l.jsx(ng,{listLabel:C("panel.tab.files"),docs:x.docs,active:x.active,tooltipOf:B,onShowList:x.showList,onSelect:x.select,onClose:x.close}):null;if(E!==null)return l.jsxs("div",{className:"panel-body",children:[F,l.jsx(sg,{doc:E,content:M,readingText:C("files.readingFile"),truncatedText:C("files.preview.truncated"),onReload:()=>x.reload(E.key),onModeChange:V=>x.setMode(E.key,V),onOpenWithSystem:R===null?null:()=>R(E.key),onInsert:()=>k(E.key),onOpenLink:T,initialScroll:x.scrollOf(E.key),onScrollChange:V=>x.rememberScroll(E.key,V)},E.key),f!==null&&l.jsx(ou,{x:f.x,y:f.y,items:f.items,onClose:()=>a(null)})]});const O=r.get(""),U=_.trim();return l.jsxs("div",{className:"panel-body",children:[F,l.jsxs("div",{className:"panel-subhead",children:[l.jsx("span",{className:"panel-subhead-title",title:s,children:s.split(/[\\/]/).filter(V=>V.length>0).pop()??s}),l.jsx(xu,{className:"icon-button",title:C("files.insertFolderPath"),onInsert:()=>k("")}),l.jsx("button",{className:y?"icon-button icon-button-on":"icon-button",onClick:S,title:C(y?"files.hidden.hide":"files.hidden.show"),children:l.jsx(tC,{open:y})}),R!==null&&l.jsx("button",{className:"icon-button",onClick:()=>R(""),title:C("files.revealFolder"),children:l.jsx(Cu,{})}),l.jsx("button",{className:"icon-button",onClick:g,title:C("files.refresh"),children:"⟳"})]}),l.jsxs("div",{className:"tree-search",children:[l.jsx("input",{className:"tree-search-input",value:_,placeholder:C("files.search.placeholder"),onChange:V=>u(V.target.value),onKeyDown:V=>{V.key==="Escape"&&_.length>0&&(V.stopPropagation(),u(""))}}),_.length>0&&l.jsx("button",{className:"tree-search-clear",onClick:()=>u(""),title:C("files.search.clear"),children:"×"})]}),l.jsx("div",{className:"panel-scroll",children:U.length>0?l.jsx(oC,{view:N,onContextMenu:D,onReveal:R,onInsertPath:k}):O===void 0?l.jsx("p",{className:"panel-note",children:c.has("")?C("files.readingDir"):C("files.readDirFailed")}):l.jsx(ig,{path:"",depth:0,view:N,onContextMenu:D,onReveal:R,onInsertPath:k})}),f!==null&&l.jsx(ou,{x:f.x,y:f.y,items:f.items,onClose:()=>a(null)})]})}function oC({view:n,onContextMenu:s,onReveal:i,onInsertPath:h}){const{results:v,searching:R,openFile:x,toggleDirectory:r}=n;return v===null?l.jsx("p",{className:"panel-note",children:C(R?"files.search.searching":"files.search.prompt")}):v.entries.length===0?l.jsx("p",{className:"panel-note",children:C("files.search.none")}):l.jsxs("ul",{className:"tree tree-results",children:[v.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"?r(c.path):x(c.path),onContextMenu:g=>s(g,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:rn(c.sizeBytes)})]}),l.jsx(xu,{className:"tree-action",title:C("files.insertPath",{name:c.name}),onInsert:()=>h(c.path)}),c.kind==="dir"&&i!==null&&l.jsx("button",{className:"tree-action",onClick:()=>i(c.path),title:C("files.reveal",{name:c.name}),children:l.jsx(Cu,{})})]})},c.path)),v.truncated&&l.jsx("li",{className:"tree-hidden",title:C("files.search.moreTitle"),children:C("files.search.more")})]})}function ig({path:n,depth:s,view:i,onContextMenu:h,onReveal:v,onInsertPath:R}){const{listings:x,loading:r}=i,c=x.get(n);return c===void 0?r.has(n)?l.jsx("div",{className:"tree-loading",children:C("files.loading")}):null:l.jsxs("ul",{className:"tree",children:[c.entries.map(g=>l.jsx(aC,{entry:g,depth:s,view:i,onContextMenu:h,onReveal:v,onInsertPath:R},g.path)),c.entries.length===0&&l.jsx("li",{className:"tree-empty",style:{paddingLeft:`${s*12+8}px`},children:c.hiddenCount>0?C("files.allHidden"):C("files.empty")}),(c.truncated||c.hiddenCount>0)&&c.entries.length>0&&l.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${s*12+8}px`},title:C("files.hiddenTitle"),children:c.truncated?C("files.moreEntries"):C("files.hiddenCount",{count:c.hiddenCount})})]})}function aC({entry:n,depth:s,view:i,onContextMenu:h,onReveal:v,onInsertPath:R}){const{expanded:x,toggleDirectory:r,openFile:c}=i,g=n.kind==="dir"&&x.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:`${s*12+6}px`},onClick:()=>n.kind==="dir"?r(n.path):c(n.path),onContextMenu:_=>h(_,n.path,n.kind),title:n.hidden===void 0?n.path:`${n.path}
130
+ ${n.hidden==="ignored"?C("files.row.ignored"):C("files.row.alwaysHidden")}`,children:[l.jsx("span",{className:`tree-chevron${g?" 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:rn(n.sizeBytes)})]}),l.jsx(xu,{className:"tree-action",title:C("files.insertPath",{name:n.name}),onInsert:()=>R(n.path)}),n.kind==="dir"&&v!==null&&l.jsx("button",{className:"tree-action",onClick:()=>v(n.path),title:C("files.reveal",{name:n.name}),children:l.jsx(Cu,{})})]}),g&&l.jsx(ig,{path:n.path,depth:s+1,view:i,onContextMenu:h,onReveal:v,onInsertPath:R})]})}const lC={added:"+",removed:"-",context:" ",hunk:"",meta:""};function cC({diff:n}){return n.binary?l.jsx("p",{className:"panel-note",children:C("diff.binary")}):n.lines.length===0?l.jsx("p",{className:"panel-note",children:n.message===null?C("diff.noChanges"):kt(n.message)}):l.jsxs("div",{className:"panel-scroll",children:[l.jsx("div",{className:"diff",children:n.lines.map((s,i)=>l.jsxs("div",{className:`diff-line diff-line-${s.kind}`,children:[l.jsx("span",{className:"diff-num","aria-hidden":"true",children:s.oldLine??""}),l.jsx("span",{className:"diff-num","aria-hidden":"true",children:s.newLine??""}),l.jsx("span",{className:"diff-marker","aria-hidden":"true",children:lC[s.kind]}),l.jsx("span",{className:"diff-text",children:s.text})]},i))}),n.truncated&&l.jsx("p",{className:"panel-note",children:C("diff.truncated")})]})}const uC={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},hC={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"},dC=[{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 np(n){const s=n.endsWith("/"),i=s?n.slice(0,-1):n,h=i.lastIndexOf("/"),v=h===-1?i:i.slice(h+1);return{dir:h===-1?"":i.slice(0,h+1),name:s?`${v}/`:v,isDirectory:s}}function fC({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?C("git.detachedAt",{head:n.head}):C("git.detached"))}),n.upstream!==null&&l.jsx("span",{className:"git-upstream",title:C("git.upstreamTitle",{upstream:n.upstream}),children:n.upstream}),(n.ahead>0||n.behind>0)&&l.jsxs("span",{className:"git-ab",title:C("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 pC({view:n}){const{status:s,diff:i,loadingDiff:h,openDiff:v,closeDiff:R,refresh:x}=n;if(i!==null||h)return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsxs("button",{className:"link-button",onClick:R,children:["← ",C("git.backToChanges")]}),i!==null&&l.jsxs("span",{className:"panel-subhead-title",title:i.path,children:[np(i.path).name,i.staged&&l.jsxs("span",{className:"panel-tagline",children:[" ",C("git.stagedTag")]})]})]}),h?l.jsx("p",{className:"panel-note",children:C("git.readingDiff")}):i!==null&&l.jsx(cC,{diff:i})]});if(s.state!=="ready")return l.jsx("div",{className:"panel-body",children:l.jsx("p",{className:"panel-note",children:s.message===null?C("git.unknownState"):kt(s.message)})});const r=s.worktrees.filter(c=>!c.isCurrent);return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx(fC,{status:s}),l.jsx("button",{className:"icon-button",onClick:x,title:C("git.refresh"),children:"⟳"})]}),l.jsxs("div",{className:"panel-scroll",children:[s.changes.length===0&&l.jsx("p",{className:"panel-note",children:C("git.clean")}),dC.map(c=>{const g=s.changes.filter(_=>_.stage===c.stage);return g.length===0?null:l.jsxs("section",{className:"git-group",children:[l.jsxs("h3",{className:"git-group-title",title:C(c.hint),children:[C(c.title),l.jsx("span",{className:"git-group-count",children:g.length})]}),l.jsx("ul",{className:"git-list",children:g.map(_=>{const{dir:u,name:y,isDirectory:S}=np(_.path),L=_.oldPath!==null?`${_.oldPath} → ${_.path}`:S?C("git.newFolderTitle",{path:_.path}):_.path,f=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`git-badge git-badge-${_.kind}`,title:C(hC[_.kind]),children:uC[_.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:L,children:f}):l.jsx("button",{className:"git-item",onClick:()=>v(_.path,_.stage==="staged"),title:L,children:f})},`${c.stage}:${_.path}`)})})]},c.stage)}),s.truncated&&l.jsx("p",{className:"panel-note",children:Ft("git.truncated")}),r.length>0&&l.jsxs("section",{className:"git-group",children:[l.jsxs("h3",{className:"git-group-title",title:C("git.worktrees.headingTitle"),children:[C("git.worktrees.heading"),l.jsx("span",{className:"git-group-count",children:r.length})]}),l.jsx("ul",{className:"git-list",children:r.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??C("git.worktrees.detached")}),l.jsx("span",{className:"git-worktree-path",children:c.path})]})},c.path))})]})]})]})}const mC={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},gC={"AGENTS.md":["Codex","Antigravity","OpenCode"],"CLAUDE.md":["Claude Code"]};function Pa(n){return n.brokenBlock||n.problem!==null}function _C(n){return n.problem==="outside"?C("memory.problem.outside"):n.problem==="encoding"?C("memory.problem.encoding"):n.brokenBlock?C("memory.problem.brokenBlock"):null}function vC(n){const s=n.files.filter(i=>!Pa(i));return n.installed?{instructionFiles:s.filter(i=>i.hasBlock||i.exists).map(i=>i.name),gitMode:n.git.kind==="error"||n.git.kind==="repo"&&!n.git.ignored?"version":"ignore",importNative:!1,copyFromMainWorktree:!1}:{...Zv(n),instructionFiles:s.map(i=>i.name)}}function yC(n){const s=n.files.filter(v=>v.hasBlock&&!v.blockCurrent),i=n.files.filter(v=>v.exists&&!v.hasBlock&&!Pa(v)),h=v=>vu(v.map(R=>R.name));return s.length===0?i.length===0?null:C("memory.update.missing",{files:h(i)}):i.length===0?C("memory.update.outdated",{count:s.length,files:h(s)}):C("memory.update.outdatedAndMissing",{count:s.length,outdated:h(s),missing:h(i)})}function wC(n){const s=n.replace(/^\uFEFF/,"").replace(/\r\n/g,`
131
+ `),i=/^---\n[\s\S]*?\n---(?:\n|$)/.exec(s);return i===null?s:s.slice(i[0].length)}function bC(n){return n.split(/`([^`]+)`/).map((s,i)=>i%2===1?l.jsx("code",{children:s},i):s)}function SC({view:n}){var a;const{status:s,open:i,loading:h,error:v,closeNote:R,openNote:x}=n,[r,c]=I.useState(null),[g,_]=I.useState(!1),u=(s==null?void 0:s.cwd)??null;I.useEffect(()=>{c(null),_(!1)},[u]),I.useEffect(()=>{n.lastResult!==null&&(c(null),_(!1))},[n.lastResult]);const y=I.useCallback(m=>{if(s===null)return null;let p=m.replace(/^\.\//,"");try{p=decodeURIComponent(p)}catch{return null}return p===ka||s.notes.some(k=>k.name===p)?()=>x(p):null},[s,x]);if(s===null)return l.jsx("div",{className:"panel-body",children:l.jsx("p",{className:"panel-note",children:v??C("memory.loading")})});if(i!==null||h!==null){const m=(i==null?void 0:i.name)??h??"",p=m===ka?C("memory.index"):((a=s.notes.find(d=>d.name===m))==null?void 0:a.title)??m;return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx("button",{className:"link-button",onClick:R,children:C("memory.back")}),l.jsx("span",{className:"panel-subhead-title",title:m,children:p})]}),i===null?l.jsx("p",{className:"panel-note",children:C("memory.note.loading")}):l.jsxs("div",{className:"panel-scroll",children:[l.jsx("div",{className:"plan-body",children:l.jsx(wu,{text:wC(i.text),localLink:y})}),i.truncated&&l.jsx("p",{className:"panel-note",children:C("memory.note.truncated")})]})]})}const S=r??vC(s),L=s.installed?yC(s):null,f=!s.installed||g||n.planned!==null;return l.jsxs("div",{className:"panel-body",children:[l.jsx(CC,{reach:s.reach,onAdjust:s.installed&&!f&&L===null&&s.reach.some(m=>!m.reaches)?()=>_(!0):null}),l.jsxs("div",{className:"panel-scroll",children:[(v??n.lastResult)!==null&&l.jsxs("div",{className:`memory-message${v!==null?" memory-message-error":""}`,children:[l.jsx("span",{children:v??n.lastResult}),l.jsx("button",{className:"link-button",onClick:n.dismissMessage,title:C("common.dismissNotice"),children:"×"})]}),s.git.kind==="error"&&l.jsxs("div",{className:"memory-warning",children:[l.jsx("p",{className:"memory-warning-line",children:Ft("memory.git.errorWarning")}),l.jsx("pre",{className:"memory-git-message",children:kt(s.git.message)})]}),s.files.filter(Pa).map(m=>l.jsx("p",{className:"memory-warning",children:m.problem==="outside"?Ft("memory.problem.outsideWarning",{file:m.name}):m.problem==="encoding"?Ft("memory.problem.encodingWarning",{file:m.name}):Ft("memory.problem.brokenBlockWarning",{file:m.name})},m.name)),!s.installed&&l.jsxs("div",{className:"memory-intro",children:[l.jsx("p",{children:C("memory.intro.what")}),l.jsx("p",{children:Ft("memory.intro.where")})]}),s.installed&&L!==null&&!f&&l.jsxs("div",{className:"memory-callout",children:[l.jsx("span",{children:L}),l.jsx("button",{className:"primary-button primary-button-small",onClick:()=>_(!0),children:C("memory.update.button")})]}),f&&(n.planned===null?l.jsx(xC,{status:s,options:S,busy:n.busy,onChange:c,onPlan:()=>{c(S),n.requestPlan(S)},onCancel:s.installed?()=>{_(!1),c(null)}:null}):l.jsx(kC,{changes:n.planned,busy:n.busy,confirmLabel:s.installed?C("memory.plan.update"):C("memory.plan.install"),onConfirm:n.install,onCancel:n.cancelPlan})),s.installed&&s.native.pending>0&&!f&&l.jsxs("div",{className:"memory-callout",children:[l.jsx("span",{children:C("memory.native.pending",{count:s.native.pending})}),l.jsx("button",{className:"primary-button primary-button-small",disabled:n.busy!==null,onClick:n.importNative,children:n.busy==="import"?C("memory.native.importing"):C("memory.native.import",{count:s.native.pending})})]}),s.installed&&l.jsx(EC,{notes:s.notes,indexExists:s.indexExists,onOpen:x}),s.globalFragments.length>0&&l.jsx(LC,{fragments:s.globalFragments})]})]})}function CC({reach:n,onAdjust:s}){return l.jsxs("div",{className:"memory-reach",children:[n.map(i=>l.jsxs("span",{className:`memory-reach-item${i.reaches?" memory-reach-on":""}`,title:C("memory.reach.title",{label:i.label,via:kt(i.via)}),children:[l.jsx("span",{className:"memory-reach-mark","aria-hidden":"true",children:i.reaches?"✓":"—"}),i.label,l.jsx("span",{className:"visually-hidden",children:i.reaches?C("memory.reach.reaches",{via:kt(i.via)}):C("memory.reach.doesNotReach",{via:kt(i.via)})})]},i.agent)),s!==null&&l.jsx("button",{className:"link-button memory-reach-adjust",onClick:s,title:C("memory.reach.adjustTitle"),children:C("memory.reach.adjust")})]})}function xC({status:n,options:s,busy:i,onChange:h,onPlan:v,onCancel:R}){const{git:x}=n,r=x.kind==="repo"?x.worktree:null,c=x.kind==="error"&&s.gitMode==="ignore",g=(_,u)=>{const y=new Set(s.instructionFiles);u?y.add(_):y.delete(_),h({...s,instructionFiles:mu.filter(S=>y.has(S))})};return l.jsxs("div",{className:"memory-form",children:[l.jsx("p",{className:"memory-section-label",children:C("memory.form.files")}),n.files.map(_=>l.jsxs("label",{className:"memory-option",title:_C(_)??void 0,children:[l.jsx("input",{type:"checkbox",checked:s.instructionFiles.includes(_.name),disabled:Pa(_),onChange:u=>g(_.name,u.target.checked)}),l.jsx("code",{children:_.name}),l.jsx("span",{className:"memory-option-hint",children:vu(gC[_.name])})]},_.name)),x.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:s.gitMode==="ignore",onChange:()=>h({...s,gitMode:"ignore"})}),C("memory.git.ignore"),l.jsx("span",{className:"memory-option-hint",children:C("memory.git.ignoreHint")})]}),l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"radio",name:"memory-git-mode",checked:s.gitMode==="version",onChange:()=>h({...s,gitMode:"version"})}),C("memory.git.version"),l.jsx("span",{className:"memory-option-hint",children:C("memory.git.versionHint")})]}),x.ignored&&s.gitMode==="version"&&l.jsx("p",{className:"memory-warning",children:Ft("memory.git.alreadyIgnored")})]}),x.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:s.gitMode==="version",onChange:()=>h({...s,gitMode:"version"})}),Ft("memory.git.dontTouch"),l.jsx("span",{className:"memory-option-hint",children:C("memory.git.errorHint")})]})]}),(n.native.pending>0||(r==null?void 0:r.mainHasMemory)===!0)&&l.jsx("p",{className:"memory-section-label",children:C("memory.form.existingNotes")}),n.native.pending>0&&l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"checkbox",checked:s.importNative,onChange:_=>h({...s,importNative:_.target.checked})}),C("memory.form.importNative",{count:n.native.pending})]}),(r==null?void 0:r.mainHasMemory)===!0&&l.jsxs("label",{className:"memory-option",title:r.mainPath,children:[l.jsx("input",{type:"checkbox",checked:s.copyFromMainWorktree,onChange:_=>h({...s,copyFromMainWorktree:_.target.checked})}),C("memory.form.copyFromMain")]}),l.jsxs("div",{className:"memory-actions",children:[l.jsx("button",{className:"primary-button primary-button-small",disabled:i!==null||s.instructionFiles.length===0||c,onClick:v,title:s.instructionFiles.length===0?C("memory.form.noFiles"):c?C("memory.git.blocked"):void 0,children:C(i==="plan"?"memory.form.planning":"memory.form.preview")}),R!==null&&l.jsx("button",{className:"link-button",onClick:R,disabled:i!==null,children:C("common.cancel")})]})]})}function kC({changes:n,busy:s,confirmLabel:i,onConfirm:h,onCancel:v}){const R=s==="install";return l.jsxs("div",{className:"memory-form",children:[l.jsx("p",{className:"memory-section-label",children:C("memory.plan.changes")}),n.length===0?l.jsx("p",{className:"memory-empty",children:C("memory.plan.nothing")}):l.jsx("ul",{className:"memory-change-list",children:n.map((x,r)=>l.jsxs("li",{className:"memory-change",children:[l.jsxs("div",{className:"memory-change-head",children:[l.jsx("code",{className:"memory-change-file",children:x.file}),l.jsx("span",{className:"memory-option-hint",children:C(mC[x.action])})]}),x.copiedFrom!==null&&l.jsx("p",{className:"memory-option-hint",children:C("memory.plan.copiedFrom",{path:x.copiedFrom})}),x.preview.length>0&&l.jsx("pre",{className:"memory-preview",children:x.preview})]},`${x.file}-${r}`))}),l.jsxs("div",{className:"memory-actions",children:[n.length>0&&l.jsx("button",{className:"primary-button primary-button-small",disabled:s!==null,onClick:h,children:R?C("memory.plan.writing"):i}),l.jsx("button",{className:"link-button",onClick:v,disabled:R,children:n.length===0?C("memory.plan.back"):C("common.cancel")})]})]})}function EC({notes:n,indexExists:s,onOpen:i}){return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"memory-section-label",children:C("memory.list.notes")}),l.jsxs("ul",{className:"plan-list",children:[s&&l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:()=>i(ka),children:[l.jsx("span",{className:"plan-name",children:C("memory.index")}),l.jsx("span",{className:"plan-meta",children:ka})]})}),n.map(h=>l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:()=>i(h.name),title:h.name,children:[l.jsx("span",{className:"plan-name",children:h.title}),h.description.length>0&&l.jsx("span",{className:"memory-note-description",children:h.description}),l.jsxs("span",{className:"plan-meta",children:[Hn(h.modifiedAt)," · ",rn(h.sizeBytes)]})]})},h.name))]}),n.length===0&&l.jsx("p",{className:"memory-empty",children:C("memory.list.empty")})]})}function LC({fragments:n}){const s=I.useCallback(i=>{navigator.clipboard.writeText(i).catch(()=>{})},[]);return l.jsxs("details",{className:"memory-global",children:[l.jsx("summary",{className:"memory-global-summary",children:C("memory.global.title")}),l.jsx("p",{className:"memory-empty",children:Ft("memory.global.intro")}),n.map(i=>l.jsxs("div",{className:"memory-fragment",children:[l.jsxs("div",{className:"memory-change-head",children:[l.jsx("span",{className:"memory-fragment-label",children:i.label}),l.jsx("code",{className:"memory-fragment-target",title:i.target,children:i.target})]}),l.jsxs("div",{className:"memory-fragment-body",children:[l.jsx("pre",{className:"memory-preview",children:i.text}),l.jsx(rC,{className:"icon-button",title:C("memory.global.copy"),onCopy:()=>s(i.text)})]}),l.jsx("p",{className:"memory-fragment-note",children:bC(kt(i.note))})]},i.agent))]})}function TC(n){for(const s of n.split(`
132
+ `,40)){const i=/^#{1,3}\s+(.+)$/.exec(s.trim());if(i!==null)return(i[1]??"").trim()}return null}function RC({view:n,docs:s}){const{plans:i}=n,h=s.active===null?null:s.docs.find(c=>c.key===s.active)??null,v=h===null?void 0:s.content(h.key),R=h!==null&&v===void 0&&n.listFor!==null&&n.listFor===s.terminalId;I.useEffect(()=>{R&&h!==null&&s.reload(h.key)},[R,h==null?void 0:h.key]);const x=c=>{var _;const g=(_=s.content(c.key))==null?void 0:_.loaded;return(g==null?void 0:g.kind)==="plan"?TC(g.plan.text)??c.title:c.title},r=c=>{var _;const g=((_=i.find(u=>u.fileName===c.key))==null?void 0:_.path)??"";return g.length>0?g:x(c)};return l.jsxs("div",{className:"panel-body",children:[s.docs.length>0&&l.jsx(ng,{listLabel:C("panel.tab.plans"),docs:s.docs,active:s.active,tooltipOf:r,labelOf:x,onShowList:s.showList,onSelect:s.select,onClose:s.close}),h!==null?l.jsx(sg,{doc:h,content:v,readingText:C("plans.loading"),truncatedText:C("plans.truncated"),onReload:()=>s.reload(h.key),onModeChange:c=>s.setMode(h.key,c),onOpenWithSystem:null,initialScroll:s.scrollOf(h.key),onScrollChange:c=>s.rememberScroll(h.key,c)},h.key):l.jsx("div",{className:"panel-scroll",children:i.length===0?l.jsx("p",{className:"panel-note",children:Ft("plans.empty")}):l.jsx("ul",{className:"plan-list",children:[...i].reverse().map(c=>l.jsx(MC,{plan:c,onOpen:()=>s.open({key:c.fileName,title:c.title})},c.fileName))})})]})}function MC({plan:n,onOpen:s}){const i=n.path.length>0?n.path:null;return n.exists?l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:s,title:i??void 0,children:[l.jsx("span",{className:"plan-name",children:n.title}),i!==null&&l.jsx("span",{className:"plan-path",children:i}),l.jsxs("span",{className:"plan-meta",children:[Hn(n.modifiedAt)," · ",rn(n.sizeBytes)]})]})}):l.jsxs("li",{className:"plan-row plan-row-missing",title:i??C("plans.missingTitle"),children:[l.jsx("span",{className:"plan-name",children:n.title}),i!==null&&l.jsx("span",{className:"plan-path",children:i}),l.jsx("span",{className:"plan-meta",children:C("plans.missing")})]})}const AC=[{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 og(n){return n.state!=="ready"?0:new Set(n.changes.map(s=>s.path)).size}function NC({tab:n,plansAvailable:s,hiddenTabs:i,hidden:h,onTabChange:v,title:R,cwd:x,platform:r,cli:c,cliUnseen:g,expanded:_,onToggleExpanded:u,git:y,files:S,plans:L,documents:f,memory:a,onInsert:m,onInsertPath:p,onReveal:d,onHide:k}){var M;const D=og(y.status),E=((M=a.status)==null?void 0:M.installed)===!0?a.status.notes.length:0;return l.jsxs("section",{className:`side-panel${h?" side-panel-hidden":""}`,"aria-hidden":h,children:[l.jsxs("header",{className:"side-panel-header",children:[l.jsx("button",{className:"icon-button",onClick:k,title:C("panel.hide"),children:"»"}),x.length>0&&l.jsx("span",{className:"project-swatch",style:{background:nr(x)}}),l.jsx("span",{className:"side-panel-title",title:x,children:R}),l.jsx("button",{className:"icon-button",onClick:u,title:C(_?"panel.restoreWidth":"panel.widen"),children:_?"⇥":"⇤"})]}),l.jsx("nav",{className:"side-panel-tabs",children:Sy(AC,s,i).map(b=>l.jsxs("button",{className:`side-panel-tab${b.id===n?" side-panel-tab-active":""}`,onClick:()=>v(b.id),title:C(b.labelKey),children:[l.jsx("span",{className:"side-panel-tab-label",children:C(b.labelKey)}),b.id==="git"&&D>0&&l.jsx("span",{className:"side-panel-badge",children:D}),b.id==="plans"&&L.plans.length>0&&l.jsx("span",{className:"side-panel-badge",children:L.plans.length}),b.id==="memory"&&E>0&&l.jsx("span",{className:"side-panel-badge",children:E}),b.id==="cli"&&g&&n!=="cli"&&l.jsx("span",{className:"side-panel-dot",title:C("panel.cliUnseen")})]},b.id))}),l.jsxs("div",{className:"side-panel-body",children:[l.jsx("div",{className:`cli-slot${n==="cli"?"":" cli-slot-hidden"}`,children:c}),n==="git"&&l.jsx(pC,{view:y}),n==="plans"&&l.jsx(RC,{view:L,docs:f.plans}),n==="memory"&&l.jsx(SC,{view:a}),n==="files"&&l.jsx(iC,{view:S,cwd:x,platform:r,onInsert:m,onInsertPath:p,onReveal:d,docs:f.files})]})]})}function DC(n,s,i){return`${s===void 0||s.length===0?n:`${n} — ${s}`}
133
+ ${i}`}function IC({placement:n}){return l.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${n.pending.cwd}
134
+ ${C("tabs.state.opening")}`,style:{"--tab-project-color":nr(n.pending.cwd)},children:[l.jsx("span",{className:"tab-opening","aria-label":C("tabs.aria.opening"),children:l.jsx("i",{})}),l.jsx("span",{className:"tab-label",children:n.label})]})}function ku({terminal:n,activity:s,statusLine:i}){if(!n.alive){const h=n.sleeping;return l.jsx("span",{className:`tab-dot${h?" tab-dot-sleeping":" tab-dot-dead"}`,title:C(h?"tabs.dot.sleeping":"tabs.dot.exited")})}return s==="waiting"?l.jsx("span",{className:"tab-bang",title:C("tabs.dot.waiting"),children:"!"}):s==="busy"?l.jsxs("span",{className:"tab-working",title:C("tabs.dot.busy"),"aria-label":C("tabs.aria.working"),children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}):l.jsx("span",{className:"tab-dot",title:Dy(s,i)})}function Vi(n){if(n.label.length>0)return n.label;const s=n.cwd.split(/[\\/]/).filter(h=>h.length>0),i=s[s.length-1]??n.cwd;return n.resumed?`${i} ↩`:i}function jC(n){return n.alive?C("tabs.state.alive"):n.sleeping?C("tabs.state.sleeping"):C("tabs.state.exited",{code:n.exitCode??"?"})}function PC({terminals:n,activeTerminalId:s,activity:i,canOpen:h,onSelect:v,onClose:R,onRename:x,onReorder:r,onNew:c,agents:g,offerAgentChoice:_,newTabAgent:u,pendingOpens:y,platform:S,newTabBlockedTitle:L,sessionTitles:f}){const[a,m]=I.useState(null),[p,d]=I.useState(""),[k,D]=I.useState(null),E=I.useRef(null);I.useEffect(()=>{var O;a!==null&&((O=E.current)==null||O.select())},[a]);const M=O=>{m(O.terminalId),d(O.label.length>0?O.label:Vi(O))},b=()=>{a!==null&&x(a,p.trim()),m(null)},T=O=>{if(k===null||k===O)return;const U=n.map(X=>X.terminalId),V=U.indexOf(k),Y=U.indexOf(O);V===-1||Y===-1||(U.splice(Y,0,...U.splice(V,1)),r(U),D(null))},N=aw(n,y,S),B=new Map;for(const O of N){const U=B.get(O.index);U===void 0?B.set(O.index,[O]):U.push(O)}const F=O=>(B.get(O)??[]).map(U=>l.jsx(IC,{placement:U},`pending:${U.pending.requestId}`));return l.jsxs("div",{className:"tab-bar",children:[n.map((O,U)=>{var X;const V=O.terminalId===s,Y=O.terminalId===a;return l.jsxs(z_.Fragment,{children:[F(U),l.jsx("div",{className:`tab${V?" tab-active":""}${O.alive||O.sleeping?"":" tab-dead"}`,draggable:!Y,onDragStart:()=>D(O.terminalId),onDragOver:G=>G.preventDefault(),onDrop:()=>T(O.terminalId),onDragEnd:()=>D(null),onClick:()=>v(O.terminalId),onDoubleClick:()=>M(O),title:DC(O.cwd,f.get(O.terminalId),jC(O)),style:{"--tab-project-color":nr(O.cwd)},children:Y?l.jsx("input",{ref:E,className:"tab-input",value:p,onChange:G=>d(G.target.value),onBlur:b,onKeyDown:G=>{G.key==="Enter"&&b(),G.key==="Escape"&&m(null),G.stopPropagation()},onClick:G=>G.stopPropagation()}):l.jsxs(l.Fragment,{children:[l.jsx(ku,{terminal:O,activity:i.get(O.terminalId),statusLine:((X=g.find(G=>G.id===O.agent))==null?void 0:X.statusLine)??null}),l.jsxs("span",{className:"tab-label",children:[O.agent!==null&&Ky(_,O.agent)&&l.jsx(iu,{agent:O.agent,agents:g}),Vi(O)]}),l.jsx("button",{className:"tab-close",onClick:G=>{G.stopPropagation(),R(O.terminalId)},title:C("tabs.close"),children:"×"})]})})]},O.terminalId)}),F(n.length),l.jsx(bu,{className:"tab-new",text:"+",title:L??C("tabs.new"),disabled:!h||L!==null,offerAgentChoice:_,agents:g,agent:u,onOpen:c})]})}function OC(n,s,i){const[h,v]=I.useState(!1);return I.useEffect(()=>{if(v(!1),!(s===null||i))return n.onMessage(R=>{R.type==="terminal.output"&&R.terminalId===s&&v(!0)})},[n,s,i]),h&&!i}const BC=200,sp="agent-workbench.files.hidden";function FC(n,s){const[i,h]=I.useState(new Map),[v,R]=I.useState(new Set),[x,r]=I.useState(new Set),[c,g]=I.useState(""),[_,u]=I.useState(null),[y,S]=I.useState(!1),[L,f]=I.useState(()=>mt(sp,!1,E=>E==="true"?!0:E==="false"?!1:null)),a=I.useRef(new Set),m=I.useRef(L);m.current=L;const p=I.useCallback(E=>{s===null||a.current.has(E)||(a.current.add(E),r(M=>new Set(M).add(E)),n.send({type:"files.list",terminalId:s,path:E,includeHidden:m.current}))},[n,s]);I.useEffect(()=>{if(h(new Map),R(new Set),r(new Set),g(""),u(null),S(!1),a.current=new Set,s===null)return;const E=n.onMessage(b=>{switch(b.type){case"files.listing":{if(b.terminalId!==s)break;const{listing:T}=b;a.current.delete(T.path),h(N=>new Map(N).set(T.path,T)),r(N=>{const B=new Set(N);return B.delete(T.path),B});break}case"files.results":if(b.terminalId!==s)break;u(b.result),S(!1);break;case"error":a.current=new Set,r(new Set),S(!1);break}});n.send({type:"files.list",terminalId:s,path:"",includeHidden:m.current}),a.current.add(""),r(new Set([""]));const M=n.onReopen(()=>{a.current=new Set,n.send({type:"files.list",terminalId:s,path:"",includeHidden:m.current})});return()=>{E(),M()}},[n,s]),I.useEffect(()=>{const E=c.trim();if(s===null||E.length===0){u(null),S(!1);return}S(!0);const M=window.setTimeout(()=>{n.send({type:"files.search",terminalId:s,query:E,includeHidden:m.current})},BC);return()=>window.clearTimeout(M)},[n,s,c,L]);const d=I.useCallback(E=>{R(M=>{const b=new Set(M);return b.has(E)?b.delete(E):(b.add(E),p(E)),b})},[p]),k=I.useCallback(()=>{if(s===null)return;a.current=new Set;const E=["",...v];for(const M of E)a.current.add(M),n.send({type:"files.list",terminalId:s,path:M,includeHidden:m.current});r(new Set(E))},[n,s,v]),D=I.useCallback(()=>{f(E=>{const M=!E;if(m.current=M,ht(sp,String(M)),s!==null){a.current=new Set;const b=["",...v];for(const T of b)a.current.add(T),n.send({type:"files.list",terminalId:s,path:T,includeHidden:M});r(new Set(b))}return M})},[n,s,v]);return{listings:i,expanded:v,loading:x,query:c,setQuery:g,results:_,searching:y,showHidden:L,toggleHidden:D,toggleDirectory:d,refresh:k}}function HC(n){const[s,i]=I.useState(!1),[h,v]=I.useState(null),[R,x]=I.useState(null),[r,c]=I.useState(null),g=I.useRef(null);I.useEffect(()=>{const y=n.onMessage(L=>{switch(L.type){case"search.progress":if(g.current===null||L.searchId!==g.current)break;v(f=>iS(f,L.progress));break;case"search.results":if(g.current===null||L.searchId!==g.current)break;g.current=null,v(L.result),x(null),i(!1);break;case"error":if(L.code!=="search-failed"||g.current===null||L.requestId!==g.current)break;g.current=null,L.detail!==void 0&&console.error("[servidor]",L.detail),v(null),x(kt(L.text)),i(!1);break}}),S=n.onReopen(()=>{g.current!==null&&(g.current=null,i(!1),x(C("searchHook.connectionLost")))});return()=>{y(),S()}},[n]);const _=I.useCallback((y,S)=>{const L=crypto.randomUUID();g.current=L,c({query:y,includeArchived:S}),i(!0),x(null),v(null),n.send({type:"search.global",searchId:L,query:y,includeArchived:S})},[n]),u=I.useCallback(()=>{const y=g.current;g.current=null,y!==null&&n.send({type:"search.cancel",searchId:y}),c(null),i(!1),v(null),x(null)},[n]);return{searching:s,result:h,error:R,submitted:r,search:_,clear:u}}function $C(n,s){const[i,h]=I.useState([]),[v,R]=I.useState(null);return I.useEffect(()=>{if(h([]),R(null),s!==null)return n.onMessage(x=>{switch(x.type){case"conversation.plans":if(x.terminalId!==s)break;h(x.plans),R(s);break}})},[n,s]),{plans:i,listFor:v}}const ag=8,lg=1024,UC=300,WC=["file","plan"],Aa={docs:[],active:null,recent:[]},qi={};function Na(n,s){return[...n.filter(i=>i!==s),s]}function zC(n,s){const i=n.docs.find(R=>R.key===s.key);if(i!==void 0)return{docs:i.title===s.title?n.docs:n.docs.map(x=>x.key===s.key?{...x,title:s.title}:x),active:s.key,recent:Na(n.recent,s.key)};let h=[...n.docs,{key:s.key,title:s.title}],v=Na(n.recent,s.key);for(;h.length>ag;){const R=v.find(x=>x!==s.key);if(R===void 0)break;h=h.filter(x=>x.key!==R),v=v.filter(x=>x!==R)}return{docs:h,active:s.key,recent:v}}function VC(n,s){return n.docs.some(i=>i.key===s)?{...n,active:s,recent:Na(n.recent,s)}:n}function qC(n){return n.active===null?n:{...n,active:null}}function KC(n,s){const i=n.docs.findIndex(x=>x.key===s);if(i===-1)return n;const h=n.docs.filter(x=>x.key!==s),v=n.recent.filter(x=>x!==s);if(n.active!==s)return{docs:h,active:n.active,recent:v};const R=h[i]??h[i-1]??null;return{docs:h,active:R===null?null:R.key,recent:R===null?v:Na(v,R.key)}}function GC(n,s,i){return{...n,docs:n.docs.map(h=>h.key===s?{...h,mode:i}:h)}}function Fc(n,s,i){var h;return((h=n[s])==null?void 0:h[i])??Aa}function YC(n,s,i,h){const v=n[s]??{file:Aa,plan:Aa};return{...n,[s]:{...v,[i]:h}}}function XC(n,s){if(s.length===0)return n;const i=new Set(s),h=Object.keys(n).filter(R=>!i.has(R));if(h.length===0)return n;const v={...n};for(const R of h)delete v[R];return v}function tr(n,s,i){return`${n}\0${s}\0${i}`}function QC(n){const s=new Set;for(const[i,h]of Object.entries(n))for(const v of WC)for(const R of h[v].docs)s.add(tr(i,v,R.key));return s}function JC(n){return JSON.stringify(n)}function Da(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:null}function ZC(n){const s=Da(n);if(s===null)return null;const{key:i,title:h,mode:v}=s;if(typeof i!="string"||i.length===0||i.length>lg||typeof h!="string"||h.length>UC)return null;const R={key:i,title:h};return v==="formatted"||v==="source"?{...R,mode:v}:R}function rp(n){const s=Da(n);if(s===null||!Array.isArray(s.docs))return Aa;const i=[];for(const r of s.docs){const c=ZC(r);if(c!==null&&!i.some(g=>g.key===c.key)&&i.push(c),i.length===ag)break}const h=i.map(r=>r.key),v=typeof s.active=="string"&&h.includes(s.active)?s.active:null,R=Array.isArray(s.recent)?s.recent.filter(r=>typeof r=="string"&&h.includes(r)):[],x=[...h.filter(r=>!R.includes(r)),...new Set(R)];return{docs:i,active:v,recent:x}}function ex(n){let s;try{s=JSON.parse(n)}catch{return qi}const i=Da(s);if(i===null)return qi;const h={};for(const[v,R]of Object.entries(i)){const x=Da(R);if(x===null||v.length===0||v.length>lg)continue;const r=rp(x.file),c=rp(x.plan);r.docs.length===0&&c.docs.length===0||(h[v]={file:r,plan:c})}return h}const cg="agent-workbench.docTabs";function tx(){try{const n=window.sessionStorage.getItem(cg);return n===null?qi:ex(n)}catch{return qi}}function nx(n,s,i){const[h,v]=I.useState(tx),[R,x]=I.useState(new Map),r=I.useRef(R);r.current=R;const c=I.useRef(new Map);I.useEffect(()=>{v(u=>XC(u,s.map(y=>y.terminalId)))},[s]),I.useEffect(()=>{const u=QC(h);for(const y of[...c.current.keys()])u.has(y)||c.current.delete(y);x(y=>{const S=[...y.keys()].filter(f=>!u.has(f));if(S.length===0)return y;const L=new Map(y);for(const f of S)L.delete(f);return L})},[h]),I.useEffect(()=>{try{window.sessionStorage.setItem(cg,JC(h))}catch{}},[h]);const g=I.useCallback((u,y,S)=>{const L=tr(u,y,S);x(f=>{var a;return new Map(f).set(L,{loaded:((a=f.get(L))==null?void 0:a.loaded)??null,loading:!0,failed:!1})}),y==="file"?n.send({type:"files.read",terminalId:u,path:S}):n.send({type:"plans.read",terminalId:u,fileName:S})},[n]);I.useEffect(()=>{const u=(L,f)=>x(a=>a.has(L)?new Map(a).set(L,{loaded:f,loading:!1,failed:!1}):a),y=n.onMessage(L=>{switch(L.type){case"files.preview":u(tr(L.terminalId,"file",L.preview.path),{kind:"file",preview:L.preview});break;case"plans.content":u(tr(L.terminalId,"plan",L.plan.fileName),{kind:"plan",plan:L.plan});break;case"error":x(f=>{if(![...f.values()].some(m=>m.loading))return f;const a=new Map;for(const[m,p]of f)a.set(m,p.loading?{...p,loading:!1,failed:!0}:p);return a});break}}),S=n.onReopen(()=>{for(const[L,f]of r.current){if(!f.loading)continue;const[a,m,p]=L.split("\0");a===void 0||p===void 0||(m==="file"&&n.send({type:"files.read",terminalId:a,path:p}),m==="plan"&&n.send({type:"plans.read",terminalId:a,fileName:p}))}});return()=>{y(),S()}},[n]);const _=I.useCallback(u=>{const y=i,S=y===null?Fc(qi,"",u):Fc(h,y,u),L=f=>{y!==null&&v(a=>YC(a,y,u,f(Fc(a,y,u))))};return{terminalId:y,docs:S.docs,active:S.active,open:f=>{y!==null&&(L(a=>zC(a,f)),g(y,u,f.key))},select:f=>L(a=>VC(a,f)),showList:()=>L(qC),close:f=>L(a=>KC(a,f)),setMode:(f,a)=>L(m=>GC(m,f,a)),content:f=>y===null?void 0:R.get(tr(y,u,f)),reload:f=>{y!==null&&g(y,u,f)},rememberScroll:(f,a)=>{y!==null&&c.current.set(tr(y,u,f),a)},scrollOf:f=>y===null?void 0:c.current.get(tr(y,u,f))}},[i,h,R,g]);return I.useMemo(()=>({files:_("file"),plans:_("plan")}),[_])}function sx(n,s){const[i,h]=I.useState(bc),[v,R]=I.useState(null),[x,r]=I.useState(!1);I.useEffect(()=>{if(s===null){h(bc),R(null);return}h(bc),R(null),r(!1);const u=n.onMessage(S=>{switch(S.type){case"git.status":S.terminalId===s&&h(S.status);break;case"git.diff":if(S.terminalId!==s)break;R(S.diff),r(!1);break;case"error":r(!1);break}});n.send({type:"git.subscribe",terminalId:s});const y=n.onReopen(()=>{n.send({type:"git.subscribe",terminalId:s})});return()=>{u(),y(),n.send({type:"git.unsubscribe",terminalId:s})}},[n,s]);const c=I.useCallback((u,y)=>{s!==null&&(r(!0),R(null),n.send({type:"git.diff",terminalId:s,path:u,staged:y}))},[n,s]),g=I.useCallback(()=>{R(null),r(!1)},[]),_=I.useCallback(()=>{s!==null&&n.send({type:"git.refresh",terminalId:s})},[n,s]);return{status:i,diff:v,loadingDiff:x,openDiff:c,closeDiff:g,refresh:_}}const uu=new Set;function rx(n){return n!==void 0&&uu.has(n)}function ix(n){return n.length===0?C("memory.result.nothingChanged"):C("memory.result.installed",{count:n.length})}function ox(n,s){const i=n.length===0?C("memory.result.nothingImported"):C("memory.result.imported",{count:n.length});return s.length===0?i:C("memory.result.withSkipped",{result:i,skipped:C("memory.result.skipped",{count:s.length,files:s.join(", ")})})}function ax(n,s){const[i,h]=I.useState(null),[v,R]=I.useState(null),[x,r]=I.useState(null),[c,g]=I.useState(null),[_,u]=I.useState(null),[y,S]=I.useState(null),[L,f]=I.useState(null),a=I.useRef(new Map),m=I.useRef(new Set),p=I.useRef(null),d=I.useRef(!1),k=I.useCallback(U=>{const V=`memory-${crypto.randomUUID()}`;return a.current.set(V,U),m.current.add(V),uu.add(V),V},[]),D=I.useCallback(U=>{for(const[V,Y]of a.current)Y===U&&a.current.delete(V)},[]);I.useEffect(()=>{h(null),R(null),r(null),g(null),u(null),S(null),f(null),a.current.clear();for(const P of m.current)uu.delete(P);if(m.current.clear(),p.current=null,d.current=!1,s===null)return;const U=(P,$)=>P===void 0||a.current.get(P)!==$?!1:(a.current.delete(P),!0),V=n.onMessage(P=>{switch(P.type){case"memory.status":if(P.terminalId!==s)break;h(P.status),d.current&&(d.current=!1,f(null));break;case"memory.planned":if(P.terminalId!==s||!U(P.requestId,"plan"))break;g(P.changes),u(null);break;case"memory.installed":if(P.terminalId!==s||!U(P.requestId,"install"))break;p.current=null,g(null),u(null),S(ix(P.applied));break;case"memory.imported":if(P.terminalId!==s||!U(P.requestId,"import"))break;u(null),S(ox(P.copied,P.skipped));break;case"memory.content":if(P.terminalId!==s||!U(P.requestId,"read"))break;R(P.note),r(null);break;case"error":{const $=P.requestId,H=$===void 0?void 0:a.current.get($);if($===void 0||H===void 0)break;a.current.delete($),H==="read"?r(null):H!=="subscribe"&&u(null),f(kt(P.text)),d.current=H==="subscribe";break}}}),Y=n.onStatus(P=>{if(P!=="reconnecting"&&P!=="failed")return;const $=new Set(a.current.values());a.current.clear(),u(null),r(null),($.has("install")||$.has("import"))&&(p.current=null,g(null),f(C("memory.error.connectionLost")))}),X=()=>{n.send({type:"memory.subscribe",terminalId:s,requestId:k("subscribe")})};X();const G=n.onReopen(X);return()=>{V(),Y(),G(),n.send({type:"memory.unsubscribe",terminalId:s})}},[n,s,k]);const E=I.useCallback(()=>{d.current=!1,f(null),S(null)},[]),M=I.useCallback(U=>{s!==null&&(D("read"),E(),r(U),R(null),n.send({type:"memory.read",terminalId:s,name:U,requestId:k("read")}))},[n,s,E,D,k]),b=I.useCallback(()=>{D("read"),R(null),r(null)},[D]),T=I.useCallback(U=>{s!==null&&(E(),p.current=U,g(null),u("plan"),n.send({type:"memory.plan",terminalId:s,options:U,requestId:k("plan")}))},[n,s,E,k]),N=I.useCallback(()=>{const U=p.current;s===null||U===null||(E(),u("install"),n.send({type:"memory.install",terminalId:s,options:U,requestId:k("install")}))},[n,s,E,k]),B=I.useCallback(()=>{s!==null&&(E(),u("import"),n.send({type:"memory.import",terminalId:s,requestId:k("import")}))},[n,s,E,k]),F=I.useCallback(()=>{D("plan"),p.current=null,g(null)},[D]),O=I.useCallback(()=>{d.current=!1,f(null),S(null)},[]);return{status:i,open:v,loading:x,planned:c,busy:_,lastResult:y,error:L,openNote:M,closeNote:b,requestPlan:T,install:N,importNative:B,cancelPlan:F,dismissMessage:O}}function lx(n){const[s,i]=I.useState([]),[h,v]=I.useState({}),[R,x]=I.useState(null),r=I.useRef(new Set);I.useEffect(()=>{const a=n.onMessage(p=>{switch(p.type){case"notes.list":i(p.notes);break;case"notes.imageData":r.current.add(p.imageId),v(d=>({...d,[p.imageId]:p.data===null?null:`data:${p.mediaType};base64,${p.data}`}));break;case"error":p.code==="notes-failed"&&x(kt(p.text));break}}),m=n.onReopen(()=>{r.current.clear()});return()=>{a(),m()}},[n]);const c=I.useCallback(a=>{r.current.has(a)||(r.current.add(a),n.send({type:"notes.image",imageId:a}))},[n]),g=I.useCallback(()=>{const a=crypto.randomUUID(),m=Date.now();return i(p=>[...p,{noteId:a,text:"",images:[],createdAt:m,updatedAt:m}]),n.send({type:"notes.create",noteId:a}),a},[n]),_=I.useCallback((a,m)=>{i(p=>p.map(d=>d.noteId===a?{...d,text:m,updatedAt:Date.now()}:d)),n.send({type:"notes.update",noteId:a,text:m})},[n]),u=I.useCallback(a=>{i(m=>m.filter(p=>p.noteId!==a)),n.send({type:"notes.delete",noteId:a})},[n]),y=I.useCallback((a,m)=>{const p=s.find(k=>k.noteId===a);if(p!==void 0&&p.images.length>=Qd){x(C("notes.tooManyImages",{count:Qd}));return}if(m.size>Ea){x(C("notes.imageTooBig",{name:m.name||C("notes.imageFallbackName"),size:Math.round(m.size/1024/1024),max:Ea/1024/1024}));return}const d=new FileReader;d.onload=()=>{const k=d.result;if(typeof k!="string")return;const D=k.indexOf(",");D!==-1&&n.send({type:"notes.addImage",noteId:a,image:{mediaType:m.type,data:k.slice(D+1)}})},d.onerror=()=>x(C("notes.readFailed")),d.readAsDataURL(m)},[n,s]),S=I.useCallback((a,m)=>{i(p=>p.map(d=>d.noteId===a?{...d,images:d.images.filter(k=>k.imageId!==m)}:d)),n.send({type:"notes.removeImage",noteId:a,imageId:m})},[n]),L=I.useCallback((a,m)=>{n.send({type:"notes.send",noteId:a,terminalId:m})},[n]),f=I.useCallback(()=>x(null),[]);return{notes:s,images:h,problem:R,requestImage:c,create:g,updateText:_,remove:u,addImage:y,removeImage:S,sendToAgent:L,dismissProblem:f}}const ug="agent-workbench.theme",Hc=["system","light","dark"],cx={system:"theme.system",light:"theme.light",dark:"theme.dark"};function ip(n){return C("theme.title",{theme:C(cx[n])})}const op={system:"◐",light:"☀",dark:"☾"};function ux(){return mt(ug,"system",n=>n==="light"||n==="dark"||n==="system"?n:null)}function hx(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function dx(){const[n,s]=I.useState(ux),[i,h]=I.useState(hx);I.useEffect(()=>{const x=window.matchMedia("(prefers-color-scheme: dark)"),r=c=>h(c.matches);return x.addEventListener("change",r),()=>x.removeEventListener("change",r)},[]);const v=n==="system"?i?"dark":"light":n;I.useEffect(()=>{document.documentElement.dataset.theme=v,document.documentElement.style.colorScheme=v},[v]);const R=I.useCallback(()=>{s(x=>{const r=Hc[(Hc.indexOf(x)+1)%Hc.length]??"system";return ht(ug,r),r})},[]);return{preference:n,resolved:v,cycle:R}}const ap="agent-workbench.terminalTheme";function fx(n){return n==="dark"||n==="follow"?n:null}function px(n,s){return n==="follow"?s:"dark"}function mx(n){const[s,i]=I.useState(()=>mt(ap,"dark",fx)),h=px(s,n);I.useEffect(()=>{document.documentElement.dataset.terminalTheme=h},[h]);const v=I.useCallback(R=>{ht(ap,R),i(R)},[]);return{preference:s,resolved:h,setPreference:v}}const gx=1500;function _x(n,s){return n===void 0||n===s?null:s==="waiting"?"attention":s==="idle"&&n==="busy"?"done":null}function vx(n,s){const i={now:[],later:[],cancel:[]};for(const[h,v]of s){const R=n.get(h);if(R===v)continue;i.cancel.push(h);const x=_x(R,v);x==="attention"?i.now.push(h):x==="done"&&i.later.push(h)}for(const h of n.keys())s.has(h)||i.cancel.push(h);return i}const lp="agent-workbench.phone-chime";function yx(n){return n==="system"||n==="page"?n:null}function wx(n){return`agentworkbench://chime?source=${n}`}function bx(n,s,i,h){return n?s==="page"?Oa:null:i?Xi(h):null}const cp="agent-workbench.sound";function Sx(n){return n==="on"?!0:n==="off"?!1:null}function Cx(n){return C(n?"sound.on":"sound.off")}function xx(n,s){return n&&s>0}const kx={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}]},hg=.02,Oa=.8,dg=.2,up="agent-workbench.sound-volume";function Xi(n){return Math.min(Oa,Math.max(hg,n))}function Ex(n){if(n.trim().length===0)return null;const s=Number(n);return Number.isFinite(s)?Xi(s):null}function Lx(n){return Math.round(Xi(n)/Oa*100)}class Tx{constructor(){Lt(this,"context",null);Lt(this,"volume",dg)}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 s;return((s=this.context)==null?void 0:s.state)==="running"}play(s){const i=this.context;if(i===null||i.state!=="running")return;const h=i.currentTime+.01;for(const v of kx[s]){const R=i.createOscillator(),x=i.createGain();R.type="sine",R.frequency.value=v.frequency;const r=h+v.at;x.gain.setValueAtTime(1e-4,r),x.gain.exponentialRampToValueAtTime(Xi(this.volume),r+.012),x.gain.exponentialRampToValueAtTime(1e-4,r+v.duration),R.connect(x),x.connect(i.destination),R.start(r),R.stop(r+v.duration+.02)}}}const $c="agent-workbench.notify";function Rx(n){return n==="on"?!0:n==="off"?!1:null}function Mx(n,s,i){return n&&s==="granted"&&!i}function Ax(n,s){return C(s==="denied"?"sound.notify.blocked":n?"sound.notify.on":"sound.notify.off")}function Nx(n,s){return n==="attention"?C("notify.attention",{tab:s}):C("notify.done",{tab:s})}function Dx(n){return n===void 0?"":n.label.length>0?n.label:n.cwd.split(/[\\/]/).filter(s=>s.length>0).pop()??n.cwd}function Ui(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function Ix(){if(Ui()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return Ui()}}function jx(){return document.visibilityState==="visible"&&document.hasFocus()}function Px(n){try{const s=new Notification("Agent Workbench",{body:Nx(n.chime,n.tabName),tag:`agent-workbench:${n.terminalId}`});s.onclick=()=>{window.focus(),n.onClick(),s.close()}}catch{}}function Ox(n,s){const[i,h]=I.useState(()=>mt(cp,!0,Sx)),v=I.useRef(i);v.current=i;const[R,x]=I.useState(()=>mt(up,dg,Ex)),r=I.useRef(R);r.current=R;const[c]=I.useState(()=>typeof navigator<"u"&&km(navigator.userAgent)),[g,_]=I.useState(()=>mt(lp,"system",yx)),u=I.useRef(g);u.current=g;const[y,S]=I.useState(()=>Ui()),[L,f]=I.useState(()=>mt($c,!1,Rx)),a=I.useRef(L);a.current=L;const m=I.useRef(s);m.current=s;const p=I.useCallback((U,V)=>{Mx(a.current,Ui(),jx())&&Px({chime:U,terminalId:V,tabName:m.current.nameOf(V),onClick:()=>m.current.activate(V)})},[]),d=I.useRef(null),k=I.useRef(new Map),D=I.useRef(new Map),E=I.useCallback(U=>{const V=d.current,Y=bx(c,u.current,v.current,r.current);V===null||Y===null||(V.volume=Y,V.play(U))},[c]);I.useEffect(()=>{const U=new Tx;U.volume=r.current,d.current=U;const V=()=>{U.unlock(),U.ready&&(window.removeEventListener("pointerdown",V),window.removeEventListener("keydown",V))};return window.addEventListener("pointerdown",V),window.addEventListener("keydown",V),()=>{window.removeEventListener("pointerdown",V),window.removeEventListener("keydown",V),d.current=null}},[]),I.useEffect(()=>{const U=vx(k.current,n);k.current=new Map(n);const V=D.current;for(const Y of U.cancel){const X=V.get(Y);X!==void 0&&(window.clearTimeout(X),V.delete(Y))}U.now.length>0&&E("attention");for(const Y of U.now)p("attention",Y);for(const Y of U.later)V.set(Y,window.setTimeout(()=>{V.delete(Y),E("done"),p("done",Y)},gx))},[n,p,E]),I.useEffect(()=>{const U=D.current;return()=>{for(const V of U.values())window.clearTimeout(V);U.clear()}},[]);const M=I.useCallback(()=>{var U,V;h(Y=>{const X=!Y;return ht(cp,X?"on":"off"),X}),v.current||((U=d.current)==null||U.unlock(),(V=d.current)==null||V.play("done"))},[]),b=I.useCallback(U=>{const V=Xi(U);x(V),ht(up,String(V)),d.current!==null&&(d.current.volume=V)},[]),T=I.useCallback(()=>{var U,V;v.current&&((U=d.current)==null||U.unlock(),(V=d.current)==null||V.play("done"))},[]),N=I.useCallback(()=>{if(a.current&&Ui()==="granted"){f(!1),ht($c,"off");return}Ix().then(U=>{S(U),U==="granted"&&(f(!0),ht($c,"on"))})},[]),B={supported:y!=="unsupported",enabled:L&&y==="granted",permission:y,toggle:N},F=I.useCallback(U=>{var V;_(U),u.current=U,ht(lp,U),window.location.href=wx(U),U==="page"&&((V=d.current)==null||V.unlock(),E("done"))},[E]);return{enabled:i,toggle:M,volume:R,setVolume:b,previewVolume:T,notify:B,phoneChime:c?{source:g,setSource:F}:null}}function fg(n,s,i){const[h,v]=I.useState(()=>mt(n,s,nb));I.useLayoutEffect(()=>{document.documentElement.dataset[i]=h},[i,h]);const R=I.useCallback(()=>{v(x=>{const r=Pm(x);return ht(n,r),r})},[n]);return{size:h,cycle:R}}function Bx(){return fg(J1,jm,"threadFont")}function Fx(){return fg(Z1,eb,"notesFont")}function Hx(n,s){const[i,h]=I.useState(()=>new Map),[v,R]=I.useState(()=>new Map),x=I.useCallback((c,g,_,u)=>{h(y=>new Map(y).set(c,{requestId:g,terminalId:c,afterEventId:_,phase:"sending",queued:u,sentAt:Date.now(),deliveredAt:null}))},[]);I.useEffect(()=>{const c=n.onMessage(_=>{_.type==="agent.submitted"&&h(u=>a1(u,_,Date.now()))}),g=n.onReopen(()=>h(_=>o1(_,Date.now())));return()=>{c(),g()}},[n]);const r=I.useRef(new Map);return I.useLayoutEffect(()=>{const c=r.current;if(c===s)return;r.current=s;const g=Date.now();R(_=>i1(c,s,_,g))},[s]),{track:x,receipts:i,clocks:v}}const $x=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function pg({sound:n}){return l.jsxs("span",{className:"sound-control",children:[l.jsx("button",{className:`icon-button${xx(n.enabled,n.volume)?" icon-button-on":""}`,onClick:n.toggle,title:Cx(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:hg,max:Oa,step:.01,value:n.volume,onChange:s=>n.setVolume(Number(s.target.value)),onPointerUp:n.previewVolume,onKeyUp:s=>{$x.has(s.key)&&n.previewVolume()},title:C("sound.volume"),"aria-label":C("sound.volume")}),l.jsxs("span",{className:"sound-volume-value",children:[Lx(n.volume),"%"]})]})})]})}function mg({notify:n}){return n.supported?l.jsx("button",{className:`icon-button${n.enabled?" icon-button-on":""}`,onClick:n.toggle,title:Ax(n.enabled,n.permission),"aria-pressed":n.enabled,children:l.jsx(Ux,{})}):null}function Ux(){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 Wx(n){const[s,i]=I.useState(null),[h,v]=I.useState(null),[R,x]=I.useState(null),[r,c]=I.useState(!1),[g,_]=I.useState(null);I.useEffect(()=>{const k=n.onMessage(E=>{switch(E.type){case"remote.status":i(E.status),E.status.pairingActive||(v(null),x(null));break;case"remote.pairing.code":v(E.pairing),x(null);break;case"remote.phone.pairing":x(E.pairing),v(null);break;case"error":if(E.code!=="remote-failed")break;_(kt(E.text)),E.detail!==void 0&&console.error("[servidor]",E.detail);break}}),D=n.onReopen(()=>{v(null),x(null),c(!1)});return()=>{k(),D()}},[n]);const u=I.useCallback(k=>{_(null),n.send({type:"remote.configure",enabled:k})},[n]),y=I.useCallback(k=>{_(null),n.send({type:"remote.configure",port:k})},[n]),S=I.useCallback(()=>{_(null),n.send({type:"remote.pairing.start"})},[n]),L=I.useCallback(()=>{v(null),n.send({type:"remote.pairing.cancel"})},[n]),f=I.useCallback(()=>{_(null),c(!0),n.send({type:"remote.phone.start"})},[n]),a=I.useCallback(()=>{x(null),c(!1),n.send({type:"remote.phone.cancel"})},[n]),m=I.useCallback((k,D)=>{_(null),n.send({type:"remote.device.rename",deviceId:k,label:D})},[n]),p=I.useCallback(k=>{_(null),n.send({type:"remote.device.revoke",deviceId:k})},[n]),d=I.useCallback(()=>_(null),[]);return{status:s,pairing:h,phonePairing:R,phoneStarted:r,problem:g,setEnabled:u,setPort:y,startPairing:S,cancelPairing:L,startPhonePairing:f,cancelPhonePairing:a,renameDevice:m,revokeDevice:p,dismissProblem:d}}const zx="USER";function Vx(n,s){const i=n.sshUser.length>0?n.sshUser:zx,h=/\s/.test(i)?`"${i}@${s}"`:`${i}@${s}`;return`ssh -N -L ${n.port}:127.0.0.1:${n.port} ${h}`}function gg(n){return`http://localhost:${n}`}function qx(n,s){return`${gg(n)}/?${w0}=${s}`}function hp(n){return n[0]??"localhost"}function hu(n,s){switch(n){case"off":return C("remote.state.off");case"active":return C("remote.state.active",{port:s});case"restart-needed":return C("remote.state.restartNeeded");case"port-busy":return C("remote.state.portBusy",{port:s})}}function Kx(n){const s=n.trim();if(!/^\d{1,5}$/.test(s))return null;const i=Number(s);return S0(i)?i:null}function Gx(){return C("remote.portInvalid",{min:Gp,max:Yp})}function dp(n,s){return Math.max(0,Math.ceil((n-s)/1e3))}function fp(n){return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function Yx(n,s=Date.now()){return n.connected?C("remote.device.connected"):n.lastSeenAt===null?C("remote.device.never"):C("remote.device.lastSeen",{when:Hn(n.lastSeenAt,s)})}function Xx(n,s=Date.now()){return C("remote.device.paired",{when:Hn(n.createdAt,s)})}function Qx(n){switch(n){case"powershell-admin":return C("remote.phone.authorize.admin");case"powershell":return C("remote.phone.authorize.powershell");case"terminal":return C("remote.phone.authorize.terminal")}}function Jx(){return[{platform:"win32",label:"Windows",hint:C("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:C("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:C("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
136
+ `)}]}function Zx(n){return n==="win32"||n==="darwin"?n:"linux"}function ba(n){return n!==null&&n.state==="active"}function pp(n){return n!==null&&n.state==="active"&&n.devices.length>0}const Gr=function(n,s){let v=n;const R=$i[s];let x=null,r=0,c=null;const g=[],_={},u=function(M,b){r=v*4+17,x=(function(T){const N=new Array(T);for(let B=0;B<T;B+=1){N[B]=new Array(T);for(let F=0;F<T;F+=1)N[B][F]=null}return N})(r),y(0,0),y(r-7,0),y(0,r-7),f(),L(),m(M,b),v>=7&&a(M),c==null&&(c=k(v,R,g)),p(c,b)},y=function(M,b){for(let T=-1;T<=7;T+=1)if(!(M+T<=-1||r<=M+T))for(let N=-1;N<=7;N+=1)b+N<=-1||r<=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?x[M+T][b+N]=!0:x[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=Ts.getLostPoint(_);(T==0||M>N)&&(M=N,b=T)}return b},L=function(){for(let M=8;M<r-8;M+=1)x[M][6]==null&&(x[M][6]=M%2==0);for(let M=8;M<r-8;M+=1)x[6][M]==null&&(x[6][M]=M%2==0)},f=function(){const M=Ts.getPatternPosition(v);for(let b=0;b<M.length;b+=1)for(let T=0;T<M.length;T+=1){const N=M[b],B=M[T];if(x[N][B]==null)for(let F=-2;F<=2;F+=1)for(let O=-2;O<=2;O+=1)F==-2||F==2||O==-2||O==2||F==0&&O==0?x[N+F][B+O]=!0:x[N+F][B+O]=!1}},a=function(M){const b=Ts.getBCHTypeNumber(v);for(let T=0;T<18;T+=1){const N=!M&&(b>>T&1)==1;x[Math.floor(T/3)][T%3+r-8-3]=N}for(let T=0;T<18;T+=1){const N=!M&&(b>>T&1)==1;x[T%3+r-8-3][Math.floor(T/3)]=N}},m=function(M,b){const T=R<<3|b,N=Ts.getBCHTypeInfo(T);for(let B=0;B<15;B+=1){const F=!M&&(N>>B&1)==1;B<6?x[B][8]=F:B<8?x[B+1][8]=F:x[r-15+B][8]=F}for(let B=0;B<15;B+=1){const F=!M&&(N>>B&1)==1;B<8?x[8][r-B-1]=F:B<9?x[8][15-B-1+1]=F:x[8][15-B-1]=F}x[r-8][8]=!M},p=function(M,b){let T=-1,N=r-1,B=7,F=0;const O=Ts.getMaskFunction(b);for(let U=r-1;U>0;U-=2)for(U==6&&(U-=1);;){for(let V=0;V<2;V+=1)if(x[N][U-V]==null){let Y=!1;F<M.length&&(Y=(M[F]>>>B&1)==1),O(N,U-V)&&(Y=!Y),x[N][U-V]=Y,B-=1,B==-1&&(F+=1,B=7)}if(N+=T,N<0||r<=N){N-=T,T=-T;break}}},d=function(M,b){let T=0,N=0,B=0;const F=new Array(b.length),O=new Array(b.length);for(let X=0;X<b.length;X+=1){const G=b[X].dataCount,P=b[X].totalCount-G;N=Math.max(N,G),B=Math.max(B,P),F[X]=new Array(G);for(let ne=0;ne<F[X].length;ne+=1)F[X][ne]=255&M.getBuffer()[ne+T];T+=G;const $=Ts.getErrorCorrectPolynomial(P),q=Ki(F[X],$.getLength()-1).mod($);O[X]=new Array($.getLength()-1);for(let ne=0;ne<O[X].length;ne+=1){const re=ne+q.getLength()-O[X].length;O[X][ne]=re>=0?q.getAt(re):0}}let U=0;for(let X=0;X<b.length;X+=1)U+=b[X].totalCount;const V=new Array(U);let Y=0;for(let X=0;X<N;X+=1)for(let G=0;G<b.length;G+=1)X<F[G].length&&(V[Y]=F[G][X],Y+=1);for(let X=0;X<B;X+=1)for(let G=0;G<b.length;G+=1)X<O[G].length&&(V[Y]=O[G][X],Y+=1);return V},k=function(M,b,T){const N=mp.getRSBlocks(M,b),B=gp();for(let O=0;O<T.length;O+=1){const U=T[O];B.put(U.getMode(),4),B.put(U.getLength(),Ts.getLengthInBits(U.getMode(),M)),U.write(B)}let F=0;for(let O=0;O<N.length;O+=1)F+=N[O].dataCount;if(B.getLengthInBits()>F*8)throw"code length overflow. ("+B.getLengthInBits()+">"+F*8+")";for(B.getLengthInBits()+4<=F*8&&B.put(0,4);B.getLengthInBits()%8!=0;)B.putBit(!1);for(;!(B.getLengthInBits()>=F*8||(B.put(236,8),B.getLengthInBits()>=F*8));)B.put(17,8);return d(B,N)};_.addData=function(M,b){b=b||"Byte";let T=null;switch(b){case"Numeric":T=ek(M);break;case"Alphanumeric":T=tk(M);break;case"Byte":T=nk(M);break;case"Kanji":T=sk(M);break;default:throw"mode:"+b}g.push(T),c=null},_.isDark=function(M,b){if(M<0||r<=M||b<0||r<=b)throw M+","+b;return x[M][b]},_.getModuleCount=function(){return r},_.make=function(){if(v<1){let M=1;for(;M<40;M++){const b=mp.getRSBlocks(M,R),T=gp();for(let B=0;B<g.length;B++){const F=g[B];T.put(F.getMode(),4),T.put(F.getLength(),Ts.getLengthInBits(F.getMode(),M)),F.write(T)}let N=0;for(let B=0;B<b.length;B++)N+=b[B].dataCount;if(T.getLengthInBits()<=N*8)break}v=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 B=0;B<_.getModuleCount();B+=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,B)?"#000000":"#ffffff",T+=";",T+='"/>';T+="</tr>"}return T+="</tbody>",T+="</table>",T},_.createSvgTag=function(M,b,T,N){let B={};typeof arguments[0]=="object"&&(B=arguments[0],M=B.cellSize,b=B.margin,T=B.alt,N=B.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 F=_.getModuleCount()*M+b*2;let O,U,V,Y,X="",G;for(G="l"+M+",0 0,"+M+" -"+M+",0 0,-"+M+"z ",X+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',X+=B.scalable?"":' width="'+F+'px" height="'+F+'px"',X+=' viewBox="0 0 '+F+" "+F+'" ',X+=' preserveAspectRatio="xMinYMin meet"',X+=N.text||T.text?' role="img" aria-labelledby="'+D([N.id,T.id].join(" ").trim())+'"':"",X+=">",X+=N.text?'<title id="'+D(N.id)+'">'+D(N.text)+"</title>":"",X+=T.text?'<description id="'+D(T.id)+'">'+D(T.text)+"</description>":"",X+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',X+='<path d="',V=0;V<_.getModuleCount();V+=1)for(Y=V*M+b,O=0;O<_.getModuleCount();O+=1)_.isDark(V,O)&&(U=O*M+b,X+="M"+U+","+Y+G);return X+='" stroke="transparent" fill="black"/>',X+="</svg>",X},_.createDataURL=function(M,b){M=M||2,b=typeof b>"u"?M*4:b;const T=_.getModuleCount()*M+b*2,N=b,B=T-b;return ak(T,T,function(F,O){if(N<=F&&F<B&&N<=O&&O<B){const U=Math.floor((F-N)/M),V=Math.floor((O-N)/M);return _.isDark(V,U)?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 B="";return B+="<img",B+=' src="',B+=_.createDataURL(M,b),B+='"',B+=' width="',B+=N,B+='"',B+=' height="',B+=N,B+='"',T&&(B+=' alt="',B+=D(T),B+='"'),B+="/>",B};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},E=function(M){M=typeof M>"u"?2:M;const T=_.getModuleCount()*1+M*2,N=M,B=T-M;let F,O,U,V,Y;const X={"██":"█","█ ":"▀"," █":"▄"," ":" "},G={"██":"▀","█ ":"▀"," █":" "," ":" "};let P="";for(F=0;F<T;F+=2){for(U=Math.floor((F-N)/1),V=Math.floor((F+1-N)/1),O=0;O<T;O+=1)Y="█",N<=O&&O<B&&N<=F&&F<B&&_.isDark(U,Math.floor((O-N)/1))&&(Y=" "),N<=O&&O<B&&N<=F+1&&F+1<B&&_.isDark(V,Math.floor((O-N)/1))?Y+=" ":Y+="█",P+=M<1&&F+1>=B?G[Y]:X[Y];P+=`
137
+ `}return T%2&&M>0?P.substring(0,P.length-T-1)+Array(T+1).join("▀"):P.substring(0,P.length-1)};return _.createASCII=function(M,b){if(M=M||1,M<2)return E(b);M-=1,b=typeof b>"u"?M*2:b;const T=_.getModuleCount()*M+b*2,N=b,B=T-b;let F,O,U,V;const Y=Array(M+1).join("██"),X=Array(M+1).join(" ");let G="",P="";for(F=0;F<T;F+=1){for(U=Math.floor((F-N)/M),P="",O=0;O<T;O+=1)V=1,N<=O&&O<B&&N<=F&&F<B&&_.isDark(U,Math.floor((O-N)/M))&&(V=0),P+=V?Y:X;for(U=0;U<M;U+=1)G+=P+`
138
+ `}return G.substring(0,G.length-1)},_.renderTo2dContext=function(M,b){b=b||2;const T=_.getModuleCount();for(let N=0;N<T;N++)for(let B=0;B<T;B++)M.fillStyle=_.isDark(N,B)?"black":"white",M.fillRect(B*b,N*b,b,b)},_};Gr.stringToBytes=function(n){const s=[];for(let i=0;i<n.length;i+=1){const h=n.charCodeAt(i);s.push(h&255)}return s};Gr.createStringToBytes=function(n,s){const i=(function(){const v=ik(n),R=function(){const c=v.read();if(c==-1)throw"eof";return c};let x=0;const r={};for(;;){const c=v.read();if(c==-1)break;const g=R(),_=R(),u=R(),y=String.fromCharCode(c<<8|g),S=_<<8|u;r[y]=S,x+=1}if(x!=s)throw x+" != "+s;return r})(),h=63;return function(v){const R=[];for(let x=0;x<v.length;x+=1){const r=v.charCodeAt(x);if(r<128)R.push(r);else{const c=i[v.charAt(x)];typeof c=="number"?(c&255)==c?R.push(c):(R.push(c>>>8),R.push(c&255)):R.push(h)}}return R}};const Vt={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},$i={L:1,M:0,Q:3,H:2},Ls={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Ts=(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]],s=1335,i=7973,h=21522,v={},R=function(x){let r=0;for(;x!=0;)r+=1,x>>>=1;return r};return v.getBCHTypeInfo=function(x){let r=x<<10;for(;R(r)-R(s)>=0;)r^=s<<R(r)-R(s);return(x<<10|r)^h},v.getBCHTypeNumber=function(x){let r=x<<12;for(;R(r)-R(i)>=0;)r^=i<<R(r)-R(i);return x<<12|r},v.getPatternPosition=function(x){return n[x-1]},v.getMaskFunction=function(x){switch(x){case Ls.PATTERN000:return function(r,c){return(r+c)%2==0};case Ls.PATTERN001:return function(r,c){return r%2==0};case Ls.PATTERN010:return function(r,c){return c%3==0};case Ls.PATTERN011:return function(r,c){return(r+c)%3==0};case Ls.PATTERN100:return function(r,c){return(Math.floor(r/2)+Math.floor(c/3))%2==0};case Ls.PATTERN101:return function(r,c){return r*c%2+r*c%3==0};case Ls.PATTERN110:return function(r,c){return(r*c%2+r*c%3)%2==0};case Ls.PATTERN111:return function(r,c){return(r*c%3+(r+c)%2)%2==0};default:throw"bad maskPattern:"+x}},v.getErrorCorrectPolynomial=function(x){let r=Ki([1],0);for(let c=0;c<x;c+=1)r=r.multiply(Ki([1,Rs.gexp(c)],0));return r},v.getLengthInBits=function(x,r){if(1<=r&&r<10)switch(x){case Vt.MODE_NUMBER:return 10;case Vt.MODE_ALPHA_NUM:return 9;case Vt.MODE_8BIT_BYTE:return 8;case Vt.MODE_KANJI:return 8;default:throw"mode:"+x}else if(r<27)switch(x){case Vt.MODE_NUMBER:return 12;case Vt.MODE_ALPHA_NUM:return 11;case Vt.MODE_8BIT_BYTE:return 16;case Vt.MODE_KANJI:return 10;default:throw"mode:"+x}else if(r<41)switch(x){case Vt.MODE_NUMBER:return 14;case Vt.MODE_ALPHA_NUM:return 13;case Vt.MODE_8BIT_BYTE:return 16;case Vt.MODE_KANJI:return 12;default:throw"mode:"+x}else throw"type:"+r},v.getLostPoint=function(x){const r=x.getModuleCount();let c=0;for(let u=0;u<r;u+=1)for(let y=0;y<r;y+=1){let S=0;const L=x.isDark(u,y);for(let f=-1;f<=1;f+=1)if(!(u+f<0||r<=u+f))for(let a=-1;a<=1;a+=1)y+a<0||r<=y+a||f==0&&a==0||L==x.isDark(u+f,y+a)&&(S+=1);S>5&&(c+=3+S-5)}for(let u=0;u<r-1;u+=1)for(let y=0;y<r-1;y+=1){let S=0;x.isDark(u,y)&&(S+=1),x.isDark(u+1,y)&&(S+=1),x.isDark(u,y+1)&&(S+=1),x.isDark(u+1,y+1)&&(S+=1),(S==0||S==4)&&(c+=3)}for(let u=0;u<r;u+=1)for(let y=0;y<r-6;y+=1)x.isDark(u,y)&&!x.isDark(u,y+1)&&x.isDark(u,y+2)&&x.isDark(u,y+3)&&x.isDark(u,y+4)&&!x.isDark(u,y+5)&&x.isDark(u,y+6)&&(c+=40);for(let u=0;u<r;u+=1)for(let y=0;y<r-6;y+=1)x.isDark(y,u)&&!x.isDark(y+1,u)&&x.isDark(y+2,u)&&x.isDark(y+3,u)&&x.isDark(y+4,u)&&!x.isDark(y+5,u)&&x.isDark(y+6,u)&&(c+=40);let g=0;for(let u=0;u<r;u+=1)for(let y=0;y<r;y+=1)x.isDark(y,u)&&(g+=1);const _=Math.abs(100*g/r/r-50)/5;return c+=_*10,c},v})(),Rs=(function(){const n=new Array(256),s=new Array(256);for(let h=0;h<8;h+=1)n[h]=1<<h;for(let h=8;h<256;h+=1)n[h]=n[h-4]^n[h-5]^n[h-6]^n[h-8];for(let h=0;h<255;h+=1)s[n[h]]=h;const i={};return i.glog=function(h){if(h<1)throw"glog("+h+")";return s[h]},i.gexp=function(h){for(;h<0;)h+=255;for(;h>=256;)h-=255;return n[h]},i})(),Ki=function(n,s){if(typeof n.length>"u")throw n.length+"/"+s;const i=(function(){let v=0;for(;v<n.length&&n[v]==0;)v+=1;const R=new Array(n.length-v+s);for(let x=0;x<n.length-v;x+=1)R[x]=n[x+v];return R})(),h={};return h.getAt=function(v){return i[v]},h.getLength=function(){return i.length},h.multiply=function(v){const R=new Array(h.getLength()+v.getLength()-1);for(let x=0;x<h.getLength();x+=1)for(let r=0;r<v.getLength();r+=1)R[x+r]^=Rs.gexp(Rs.glog(h.getAt(x))+Rs.glog(v.getAt(r)));return Ki(R,0)},h.mod=function(v){if(h.getLength()-v.getLength()<0)return h;const R=Rs.glog(h.getAt(0))-Rs.glog(v.getAt(0)),x=new Array(h.getLength());for(let r=0;r<h.getLength();r+=1)x[r]=h.getAt(r);for(let r=0;r<v.getLength();r+=1)x[r]^=Rs.gexp(Rs.glog(v.getAt(r))+R);return Ki(x,0).mod(v)},h},mp=(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]],s=function(v,R){const x={};return x.totalCount=v,x.dataCount=R,x},i={},h=function(v,R){switch(R){case $i.L:return n[(v-1)*4+0];case $i.M:return n[(v-1)*4+1];case $i.Q:return n[(v-1)*4+2];case $i.H:return n[(v-1)*4+3];default:return}};return i.getRSBlocks=function(v,R){const x=h(v,R);if(typeof x>"u")throw"bad rs block @ typeNumber:"+v+"/errorCorrectionLevel:"+R;const r=x.length/3,c=[];for(let g=0;g<r;g+=1){const _=x[g*3+0],u=x[g*3+1],y=x[g*3+2];for(let S=0;S<_;S+=1)c.push(s(u,y))}return c},i})(),gp=function(){const n=[];let s=0;const i={};return i.getBuffer=function(){return n},i.getAt=function(h){const v=Math.floor(h/8);return(n[v]>>>7-h%8&1)==1},i.put=function(h,v){for(let R=0;R<v;R+=1)i.putBit((h>>>v-R-1&1)==1)},i.getLengthInBits=function(){return s},i.putBit=function(h){const v=Math.floor(s/8);n.length<=v&&n.push(0),h&&(n[v]|=128>>>s%8),s+=1},i},ek=function(n){const s=Vt.MODE_NUMBER,i=n,h={};h.getMode=function(){return s},h.getLength=function(x){return i.length},h.write=function(x){const r=i;let c=0;for(;c+2<r.length;)x.put(v(r.substring(c,c+3)),10),c+=3;c<r.length&&(r.length-c==1?x.put(v(r.substring(c,c+1)),4):r.length-c==2&&x.put(v(r.substring(c,c+2)),7))};const v=function(x){let r=0;for(let c=0;c<x.length;c+=1)r=r*10+R(x.charAt(c));return r},R=function(x){if("0"<=x&&x<="9")return x.charCodeAt(0)-48;throw"illegal char :"+x};return h},tk=function(n){const s=Vt.MODE_ALPHA_NUM,i=n,h={};h.getMode=function(){return s},h.getLength=function(R){return i.length},h.write=function(R){const x=i;let r=0;for(;r+1<x.length;)R.put(v(x.charAt(r))*45+v(x.charAt(r+1)),11),r+=2;r<x.length&&R.put(v(x.charAt(r)),6)};const v=function(R){if("0"<=R&&R<="9")return R.charCodeAt(0)-48;if("A"<=R&&R<="Z")return R.charCodeAt(0)-65+10;switch(R){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 :"+R}};return h},nk=function(n){const s=Vt.MODE_8BIT_BYTE,i=Gr.stringToBytes(n),h={};return h.getMode=function(){return s},h.getLength=function(v){return i.length},h.write=function(v){for(let R=0;R<i.length;R+=1)v.put(i[R],8)},h},sk=function(n){const s=Vt.MODE_KANJI,i=Gr.stringToBytes;(function(R,x){const r=i(R);if(r.length!=2||(r[0]<<8|r[1])!=x)throw"sjis not supported."})("友",38726);const h=i(n),v={};return v.getMode=function(){return s},v.getLength=function(R){return~~(h.length/2)},v.write=function(R){const x=h;let r=0;for(;r+1<x.length;){let c=(255&x[r])<<8|255&x[r+1];if(33088<=c&&c<=40956)c-=33088;else if(57408<=c&&c<=60351)c-=49472;else throw"illegal char at "+(r+1)+"/"+c;c=(c>>>8&255)*192+(c&255),R.put(c,13),r+=2}if(r<x.length)throw"illegal char at "+(r+1)},v},_g=function(){const n=[],s={};return s.writeByte=function(i){n.push(i&255)},s.writeShort=function(i){s.writeByte(i),s.writeByte(i>>>8)},s.writeBytes=function(i,h,v){h=h||0,v=v||i.length;for(let R=0;R<v;R+=1)s.writeByte(i[R+h])},s.writeString=function(i){for(let h=0;h<i.length;h+=1)s.writeByte(i.charCodeAt(h))},s.toByteArray=function(){return n},s.toString=function(){let i="";i+="[";for(let h=0;h<n.length;h+=1)h>0&&(i+=","),i+=n[h];return i+="]",i},s},rk=function(){let n=0,s=0,i=0,h="";const v={},R=function(r){h+=String.fromCharCode(x(r&63))},x=function(r){if(r<0)throw"n:"+r;if(r<26)return 65+r;if(r<52)return 97+(r-26);if(r<62)return 48+(r-52);if(r==62)return 43;if(r==63)return 47;throw"n:"+r};return v.writeByte=function(r){for(n=n<<8|r&255,s+=8,i+=1;s>=6;)R(n>>>s-6),s-=6},v.flush=function(){if(s>0&&(R(n<<6-s),n=0,s=0),i%3!=0){const r=3-i%3;for(let c=0;c<r;c+=1)h+="="}},v.toString=function(){return h},v},ik=function(n){const s=n;let i=0,h=0,v=0;const R={};R.read=function(){for(;v<8;){if(i>=s.length){if(v==0)return-1;throw"unexpected end of file./"+v}const c=s.charAt(i);if(i+=1,c=="=")return v=0,-1;if(c.match(/^\s$/))continue;h=h<<6|x(c.charCodeAt(0)),v+=6}const r=h>>>v-8&255;return v-=8,r};const x=function(r){if(65<=r&&r<=90)return r-65;if(97<=r&&r<=122)return r-97+26;if(48<=r&&r<=57)return r-48+52;if(r==43)return 62;if(r==47)return 63;throw"c:"+r};return R},ok=function(n,s){const i=n,h=s,v=new Array(n*s),R={};R.setPixel=function(g,_,u){v[_*i+g]=u},R.write=function(g){g.writeString("GIF87a"),g.writeShort(i),g.writeShort(h),g.writeByte(128),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(255),g.writeByte(255),g.writeByte(255),g.writeString(","),g.writeShort(0),g.writeShort(0),g.writeShort(i),g.writeShort(h),g.writeByte(0);const _=2,u=r(_);g.writeByte(_);let y=0;for(;u.length-y>255;)g.writeByte(255),g.writeBytes(u,y,255),y+=255;g.writeByte(u.length-y),g.writeBytes(u,y,u.length-y),g.writeByte(0),g.writeString(";")};const x=function(g){const _=g;let u=0,y=0;const S={};return S.write=function(L,f){if(L>>>f)throw"length over";for(;u+f>=8;)_.writeByte(255&(L<<u|y)),f-=8-u,L>>>=8-u,y=0,u=0;y=L<<u|y,u=u+f},S.flush=function(){u>0&&_.writeByte(y)},S},r=function(g){const _=1<<g,u=(1<<g)+1;let y=g+1;const S=c();for(let p=0;p<_;p+=1)S.add(String.fromCharCode(p));S.add(String.fromCharCode(_)),S.add(String.fromCharCode(u));const L=_g(),f=x(L);f.write(_,y);let a=0,m=String.fromCharCode(v[a]);for(a+=1;a<v.length;){const p=String.fromCharCode(v[a]);a+=1,S.contains(m+p)?m=m+p:(f.write(S.indexOf(m),y),S.size()<4095&&(S.size()==1<<y&&(y+=1),S.add(m+p)),m=p)}return f.write(S.indexOf(m),y),f.write(u,y),f.flush(),L.toByteArray()},c=function(){const g={};let _=0;const u={};return u.add=function(y){if(u.contains(y))throw"dup key:"+y;g[y]=_,_+=1},u.size=function(){return _},u.indexOf=function(y){return g[y]},u.contains=function(y){return typeof g[y]<"u"},u};return R},ak=function(n,s,i){const h=ok(n,s);for(let r=0;r<s;r+=1)for(let c=0;c<n;c+=1)h.setPixel(c,r,i(c,r));const v=_g();h.write(v);const R=rk(),x=v.toByteArray();for(let r=0;r<x.length;r+=1)R.writeByte(x[r]);return R.flush(),"data:image/gif;base64,"+R};Gr.stringToBytes;const Fi=4;function lk(n){const s=Gr(0,"M");s.addData(n,"Byte"),s.make();const i=s.getModuleCount();let h="";for(let v=0;v<i;v++){let R=0;for(;R<i;){if(!s.isDark(v,R)){R++;continue}const x=R;for(;R<i&&s.isDark(v,R);)R++;h+=`M${x} ${v}h${R-x}v1h-${R-x}z`}}return{size:i,path:h}}const ck=1e3,uk=4e3;function hk({status:n,pairing:s,phonePairing:i,phoneStarted:h,problem:v,platform:R,onSetEnabled:x,onSetPort:r,onStartPairing:c,onCancelPairing:g,onStartPhonePairing:_,onCancelPhonePairing:u,onRenameDevice:y,onRevokeDevice:S,onDismissProblem:L,onClose:f}){const[a,m]=I.useState(()=>hp(n.hostNames)),[p,d]=I.useState(String(n.port)),[k,D]=I.useState(null),E=I.useRef(null),[M,b]=I.useState(()=>Date.now()),T=()=>{s!==null&&g(),h&&u(),f()},N=I.useRef(T);N.current=T,I.useEffect(()=>{const P=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),N.current())};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[]),I.useEffect(()=>{if(s===null&&i===null)return;b(Date.now());const P=window.setInterval(()=>b(Date.now()),1e3);return()=>window.clearInterval(P)},[s,i]),I.useEffect(()=>()=>{E.current!==null&&window.clearTimeout(E.current)},[]);const B=I.useRef(null),F=i!==null;I.useEffect(()=>{var $;if(!F)return;const P=window.matchMedia("(prefers-reduced-motion: reduce)").matches;($=B.current)==null||$.scrollIntoView({block:"center",behavior:P?"auto":"smooth"})},[F]),I.useEffect(()=>{d(String(n.port))},[n.port]),I.useEffect(()=>{n.hostNames.includes(a)||m(hp(n.hostNames))},[n.hostNames,a]);const O=(P,$)=>{navigator.clipboard.writeText($).then(()=>{D(P),E.current!==null&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>D(null),ck)}).catch(()=>D(null))},U=Kx(p),V=U!==null&&U!==n.port,Y=Vx(n,a),X=C("remote.title"),G=s===null?null:qx(n.port,s.code);return l.jsx("div",{className:"modal-backdrop",onClick:T,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":X,onClick:P=>P.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:X}),l.jsx("button",{className:"icon-button",onClick:T,title:C("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:hu(n.state,n.port)}),l.jsx("p",{className:"modal-hint",children:C("remote.intro")}),l.jsx("div",{className:"vault-actions",children:n.enabled?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"link-button",onClick:()=>x(!1),children:C("remote.turnOff")}),l.jsx("span",{className:"modal-hint",children:C("remote.turnOffHint")})]}):l.jsx("button",{className:"primary-button",onClick:()=>x(!0),children:C("remote.turnOn")})}),l.jsxs("div",{className:"remote-port",children:[l.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:C("remote.port")}),l.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:p,onChange:P=>d(P.target.value),onKeyDown:P=>{P.key==="Enter"&&V&&U!==null&&r(U)}}),l.jsx("button",{className:"link-button",onClick:()=>U!==null&&r(U),disabled:!V,children:C("remote.portSave")}),U===null&&l.jsx("span",{className:"modal-hint remote-port-invalid",children:Gx()})]}),l.jsx("p",{className:"modal-hint",children:C("remote.restartHint")}),v!==null&&l.jsxs("div",{className:"vault-problem",role:"alert",children:[l.jsx("span",{children:v}),l.jsx("button",{className:"icon-button",onClick:L,title:C("common.close"),children:"×"})]}),l.jsx("h3",{className:"modal-section",children:C("remote.step.host")}),l.jsx("p",{className:"modal-hint",children:C("remote.step.hostHint")}),Jx().map(P=>l.jsxs("details",{className:"remote-os",open:P.platform===Zx(R),children:[l.jsx("summary",{className:"remote-os-summary",children:P.label}),l.jsx("p",{className:"modal-hint",children:P.hint}),P.command!==null&&l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:P.command}),l.jsx("button",{className:"link-button",onClick:()=>O("ssh",P.command??""),children:k==="ssh"?l.jsxs(l.Fragment,{children:["✓ ",C("remote.copied")]}):C("remote.copy")})]})]},P.platform)),l.jsx("h3",{className:"modal-section",children:C("remote.step.tunnel")}),l.jsx("p",{className:"modal-hint",children:C("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:C("remote.address")}),l.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:a,onChange:P=>m(P.target.value),children:n.hostNames.map(P=>l.jsx("option",{value:P,children:P},P))})]}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:Y}),l.jsx("button",{className:"link-button",onClick:()=>O("command",Y),children:k==="command"?l.jsxs(l.Fragment,{children:["✓ ",C("remote.copied")]}):C("remote.copy")})]}),l.jsxs("details",{className:"remote-os",children:[l.jsx("summary",{className:"remote-os-summary",children:C("remote.trouble")}),l.jsxs("ul",{className:"remote-trouble",children:[l.jsx("li",{className:"modal-hint",children:C("remote.trouble.network")}),l.jsx("li",{className:"modal-hint",children:C("remote.vpnHint")}),n.sshUser.length>0&&l.jsx("li",{className:"modal-hint",children:C("remote.userHint",{user:n.sshUser})})]})]}),l.jsx("h3",{className:"modal-section",children:C("remote.step.pair")}),s===null||G===null?l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"primary-button",onClick:c,disabled:!ba(n),children:C("remote.pair.start")}),!ba(n)&&l.jsx("span",{className:"modal-hint",children:C("remote.pair.needsActive")})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:C("remote.pair.open")}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:G}),l.jsx("button",{className:"link-button",onClick:()=>O("pairing",G),children:k==="pairing"?l.jsxs(l.Fragment,{children:["✓ ",C("remote.copied")]}):C("remote.copy")})]}),l.jsxs("p",{className:"modal-hint",children:[C("remote.pair.expires",{time:fp(dp(s.expiresAt,M))})," ",C("remote.pair.after",{url:gg(n.port)})]}),l.jsx("div",{className:"vault-actions",children:l.jsx("button",{className:"link-button",onClick:g,children:C("remote.pair.cancel")})})]}),l.jsx("h3",{className:"modal-section",children:C("remote.phone.title")}),i===null?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:C("remote.phone.hint")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"primary-button",onClick:_,disabled:!ba(n),children:C("remote.phone.start")}),!ba(n)&&l.jsx("span",{className:"modal-hint",children:C("remote.pair.needsActive")})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:Qx(i.shell)}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre remote-phone-command",children:i.authorizeCommand}),l.jsx("button",{className:"link-button",onClick:()=>O("phone",i.authorizeCommand),children:k==="phone"?l.jsxs(l.Fragment,{children:["✓ ",C("remote.copied")]}):C("remote.copy")})]}),l.jsx("p",{className:"modal-hint",children:C("remote.phone.authorizeOnce")}),l.jsx("p",{className:"modal-hint",children:C("remote.phone.scan")}),l.jsx("div",{ref:B,children:l.jsx(dk,{payload:i.payload})}),l.jsx("p",{className:"modal-hint",children:C("remote.phone.secret")}),l.jsx("p",{className:"modal-hint",children:C("remote.pair.expires",{time:fp(dp(i.expiresAt,M))})}),l.jsx("div",{className:"vault-actions",children:l.jsx("button",{className:"link-button",onClick:u,children:C("remote.pair.cancel")})})]}),l.jsx("h3",{className:"modal-section",children:C("remote.devices")}),n.devices.length===0?l.jsx("p",{className:"modal-hint",children:C("remote.devices.empty")}):l.jsx("ul",{className:"remote-devices",children:n.devices.map(P=>l.jsx(fk,{device:P,onRename:$=>y(P.id,$),onRevoke:()=>S(P.id)},P.id))})]})]})})}function dk({payload:n}){const s=lk(n),i=s.size+Fi*2;return l.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-Fi} ${-Fi} ${i} ${i}`,role:"img","aria-label":C("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[l.jsx("rect",{x:-Fi,y:-Fi,width:i,height:i,fill:"#fff"}),l.jsx("path",{d:s.path,fill:"#000"})]})}function fk({device:n,onRename:s,onRevoke:i}){const[h,v]=I.useState(!1),[R,x]=I.useState(n.label),[r,c]=I.useState(!1),g=I.useRef(null);I.useEffect(()=>()=>{g.current!==null&&window.clearTimeout(g.current)},[]);const _=()=>{v(!1);const y=R.trim();y.length>0&&y!==n.label&&s(y)},u=()=>{if(r){i();return}c(!0),g.current=window.setTimeout(()=>c(!1),uk)};return l.jsxs("li",{className:"remote-device",children:[l.jsxs("div",{className:"remote-device-main",children:[h?l.jsx("input",{className:"remote-device-input",value:R,autoFocus:!0,onChange:y=>x(y.target.value),onBlur:_,onKeyDown:y=>{y.key==="Enter"&&_()}}):l.jsx("button",{className:"remote-device-label",onClick:()=>{x(n.label),v(!0)},title:C("remote.device.rename"),children:n.label}),l.jsx("span",{className:`remote-device-seen${n.connected?" remote-device-connected":""}`,children:Yx(n)}),l.jsx("span",{className:"remote-device-paired",children:Xx(n)})]}),l.jsx("button",{className:`link-button${r?" remote-device-confirm":""}`,onClick:u,children:C(r?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const Uc="agent-workbench.notes-open",_p="agent-workbench.notes-active",vp="agent-workbench.notes-height",Wc=160,pk=300;function mk(n){return n.text.trim().length===0?n.images.length>0?C("notes.imageOnly"):C("notes.untitled"):l0(n)}function gk({notes:n,onSendNote:s,sendTargetCwd:i,fill:h,onHide:v}){const[R,x]=I.useState(()=>mt(Uc,!1,V=>V==="true")),r=R||h,[c,g]=I.useState(()=>mt(vp,pk,V=>{const Y=Number.parseInt(V,10);return Number.isFinite(Y)?Math.max(Y,Wc):null})),[_,u]=I.useState(()=>mt(_p,null,V=>V)),[y,S]=I.useState(null),[L,f]=I.useState(null),[a,m]=I.useState(0),p=Fx(),d=I.useMemo(()=>n.notes.length===0?null:n.notes.find(V=>V.noteId===_)??n.notes[n.notes.length-1]??null,[n.notes,_]),k=I.useCallback(V=>{u(V),ht(_p,V),S(null)},[]),D=I.useCallback(()=>{x(V=>{const Y=!V;return ht(Uc,String(Y)),Y})},[]),E=I.useCallback(()=>{const V=n.create();k(V),r||(x(!0),ht(Uc,"true")),m(Y=>Y+1)},[n,r,k]),M=I.useCallback(V=>{if(V.text.trim().length===0&&V.images.length===0){n.remove(V.noteId);return}k(V.noteId),S(V.noteId)},[n,k]),b=I.useCallback(()=>{y!==null&&n.remove(y),S(null)},[y,n]),T=I.useRef(null),N=I.useCallback(V=>{const Y=V.currentTarget.parentElement,X=Y===null?c:Math.round(Y.getBoundingClientRect().height);T.current={startY:V.clientY,startHeight:X},V.currentTarget.setPointerCapture(V.pointerId),V.preventDefault()},[c]),B=I.useCallback(V=>{const Y=T.current;if(Y===null)return;const X=Math.max(Wc,Math.floor(window.innerHeight*.8));g(Math.min(X,Math.max(Wc,Y.startHeight+Y.startY-V.clientY)))},[]),F=I.useCallback(V=>{T.current!==null&&(T.current=null,V.currentTarget.releasePointerCapture(V.pointerId),ht(vp,String(c)))},[c]);I.useEffect(()=>{if(L===null)return;const V=Y=>{Y.key==="Escape"&&(Y.stopPropagation(),f(null))};return window.addEventListener("keydown",V,!0),()=>window.removeEventListener("keydown",V,!0)},[L]);const O=L===null?void 0:n.images[L],U=n.notes.length;return l.jsxs("section",{className:`notes${r?" notes-open":""}${h?" notes-fill":""}`,style:r&&!h?{height:`${c}px`}:void 0,children:[r&&!h&&l.jsx("div",{className:"notes-resize",onPointerDown:N,onPointerMove:B,onPointerUp:F,onPointerCancel:F,title:C("notes.resize")}),r?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"notes-header",children:[l.jsxs("div",{className:"strip-tabs",role:"tablist",children:[n.notes.map(V=>{const Y=V.noteId===(d==null?void 0:d.noteId),X=mk(V);return l.jsxs("div",{className:`strip-tab${Y?" is-active":""}`,role:"tab","aria-selected":Y,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>k(V.noteId),title:X,children:X}),l.jsx("button",{className:"strip-tab-close",onClick:()=>M(V),title:C("notes.closeNote"),children:"×"})]},V.noteId)}),l.jsx("button",{className:"strip-tab-new",onClick:E,title:C("notes.new"),children:"+"})]}),l.jsx("span",{className:"strip-spacer"}),l.jsx("button",{className:"icon-button thread-font-button",onClick:p.cycle,title:Ra(p.size),"aria-label":Ra(p.size),children:l.jsxs("span",{"aria-hidden":"true",children:["a",l.jsx("span",{className:"thread-font-big",children:"A"})]})}),!h&&l.jsx("button",{className:"icon-button",onClick:D,title:C("notes.collapse"),children:"▾"}),v!==void 0&&l.jsx(Ta,{title:C("settings.hide.notes"),onHide:v,confirmText:null})]}),l.jsx("div",{className:"notes-body",children:U===0||d===null?l.jsx("p",{className:"notes-empty",children:Ft("notes.empty")}):l.jsx(yk,{note:d,notes:n,closing:y===d.noteId,focusRequest:a,onConfirmClose:b,onCancelClose:()=>S(null),onOpenImage:f,onSend:s===null?null:()=>s(d.noteId),sendTargetCwd:i},d.noteId)})]}):l.jsxs("div",{className:"strip-collapsed-row",children:[l.jsxs("button",{className:"strip-collapsed",onClick:D,title:C("notes.expand"),children:[l.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),l.jsx("span",{children:C("notes.name")}),U>0&&l.jsx("span",{className:"strip-collapsed-count",children:U})]}),v!==void 0&&l.jsx(Ta,{title:C("settings.hide.notes"),onHide:v,confirmText:null})]}),L!==null&&l.jsx("div",{className:"notes-lightbox",onClick:()=>f(null),title:C("notes.lightboxClose"),children:typeof O=="string"?l.jsx("img",{src:O,alt:C("notes.imageAlt")}):l.jsx("span",{className:"notes-lightbox-missing",children:C("notes.imageUnavailable")})})]})}function _k(){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 vk(){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 yk({note:n,notes:s,closing:i,focusRequest:h,onConfirmClose:v,onCancelClose:R,onOpenImage:x,onSend:r,sendTargetCwd:c}){const g=I.useRef(null),[_,u]=I.useState(!1),y=n.text.trim().length===0&&n.images.length===0;I.useEffect(()=>{var f;h>0&&((f=g.current)==null||f.focus())},[h]);const S=I.useCallback(f=>{const a=Array.from(f).filter(m=>m.type.startsWith("image/"));for(const m of a)s.addImage(n.noteId,m);return a.length>0},[s,n.noteId]),L=I.useCallback(f=>{f.clipboardData!==null&&S(f.clipboardData.files)&&f.preventDefault()},[S]);return l.jsxs("div",{className:`note-editor${_?" note-editor-dragging":""}`,onDragOver:f=>{Array.from(f.dataTransfer.types).includes("Files")&&(f.preventDefault(),u(!0))},onDragLeave:()=>u(!1),onDrop:f=>{f.preventDefault(),u(!1),S(f.dataTransfer.files)},children:[i&&l.jsxs("div",{className:"note-closing",children:[l.jsx("span",{children:C("notes.closeConfirm")}),l.jsx("button",{className:"link-button link-danger",onClick:v,children:C("common.close")}),l.jsx("button",{className:"link-button",onClick:R,children:C("common.cancel")})]}),s.problem!==null&&l.jsxs("div",{className:"composer-problem",children:[l.jsx("span",{children:s.problem}),l.jsx("button",{className:"icon-button",onClick:s.dismissProblem,title:C("common.close"),children:"×"})]}),l.jsx("textarea",{ref:g,className:"note-input",value:n.text,placeholder:C("notes.placeholder"),onChange:f=>s.updateText(n.noteId,f.target.value),onPaste:L,spellCheck:!1}),n.images.length>0&&l.jsx("div",{className:"note-images",children:n.images.map(f=>l.jsx(wk,{image:f,src:s.images[f.imageId],onRequest:s.requestImage,onOpen:()=>x(f.imageId),onRemove:()=>s.removeImage(n.noteId,f.imageId)},f.imageId))}),l.jsxs("div",{className:"note-footer",children:[l.jsx("span",{className:"note-meta",children:Hn(n.updatedAt)}),l.jsx("span",{className:"composer-spacer"}),l.jsx("button",{className:"icon-button",onClick:()=>r==null?void 0:r(),disabled:r===null||y,title:Iy(r!==null,c,y),children:l.jsx(vk,{})}),l.jsxs("label",{className:"icon-button note-attach",title:C("notes.attach"),children:[l.jsx(_k,{}),l.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:f=>{f.target.files!==null&&S(f.target.files),f.target.value=""}})]})]})]})}function wk({image:n,src:s,onRequest:i,onOpen:h,onRemove:v}){return I.useEffect(()=>{s===void 0&&i(n.imageId)},[s,n.imageId,i]),l.jsxs("figure",{className:"chip chip-image note-thumb",title:rn(n.bytes),children:[typeof s=="string"?l.jsx("img",{src:s,alt:C("notes.imageAlt"),onClick:h}):l.jsx("span",{className:"note-thumb-placeholder",children:s===null?C("notes.thumbMissing"):"…"}),l.jsx("button",{className:"chip-remove",onClick:v,title:C("notes.removeImage"),children:"×"})]})}function vg(){const n=Yi(),s=pb(),[i,h]=I.useState(null),v=I.useCallback(()=>h(null),[]),R=I.useRef(null),x=g=>{hb(g).catch(()=>{})},r=[{label:C("header.locale.auto",{name:xc[cb()]}),checked:s==="auto",onSelect:()=>x("auto")},...gu.map(g=>({label:xc[g],lang:g,checked:s===g,onSelect:()=>x(g)}))],c=xc[n];return l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:R,className:"icon-button locale-button",onClick:g=>{const _=g.currentTarget.getBoundingClientRect();h(u=>u===null?{x:_.left,y:_.bottom+4}:null)},title:s==="auto"?C("header.locale.titleAuto",{name:c}):C("header.locale.title",{name:c}),"aria-haspopup":"menu","aria-expanded":i!==null,children:Q0[n]}),i!==null&&l.jsx(ou,{x:i.x,y:i.y,items:r,onClose:v,anchor:R.current})]})}function bk({onKey:n}){return l.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":C("narrow.keys.label"),children:Vw.map(s=>l.jsx("button",{className:"narrow-key",onPointerDown:i=>i.preventDefault(),onClick:()=>n(s.data),title:C(s.titleKey),children:s.label},s.id))})}function Sk({banners:n,status:s,statusLabel:i,terminals:h,activeTerminalId:v,activity:R,agents:x,offerAgentChoice:r,newTabAgent:c,canOpen:g,newTabBlockedTitle:_,onSelectTab:u,onCloseTab:y,onRenameTab:S,onNewTab:L,drawer:f,drawerOpen:a,onDrawerChange:m,menu:p,view:d,views:k,onViewChange:D,badges:E,chat:M,panel:b,notes:T,console:N,onTerminalKey:B}){const[F,O]=I.useState(null),U=h.find(P=>P.terminalId===v)??null,V=P=>{var $;return(($=x.find(H=>H.id===P.agent))==null?void 0:$.statusLine)??null};I.useEffect(()=>{if(!a&&F===null)return;const P=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),F!==null?O(null):m(!1))};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[a,F,m]);const Y=I.useRef({sheet:F,drawerOpen:a,view:d,onDrawerChange:m,onViewChange:D});Y.current={sheet:F,drawerOpen:a,view:d,onDrawerChange:m,onViewChange:D},I.useEffect(()=>{const P=window;return P[vf]=()=>{const $=Y.current;switch(Xw({dialogOpen:document.querySelector(".modal-backdrop")!==null,sheetOpen:$.sheet!==null,drawerOpen:$.drawerOpen,view:$.view})){case"close-dialog":return window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),!0;case"close-sheet":return O(null),!0;case"close-drawer":return $.onDrawerChange(!1),!0;case"show-chat":return $.onViewChange("chat"),!0;case null:return!1}},()=>{delete P[vf]}},[]);const X=I.useRef(null);I.useEffect(()=>{var P;(P=X.current)==null||P.scrollIntoView({block:"nearest",inline:"nearest"})},[d]);const G=P=>{const $=P==="git"?E.changes:P==="plans"?E.plans:P==="memory"?E.memory:0;return $>0?l.jsx("span",{className:"side-panel-badge",children:$}):P==="cli"&&E.cliUnseen&&d!=="cli"?l.jsx("span",{className:"narrow-view-dot",title:C("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:()=>m(!0),title:C("narrow.projects"),"aria-label":C("narrow.projects"),children:"☰"}),l.jsxs("button",{className:"narrow-current",onClick:()=>O("tabs"),title:C("narrow.tabs.open"),children:[U===null?l.jsx("span",{className:"app-name",children:"Agent Workbench"}):l.jsxs(l.Fragment,{children:[l.jsx(ku,{terminal:U,activity:R.get(U.terminalId),statusLine:V(U)}),l.jsx("span",{className:"project-swatch",style:{background:nr(U.cwd)}}),l.jsx("span",{className:"narrow-current-label",children:Vi(U)})]}),l.jsx("span",{className:"narrow-caret","aria-hidden":"true",children:"▾"})]}),s!=="open"&&l.jsx("span",{className:`status status-${s}`,children:i}),l.jsx("button",{className:"icon-button narrow-icon",onClick:()=>O("menu"),title:C("narrow.more"),"aria-label":C("narrow.more"),children:"⋮"})]}),n,l.jsxs("div",{className:"narrow-body",children:[l.jsx("nav",{className:"narrow-views",role:"tablist",children:k.map(P=>l.jsxs("button",{ref:P===d?X:null,role:"tab","aria-selected":P===d,className:`narrow-view-tab${P===d?" narrow-view-active":""}`,onClick:()=>D(P),children:[l.jsx("span",{children:C($w(P))}),G(P)]},P))}),l.jsxs("div",{className:"narrow-stack",children:[l.jsx("main",{className:`workspace narrow-pane${d==="chat"?"":" narrow-pane-veiled"}`,children:M}),b,l.jsx("div",{className:`narrow-pane${d==="notes"?"":" narrow-pane-hidden"}`,children:T}),l.jsx("div",{className:`narrow-pane${d==="console"?"":" narrow-pane-hidden"}`,children:N})]}),B!==null&&l.jsx(bk,{onKey:B})]}),a&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>m(!1),children:l.jsx("div",{className:"narrow-drawer",onClick:P=>P.stopPropagation(),children:f})}),F==="tabs"&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>O(null),children:l.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":C("narrow.tabs.open"),onClick:P=>P.stopPropagation(),children:[l.jsx(Ck,{terminals:h,activeTerminalId:v,activity:R,statusLineOf:V,onSelect:P=>{u(P),O(null)},onClose:y,onRename:S}),l.jsx(bu,{className:"narrow-sheet-new",text:C("narrow.tabs.new"),title:_??C("narrow.tabs.new"),disabled:!g||_!==null,offerAgentChoice:r,agents:x,agent:c,onOpen:P=>{L(P),O(null)}})]})}),F==="menu"&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>O(null),children:l.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":C("narrow.more"),onClick:P=>P.stopPropagation(),children:l.jsx(kk,{menu:p,status:s,statusLabel:i,onClose:()=>O(null)})})})]})}function Ck({terminals:n,activeTerminalId:s,activity:i,statusLineOf:h,onSelect:v,onClose:R,onRename:x}){const[r,c]=I.useState(null),[g,_]=I.useState(""),u=I.useRef(null);I.useEffect(()=>{var S;r!==null&&((S=u.current)==null||S.select())},[r]);const y=()=>{r!==null&&x(r,g.trim()),c(null)};return n.length===0?l.jsx("p",{className:"narrow-sheet-empty",children:C("narrow.tabs.none")}):l.jsx("ul",{className:"narrow-tabs",children:n.map(S=>{const L=r===S.terminalId;return l.jsxs("li",{className:`narrow-tab-row${S.terminalId===s?" narrow-tab-active":""}`,style:{"--tab-project-color":nr(S.cwd)},children:[L?l.jsx("input",{ref:u,className:"narrow-tab-input",value:g,onChange:f=>_(f.target.value),onBlur:y,onKeyDown:f=>{f.key==="Enter"&&y(),f.key==="Escape"&&(f.stopPropagation(),c(null))}}):l.jsxs("button",{className:"narrow-tab-select",onClick:()=>v(S.terminalId),children:[l.jsx(ku,{terminal:S,activity:i.get(S.terminalId),statusLine:h(S)}),l.jsx("span",{className:"narrow-tab-label",children:Vi(S)})]}),l.jsx("button",{className:"icon-button",onClick:()=>{c(S.terminalId),_(S.label.length>0?S.label:Vi(S))},title:C("narrow.tabs.rename"),children:"✎"}),l.jsx("button",{className:"icon-button",onClick:()=>R(S.terminalId),title:C("narrow.tabs.close"),children:"×"})]},S.terminalId)})})}function xk({choice:n}){const s=[{source:"system",label:C("narrow.menu.chimeSystem")},{source:"page",label:C("narrow.menu.chimePage")}];return l.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":C("narrow.menu.sound"),children:s.map(({source:i,label:h})=>l.jsx("button",{className:`narrow-chime-option${n.source===i?" is-on":""}`,"aria-pressed":n.source===i,onClick:()=>n.setSource(i),children:h},i))})}function kk({menu:n,status:s,statusLabel:i,onClose:h}){return l.jsxs("div",{className:"narrow-menu",children:[l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.connection")}),l.jsx("span",{className:`status status-${s}`,children:i}),km(navigator.userAgent)&&l.jsxs(l.Fragment,{children:[l.jsx("a",{className:"link-button",href:Yw,onClick:h,children:C("narrow.menu.phoneAppDisconnect")}),l.jsx("a",{className:"link-button",href:Gw,onClick:h,children:C("narrow.menu.phoneAppSettings")})]})]}),n.cwd!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:C("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:C("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:C("app.header.remoteBadge")}),l.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:C("app.header.remoteBadgeTitle")})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:C("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:C("narrow.menu.language")}),l.jsx(vg,{})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.sound")}),n.sound.phoneChime===null?l.jsx(pg,{sound:n.sound}):l.jsx(xk,{choice:n.sound.phoneChime})]}),n.sound.notify.supported&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.notifications")}),l.jsx(mg,{notify:n.sound.notify})]}),n.remote!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:C("app.header.remoteAccess")}),l.jsx("button",{className:`icon-button${n.remote.active?" icon-button-on":""}`,onClick:()=>{var v;h(),(v=n.remote)==null||v.onOpen()},title:n.remote.title,children:"⇄"})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:C("narrow.menu.shortcuts")}),l.jsx("button",{className:"icon-button",onClick:()=>{h(),n.onShortcuts()},title:C("app.header.shortcuts"),children:"?"})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:C("settings.title")}),l.jsx("button",{className:"icon-button",onClick:()=>{h(),n.onSettings()},title:C("settings.open"),"aria-label":C("settings.open"),children:"⚙"})]})]})}function Ek(){const n=window.location.search,s=new URLSearchParams(n).get(Kc),i=s!==null&&s.length>0?s:null,h=Ww(n);return i===null&&h===null?{token:i,tab:h}:(window.history.replaceState(null,"",`${window.location.pathname}${zw(n,[Kc,Cm])}`),{token:i,tab:h})}const yg=Ek(),yp=yg.token,Lk=yg.tab,zc=new Set;function Tk(n){const[s,i]=I.useState(null),[h,v]=I.useState(null),[R,x]=I.useState(zc),[r,c]=I.useState(null);I.useEffect(()=>{const a=n.onMessage(p=>{switch(p.type){case"vault.status":i(p.status);break;case"vault.exported":x(d=>{if(!d.has(p.projectKey))return d;const k=new Set(d);return k.delete(p.projectKey),k}),c({projectKey:p.projectKey,sessions:p.sessions,at:Date.now()});break;case"error":if(p.code!=="vault-failed")break;v(kt(p.text)),p.detail!==void 0&&console.error("[servidor]",p.detail),x(zc);break}}),m=n.onReopen(()=>x(zc));return()=>{a(),m()}},[n]);const g=I.useCallback(()=>{v(null),n.send({type:"vault.measure"})},[n]),_=I.useCallback(a=>{v(null),n.send({type:"vault.enable",enabled:a})},[n]),u=I.useCallback(a=>{v(null),n.send({type:"vault.setDir",pickerId:a})},[n]),y=I.useCallback(a=>{v(null),x(m=>new Set(m).add(a)),n.send({type:"vault.exportProject",projectKey:a})},[n]),S=I.useCallback((a,m)=>{v(null),n.send({type:"vault.openSession",agent:a,sessionId:m})},[n]),L=I.useCallback(()=>{v(null),n.send({type:"vault.reveal"})},[n]),f=I.useCallback(()=>v(null),[]);return{status:s,problem:h,exporting:R,lastExported:r,measure:g,setEnabled:_,chooseDir:u,exportProject:y,openSession:S,reveal:L,dismissProblem:f}}function Rk(n){return C("summary.outdatedServer",{server:n,page:Fr})}function Mk(n){const[s,...i]=n;if(s===void 0||s.missingMessage===null)return null;const h=kt(s.missingMessage);return i.length===0?h:`${h}
139
+ ${C("summary.alsoWorksWith",{names:i.map(v=>v.label).join(", ")})}`}function Ak(n){const s=n.version??"?";return s.toLowerCase().includes(n.label.toLowerCase())?s:`${n.label} ${s}`}function Nk(n,s,i=Fr){var x,r;if(s&&i<Fr)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:Rk(i),environmentNotice:null};if(s&&i>Fr)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:C("summary.newerServer",{server:i,page:Fr}),environmentNotice:null};const h=n.filter(c=>c.available);let v=null;h.length===1?v=((x=h[0])==null?void 0:x.version)??null:h.length>1&&(v=h.map(Ak).join(" · "));const R=s&&h.length===0;return{cliAvailable:!s||h.length>0,cliVersion:v,cliMissingMessage:R?Mk(n):null,environmentNotice:((r=n.find(c=>c.environmentNotice!==null))==null?void 0:r.environmentNotice)??null}}const Dk=500,Ik=8e3;class jk{constructor(){Lt(this,"socket",null);Lt(this,"status","connecting");Lt(this,"attempt",0);Lt(this,"closedByUs",!1);Lt(this,"hasConnectedOnce",!1);Lt(this,"reconnectTimer");Lt(this,"messageHandlers",new Set);Lt(this,"statusHandlers",new Set);Lt(this,"reopenHandlers",new Set);Lt(this,"outbox",[])}getStatus(){return this.status}onMessage(s){return this.messageHandlers.add(s),()=>this.messageHandlers.delete(s)}onStatus(s){return this.statusHandlers.add(s),()=>this.statusHandlers.delete(s)}onReopen(s){return this.reopenHandlers.add(s),()=>this.reopenHandlers.delete(s)}connect(){if(this.socket!==null)return;const s=new URL(N0,window.location.href);s.protocol=window.location.protocol==="https:"?"wss:":"ws:",yp!==null&&s.searchParams.set(Kc,yp);const i=new WebSocket(s);this.socket=i,i.onopen=()=>{for(this.attempt=0,this.setStatus("open");this.outbox.length>0;){const h=this.outbox.shift();h!==void 0&&i.send(nf(h))}if(this.hasConnectedOnce)for(const h of this.reopenHandlers)h();this.hasConnectedOnce=!0},i.onmessage=h=>{const v=B0(h.data);if(v===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const R of this.messageHandlers)R(v)},i.onclose=h=>{if(this.socket=null,!this.closedByUs){if(h.code===b0){this.setStatus("revoked");return}this.setStatus("reconnecting"),this.scheduleReconnect()}},i.onerror=()=>{}}send(s){return this.socket!==null&&this.socket.readyState===WebSocket.OPEN?(this.socket.send(nf(s)),!0):(s.type!=="input"&&s.type!=="resize"&&this.outbox.push(s),!1)}close(){var s;this.closedByUs=!0,window.clearTimeout(this.reconnectTimer),(s=this.socket)==null||s.close(),this.socket=null}setStatus(s){if(this.status!==s){this.status=s;for(const i of this.statusHandlers)i(s)}}scheduleReconnect(){if(this.attempt+=1,!this.hasConnectedOnce&&this.attempt>4){this.setStatus("failed");return}const s=Math.min(Dk*2**(this.attempt-1),Ik);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),s)}}const du="agent-workbench.activeTab";function Pk(){try{return window.sessionStorage.getItem(du)}catch{return null}}const Ok={state:"idle",scannedFiles:0,totalFiles:0};function Bk(n,s,i){const h=new Map(i?[]:n.map(v=>[v.key,v]));for(const v of s)h.set(v.key,v);return[...h.values()].sort((v,R)=>R.lastActivityAt-v.lastActivityAt)}function Fk(){const n=I.useMemo(()=>new jk,[]),s=I.useMemo(()=>new Mw({send:(Re,ze)=>n.send({type:"composer.draft",terminalId:Re,draft:ze}),connected:()=>n.getStatus()==="open",setTimer:(Re,ze)=>window.setTimeout(Re,ze),clearTimer:Re=>window.clearTimeout(Re),newId:()=>crypto.randomUUID()}),[n]),[i,h]=I.useState("connecting"),[v,R]=I.useState([]),[x,r]=I.useState(null),[c,g]=I.useState(!1),[_,u]=I.useState(Fr),[y,S]=I.useState(""),[L,f]=I.useState(""),[a,m]=I.useState(null),[p,d]=I.useState(!1),[k,D]=I.useState([]),[E,M]=I.useState([]),[b,T]=I.useState(Ok),[N,B]=I.useState(Pk);I.useEffect(()=>{try{N===null?window.sessionStorage.removeItem(du):window.sessionStorage.setItem(du,N)}catch{}},[N]);const[F,O]=I.useState(new Set),[U,V]=I.useState(new Map),[Y,X]=I.useState(new Map),G=I.useRef(new Map),P=I.useRef(new Map),[$,H]=I.useState(new Set),[q,ne]=I.useState(null),[re,ue]=I.useState([]),[de,K]=I.useState(new Map),[W,J]=I.useState([]),Z=I.useRef(1),pe=I.useRef(new Set),me=I.useRef(new Map),ie=I.useRef(new Map),Le=I.useCallback(Re=>{const ze=ie.current.get(Re);ze!==void 0&&(clearTimeout(ze),ie.current.delete(Re)),ue(te=>te.some(le=>le.requestId===Re)?te.filter(le=>le.requestId!==Re):te)},[]),Ae=I.useCallback(()=>{for(const Re of ie.current.values())clearTimeout(Re);ie.current.clear(),ue(Re=>Re.length===0?Re:[])},[]);I.useEffect(()=>{const Re=n.onStatus(le=>{h(le),le==="failed"&&ne({message:C("workspace.connectFailed"),at:Date.now()})}),ze=n.onMessage(le=>{switch(le.type){case"agents":R(le.agents),r(le.defaultAgent);break;case"hello":R(le.agents),r(le.defaultAgent),g(!0),u(le.protocolVersion),S(le.platform),f(le.defaultCwd),m(le.shellName),d(le.remoteClient);break;case"terminal.list":{D(le.terminals),s.retain(le.terminals.map(We=>We.terminalId));const ke=sw(P.current,le.terminals),rt=ke.finished.length>0||[...ke.phases].some(([We,ut])=>P.current.get(We)!==ut);P.current=ke.phases,rt&&H(new Set(ke.phases.keys())),O(We=>{if(We.size===0)return We;const ut=new Set(We);for(const Mt of We){if(ke.phases.has(Mt))continue;const Pt=le.terminals.find(rs=>rs.terminalId===Mt);(Pt===void 0||Pt.alive)&&ut.delete(Mt)}return ut.size===We.size?We:ut}),X(We=>{if(We.size===0)return We;const ut=new Map([...We].filter(([Mt])=>le.terminals.some(Pt=>Pt.terminalId===Mt)));return ut.size===We.size?We:(G.current=ut,ut)});const Te=le.terminals.filter(We=>We.kind==="agent");B(We=>{var ut;return We!==null&&Te.some(Mt=>Mt.terminalId===We)?We:((ut=Te[0])==null?void 0:ut.terminalId)??null}),K(We=>{if(We.size===0)return We;const ut=new Map(We);for(const Mt of We.keys())le.terminals.some(Pt=>Pt.terminalId===Mt)||ut.delete(Mt);return ut.size===We.size?We:ut});break}case"session.continued":K(ke=>new Map(ke).set(le.terminalId,{sourceAgent:le.source.agent,includedTurns:le.includedTurns,totalTurns:le.totalTurns,totalTurnsIsMinimum:le.totalTurnsIsMinimum,delivery:le.delivery,prefillReason:null}));break;case"composer.prefill":{const ke=Z.current;Z.current+=1,J(rt=>[...rt,{id:ke,terminalId:le.terminalId,text:le.text}]),K(rt=>{const Te=rt.get(le.terminalId);return Te===void 0?rt:new Map(rt).set(le.terminalId,{...Te,delivery:"prefilled",prefillReason:le.reason})});break}case"composer.drafts":s.restore(le.drafts);break;case"terminal.opened":{Le(le.requestId),pe.current.delete(le.requestId)&&le.terminal.kind==="agent"&&B(le.terminal.terminalId);const ke=me.current.get(le.requestId);ke!==void 0&&(me.current.delete(le.requestId),ke(le.terminal));break}case"terminal.activity":V(ke=>ke.get(le.terminalId)===le.activity?ke:new Map(ke).set(le.terminalId,le.activity)),X(ke=>{const rt=le.offlineReason??null;if((ke.get(le.terminalId)??null)===rt)return ke;const Te=new Map(ke);return rt===null?Te.delete(le.terminalId):Te.set(le.terminalId,rt),G.current=Te,Te});break;case"index.status":T(le.status);break;case"index.projects":M(ke=>Bk(ke,le.projects,le.replace));break;case"error":if(rx(le.requestId)){le.detail!==void 0&&console.error("[servidor]",le.detail);break}if(le.code==="vault-failed"||le.code==="search-failed"||le.code==="remote-failed"||le.code==="settings-failed")break;ne({message:kt(le.text),at:Date.now()}),O(ke=>ke.size===0?ke:new Set),P.current.size>0&&(P.current=new Map,H(new Set)),le.detail!==void 0&&console.error("[servidor]",le.detail),le.requestId!==void 0&&(pe.current.delete(le.requestId),me.current.delete(le.requestId),Le(le.requestId));break}}),te=n.onReopen(()=>{Ae(),O(le=>le.size===0?le:new Set),P.current.size>0&&(P.current=new Map,H(new Set))});return n.connect(),()=>{Re(),ze(),te(),n.close()}},[n,s,Le,Ae]),I.useEffect(()=>{const Re=n.onReopen(()=>s.reconnected()),ze=()=>s.flushAll(),te=()=>{document.visibilityState==="hidden"&&s.flushAll()};return window.addEventListener("pagehide",ze),document.addEventListener("visibilitychange",te),()=>{Re(),window.removeEventListener("pagehide",ze),document.removeEventListener("visibilitychange",te)}},[n,s]),I.useEffect(()=>Ae,[Ae]);const Xe=I.useCallback(Re=>{const ze=crypto.randomUUID();pe.current.add(ze),Re.onOpened!==void 0&&me.current.set(ze,Re.onOpened),ue(le=>[...le,{requestId:ze,cwd:Re.cwd,agent:Re.agent??null,label:Re.label??"",at:Date.now()}]);const te=setTimeout(()=>Le(ze),iw);ie.current.set(ze,te),n.send({type:"terminal.open",requestId:ze,cwd:Re.cwd,...Re.resumeSessionId!==void 0?{resumeSessionId:Re.resumeSessionId}:{},...Re.label!==void 0?{label:Re.label}:{},...Re.agent!==void 0?{agent:Re.agent}:{}})},[n,Le]),Ce=I.useCallback(Re=>{n.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:Re,kind:"shell"})},[n]),fe=I.useCallback(Re=>n.send({type:"terminal.close",terminalId:Re}),[n]),Me=I.useCallback(Re=>{O(ze=>new Set(ze).add(Re)),G.current.get(Re)==="server-closed"&&(P.current=new Map(P.current).set(Re,"waiting-exit"),H(new Set(P.current.keys()))),n.send({type:"terminal.wake",terminalId:Re})},[n]),_e=I.useCallback((Re,ze)=>n.send({type:"terminal.rename",terminalId:Re,label:ze}),[n]),Ee=I.useCallback(Re=>n.send({type:"tabs.reorder",terminalIds:Re}),[n]),Fe=I.useCallback((Re,ze)=>n.send({type:"session.archive",sessionIds:Re,archived:ze}),[n]),Se=I.useCallback((Re,ze,te)=>{const le=crypto.randomUUID();pe.current.add(le),n.send({type:"session.continue",requestId:le,agent:Re.agent,sessionId:Re.sessionId,target:ze,label:te})},[n]),Ne=I.useCallback(Re=>{K(ze=>{if(!ze.has(Re))return ze;const te=new Map(ze);return te.delete(Re),te})},[]),et=I.useCallback(Re=>{J(ze=>ze.some(te=>te.id===Re)?ze.filter(te=>te.id!==Re):ze)},[]),tt=I.useCallback(()=>n.send({type:"index.refresh"}),[n]),Je=I.useCallback(()=>n.send({type:"agents.refresh"}),[n]),lt=I.useCallback(()=>ne(null),[]),ct=I.useMemo(()=>k.filter(Re=>Re.kind==="agent"),[k]),$e=I.useMemo(()=>k.filter(Re=>Re.kind==="shell"),[k]),Ze=Yi(),Ve=I.useMemo(()=>Nk(v,c,_),[v,c,_,Ze]),st=I.useCallback(Re=>{var ze;return(Re===null||(ze=v.find(te=>te.id===Re))==null?void 0:ze.capabilities)??Pp},[v]),dt=I.useMemo(()=>pu(v),[v]);return{connection:n,status:i,agents:v,defaultAgent:x,capabilitiesFor:st,offerAgentChoice:dt,cliAvailable:Ve.cliAvailable,cliVersion:Ve.cliVersion,cliMissingMessage:Ve.cliMissingMessage,platform:y,defaultCwd:L,environmentNotice:Ve.environmentNotice,shellName:a,remoteClient:p,terminals:ct,shells:$e,pendingOpens:re,activeTerminalId:N,projects:E,indexStatus:b,error:q,dismissError:lt,setActiveTerminal:B,openTerminal:Xe,openShell:Ce,closeTerminal:fe,wakeTerminal:Me,waking:F,activity:U,offlineReasons:Y,relaunching:$,renameTerminal:_e,reorderTabs:Ee,refreshIndex:tt,refreshAgents:Je,archiveSessions:Fe,continueSession:Se,handoffs:de,dismissHandoff:Ne,prefills:W,prefillApplied:et,drafts:s}}const Eu=["git","files","plans","memory","console","notes"],wp="agent-workbench.hiddenPanels";function Hk(n){return Eu.includes(n)}const $k=new Set(["memory"]),Uk="none";function Wk(n){return new Set(n.split(",").map(s=>s.trim()).filter(Hk))}function zk(n){const s=Eu.filter(i=>n.has(i));return s.length===0?Uk:s.join(",")}function Vk(n,s,i){const h=new Set(n);return i?h.delete(s):h.add(s),h}function qk(){const[n,s]=I.useState(()=>mt(wp,$k,Wk)),i=I.useCallback((v,R)=>{s(x=>{const r=Vk(x,v,R);return ht(wp,zk(r)),r})},[]),h=I.useCallback(v=>!n.has(v),[n]);return{hidden:n,isVisible:h,setVisible:i}}const Kk={git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",console:"console.name",notes:"notes.name"},Gk={dark:"settings.terminalTheme.dark",follow:"settings.terminalTheme.follow"};function Yk(n,s,i){const h=n.filter(v=>v!==s);return i?[...h,s]:h}function Xk(n,s){return n.length===s.length&&n.every(i=>s.includes(i))}function Qk({onClose:n,terminalTheme:s,panels:i,consoleCount:h,onHideConsole:v,appSettings:R,agents:x,remoteClient:r,onOpenVault:c,onOpenRemote:g}){const[_,u]=I.useState(!1),y=R.status,S=y!==null&&!r,[L,f]=I.useState(null),[a,m]=I.useState(null);I.useEffect(()=>{f(null),m(null)},[y,R.problem]);const p=L??(y==null?void 0:y.consoleShell)??"auto",d=a??(y==null?void 0:y.disabledAgents)??[];I.useEffect(()=>{const b=T=>{T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),n())};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[n]);const k=(b,T)=>{if(b==="console"&&!T&&h>0){u(!0);return}i.setVisible(b,T)},D=(y==null?void 0:y.consoleShells.find(b=>b.id!=="git-bash"&&b.id!=="zsh"))??null,E=y!==null&&!Xk(y.disabledAgents,y.disabledAtStart),M=y===null?[]:[{id:"auto",label:D===null?C("settings.console.auto"):C("settings.console.autoWith",{shell:D.label})},...y.consoleShells];return l.jsx("div",{className:"modal-backdrop",onClick:n,children:l.jsxs("div",{className:"modal settings-dialog",role:"dialog","aria-label":C("settings.title"),onClick:b=>b.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:C("settings.title")}),l.jsx("button",{className:"icon-button",onClick:n,title:C("common.closeEsc"),children:"×"})]}),l.jsxs("div",{className:"modal-body settings-body",children:[l.jsx("h3",{className:"modal-section",children:C("settings.section.appearance")}),l.jsxs("div",{className:"settings-row",children:[l.jsx("span",{className:"settings-label",children:C("settings.language")}),l.jsx(vg,{})]}),l.jsxs("div",{className:"settings-row settings-row-top",children:[l.jsx("span",{className:"settings-label",children:C("settings.terminalTheme")}),l.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":C("settings.terminalTheme"),children:[["dark","follow"].map(b=>l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"radio",name:"terminal-theme",checked:s.preference===b,onChange:()=>s.setPreference(b)}),C(Gk[b])]},b)),l.jsx("p",{className:"modal-hint",children:C("settings.terminalTheme.hint")})]})]}),l.jsx("h3",{className:"modal-section",children:C("settings.section.panels")}),l.jsx("div",{className:"settings-panels",children:Eu.map(b=>l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"checkbox",checked:i.isVisible(b),onChange:T=>k(b,T.target.checked)}),C(Kk[b])]},b))}),_&&l.jsxs("div",{className:"settings-confirm",role:"alert",children:[l.jsx("span",{children:C("settings.panels.consoleConfirm",{count:h})}),l.jsx("button",{className:"link-button",onClick:()=>{u(!1),v()},children:C("settings.panels.consoleConfirmYes")}),l.jsx("button",{className:"link-button",onClick:()=>u(!1),children:C("common.cancel")})]}),l.jsx("p",{className:"modal-hint",children:C("settings.panels.cliAlways")}),y===null?l.jsx("p",{className:"modal-hint",children:C("settings.oldServer")}):l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:C("settings.section.console")}),y.consoleShells.length===0?l.jsx("p",{className:"modal-hint",children:C("console.noShell")}):l.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":C("settings.section.console"),children:[M.map(b=>l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"radio",name:"console-shell",checked:p===b.id,disabled:!S,onChange:()=>{f(b.id),R.setConsoleShell(b.id)}}),b.label]},b.id)),l.jsx("p",{className:"modal-hint",children:C("settings.console.hint")})]}),l.jsx("h3",{className:"modal-section",children:C("settings.section.clis")}),l.jsx("ul",{className:"settings-clis",children:x.map(b=>{const T=d.includes(b.id),N=y.disabledAtStart.includes(b.id),B=b.available||N;return l.jsxs("li",{className:"settings-cli",children:[B?l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"checkbox",checked:!T,disabled:!S,onChange:F=>{const O=Yk(d,b.id,!F.target.checked);m(O),R.setDisabledAgents(O)}}),l.jsx("span",{className:"settings-cli-name",children:b.label})]}):l.jsx("span",{className:"settings-cli-name settings-cli-missing",children:b.label}),l.jsx("span",{className:"settings-cli-detail",children:b.available?b.version??"":C(N?"settings.cli.disabled":"settings.cli.notInstalled")}),!B&&l.jsx("a",{className:"link-button",href:b.installUrl,target:"_blank",rel:"noreferrer noopener",children:C("settings.cli.install")})]},b.id)})}),l.jsx("p",{className:"modal-hint",children:C("settings.cli.hint")}),E&&l.jsx("p",{className:"settings-restart",children:C("settings.cli.restart")}),r&&l.jsx("p",{className:"modal-hint",children:C("settings.hostOnly")}),R.problem!==null&&l.jsxs("p",{className:"settings-problem",role:"alert",children:[R.problem,l.jsx("button",{className:"link-button",onClick:R.dismissProblem,children:C("common.close")})]})]}),(c!==null||g!==null)&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:C("settings.section.more")}),l.jsxs("div",{className:"settings-row settings-more",children:[c!==null&&l.jsx("button",{className:"primary-button primary-button-small",onClick:c,children:C("settings.more.open",{name:qr()})}),g!==null&&l.jsx("button",{className:"primary-button primary-button-small",onClick:g,children:C("settings.more.open",{name:C("app.header.remoteAccess")})})]})]})]})]})})}function Jk(n){const[s,i]=I.useState(null),[h,v]=I.useState(null);I.useEffect(()=>n.onMessage(c=>{switch(c.type){case"settings.status":i(c.settings),v(null);break;case"error":if(c.code!=="settings-failed")break;v(kt(c.text)),c.detail!==void 0&&console.error("[servidor]",c.detail);break}}),[n]);const R=I.useCallback(c=>n.send({type:"settings.update",consoleShell:c}),[n]),x=I.useCallback(c=>n.send({type:"settings.update",disabledAgents:c}),[n]),r=I.useCallback(()=>v(null),[]);return{status:s,problem:h,setConsoleShell:R,setDisabledAgents:x,dismissProblem:r}}function Zk({status:n,agents:s,indexReady:i,problem:h,covered:v,onMeasure:R,onSetEnabled:x,onChangeDir:r,onReveal:c,onDismissProblem:g,onClose:_}){return I.useEffect(()=>{if(v)return;const u=y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),_())};return window.addEventListener("keydown",u,!0),()=>window.removeEventListener("keydown",u,!0)},[v,_]),l.jsx("div",{className:"modal-backdrop",onClick:_,children:l.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":qr(),onClick:u=>u.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:qr()}),n!==null&&l.jsx("span",{className:`vault-state${n.enabled?" vault-state-on":""}`,children:MS(n)}),l.jsx("button",{className:"icon-button",onClick:_,title:C("common.closeEsc"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:"vault-lead",children:kS()}),l.jsx("p",{className:"modal-hint",children:ES()}),n===null?l.jsx("p",{className:"modal-hint",children:C("vault.dialog.waiting")}):l.jsx(eE,{status:n,agents:s,indexReady:i,onMeasure:R,onSetEnabled:x,onChangeDir:r,onReveal:c}),h!==null&&l.jsxs("div",{className:"vault-problem",role:"alert",children:[l.jsx("span",{children:h}),l.jsx("button",{className:"icon-button",onClick:g,title:C("common.dismissNotice"),children:"×"})]})]})]})})}function eE({status:n,agents:s,indexReady:i,onMeasure:h,onSetEnabled:v,onChangeDir:R,onReveal:x}){const r=IS(n,i),c=jS(n),g=DS(n),_=n.measurement===null?null:BS(n.measurement,s),u=n.progress;return l.jsxs(l.Fragment,{children:[n.enabled&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:C("vault.dialog.inFolder")}),l.jsxs("p",{className:"vault-summary",children:[tg(n.sessions)," · ",rn(n.bytes),n.lastPassAt!==null&&l.jsxs(l.Fragment,{children:[" · ",C("vault.dialog.lastPass",{when:Hn(n.lastPassAt)})]}),n.pending>0&&l.jsxs(l.Fragment,{children:[" · ",C("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:C("vault.dialog.sizeSection")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"link-button vault-measure",onClick:h,disabled:r!==null,title:r??C("vault.dialog.measureTitle"),children:n.state==="measuring"?C("vault.state.measuring"):C(_===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:C("vault.dialog.table.sessions")}),l.jsx("th",{children:C("vault.dialog.table.size")}),l.jsx("th",{children:C("vault.dialog.table.images")}),l.jsx("th",{title:C("vault.dialog.table.archivedTitle"),children:C("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:rn(y.bytes)}),l.jsx("td",{title:y.images>0?rn(y.imageBytes):void 0,children:y.images}),l.jsx("td",{children:y.skippedArchived})]},y.agent)),l.jsxs("tr",{children:[l.jsx("td",{children:C("vault.dialog.table.memory",{count:_.memoryProjects})}),l.jsx("td",{}),l.jsx("td",{children:rn(_.memoryBytes)}),l.jsx("td",{}),l.jsx("td",{})]})]}),l.jsx("tfoot",{children:l.jsxs("tr",{children:[l.jsx("td",{children:C("vault.dialog.table.total")}),l.jsx("td",{children:_.total.sessions}),l.jsx("td",{children:rn(_.total.bytes)}),l.jsx("td",{children:_.total.images}),l.jsx("td",{children:_.total.skippedArchived})]})})]})}),l.jsxs("div",{className:"vault-actions vault-switch",children:[g==="enabled"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"link-button",onClick:()=>v(!1),children:C("vault.dialog.turnOff")}),l.jsx("span",{className:"modal-hint",children:C("vault.dialog.turnOffHint")})]}),(g==="measured"||g==="existing")&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"primary-button",onClick:()=>v(!0),title:C(g==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:C("vault.dialog.activate")}),l.jsx("span",{className:"modal-hint",children:C(g==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),g==="needs-measure"&&l.jsx("span",{className:"modal-hint",children:C("vault.dialog.needsMeasure",{activate:C("vault.dialog.activate")})})]}),l.jsx("h3",{className:"modal-section",children:C("vault.dialog.folderSection")}),l.jsx("p",{className:"vault-dir",title:n.dir,children:n.dir}),n.isDefaultDir&&l.jsx("p",{className:"modal-hint",children:C("vault.dialog.defaultDir")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"link-button",onClick:R,disabled:c!==null,title:c??C("vault.dialog.changeDirTitle"),children:C("vault.dialog.changeDir")}),x!==null&&l.jsx("button",{className:"link-button",onClick:x,title:C("vault.dialog.openFolderTitle"),children:C("vault.dialog.openFolder")})]}),n.previousDir!==null&&l.jsx("p",{className:"modal-hint",children:PS(n.previousDir)}),n.lastError!==null&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:C("vault.dialog.lastError")}),l.jsx("p",{className:"vault-error",children:kt(n.lastError)})]})]})}const bp={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},Sp=320,tE=1400,nE=640,Cp=200,xp=560,sE=270,rE=120,iE=720,oE=260,kp="agent-workbench.panel-width",Ep="agent-workbench.panel-visible",Lp="agent-workbench.panel-tab",Vc="agent-workbench.panel-expanded",Tp="agent-workbench.sidebar-visible",Rp="agent-workbench.sidebar-width",Mp="agent-workbench.console-visible",Ap="agent-workbench.console-height",Np="agent-workbench.marker-notice-dismissed",Dp="agent-workbench.hidden-hint-shown";function aE(){var hi,So,Co;const n=Yi(),s=Fk(),{connection:i,status:h,agents:v,defaultAgent:R,capabilitiesFor:x,offerAgentChoice:r,cliAvailable:c,cliVersion:g,cliMissingMessage:_,platform:u,defaultCwd:y,environmentNotice:S,shellName:L,terminals:f,archiveSessions:a,shells:m,pendingOpens:p,activeTerminalId:d,projects:k,indexStatus:D,error:E,dismissError:M,setActiveTerminal:b,openTerminal:T,openShell:N,closeTerminal:B,wakeTerminal:F,waking:O,activity:U,offlineReasons:V,relaunching:Y,renameTerminal:X,reorderTabs:G,refreshIndex:P,refreshAgents:$,continueSession:H,handoffs:q,dismissHandoff:ne,prefills:re,prefillApplied:ue,drafts:de,remoteClient:K}=s,W=dx(),J=mx(W.resolved),Z=I.useMemo(()=>({nameOf:oe=>Dx(f.find(ye=>ye.terminalId===oe)),activate:b}),[f,b]),pe=Ox(U,Z),me=Bx(),ie=f.find(oe=>oe.terminalId===d)??null,Le=I.useCallback(oe=>{oe!==d&&M(),b(oe)},[d,M,b]),Ae=(ie==null?void 0:ie.agent)??null,Xe=x(Ae),Ce=I.useMemo(()=>hy(Xe),[Xe]),fe=v.find(oe=>oe.id===Ae)??null,Me=I.useMemo(()=>{if(ie===null||Ae===null)return null;for(const oe of k){const ye=oe.sessions.find(Qe=>Qe.agent===Ae&&Qe.sessionId===ie.sessionId);if(ye!==void 0)return Fn(ye.title,ye.titleSource)}return null},[ie,Ae,k,n]),_e=I.useMemo(()=>ly(f,k.flatMap(oe=>oe.sessions)),[f,k]),Ee=(fe==null?void 0:fe.statusLine)??null,Fe=(ie==null?void 0:ie.cwd)??y,Se=I.useMemo(()=>r?Py(f,Fe,u,v,R):null,[r,f,Fe,u,v,R]),Ne=I.useMemo(()=>df(p,Fe,u),[p,Fe,u]),et=Ne?pm():null,tt=lx(i),Je=Tk(i),[lt,ct]=I.useState(!1),$e=Wx(i),[Ze,Ve]=I.useState(!1),st=p1(),dt=qk(),[Re,ze]=I.useState(!1),te=I.useCallback(()=>ze(!1),[]),[le,ke]=I.useState(()=>mt(gf,"chat",Ow)),rt=I.useMemo(()=>Bw({hasTab:ie!==null,plansAvailable:Ce.plansAvailable,hidden:dt.hidden}),[ie,Ce.plansAvailable,dt.hidden]),Te=Fw(le,rt),We=I.useCallback(oe=>{ke(oe),ht(gf,oe)},[]),ut=I.useRef(Lk);I.useEffect(()=>{if(ut.current!==null)return i.onMessage(oe=>{if(oe.type!=="terminal.list"||ut.current===null)return;const ye=ut.current;ut.current=null,oe.terminals.some(Qe=>Qe.terminalId===ye&&Qe.kind==="agent")&&b(ye)})},[i,b]);const Mt=HC(i),Pt=Kb(v,Je.status),[rs,As]=I.useState(null),gn=I.useRef(0),Qi=I.useCallback(oe=>{As(ye=>ye!==null&&ye.seq===oe?null:ye)},[]),Ns=(oe,ye)=>{const Qe=aS(oe,{projects:k,terminals:f,platform:u,canResume:Yn=>lf(v,Yn)}),Dn=()=>{ye.length!==0&&(gn.current+=1,As({query:ye,seq:gn.current}))};switch(Qe.kind){case"activate":Le(Qe.terminalId),Dn();break;case"resume":Qe.session.archived&&a([Qe.session.sessionId],!1),T({cwd:Qe.cwd,resumeSessionId:Qe.session.sessionId,agent:Qe.session.agent,label:Fn(Qe.session.title,Qe.session.titleSource)}),Dn();break;case"copy":Je.openSession(oe.agent,oe.sessionId);break}},Yr=I.useMemo(()=>new Set(f.map(oe=>oe.sessionId).filter(oe=>oe.length>0)),[f]),[cn,Ba]=I.useState(()=>mt(Ep,!0,oe=>oe==="true")),[Ds,sr]=I.useState(()=>mt(Lp,"cli",oe=>oe==="git"||oe==="files"||oe==="cli"||oe==="plans"||oe==="memory"?oe:oe==="conversation"?"cli":null)),[Is,Xr]=I.useState(()=>mt(kp,nE,oe=>{const ye=Number.parseInt(oe,10);return Number.isFinite(ye)?Math.max(ye,Sp):null})),[Ji,Zi]=I.useState(()=>mt(Vc,!1,oe=>oe==="true")),[Qr,Un]=I.useState(()=>mt(Tp,!0,oe=>oe==="true")),[Jr,eo]=I.useState(()=>mt(Rp,sE,oe=>{const ye=Number.parseInt(oe,10);return Number.isFinite(ye)?Math.min(xp,Math.max(Cp,ye)):null})),[Fa,to]=I.useState(()=>mt(Mp,!1,oe=>oe==="true")),[Zr,no]=I.useState(()=>mt(Ap,oE,oe=>{const ye=Number.parseInt(oe,10);return Number.isFinite(ye)?ye:null})),[so,Ha]=I.useState(()=>mt(Np,!0,oe=>oe!=="true")),[$a,gt]=I.useState(!1),ei=Jk(i),[ti,is]=I.useState(!1),Wn=ei.status!==null?ei.status.shellName:L,[ro,ni]=I.useState(null),[rr,Xt]=I.useState(!1);I.useEffect(()=>{Ee===null&&Xt(!1)},[Ee]);const[si,At]=I.useState(null),ir=cn&&ie!==null,or=Cy(Ds,Ce.plansAvailable,dt.hidden),ar=Fa&&dt.isVisible("console"),_n=ie!==null?cn||ar:cn,os=Ji&&ie!==null,Ht=I.useMemo(()=>ie===null?[]:m.filter(oe=>oe.cwd===ie.cwd),[m,ie]),[lr,io]=I.useState(null),as=Ht.find(oe=>oe.terminalId===lr)??Ht[0]??null,ls=Te==="cli"?d:Te==="console"?(as==null?void 0:as.terminalId)??null:null,oo=I.useCallback(oe=>{ls!==null&&i.send({type:"input",terminalId:ls,data:oe})},[i,ls]),Nt=Rb(i,d),zn=Hx(i,U),ao=st?ie!==null:ir,ri=st?Te==="files":ir&&or==="files",ot=sx(i,ao?d:null),lo=FC(i,ri?d:null),ii=$C(i,d),oi=nx(i,f,d),cr=ax(i,ao?d:null),co=st?Te==="cli":ir&&or==="cli",ai=Nt.usage.lastModel,ur=Nt.usage.lastEffort??((hi=[...Nt.events].reverse().find(oe=>oe.effort!==null))==null?void 0:hi.effort)??null,js=ai??Nt.defaults.model,vn=ur??Nt.defaults.effort,Rn=ai===null&&js!==null,Mn=ur===null&&vn!==null,cs=OC(i,d,co),Vn=d===null?null:U.get(d)??null,yn=Jy(Xe,Nt.openToolCall,(fe==null?void 0:fe.label)??null,(ie==null?void 0:ie.alive)??!1,Vn),li=Zy({offlineReason:d===null?null:V.get(d)??null,alive:(ie==null?void 0:ie.alive)??!1,relaunching:d!==null&&Y.has(d)}),hr=li===null?null:ew((fe==null?void 0:fe.label)??null),Ps=hr??yn??rw(Xe,Nt.waitingFor,(ie==null?void 0:ie.alive)??!1),Ua=!jp(Xe,Vn),uo=I.useMemo(()=>dm(v,Ae),[v,Ae]),Os=ie!==null&&Yy(Ae,ie.sessionId,Xe),wn=d===null?null:q.get(d)??null,Wa=wn===null?null:{text:zy(Gi(wn.sourceAgent,v),wn.includedTurns,wn.totalTurns,wn.totalTurnsIsMinimum),status:wn.prefillReason!==null?qy(wn.prefillReason):wn.delivery==="sending"&&Nt.events.length===0?Vy():null},bn=I.useCallback(()=>{Ba(oe=>{const ye=!oe;return ht(Ep,String(ye)),ye})},[]),us=I.useCallback(()=>{Un(oe=>{const ye=!oe;return ht(Tp,String(ye)),ye})},[]),qn=I.useCallback(()=>{to(oe=>{const ye=!oe;return ht(Mp,String(ye)),ye})},[]),Bs=I.useCallback(oe=>{sr(oe),ht(Lp,oe)},[]),za=I.useCallback(()=>{Zi(oe=>{const ye=!oe;return ht(Vc,String(ye)),ye})},[]),Va=I.useCallback(()=>{d!==null&&i.send({type:"input",terminalId:d,data:"\x1B\x1B"})},[i,d]),ci=I.useCallback(oe=>{d!==null&&i.send({type:"input",terminalId:d,data:`${oe} `})},[i,d]),Kn=I.useRef(null),ui=I.useCallback(oe=>{var ye;return(ye=Kn.current)==null?void 0:ye.call(Kn,oe,!st)},[st]),ho=I.useCallback(oe=>{d!==null&&i.send({type:"agent.submit",terminalId:d,text:oe,images:[]})},[i,d]),An=I.useCallback(oe=>{d!==null&&i.send({type:"files.reveal",terminalId:d,path:oe})},[i,d]),Nn=I.useRef(new Set);I.useEffect(()=>{if(!ar){Nn.current.clear();return}if(ie===null)return;const{cwd:oe}=ie;if(m.some(ye=>ye.cwd===oe)){Nn.current.delete(oe);return}Nn.current.has(oe)||(Nn.current.add(oe),N(oe))},[ar,ie,m,N]);const dr=I.useCallback(oe=>{const ye=Ht.find(Qe=>Qe.terminalId===oe);ye!==void 0&&Nn.current.delete(ye.cwd),B(oe)},[Ht,B]),fr=I.useCallback(oe=>{if(oe==="console")for(const ye of m)B(ye.terminalId);dt.setVisible(oe,!1),!mt(Dp,!1,ye=>ye==="true")&&(ht(Dp,"true"),ni(oe))},[m,B,dt]),pr=I.useCallback(()=>{for(const oe of m)B(oe.terminalId);dt.setVisible("console",!1)},[m,B,dt]),Fs=I.useRef(new Set);I.useEffect(()=>{const oe=Ht.filter(Qe=>!Fs.current.has(Qe.terminalId));for(const Qe of Ht)Fs.current.add(Qe.terminalId);const ye=oe[oe.length-1];ye!==void 0&&io(ye.terminalId)},[Ht]);const fo=I.useCallback(()=>{ie!==null&&(Nn.current.add(ie.cwd),N(ie.cwd))},[ie,N]),Kt=xa({min:Sp,max:tE,value:Is,measure:I.useCallback(oe=>window.innerWidth-oe.clientX,[]),onChange:Xr,onCommit:I.useCallback(oe=>ht(kp,String(oe)),[]),onStart:I.useCallback(()=>{Zi(!1),ht(Vc,"false")},[])}),hs=xa({min:Cp,max:xp,value:Jr,measure:I.useCallback(oe=>oe.clientX,[]),onChange:eo,onCommit:I.useCallback(oe=>ht(Rp,String(oe)),[])}),mr=I.useRef(0),Hs=xa({min:rE,max:iE,value:Zr,measure:I.useCallback(oe=>Math.round(mr.current-oe.clientY),[]),onChange:no,onCommit:I.useCallback(oe=>ht(Ap,String(oe)),[]),onStart:I.useCallback(oe=>{const ye=oe.currentTarget.nextElementSibling;mr.current=ye===null?window.innerHeight:oe.clientY+ye.getBoundingClientRect().height},[])}),qa=I.useCallback(()=>{Ha(!1),ht(Np,"true")},[]),$s=I.useCallback(oe=>{if(f.length===0)return;const Qe=(f.findIndex(Yn=>Yn.terminalId===d)+oe+f.length)%f.length,Dn=f[Qe];Dn!==void 0&&Le(Dn.terminalId)},[f,d,Le]),gr=I.useRef(null),Gn=I.useRef(null);I.useEffect(()=>{d!==Gn.current&&(gr.current=Gn.current,Gn.current=d)},[d]);const Us=I.useCallback(()=>{const oe=gr.current;oe===null||oe===d||f.some(ye=>ye.terminalId===oe)&&Le(oe)},[d,f,Le]);I.useEffect(()=>{const oe=ye=>{if(ye.key!=="Tab"||!ye.shiftKey||ye.altKey||ye.ctrlKey||ye.metaKey)return;const Qe=document.activeElement;Qe instanceof Element&&Qe.closest(".xterm")!==null||(ye.preventDefault(),ye.stopPropagation(),Us())};return window.addEventListener("keydown",oe,!0),()=>window.removeEventListener("keydown",oe,!0)},[Us]),I.useEffect(()=>{const oe=ye=>{if(!ye.altKey||ye.ctrlKey||ye.metaKey)return;const Qe=ye.key.toLowerCase();if(Qe==="t"){c&&y.length>0&&!Ne&&(ye.preventDefault(),ye.stopPropagation(),T({cwd:(ie==null?void 0:ie.cwd)??y}));return}if(Qe==="w"){d!==null&&(ye.preventDefault(),ye.stopPropagation(),B(d));return}if(Qe==="p"){ye.preventDefault(),ye.stopPropagation(),bn();return}if(Qe==="arrowright"||Qe==="pagedown"){ye.preventDefault(),ye.stopPropagation(),$s(1);return}(Qe==="arrowleft"||Qe==="pageup")&&(ye.preventDefault(),ye.stopPropagation(),$s(-1))};return window.addEventListener("keydown",oe,!0),()=>window.removeEventListener("keydown",oe,!0)},[ie,d,c,B,$s,y,Ne,T,bn]);const po=ie===null?C("app.panel.name"):ie.label.length>0?ie.label:ie.cwd.split(/[\\/]/).filter(oe=>oe.length>0).pop()??ie.cwd,mo=l.jsx(qS,{projects:k,indexStatus:D,disabled:!c,onOpenProject:(oe,ye)=>{te(),T({cwd:oe,...ye!==void 0?{agent:ye}:{}})},agents:v,offerAgentChoice:r,agentForProject:oe=>Oy(f,oe,u,v,R),onOpenSession:(oe,ye)=>{te(),T({cwd:oe,resumeSessionId:ye.sessionId,agent:ye.agent,label:Fn(ye.title,ye.titleSource)})},canResume:oe=>lf(v,oe),platform:u,onRefresh:P,openSessionIds:Yr,openBlocked:oe=>df(p,oe,u),onArchive:a,onHide:st?te:us,width:Jr,onNewProject:()=>{te(),At("project")},vault:Je.status,onOpenVault:()=>{te(),ct(!0)},onOpenVaultSession:K?null:oe=>Je.openSession(oe.agent,oe.sessionId),onExportProject:K?null:Je.exportProject,exporting:Je.exporting,lastExported:Je.lastExported,onContinueSession:(oe,ye)=>{te(),H({agent:oe.agent,sessionId:oe.sessionId},ye,uf(Fn(oe.title,oe.titleSource)))},globalSearch:Pt?{...Mt,vaultEnabled:((So=Je.status)==null?void 0:So.enabled)===!0}:null,onOpenSearchHit:(oe,ye)=>{te(),Ns(oe,ye)}}),go=l.jsx("div",{className:"chat-stack",children:f.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx("p",{children:C("app.empty.noTabs")}),l.jsx("p",{className:"empty-hint",children:C("app.empty.hint")}),c&&y.length>0&&l.jsx("button",{className:"primary-button",onClick:()=>T({cwd:y}),disabled:Ne,title:et??void 0,children:Ne?C("app.empty.opening"):C("app.empty.newSession",{cwd:y})})]}):l.jsx(Nb,{view:Nt,terminalId:d,threadFont:me,onRewind:Ce.rewind&&(ie==null?void 0:ie.alive)===!0?Va:void 0,questionsAnswerable:Ce.questionsAnswerable,contextWindowSource:Ce.contextWindowSource,instructionsFile:uy(Ae),onGoToCli:()=>{if(st){We("cli");return}ir||bn(),Bs("cli")},cliPresence:ie===null||ie.alive?"live":ie.sleeping?"sleeping":"exited",exitCode:(ie==null?void 0:ie.exitCode)??null,waking:d!==null&&O.has(d),onWakeCli:()=>{d!==null&&F(d)},discovering:Os,continueTargets:uo,continueBlockedReason:Wy((ie==null?void 0:ie.sessionId)??"",Os,Nt.events.length>0),onContinue:ie===null||Ae===null?void 0:oe=>H({agent:Ae,sessionId:ie.sessionId},oe,uf(Me??ie.label)),searchRequest:rs,onSearchRequestApplied:Qi,toolCallNotice:yn,serverClosed:li===null||hr===null?null:{state:li,text:hr},statusLineState:(Ee==null?void 0:Ee.state)??null,onConfigureStatusLine:Ee===null?void 0:()=>Xt(!0),activity:Vn,receipt:d===null?null:zn.receipts.get(d)??null,clock:d===null?null:zn.clocks.get(d)??null})}),_o=l.jsx(l.Fragment,{children:ie!==null&&l.jsx(C1,{connection:i,drafts:de,terminalId:d,alive:ie.alive,sleeping:ie.sleeping,projectColor:nr(ie.cwd),activity:U.get(ie.terminalId),imagesAllowed:Ce.imagesAllowed,blockedReason:Ps,prefills:re,onPrefillApplied:ue,notice:Wa,onDismissNotice:d===null?void 0:()=>ne(d),onSubmitted:(oe,ye,Qe)=>{ne(oe);const{events:Dn}=Nt,Yn=oe===d?Dn[Dn.length-1]:void 0;zn.track(oe,ye,(Yn==null?void 0:Yn.eventId)??null,Qe)},fontSize:me.size,insertRef:Kn,leading:Ce.modeCycle===null?void 0:l.jsx(dw,{mode:Nt.permissionMode,cycle:Ce.modeCycle,disabled:!ie.alive,waitingFor:Nt.waitingFor,statusKnown:Ua,onChange:Nt.setPermissionMode}),controls:Ce.models===null&&Ce.efforts===null?void 0:l.jsx(hw,{models:Ce.models,efforts:Ce.efforts,model:js,effort:vn,modelProvisional:Rn,effortProvisional:Mn,savesChoice:cy(Ae),disabled:!ie.alive,onCommand:ho})})}),_r=ie===null?null:l.jsx(NC,{tab:st?_f(Te)??or:or,plansAvailable:Ce.plansAvailable,hiddenTabs:dt.hidden,hidden:st?_f(Te)===null:!cn,onTabChange:st?We:Bs,title:po,cwd:ie.cwd,platform:u,cli:l.jsx("div",{className:"terminal-stack",children:f.map(oe=>l.jsx(Im,{terminalId:oe.terminalId,connection:i,active:oe.terminalId===d,theme:J.resolved,autoFocus:!1},oe.terminalId))}),cliUnseen:cs,expanded:Ji,onToggleExpanded:za,git:ot,files:lo,plans:ii,documents:oi,memory:cr,onInsert:Ce.fileMentions&&ie.alive?ci:void 0,onInsertPath:ui,onReveal:K?null:An,onHide:bn}),vo=ie===null?null:l.jsx(G1,{connection:i,shells:Ht,activeShellId:(as==null?void 0:as.terminalId)??null,cwd:ie.cwd,shellName:Wn,theme:J.resolved,onSelect:io,onOpen:fo,onCloseShell:dr,onCollapse:st?()=>We("chat"):qn,onHide:st?void 0:()=>fr("console"),hideCount:m.length}),yo=dt.isVisible("notes")?l.jsx(gk,{notes:tt,fill:st||ie===null,onHide:st?void 0:()=>fr("notes"),onSendNote:ie===null||!Ce.noteSendable?null:oe=>{const ye=ie.cwd;T({cwd:ye,...ie.agent!==null?{agent:ie.agent}:{},onOpened:Qe=>{i.send({type:"notes.send",noteId:oe,terminalId:Qe.terminalId}),st&&We("chat")}})},sendTargetCwd:(ie==null?void 0:ie.cwd)??null}):null,Ka=ie===null||!dt.isVisible("console")?null:l.jsx(l.Fragment,{children:ar?l.jsxs(l.Fragment,{children:[cn&&l.jsx("div",{className:"hdivider",...Hs,title:C("app.divider.consoleHeight")}),l.jsx("div",{className:"console-slot",style:cn?{height:`${Zr}px`}:{flex:"1 1 auto"},children:vo})]}):l.jsxs("div",{className:"strip-collapsed-row",children:[l.jsxs("button",{className:"strip-collapsed",onClick:qn,title:Wn===null?C("console.openAnyIn",{cwd:ie.cwd}):C("console.openIn",{shell:Wn,cwd:ie.cwd}),children:[l.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),l.jsx("span",{children:Wn??C("console.name")}),Ht.length>0&&l.jsx("span",{className:"strip-collapsed-count",children:Ht.length})]}),l.jsx(Ta,{title:C("settings.hide.console"),onHide:()=>fr("console"),confirmText:m.length===0?null:C("settings.panels.consoleConfirm",{count:m.length})})]})}),wo=l.jsxs(l.Fragment,{children:[h==="revoked"&&l.jsx("div",{className:"banner banner-error",children:C("app.banner.revoked")}),ro!==null&&l.jsxs("div",{className:"banner banner-notice",children:[l.jsx("span",{children:C("settings.hiddenHint",{name:C(ro==="console"?"console.name":"notes.name")})}),l.jsx("button",{className:"banner-close",onClick:()=>ni(null),title:C("common.gotIt"),children:"×"})]}),!c&&_!==null&&l.jsx("div",{className:"banner banner-error banner-lines",children:_}),S==="child-session-marker"&&so&&l.jsxs("div",{className:"banner banner-notice",children:[l.jsx("span",{children:Ft("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),l.jsx("button",{className:"banner-close",onClick:qa,title:C("common.gotIt"),children:"×"})]}),E!==null&&l.jsxs("div",{className:"banner banner-error",children:[l.jsx("span",{children:E.message}),l.jsx("button",{className:"banner-close",onClick:M,title:C("common.close"),children:"×"})]}),Je.problem!==null&&!lt&&l.jsxs("div",{className:"banner banner-error",children:[l.jsx("span",{children:Je.problem}),l.jsx("button",{className:"banner-close",onClick:Je.dismissProblem,title:C("common.close"),children:"×"})]}),l.jsx(_S,{})]}),bo=l.jsxs(l.Fragment,{children:[rr&&Ee!==null&&fe!==null&&l.jsx(gS,{info:Ee,agentLabel:fe.label,onRefresh:$,onClose:()=>Xt(!1)}),ti&&l.jsx(Qk,{onClose:()=>is(!1),terminalTheme:J,panels:dt,consoleCount:st?0:m.length,onHideConsole:pr,appSettings:ei,agents:v,remoteClient:K,onOpenVault:()=>{is(!1),ct(!0)},onOpenRemote:$e.status!==null&&!K?()=>{is(!1),Ve(!0)}:null}),$a&&l.jsx(fS,{agent:xy(Ae,v,R),onClose:()=>gt(!1)}),si==="project"&&l.jsx(Uf,{connection:i,title:C("app.picker.project.title"),confirmLabel:C("app.picker.project.confirm"),confirmTitle:oe=>C("app.picker.project.confirmTitle",{path:oe}),onChoose:(oe,ye)=>{At(null),T({cwd:ye})},onClose:()=>At(null)}),lt&&l.jsx(Zk,{status:Je.status,agents:v,indexReady:D.state==="ready",problem:Je.problem,covered:si==="vault",onMeasure:Je.measure,onSetEnabled:Je.setEnabled,onChangeDir:()=>At("vault"),onReveal:K?null:Je.reveal,onDismissProblem:Je.dismissProblem,onClose:()=>ct(!1)}),Ze&&$e.status!==null&&!K&&l.jsx(hk,{status:$e.status,pairing:$e.pairing,phonePairing:$e.phonePairing,phoneStarted:$e.phoneStarted,problem:$e.problem,platform:u,onSetEnabled:$e.setEnabled,onSetPort:$e.setPort,onStartPairing:$e.startPairing,onCancelPairing:$e.cancelPairing,onStartPhonePairing:$e.startPhonePairing,onCancelPhonePairing:$e.cancelPhonePairing,onRenameDevice:$e.renameDevice,onRevokeDevice:$e.revokeDevice,onDismissProblem:$e.dismissProblem,onClose:()=>Ve(!1)}),si==="vault"&&l.jsx(Uf,{connection:i,title:C("app.picker.vault.title"),confirmLabel:C("app.picker.vault.confirm"),confirmTitle:oe=>C("app.picker.vault.confirmTitle",{path:oe}),onChoose:oe=>{Je.chooseDir(oe),At(null)},onClose:()=>At(null)})]});return st?l.jsxs("div",{className:"app app-narrow",children:[l.jsx(Sk,{banners:wo,status:h,statusLabel:C(bp[h]),terminals:f,activeTerminalId:d,activity:U,agents:v,offerAgentChoice:r,newTabAgent:Se,canOpen:c&&y.length>0,newTabBlockedTitle:et,onSelectTab:Le,onCloseTab:B,onRenameTab:X,onNewTab:oe=>T({cwd:Fe,...oe!==void 0?{agent:oe}:{}}),drawer:mo,drawerOpen:Re,onDrawerChange:ze,menu:{cwd:(ie==null?void 0:ie.cwd)??null,cliVersion:g,themeIcon:op[W.preference],themeTitle:ip(W.preference),onCycleTheme:W.cycle,sound:pe,remote:$e.status!==null&&!K?{title:`${C("app.header.remoteAccess")} — ${hu($e.status.state,$e.status.port)}`,active:pp($e.status),onOpen:()=>Ve(!0)}:null,remoteClient:K,onShortcuts:()=>gt(!0),onSettings:()=>is(!0)},view:Te,views:rt,onViewChange:We,badges:{changes:og(ot.status),plans:ii.plans.length,memory:((Co=cr.status)==null?void 0:Co.installed)===!0?cr.status.notes.length:0,cliUnseen:cs},chat:l.jsxs(l.Fragment,{children:[go,_o]}),panel:_r,notes:yo,console:vo,onTerminalKey:ls===null?null:oo}),bo]}):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-${h}`,children:C(bp[h])}),ie!==null&&l.jsx("span",{className:"meta",title:ie.cwd,children:ie.cwd}),l.jsx("span",{className:"header-spacer"}),g!==null&&l.jsx("span",{className:"meta meta-dim",children:C("app.header.cliVersion",{version:g})}),l.jsx("button",{className:"icon-button",onClick:W.cycle,title:ip(W.preference),children:op[W.preference]}),l.jsx(pg,{sound:pe}),l.jsx(mg,{notify:pe.notify}),$e.status!==null&&!K&&l.jsx("button",{className:`icon-button${pp($e.status)?" icon-button-on":""}`,onClick:()=>Ve(!0),title:`${C("app.header.remoteAccess")} — ${hu($e.status.state,$e.status.port)}`,children:"⇄"}),K&&l.jsx("span",{className:"remote-badge",title:C("app.header.remoteBadgeTitle"),children:C("app.header.remoteBadge")}),l.jsx("button",{className:"icon-button",onClick:()=>is(!0),title:C("settings.open"),"aria-label":C("settings.open"),children:"⚙"}),l.jsx("button",{className:"icon-button",onClick:()=>gt(!0),title:C("app.header.shortcuts"),children:"?"})]}),wo,l.jsxs("div",{className:"app-body",children:[!Qr&&l.jsxs("button",{className:"panel-peek panel-peek-left",onClick:us,title:C("app.sidebar.show"),children:[l.jsx("span",{className:"panel-peek-arrow",children:"»"}),l.jsx("span",{className:"panel-peek-label",children:C("app.sidebar.name")})]}),Qr&&mo,Qr&&l.jsx("div",{className:"divider",...hs,title:C("app.divider.width")}),l.jsxs("main",{className:`workspace${os&&_n?" workspace-narrow":""}`,children:[l.jsx(PC,{terminals:f,activeTerminalId:d,activity:U,canOpen:c&&y.length>0,onSelect:Le,onClose:B,onRename:X,onReorder:G,onNew:oe=>T({cwd:Fe,...oe!==void 0?{agent:oe}:{}}),agents:v,offerAgentChoice:r,newTabAgent:Se,pendingOpens:p,platform:u,newTabBlockedTitle:et,sessionTitles:_e}),go,_o]}),l.jsxs(l.Fragment,{children:[!_n&&l.jsxs("button",{className:"panel-peek",onClick:bn,title:C("app.panel.show"),children:[l.jsx("span",{className:"panel-peek-arrow",children:"«"}),l.jsx("span",{className:"panel-peek-label",children:C("app.panel.name")})]}),_n&&l.jsx("div",{className:"divider",...Kt,title:C("app.divider.width")}),l.jsxs("div",{className:`panel-slot${_n?"":" panel-slot-collapsed"}${_n&&os?" panel-slot-expanded":""}`,style:_n&&!os?{width:`${Is}px`}:void 0,children:[ie!==null&&l.jsxs(l.Fragment,{children:[_r,Ka]}),yo]})]})]}),bo]})}const wg=document.getElementById("root");if(wg===null)throw new Error("Falta el contenedor #root.");const lE=W_.createRoot(wg);ub().then(()=>lE.render(l.jsx(aE,{})));export{j_ as g};