agent-workbench 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,139 +0,0 @@
1
- var q_=Object.defineProperty;var K_=(t,n,i)=>n in t?q_(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i;var It=(t,n,i)=>K_(t,typeof n!="symbol"?n+"":n,i);(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const g of document.querySelectorAll('link[rel="modulepreload"]'))c(g);new MutationObserver(g=>{for(const T of g)if(T.type==="childList")for(const C of T.addedNodes)C.tagName==="LINK"&&C.rel==="modulepreload"&&c(C)}).observe(document,{childList:!0,subtree:!0});function i(g){const T={};return g.integrity&&(T.integrity=g.integrity),g.referrerPolicy&&(T.referrerPolicy=g.referrerPolicy),g.crossOrigin==="use-credentials"?T.credentials="include":g.crossOrigin==="anonymous"?T.credentials="omit":T.credentials="same-origin",T}function c(g){if(g.ep)return;g.ep=!0;const T=i(g);fetch(g.href,T)}})();function G_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lc={exports:{}},Ki={},Tc={exports:{}},at={};/**
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 Yd;function Y_(){if(Yd)return at;Yd=1;var t=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),C=Symbol.for("react.context"),r=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),_=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),h=Symbol.iterator;function w(H){return H===null||typeof H!="object"?null:(H=h&&H[h]||H["@@iterator"],typeof H=="function"?H:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,f={};function a(H,K,te){this.props=H,this.context=K,this.refs=f,this.updater=te||k}a.prototype.isReactComponent={},a.prototype.setState=function(H,K){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,K,"setState")},a.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function p(){}p.prototype=a.prototype;function m(H,K,te){this.props=H,this.context=K,this.refs=f,this.updater=te||k}var d=m.prototype=new p;d.constructor=m,L(d,a.prototype),d.isPureReactComponent=!0;var x=Array.isArray,I=Object.prototype.hasOwnProperty,E={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function b(H,K,te){var re,le={},de=null,G=null;if(K!=null)for(re in K.ref!==void 0&&(G=K.ref),K.key!==void 0&&(de=""+K.key),K)I.call(K,re)&&!M.hasOwnProperty(re)&&(le[re]=K[re]);var z=arguments.length-2;if(z===1)le.children=te;else if(1<z){for(var Q=Array(z),Z=0;Z<z;Z++)Q[Z]=arguments[Z+2];le.children=Q}if(H&&H.defaultProps)for(re in z=H.defaultProps,z)le[re]===void 0&&(le[re]=z[re]);return{$$typeof:t,type:H,key:de,ref:G,props:le,_owner:E.current}}function R(H,K){return{$$typeof:t,type:H.type,key:K,ref:H.ref,props:H.props,_owner:H._owner}}function D(H){return typeof H=="object"&&H!==null&&H.$$typeof===t}function B(H){var K={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(te){return K[te]})}var O=/\/+/g;function F(H,K){return typeof H=="object"&&H!==null&&H.key!=null?B(""+H.key):K.toString(36)}function U(H,K,te,re,le){var de=typeof H;(de==="undefined"||de==="boolean")&&(H=null);var G=!1;if(H===null)G=!0;else switch(de){case"string":case"number":G=!0;break;case"object":switch(H.$$typeof){case t:case n:G=!0}}if(G)return G=H,le=le(G),H=re===""?"."+F(G,0):re,x(le)?(te="",H!=null&&(te=H.replace(O,"$&/")+"/"),U(le,K,te,"",function(Z){return Z})):le!=null&&(D(le)&&(le=R(le,te+(!le.key||G&&G.key===le.key?"":(""+le.key).replace(O,"$&/")+"/")+H)),K.push(le)),1;if(G=0,re=re===""?".":re+":",x(H))for(var z=0;z<H.length;z++){de=H[z];var Q=re+F(de,z);G+=U(de,K,te,Q,le)}else if(Q=w(H),typeof Q=="function")for(H=Q.call(H),z=0;!(de=H.next()).done;)de=de.value,Q=re+F(de,z++),G+=U(de,K,te,Q,le);else if(de==="object")throw K=String(H),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.");return G}function q(H,K,te){if(H==null)return H;var re=[],le=0;return U(H,re,"","",function(de){return K.call(te,de,le++)}),re}function X(H){if(H._status===-1){var K=H._result;K=K(),K.then(function(te){(H._status===0||H._status===-1)&&(H._status=1,H._result=te)},function(te){(H._status===0||H._status===-1)&&(H._status=2,H._result=te)}),H._status===-1&&(H._status=0,H._result=K)}if(H._status===1)return H._result.default;throw H._result}var Y={current:null},V={transition:null},j={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:V,ReactCurrentOwner:E};function $(){throw Error("act(...) is not supported in production builds of React.")}return at.Children={map:q,forEach:function(H,K,te){q(H,function(){K.apply(this,arguments)},te)},count:function(H){var K=0;return q(H,function(){K++}),K},toArray:function(H){return q(H,function(K){return K})||[]},only:function(H){if(!D(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},at.Component=a,at.Fragment=i,at.Profiler=g,at.PureComponent=m,at.StrictMode=c,at.Suspense=u,at.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j,at.act=$,at.cloneElement=function(H,K,te){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var re=L({},H.props),le=H.key,de=H.ref,G=H._owner;if(K!=null){if(K.ref!==void 0&&(de=K.ref,G=E.current),K.key!==void 0&&(le=""+K.key),H.type&&H.type.defaultProps)var z=H.type.defaultProps;for(Q in K)I.call(K,Q)&&!M.hasOwnProperty(Q)&&(re[Q]=K[Q]===void 0&&z!==void 0?z[Q]:K[Q])}var Q=arguments.length-2;if(Q===1)re.children=te;else if(1<Q){z=Array(Q);for(var Z=0;Z<Q;Z++)z[Z]=arguments[Z+2];re.children=z}return{$$typeof:t,type:H.type,key:le,ref:de,props:re,_owner:G}},at.createContext=function(H){return H={$$typeof:C,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:T,_context:H},H.Consumer=H},at.createElement=b,at.createFactory=function(H){var K=b.bind(null,H);return K.type=H,K},at.createRef=function(){return{current:null}},at.forwardRef=function(H){return{$$typeof:r,render:H}},at.isValidElement=D,at.lazy=function(H){return{$$typeof:v,_payload:{_status:-1,_result:H},_init:X}},at.memo=function(H,K){return{$$typeof:_,type:H,compare:K===void 0?null:K}},at.startTransition=function(H){var K=V.transition;V.transition={};try{H()}finally{V.transition=K}},at.unstable_act=$,at.useCallback=function(H,K){return Y.current.useCallback(H,K)},at.useContext=function(H){return Y.current.useContext(H)},at.useDebugValue=function(){},at.useDeferredValue=function(H){return Y.current.useDeferredValue(H)},at.useEffect=function(H,K){return Y.current.useEffect(H,K)},at.useId=function(){return Y.current.useId()},at.useImperativeHandle=function(H,K,te){return Y.current.useImperativeHandle(H,K,te)},at.useInsertionEffect=function(H,K){return Y.current.useInsertionEffect(H,K)},at.useLayoutEffect=function(H,K){return Y.current.useLayoutEffect(H,K)},at.useMemo=function(H,K){return Y.current.useMemo(H,K)},at.useReducer=function(H,K,te){return Y.current.useReducer(H,K,te)},at.useRef=function(H){return Y.current.useRef(H)},at.useState=function(H){return Y.current.useState(H)},at.useSyncExternalStore=function(H,K,te){return Y.current.useSyncExternalStore(H,K,te)},at.useTransition=function(){return Y.current.useTransition()},at.version="18.3.1",at}var Xd;function Eu(){return Xd||(Xd=1,Tc.exports=Y_()),Tc.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 Qd;function X_(){if(Qd)return Ki;Qd=1;var t=Eu(),n=Symbol.for("react.element"),i=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,g=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,T={key:!0,ref:!0,__self:!0,__source:!0};function C(r,u,_){var v,h={},w=null,k=null;_!==void 0&&(w=""+_),u.key!==void 0&&(w=""+u.key),u.ref!==void 0&&(k=u.ref);for(v in u)c.call(u,v)&&!T.hasOwnProperty(v)&&(h[v]=u[v]);if(r&&r.defaultProps)for(v in u=r.defaultProps,u)h[v]===void 0&&(h[v]=u[v]);return{$$typeof:n,type:r,key:w,ref:k,props:h,_owner:g.current}}return Ki.Fragment=i,Ki.jsx=C,Ki.jsxs=C,Ki}var Jd;function Q_(){return Jd||(Jd=1,Lc.exports=X_()),Lc.exports}var l=Q_(),Tl={},Rc={exports:{}},hn={},Mc={exports:{}},Ac={};/**
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 Zd;function J_(){return Zd||(Zd=1,(function(t){function n(V,j){var $=V.length;V.push(j);e:for(;0<$;){var H=$-1>>>1,K=V[H];if(0<g(K,j))V[H]=j,V[$]=K,$=H;else break e}}function i(V){return V.length===0?null:V[0]}function c(V){if(V.length===0)return null;var j=V[0],$=V.pop();if($!==j){V[0]=$;e:for(var H=0,K=V.length,te=K>>>1;H<te;){var re=2*(H+1)-1,le=V[re],de=re+1,G=V[de];if(0>g(le,$))de<K&&0>g(G,le)?(V[H]=G,V[de]=$,H=de):(V[H]=le,V[re]=$,H=re);else if(de<K&&0>g(G,$))V[H]=G,V[de]=$,H=de;else break e}}return j}function g(V,j){var $=V.sortIndex-j.sortIndex;return $!==0?$:V.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var T=performance;t.unstable_now=function(){return T.now()}}else{var C=Date,r=C.now();t.unstable_now=function(){return C.now()-r}}var u=[],_=[],v=1,h=null,w=3,k=!1,L=!1,f=!1,a=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(V){for(var j=i(_);j!==null;){if(j.callback===null)c(_);else if(j.startTime<=V)c(_),j.sortIndex=j.expirationTime,n(u,j);else break;j=i(_)}}function x(V){if(f=!1,d(V),!L)if(i(u)!==null)L=!0,X(I);else{var j=i(_);j!==null&&Y(x,j.startTime-V)}}function I(V,j){L=!1,f&&(f=!1,p(b),b=-1),k=!0;var $=w;try{for(d(j),h=i(u);h!==null&&(!(h.expirationTime>j)||V&&!B());){var H=h.callback;if(typeof H=="function"){h.callback=null,w=h.priorityLevel;var K=H(h.expirationTime<=j);j=t.unstable_now(),typeof K=="function"?h.callback=K:h===i(u)&&c(u),d(j)}else c(u);h=i(u)}if(h!==null)var te=!0;else{var re=i(_);re!==null&&Y(x,re.startTime-j),te=!1}return te}finally{h=null,w=$,k=!1}}var E=!1,M=null,b=-1,R=5,D=-1;function B(){return!(t.unstable_now()-D<R)}function O(){if(M!==null){var V=t.unstable_now();D=V;var j=!0;try{j=M(!0,V)}finally{j?F():(E=!1,M=null)}}else E=!1}var F;if(typeof m=="function")F=function(){m(O)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,q=U.port2;U.port1.onmessage=O,F=function(){q.postMessage(null)}}else F=function(){a(O,0)};function X(V){M=V,E||(E=!0,F())}function Y(V,j){b=a(function(){V(t.unstable_now())},j)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(V){V.callback=null},t.unstable_continueExecution=function(){L||k||(L=!0,X(I))},t.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<V?Math.floor(1e3/V):5},t.unstable_getCurrentPriorityLevel=function(){return w},t.unstable_getFirstCallbackNode=function(){return i(u)},t.unstable_next=function(V){switch(w){case 1:case 2:case 3:var j=3;break;default:j=w}var $=w;w=j;try{return V()}finally{w=$}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(V,j){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var $=w;w=V;try{return j()}finally{w=$}},t.unstable_scheduleCallback=function(V,j,$){var H=t.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?H+$:H):$=H,V){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=$+K,V={id:v++,callback:j,priorityLevel:V,startTime:$,expirationTime:K,sortIndex:-1},$>H?(V.sortIndex=$,n(_,V),i(u)===null&&V===i(_)&&(f?(p(b),b=-1):f=!0,Y(x,$-H))):(V.sortIndex=K,n(u,V),L||k||(L=!0,X(I))),V},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(V){var j=w;return function(){var $=w;w=j;try{return V.apply(this,arguments)}finally{w=$}}}})(Ac)),Ac}var ef;function Z_(){return ef||(ef=1,Mc.exports=J_()),Mc.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 tf;function ev(){if(tf)return hn;tf=1;var t=Eu(),n=Z_();function i(e){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+e+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c=new Set,g={};function T(e,s){C(e,s),C(e+"Capture",s)}function C(e,s){for(g[e]=s,e=0;e<s.length;e++)c.add(s[e])}var r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,_=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},h={};function w(e){return u.call(h,e)?!0:u.call(v,e)?!1:_.test(e)?h[e]=!0:(v[e]=!0,!1)}function k(e,s,o,y){if(o!==null&&o.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return y?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function L(e,s,o,y){if(s===null||typeof s>"u"||k(e,s,o,y))return!0;if(y)return!1;if(o!==null)switch(o.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function f(e,s,o,y,A,P,W){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=y,this.attributeNamespace=A,this.mustUseProperty=o,this.propertyName=e,this.type=s,this.sanitizeURL=P,this.removeEmptyString=W}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 s=e[0];a[s]=new f(s,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 p=/[\-:]([a-z])/g;function m(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 s=e.replace(p,m);a[s]=new f(s,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var s=e.replace(p,m);a[s]=new f(s,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var s=e.replace(p,m);a[s]=new f(s,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,s,o,y){var A=a.hasOwnProperty(s)?a[s]:null;(A!==null?A.type!==0:y||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(L(s,o,A,y)&&(o=null),y||A===null?w(s)&&(o===null?e.removeAttribute(s):e.setAttribute(s,""+o)):A.mustUseProperty?e[A.propertyName]=o===null?A.type===3?!1:"":o:(s=A.attributeName,y=A.attributeNamespace,o===null?e.removeAttribute(s):(A=A.type,o=A===3||A===4&&o===!0?"":""+o,y?e.setAttributeNS(y,s,o):e.setAttribute(s,o))))}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),E=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),D=Symbol.for("react.provider"),B=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),V=Symbol.iterator;function j(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var $=Object.assign,H;function K(e){if(H===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);H=s&&s[1]||""}return`
34
- `+H+e}var te=!1;function re(e,s){if(!e||te)return"";te=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(ce){var y=ce}Reflect.construct(e,[],s)}else{try{s.call()}catch(ce){y=ce}e.call(s.prototype)}else{try{throw Error()}catch(ce){y=ce}e()}}catch(ce){if(ce&&y&&typeof ce.stack=="string"){for(var A=ce.stack.split(`
35
- `),P=y.stack.split(`
36
- `),W=A.length-1,J=P.length-1;1<=W&&0<=J&&A[W]!==P[J];)J--;for(;1<=W&&0<=J;W--,J--)if(A[W]!==P[J]){if(W!==1||J!==1)do if(W--,J--,0>J||A[W]!==P[J]){var ee=`
37
- `+A[W].replace(" at new "," at ");return e.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",e.displayName)),ee}while(1<=W&&0<=J);break}}}finally{te=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?K(e):""}function le(e){switch(e.tag){case 5:return K(e.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("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 R:return"Profiler";case b:return"StrictMode";case F:return"Suspense";case U:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case B:return(e.displayName||"Context")+".Consumer";case D:return(e._context.displayName||"Context")+".Provider";case O:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return s=e.displayName||null,s!==null?s:de(e.type)||"Memo";case X:s=e._payload,e=e._init;try{return de(e(s))}catch{}}return null}function G(e){var s=e.type;switch(e.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=s.render,e=e.displayName||e.name||"",s.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return de(s);case 8:return s===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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function z(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Q(e){var s=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Z(e){var s=Q(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,s),y=""+e[s];if(!e.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var A=o.get,P=o.set;return Object.defineProperty(e,s,{configurable:!0,get:function(){return A.call(this)},set:function(W){y=""+W,P.call(this,W)}}),Object.defineProperty(e,s,{enumerable:o.enumerable}),{getValue:function(){return y},setValue:function(W){y=""+W},stopTracking:function(){e._valueTracker=null,delete e[s]}}}}function ae(e){e._valueTracker||(e._valueTracker=Z(e))}function fe(e){if(!e)return!1;var s=e._valueTracker;if(!s)return!0;var o=s.getValue(),y="";return e&&(y=Q(e)?e.checked?"true":"false":e.value),e=y,e!==o?(s.setValue(e),!0):!1}function Ee(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 Ae(e,s){var o=s.checked;return $({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function ze(e,s){var o=s.defaultValue==null?"":s.defaultValue,y=s.checked!=null?s.checked:s.defaultChecked;o=z(s.value!=null?s.value:o),e._wrapperState={initialChecked:y,initialValue:o,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function ue(e,s){s=s.checked,s!=null&&d(e,"checked",s,!1)}function Me(e,s){ue(e,s);var o=z(s.value),y=s.type;if(o!=null)y==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(y==="submit"||y==="reset"){e.removeAttribute("value");return}s.hasOwnProperty("value")?Te(e,s.type,o):s.hasOwnProperty("defaultValue")&&Te(e,s.type,z(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(e.defaultChecked=!!s.defaultChecked)}function he(e,s,o){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var y=s.type;if(!(y!=="submit"&&y!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+e._wrapperState.initialValue,o||s===e.value||(e.value=s),e.defaultValue=s}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function Te(e,s,o){(s!=="number"||Ee(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var ge=Array.isArray;function Re(e,s,o,y){if(e=e.options,s){s={};for(var A=0;A<o.length;A++)s["$"+o[A]]=!0;for(o=0;o<e.length;o++)A=s.hasOwnProperty("$"+e[o].value),e[o].selected!==A&&(e[o].selected=A),A&&y&&(e[o].defaultSelected=!0)}else{for(o=""+z(o),s=null,A=0;A<e.length;A++){if(e[A].value===o){e[A].selected=!0,y&&(e[A].defaultSelected=!0);return}s!==null||e[A].disabled||(s=e[A])}s!==null&&(s.selected=!0)}}function Ue(e,s){if(s.dangerouslySetInnerHTML!=null)throw Error(i(91));return $({},s,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ke(e,s){var o=s.value;if(o==null){if(o=s.children,s=s.defaultValue,o!=null){if(s!=null)throw Error(i(92));if(ge(o)){if(1<o.length)throw Error(i(93));o=o[0]}s=o}s==null&&(s=""),o=s}e._wrapperState={initialValue:z(o)}}function Ne(e,s){var o=z(s.value),y=z(s.defaultValue);o!=null&&(o=""+o,o!==e.value&&(e.value=o),s.defaultValue==null&&e.defaultValue!==o&&(e.defaultValue=o)),y!=null&&(e.defaultValue=""+y)}function st(e){var s=e.textContent;s===e._wrapperState.initialValue&&s!==""&&s!==null&&(e.value=s)}function ot(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 wt(e,s){return e==null||e==="http://www.w3.org/1999/xhtml"?ot(s):e==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ct,bt=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,o,y,A){MSApp.execUnsafeLocalFunction(function(){return e(s,o,y,A)})}:e})(function(e,s){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=s;else{for(ct=ct||document.createElement("div"),ct.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=ct.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;s.firstChild;)e.appendChild(s.firstChild)}});function Pe(e,s){if(s){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=s;return}}e.textContent=s}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},qe=["Webkit","ms","Moz","O"];Object.keys(Ze).forEach(function(e){qe.forEach(function(s){s=s+e.charAt(0).toUpperCase()+e.substring(1),Ze[s]=Ze[e]})});function et(e,s,o){return s==null||typeof s=="boolean"||s===""?"":o||typeof s!="number"||s===0||Ze.hasOwnProperty(e)&&Ze[e]?(""+s).trim():s+"px"}function Gt(e,s){e=e.style;for(var o in s)if(s.hasOwnProperty(o)){var y=o.indexOf("--")===0,A=et(o,s[o],y);o==="float"&&(o="cssFloat"),y?e.setProperty(o,A):e[o]=A}}var pt=$({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 it(e,s){if(s){if(pt[e]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(i(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(i(61))}if(s.style!=null&&typeof s.style!="object")throw Error(i(62))}}function pe(e,s){if(e.indexOf("-")===-1)return typeof s.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 Ke=null;function Xe(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xe=null,be=null,tt=null;function Ce(e){if(e=Ni(e)){if(typeof xe!="function")throw Error(i(280));var s=e.stateNode;s&&(s=Wo(s),xe(e.stateNode,e.type,s))}}function rt(e){be?tt?tt.push(e):tt=[e]:be=e}function St(){if(be){var e=be,s=tt;if(tt=be=null,Ce(e),s)for(e=0;e<s.length;e++)Ce(s[e])}}function gt(e,s){return e(s)}function Qe(){}var ht=!1;function Ot(e,s,o){if(ht)return e(s,o);ht=!0;try{return gt(e,s,o)}finally{ht=!1,(be!==null||tt!==null)&&(Qe(),St())}}function Nt(e,s){var o=e.stateNode;if(o===null)return null;var y=Wo(o);if(y===null)return null;o=y[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(e=e.type,y=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!y;break e;default:e=!1}if(e)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var Tn=!1;if(r)try{var ns={};Object.defineProperty(ns,"passive",{get:function(){Tn=!0}}),window.addEventListener("test",ns,ns),window.removeEventListener("test",ns,ns)}catch{Tn=!1}function ii(e,s,o,y,A,P,W,J,ee){var ce=Array.prototype.slice.call(arguments,3);try{s.apply(o,ce)}catch(we){this.onError(we)}}var ss=!1,pn=null,rs=!1,vs=null,Ks={onError:function(e){ss=!0,pn=e}};function me(e,s,o,y,A,P,W,J,ee){ss=!1,pn=null,ii.apply(Ks,arguments)}function je(e,s,o,y,A,P,W,J,ee){if(me.apply(this,arguments),ss){if(ss){var ce=pn;ss=!1,pn=null}else throw Error(i(198));rs||(rs=!0,vs=ce)}}function Ve(e){var s=e,o=e;if(e.alternate)for(;s.return;)s=s.return;else{e=s;do s=e,(s.flags&4098)!==0&&(o=s.return),e=s.return;while(e)}return s.tag===3?o:null}function _t(e){if(e.tag===13){var s=e.memoizedState;if(s===null&&(e=e.alternate,e!==null&&(s=e.memoizedState)),s!==null)return s.dehydrated}return null}function ut(e){if(Ve(e)!==e)throw Error(i(188))}function mn(e){var s=e.alternate;if(!s){if(s=Ve(e),s===null)throw Error(i(188));return s!==e?null:e}for(var o=e,y=s;;){var A=o.return;if(A===null)break;var P=A.alternate;if(P===null){if(y=A.return,y!==null){o=y;continue}break}if(A.child===P.child){for(P=A.child;P;){if(P===o)return ut(A),e;if(P===y)return ut(A),s;P=P.sibling}throw Error(i(188))}if(o.return!==y.return)o=A,y=P;else{for(var W=!1,J=A.child;J;){if(J===o){W=!0,o=A,y=P;break}if(J===y){W=!0,y=A,o=P;break}J=J.sibling}if(!W){for(J=P.child;J;){if(J===o){W=!0,o=P,y=A;break}if(J===y){W=!0,y=P,o=A;break}J=J.sibling}if(!W)throw Error(i(189))}}if(o.alternate!==y)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?e:s}function Rn(e){return e=mn(e),e!==null?ws(e):null}function ws(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var s=ws(e);if(s!==null)return s;e=e.sibling}return null}var uo=n.unstable_scheduleCallback,ho=n.unstable_cancelCallback,fo=n.unstable_shouldYield,Jl=n.unstable_requestPaint,Rt=n.unstable_now,Zl=n.unstable_getCurrentPriorityLevel,oi=n.unstable_ImmediatePriority,yr=n.unstable_UserBlockingPriority,ys=n.unstable_NormalPriority,ea=n.unstable_LowPriority,bs=n.unstable_IdlePriority,is=null,gn=null;function po(e){if(gn&&typeof gn.onCommitFiberRoot=="function")try{gn.onCommitFiberRoot(is,e,void 0,(e.current.flags&128)===128)}catch{}}var _n=Math.clz32?Math.clz32:Ss,li=Math.log,ai=Math.LN2;function Ss(e){return e>>>=0,e===0?32:31-(li(e)/ai|0)|0}var $n=64,os=4194304;function Un(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 Mn(e,s){var o=e.pendingLanes;if(o===0)return 0;var y=0,A=e.suspendedLanes,P=e.pingedLanes,W=o&268435455;if(W!==0){var J=W&~A;J!==0?y=Un(J):(P&=W,P!==0&&(y=Un(P)))}else W=o&~A,W!==0?y=Un(W):P!==0&&(y=Un(P));if(y===0)return 0;if(s!==0&&s!==y&&(s&A)===0&&(A=y&-y,P=s&-s,A>=P||A===16&&(P&4194240)!==0))return s;if((y&4)!==0&&(y|=o&16),s=e.entangledLanes,s!==0)for(e=e.entanglements,s&=y;0<s;)o=31-_n(s),A=1<<o,y|=e[o],s&=~A;return y}function ci(e,s){switch(e){case 1:case 2:case 4:return s+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function bn(e,s){for(var o=e.suspendedLanes,y=e.pingedLanes,A=e.expirationTimes,P=e.pendingLanes;0<P;){var W=31-_n(P),J=1<<W,ee=A[W];ee===-1?((J&o)===0||(J&y)!==0)&&(A[W]=ci(J,s)):ee<=s&&(e.expiredLanes|=J),P&=~J}}function ui(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function hi(){var e=$n;return $n<<=1,($n&4194240)===0&&($n=64),e}function Wn(e){for(var s=[],o=0;31>o;o++)s.push(e);return s}function zn(e,s,o){e.pendingLanes|=s,s!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,s=31-_n(s),e[s]=o}function ta(e,s){var o=e.pendingLanes&~s;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=s,e.mutableReadLanes&=s,e.entangledLanes&=s,s=e.entanglements;var y=e.eventTimes;for(e=e.expirationTimes;0<o;){var A=31-_n(o),P=1<<A;s[A]=0,y[A]=-1,e[A]=-1,o&=~P}}function Ft(e,s){var o=e.entangledLanes|=s;for(e=e.entanglements;o;){var y=31-_n(o),A=1<<y;A&s|e[y]&s&&(e[y]|=s),o&=~A}}var dt=0;function di(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var mo,br,go,fi,pi,Gs=!1,Sr=[],An=null,Nn=null,Dn=null,Cs=new Map,Ys=new Map,Vn=[],_o="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 Cr(e,s){switch(e){case"focusin":case"focusout":An=null;break;case"dragenter":case"dragleave":Nn=null;break;case"mouseover":case"mouseout":Dn=null;break;case"pointerover":case"pointerout":Cs.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ys.delete(s.pointerId)}}function xs(e,s,o,y,A,P){return e===null||e.nativeEvent!==P?(e={blockedOn:s,domEventName:o,eventSystemFlags:y,nativeEvent:P,targetContainers:[A]},s!==null&&(s=Ni(s),s!==null&&br(s)),e):(e.eventSystemFlags|=y,s=e.targetContainers,A!==null&&s.indexOf(A)===-1&&s.push(A),e)}function mi(e,s,o,y,A){switch(s){case"focusin":return An=xs(An,e,s,o,y,A),!0;case"dragenter":return Nn=xs(Nn,e,s,o,y,A),!0;case"mouseover":return Dn=xs(Dn,e,s,o,y,A),!0;case"pointerover":var P=A.pointerId;return Cs.set(P,xs(Cs.get(P)||null,e,s,o,y,A)),!0;case"gotpointercapture":return P=A.pointerId,Ys.set(P,xs(Ys.get(P)||null,e,s,o,y,A)),!0}return!1}function xr(e){var s=ir(e.target);if(s!==null){var o=Ve(s);if(o!==null){if(s=o.tag,s===13){if(s=_t(o),s!==null){e.blockedOn=s,pi(e.priority,function(){go(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){e.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}e.blockedOn=null}function kr(e){if(e.blockedOn!==null)return!1;for(var s=e.targetContainers;0<s.length;){var o=Js(e.domEventName,e.eventSystemFlags,s[0],e.nativeEvent);if(o===null){o=e.nativeEvent;var y=new o.constructor(o.type,o);Ke=y,o.target.dispatchEvent(y),Ke=null}else return s=Ni(o),s!==null&&br(s),e.blockedOn=o,!1;s.shift()}return!0}function vo(e,s,o){kr(e)&&o.delete(s)}function na(){Gs=!1,An!==null&&kr(An)&&(An=null),Nn!==null&&kr(Nn)&&(Nn=null),Dn!==null&&kr(Dn)&&(Dn=null),Cs.forEach(vo),Ys.forEach(vo)}function ks(e,s){e.blockedOn===s&&(e.blockedOn=null,Gs||(Gs=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,na)))}function rn(e){function s(A){return ks(A,e)}if(0<Sr.length){ks(Sr[0],e);for(var o=1;o<Sr.length;o++){var y=Sr[o];y.blockedOn===e&&(y.blockedOn=null)}}for(An!==null&&ks(An,e),Nn!==null&&ks(Nn,e),Dn!==null&&ks(Dn,e),Cs.forEach(s),Ys.forEach(s),o=0;o<Vn.length;o++)y=Vn[o],y.blockedOn===e&&(y.blockedOn=null);for(;0<Vn.length&&(o=Vn[0],o.blockedOn===null);)xr(o),o.blockedOn===null&&Vn.shift()}var Xs=x.ReactCurrentBatchConfig,Er=!0;function wo(e,s,o,y){var A=dt,P=Xs.transition;Xs.transition=null;try{dt=1,Lr(e,s,o,y)}finally{dt=A,Xs.transition=P}}function Es(e,s,o,y){var A=dt,P=Xs.transition;Xs.transition=null;try{dt=4,Lr(e,s,o,y)}finally{dt=A,Xs.transition=P}}function Lr(e,s,o,y){if(Er){var A=Js(e,s,o,y);if(A===null)_a(e,s,y,Qs,o),Cr(e,y);else if(mi(A,e,s,o,y))y.stopPropagation();else if(Cr(e,y),s&4&&-1<_o.indexOf(e)){for(;A!==null;){var P=Ni(A);if(P!==null&&mo(P),P=Js(e,s,o,y),P===null&&_a(e,s,y,Qs,o),P===A)break;A=P}A!==null&&y.stopPropagation()}else _a(e,s,y,null,o)}}var Qs=null;function Js(e,s,o,y){if(Qs=null,e=Xe(y),e=ir(e),e!==null)if(s=Ve(e),s===null)e=null;else if(o=s.tag,o===13){if(e=_t(s),e!==null)return e;e=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;e=null}else s!==e&&(e=null);return Qs=e,null}function yo(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(Zl()){case oi:return 1;case yr:return 4;case ys:case ea:return 16;case bs:return 536870912;default:return 16}default:return 16}}var qn=null,gi=null,ls=null;function bo(){if(ls)return ls;var e,s=gi,o=s.length,y,A="value"in qn?qn.value:qn.textContent,P=A.length;for(e=0;e<o&&s[e]===A[e];e++);var W=o-e;for(y=1;y<=W&&s[o-y]===A[P-y];y++);return ls=A.slice(e,1<y?1-y:void 0)}function Zs(e){var s=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&s===13&&(e=13)):e=s,e===10&&(e=13),32<=e||e===13?e:0}function er(){return!0}function So(){return!1}function tn(e){function s(o,y,A,P,W){this._reactName=o,this._targetInst=A,this.type=y,this.nativeEvent=P,this.target=W,this.currentTarget=null;for(var J in e)e.hasOwnProperty(J)&&(o=e[J],this[J]=o?o(P):P[J]);return this.isDefaultPrevented=(P.defaultPrevented!=null?P.defaultPrevented:P.returnValue===!1)?er:So,this.isPropagationStopped=So,this}return $(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=er)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=er)},persist:function(){},isPersistent:er}),s}var Ls={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_i=tn(Ls),tr=$({},Ls,{view:0,detail:0}),Ts=tn(tr),vi,nr,sr,rr=$({},tr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tr,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!==sr&&(sr&&e.type==="mousemove"?(vi=e.screenX-sr.screenX,nr=e.screenY-sr.screenY):nr=vi=0,sr=e),vi)},movementY:function(e){return"movementY"in e?e.movementY:nr}}),Co=tn(rr),sa=$({},rr,{dataTransfer:0}),ra=tn(sa),xo=$({},tr,{relatedTarget:0}),wi=tn(xo),ia=$({},Ls,{animationName:0,elapsedTime:0,pseudoElement:0}),yi=tn(ia),ko=$({},Ls,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bi=tn(ko),Eo=$({},Ls,{data:0}),Lo=tn(Eo),To={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ro={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"},Mo={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ao(e){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(e):(e=Mo[e])?!!s[e]:!1}function Tr(){return Ao}var No=$({},tr,{key:function(e){if(e.key){var s=To[e.key]||e.key;if(s!=="Unidentified")return s}return e.type==="keypress"?(e=Zs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ro[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tr,charCode:function(e){return e.type==="keypress"?Zs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Zs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),oa=tn(No),Do=$({},rr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Si=tn(Do),Io=$({},tr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tr}),jo=tn(Io),se=$({},Ls,{propertyName:0,elapsedTime:0,pseudoElement:0}),ye=tn(se),lt=$({},rr,{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}),Kn=tn(lt),as=[9,13,27,32],la=r&&"CompositionEvent"in window,Ci=null;r&&"documentMode"in document&&(Ci=document.documentMode);var Ug=r&&"TextEvent"in window&&!Ci,$u=r&&(!la||Ci&&8<Ci&&11>=Ci),Uu=" ",Wu=!1;function zu(e,s){switch(e){case"keyup":return as.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Rr=!1;function Wg(e,s){switch(e){case"compositionend":return Vu(s);case"keypress":return s.which!==32?null:(Wu=!0,Uu);case"textInput":return e=s.data,e===Uu&&Wu?null:e;default:return null}}function zg(e,s){if(Rr)return e==="compositionend"||!la&&zu(e,s)?(e=bo(),ls=gi=qn=null,Rr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return $u&&s.locale!=="ko"?null:s.data;default:return null}}var Vg={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 qu(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s==="input"?!!Vg[e.type]:s==="textarea"}function Ku(e,s,o,y){rt(y),s=Ho(s,"onChange"),0<s.length&&(o=new _i("onChange","change",null,o,y),e.push({event:o,listeners:s}))}var xi=null,ki=null;function qg(e){hh(e,0)}function Po(e){var s=Ir(e);if(fe(s))return e}function Kg(e,s){if(e==="change")return s}var Gu=!1;if(r){var aa;if(r){var ca="oninput"in document;if(!ca){var Yu=document.createElement("div");Yu.setAttribute("oninput","return;"),ca=typeof Yu.oninput=="function"}aa=ca}else aa=!1;Gu=aa&&(!document.documentMode||9<document.documentMode)}function Xu(){xi&&(xi.detachEvent("onpropertychange",Qu),ki=xi=null)}function Qu(e){if(e.propertyName==="value"&&Po(ki)){var s=[];Ku(s,ki,e,Xe(e)),Ot(qg,s)}}function Gg(e,s,o){e==="focusin"?(Xu(),xi=s,ki=o,xi.attachEvent("onpropertychange",Qu)):e==="focusout"&&Xu()}function Yg(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Po(ki)}function Xg(e,s){if(e==="click")return Po(s)}function Qg(e,s){if(e==="input"||e==="change")return Po(s)}function Jg(e,s){return e===s&&(e!==0||1/e===1/s)||e!==e&&s!==s}var In=typeof Object.is=="function"?Object.is:Jg;function Ei(e,s){if(In(e,s))return!0;if(typeof e!="object"||e===null||typeof s!="object"||s===null)return!1;var o=Object.keys(e),y=Object.keys(s);if(o.length!==y.length)return!1;for(y=0;y<o.length;y++){var A=o[y];if(!u.call(s,A)||!In(e[A],s[A]))return!1}return!0}function Ju(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zu(e,s){var o=Ju(e);e=0;for(var y;o;){if(o.nodeType===3){if(y=e+o.textContent.length,e<=s&&y>=s)return{node:o,offset:s-e};e=y}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Ju(o)}}function eh(e,s){return e&&s?e===s?!0:e&&e.nodeType===3?!1:s&&s.nodeType===3?eh(e,s.parentNode):"contains"in e?e.contains(s):e.compareDocumentPosition?!!(e.compareDocumentPosition(s)&16):!1:!1}function th(){for(var e=window,s=Ee();s instanceof e.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)e=s.contentWindow;else break;s=Ee(e.document)}return s}function ua(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s&&(s==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||s==="textarea"||e.contentEditable==="true")}function Zg(e){var s=th(),o=e.focusedElem,y=e.selectionRange;if(s!==o&&o&&o.ownerDocument&&eh(o.ownerDocument.documentElement,o)){if(y!==null&&ua(o)){if(s=y.start,e=y.end,e===void 0&&(e=s),"selectionStart"in o)o.selectionStart=s,o.selectionEnd=Math.min(e,o.value.length);else if(e=(s=o.ownerDocument||document)&&s.defaultView||window,e.getSelection){e=e.getSelection();var A=o.textContent.length,P=Math.min(y.start,A);y=y.end===void 0?P:Math.min(y.end,A),!e.extend&&P>y&&(A=y,y=P,P=A),A=Zu(o,P);var W=Zu(o,y);A&&W&&(e.rangeCount!==1||e.anchorNode!==A.node||e.anchorOffset!==A.offset||e.focusNode!==W.node||e.focusOffset!==W.offset)&&(s=s.createRange(),s.setStart(A.node,A.offset),e.removeAllRanges(),P>y?(e.addRange(s),e.extend(W.node,W.offset)):(s.setEnd(W.node,W.offset),e.addRange(s)))}}for(s=[],e=o;e=e.parentNode;)e.nodeType===1&&s.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<s.length;o++)e=s[o],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var e_=r&&"documentMode"in document&&11>=document.documentMode,Mr=null,ha=null,Li=null,da=!1;function nh(e,s,o){var y=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;da||Mr==null||Mr!==Ee(y)||(y=Mr,"selectionStart"in y&&ua(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),Li&&Ei(Li,y)||(Li=y,y=Ho(ha,"onSelect"),0<y.length&&(s=new _i("onSelect","select",null,s,o),e.push({event:s,listeners:y}),s.target=Mr)))}function Oo(e,s){var o={};return o[e.toLowerCase()]=s.toLowerCase(),o["Webkit"+e]="webkit"+s,o["Moz"+e]="moz"+s,o}var Ar={animationend:Oo("Animation","AnimationEnd"),animationiteration:Oo("Animation","AnimationIteration"),animationstart:Oo("Animation","AnimationStart"),transitionend:Oo("Transition","TransitionEnd")},fa={},sh={};r&&(sh=document.createElement("div").style,"AnimationEvent"in window||(delete Ar.animationend.animation,delete Ar.animationiteration.animation,delete Ar.animationstart.animation),"TransitionEvent"in window||delete Ar.transitionend.transition);function Bo(e){if(fa[e])return fa[e];if(!Ar[e])return e;var s=Ar[e],o;for(o in s)if(s.hasOwnProperty(o)&&o in sh)return fa[e]=s[o];return e}var rh=Bo("animationend"),ih=Bo("animationiteration"),oh=Bo("animationstart"),lh=Bo("transitionend"),ah=new Map,ch="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 Rs(e,s){ah.set(e,s),T(s,[e])}for(var pa=0;pa<ch.length;pa++){var ma=ch[pa],t_=ma.toLowerCase(),n_=ma[0].toUpperCase()+ma.slice(1);Rs(t_,"on"+n_)}Rs(rh,"onAnimationEnd"),Rs(ih,"onAnimationIteration"),Rs(oh,"onAnimationStart"),Rs("dblclick","onDoubleClick"),Rs("focusin","onFocus"),Rs("focusout","onBlur"),Rs(lh,"onTransitionEnd"),C("onMouseEnter",["mouseout","mouseover"]),C("onMouseLeave",["mouseout","mouseover"]),C("onPointerEnter",["pointerout","pointerover"]),C("onPointerLeave",["pointerout","pointerover"]),T("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),T("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),T("onBeforeInput",["compositionend","keypress","textInput","paste"]),T("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),T("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),T("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ti="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(" "),s_=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ti));function uh(e,s,o){var y=e.type||"unknown-event";e.currentTarget=o,je(y,s,void 0,e),e.currentTarget=null}function hh(e,s){s=(s&4)!==0;for(var o=0;o<e.length;o++){var y=e[o],A=y.event;y=y.listeners;e:{var P=void 0;if(s)for(var W=y.length-1;0<=W;W--){var J=y[W],ee=J.instance,ce=J.currentTarget;if(J=J.listener,ee!==P&&A.isPropagationStopped())break e;uh(A,J,ce),P=ee}else for(W=0;W<y.length;W++){if(J=y[W],ee=J.instance,ce=J.currentTarget,J=J.listener,ee!==P&&A.isPropagationStopped())break e;uh(A,J,ce),P=ee}}}if(rs)throw e=vs,rs=!1,vs=null,e}function kt(e,s){var o=s[Ca];o===void 0&&(o=s[Ca]=new Set);var y=e+"__bubble";o.has(y)||(dh(s,e,2,!1),o.add(y))}function ga(e,s,o){var y=0;s&&(y|=4),dh(o,e,y,s)}var Fo="_reactListening"+Math.random().toString(36).slice(2);function Ri(e){if(!e[Fo]){e[Fo]=!0,c.forEach(function(o){o!=="selectionchange"&&(s_.has(o)||ga(o,!1,e),ga(o,!0,e))});var s=e.nodeType===9?e:e.ownerDocument;s===null||s[Fo]||(s[Fo]=!0,ga("selectionchange",!1,s))}}function dh(e,s,o,y){switch(yo(s)){case 1:var A=wo;break;case 4:A=Es;break;default:A=Lr}o=A.bind(null,s,o,e),A=void 0,!Tn||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(A=!0),y?A!==void 0?e.addEventListener(s,o,{capture:!0,passive:A}):e.addEventListener(s,o,!0):A!==void 0?e.addEventListener(s,o,{passive:A}):e.addEventListener(s,o,!1)}function _a(e,s,o,y,A){var P=y;if((s&1)===0&&(s&2)===0&&y!==null)e:for(;;){if(y===null)return;var W=y.tag;if(W===3||W===4){var J=y.stateNode.containerInfo;if(J===A||J.nodeType===8&&J.parentNode===A)break;if(W===4)for(W=y.return;W!==null;){var ee=W.tag;if((ee===3||ee===4)&&(ee=W.stateNode.containerInfo,ee===A||ee.nodeType===8&&ee.parentNode===A))return;W=W.return}for(;J!==null;){if(W=ir(J),W===null)return;if(ee=W.tag,ee===5||ee===6){y=P=W;continue e}J=J.parentNode}}y=y.return}Ot(function(){var ce=P,we=Xe(o),Se=[];e:{var _e=ah.get(e);if(_e!==void 0){var De=_i,Be=e;switch(e){case"keypress":if(Zs(o)===0)break e;case"keydown":case"keyup":De=oa;break;case"focusin":Be="focus",De=wi;break;case"focusout":Be="blur",De=wi;break;case"beforeblur":case"afterblur":De=wi;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=Co;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":De=ra;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":De=jo;break;case rh:case ih:case oh:De=yi;break;case lh:De=ye;break;case"scroll":De=Ts;break;case"wheel":De=Kn;break;case"copy":case"cut":case"paste":De=bi;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":De=Si}var He=(s&4)!==0,jt=!He&&e==="scroll",ie=He?_e!==null?_e+"Capture":null:_e;He=[];for(var ne=ce,oe;ne!==null;){oe=ne;var Le=oe.stateNode;if(oe.tag===5&&Le!==null&&(oe=Le,ie!==null&&(Le=Nt(ne,ie),Le!=null&&He.push(Mi(ne,Le,oe)))),jt)break;ne=ne.return}0<He.length&&(_e=new De(_e,Be,null,o,we),Se.push({event:_e,listeners:He}))}}if((s&7)===0){e:{if(_e=e==="mouseover"||e==="pointerover",De=e==="mouseout"||e==="pointerout",_e&&o!==Ke&&(Be=o.relatedTarget||o.fromElement)&&(ir(Be)||Be[cs]))break e;if((De||_e)&&(_e=we.window===we?we:(_e=we.ownerDocument)?_e.defaultView||_e.parentWindow:window,De?(Be=o.relatedTarget||o.toElement,De=ce,Be=Be?ir(Be):null,Be!==null&&(jt=Ve(Be),Be!==jt||Be.tag!==5&&Be.tag!==6)&&(Be=null)):(De=null,Be=ce),De!==Be)){if(He=Co,Le="onMouseLeave",ie="onMouseEnter",ne="mouse",(e==="pointerout"||e==="pointerover")&&(He=Si,Le="onPointerLeave",ie="onPointerEnter",ne="pointer"),jt=De==null?_e:Ir(De),oe=Be==null?_e:Ir(Be),_e=new He(Le,ne+"leave",De,o,we),_e.target=jt,_e.relatedTarget=oe,Le=null,ir(we)===ce&&(He=new He(ie,ne+"enter",Be,o,we),He.target=oe,He.relatedTarget=jt,Le=He),jt=Le,De&&Be)t:{for(He=De,ie=Be,ne=0,oe=He;oe;oe=Nr(oe))ne++;for(oe=0,Le=ie;Le;Le=Nr(Le))oe++;for(;0<ne-oe;)He=Nr(He),ne--;for(;0<oe-ne;)ie=Nr(ie),oe--;for(;ne--;){if(He===ie||ie!==null&&He===ie.alternate)break t;He=Nr(He),ie=Nr(ie)}He=null}else He=null;De!==null&&fh(Se,_e,De,He,!1),Be!==null&&jt!==null&&fh(Se,jt,Be,He,!0)}}e:{if(_e=ce?Ir(ce):window,De=_e.nodeName&&_e.nodeName.toLowerCase(),De==="select"||De==="input"&&_e.type==="file")var $e=Kg;else if(qu(_e))if(Gu)$e=Qg;else{$e=Yg;var Ge=Gg}else(De=_e.nodeName)&&De.toLowerCase()==="input"&&(_e.type==="checkbox"||_e.type==="radio")&&($e=Xg);if($e&&($e=$e(e,ce))){Ku(Se,$e,o,we);break e}Ge&&Ge(e,_e,ce),e==="focusout"&&(Ge=_e._wrapperState)&&Ge.controlled&&_e.type==="number"&&Te(_e,"number",_e.value)}switch(Ge=ce?Ir(ce):window,e){case"focusin":(qu(Ge)||Ge.contentEditable==="true")&&(Mr=Ge,ha=ce,Li=null);break;case"focusout":Li=ha=Mr=null;break;case"mousedown":da=!0;break;case"contextmenu":case"mouseup":case"dragend":da=!1,nh(Se,o,we);break;case"selectionchange":if(e_)break;case"keydown":case"keyup":nh(Se,o,we)}var Ye;if(la)e:{switch(e){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else Rr?zu(e,o)&&(Je="onCompositionEnd"):e==="keydown"&&o.keyCode===229&&(Je="onCompositionStart");Je&&($u&&o.locale!=="ko"&&(Rr||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&Rr&&(Ye=bo()):(qn=we,gi="value"in qn?qn.value:qn.textContent,Rr=!0)),Ge=Ho(ce,Je),0<Ge.length&&(Je=new Lo(Je,e,null,o,we),Se.push({event:Je,listeners:Ge}),Ye?Je.data=Ye:(Ye=Vu(o),Ye!==null&&(Je.data=Ye)))),(Ye=Ug?Wg(e,o):zg(e,o))&&(ce=Ho(ce,"onBeforeInput"),0<ce.length&&(we=new Lo("onBeforeInput","beforeinput",null,o,we),Se.push({event:we,listeners:ce}),we.data=Ye))}hh(Se,s)})}function Mi(e,s,o){return{instance:e,listener:s,currentTarget:o}}function Ho(e,s){for(var o=s+"Capture",y=[];e!==null;){var A=e,P=A.stateNode;A.tag===5&&P!==null&&(A=P,P=Nt(e,o),P!=null&&y.unshift(Mi(e,P,A)),P=Nt(e,s),P!=null&&y.push(Mi(e,P,A))),e=e.return}return y}function Nr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function fh(e,s,o,y,A){for(var P=s._reactName,W=[];o!==null&&o!==y;){var J=o,ee=J.alternate,ce=J.stateNode;if(ee!==null&&ee===y)break;J.tag===5&&ce!==null&&(J=ce,A?(ee=Nt(o,P),ee!=null&&W.unshift(Mi(o,ee,J))):A||(ee=Nt(o,P),ee!=null&&W.push(Mi(o,ee,J)))),o=o.return}W.length!==0&&e.push({event:s,listeners:W})}var r_=/\r\n?/g,i_=/\u0000|\uFFFD/g;function ph(e){return(typeof e=="string"?e:""+e).replace(r_,`
38
- `).replace(i_,"")}function $o(e,s,o){if(s=ph(s),ph(e)!==s&&o)throw Error(i(425))}function Uo(){}var va=null,wa=null;function ya(e,s){return e==="textarea"||e==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var ba=typeof setTimeout=="function"?setTimeout:void 0,o_=typeof clearTimeout=="function"?clearTimeout:void 0,mh=typeof Promise=="function"?Promise:void 0,l_=typeof queueMicrotask=="function"?queueMicrotask:typeof mh<"u"?function(e){return mh.resolve(null).then(e).catch(a_)}:ba;function a_(e){setTimeout(function(){throw e})}function Sa(e,s){var o=s,y=0;do{var A=o.nextSibling;if(e.removeChild(o),A&&A.nodeType===8)if(o=A.data,o==="/$"){if(y===0){e.removeChild(A),rn(s);return}y--}else o!=="$"&&o!=="$?"&&o!=="$!"||y++;o=A}while(o);rn(s)}function Ms(e){for(;e!=null;e=e.nextSibling){var s=e.nodeType;if(s===1||s===3)break;if(s===8){if(s=e.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return e}function gh(e){e=e.previousSibling;for(var s=0;e;){if(e.nodeType===8){var o=e.data;if(o==="$"||o==="$!"||o==="$?"){if(s===0)return e;s--}else o==="/$"&&s++}e=e.previousSibling}return null}var Dr=Math.random().toString(36).slice(2),Gn="__reactFiber$"+Dr,Ai="__reactProps$"+Dr,cs="__reactContainer$"+Dr,Ca="__reactEvents$"+Dr,c_="__reactListeners$"+Dr,u_="__reactHandles$"+Dr;function ir(e){var s=e[Gn];if(s)return s;for(var o=e.parentNode;o;){if(s=o[cs]||o[Gn]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(e=gh(e);e!==null;){if(o=e[Gn])return o;e=gh(e)}return s}e=o,o=e.parentNode}return null}function Ni(e){return e=e[Gn]||e[cs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ir(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(i(33))}function Wo(e){return e[Ai]||null}var xa=[],jr=-1;function As(e){return{current:e}}function Et(e){0>jr||(e.current=xa[jr],xa[jr]=null,jr--)}function Ct(e,s){jr++,xa[jr]=e.current,e.current=s}var Ns={},Yt=As(Ns),on=As(!1),or=Ns;function Pr(e,s){var o=e.type.contextTypes;if(!o)return Ns;var y=e.stateNode;if(y&&y.__reactInternalMemoizedUnmaskedChildContext===s)return y.__reactInternalMemoizedMaskedChildContext;var A={},P;for(P in o)A[P]=s[P];return y&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=A),A}function ln(e){return e=e.childContextTypes,e!=null}function zo(){Et(on),Et(Yt)}function _h(e,s,o){if(Yt.current!==Ns)throw Error(i(168));Ct(Yt,s),Ct(on,o)}function vh(e,s,o){var y=e.stateNode;if(s=s.childContextTypes,typeof y.getChildContext!="function")return o;y=y.getChildContext();for(var A in y)if(!(A in s))throw Error(i(108,G(e)||"Unknown",A));return $({},o,y)}function Vo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ns,or=Yt.current,Ct(Yt,e),Ct(on,on.current),!0}function wh(e,s,o){var y=e.stateNode;if(!y)throw Error(i(169));o?(e=vh(e,s,or),y.__reactInternalMemoizedMergedChildContext=e,Et(on),Et(Yt),Ct(Yt,e)):Et(on),Ct(on,o)}var us=null,qo=!1,ka=!1;function yh(e){us===null?us=[e]:us.push(e)}function h_(e){qo=!0,yh(e)}function Ds(){if(!ka&&us!==null){ka=!0;var e=0,s=dt;try{var o=us;for(dt=1;e<o.length;e++){var y=o[e];do y=y(!0);while(y!==null)}us=null,qo=!1}catch(A){throw us!==null&&(us=us.slice(e+1)),uo(oi,Ds),A}finally{dt=s,ka=!1}}return null}var Or=[],Br=0,Ko=null,Go=0,Sn=[],Cn=0,lr=null,hs=1,ds="";function ar(e,s){Or[Br++]=Go,Or[Br++]=Ko,Ko=e,Go=s}function bh(e,s,o){Sn[Cn++]=hs,Sn[Cn++]=ds,Sn[Cn++]=lr,lr=e;var y=hs;e=ds;var A=32-_n(y)-1;y&=~(1<<A),o+=1;var P=32-_n(s)+A;if(30<P){var W=A-A%5;P=(y&(1<<W)-1).toString(32),y>>=W,A-=W,hs=1<<32-_n(s)+A|o<<A|y,ds=P+e}else hs=1<<P|o<<A|y,ds=e}function Ea(e){e.return!==null&&(ar(e,1),bh(e,1,0))}function La(e){for(;e===Ko;)Ko=Or[--Br],Or[Br]=null,Go=Or[--Br],Or[Br]=null;for(;e===lr;)lr=Sn[--Cn],Sn[Cn]=null,ds=Sn[--Cn],Sn[Cn]=null,hs=Sn[--Cn],Sn[Cn]=null}var vn=null,wn=null,Tt=!1,jn=null;function Sh(e,s){var o=Ln(5,null,null,0);o.elementType="DELETED",o.stateNode=s,o.return=e,s=e.deletions,s===null?(e.deletions=[o],e.flags|=16):s.push(o)}function Ch(e,s){switch(e.tag){case 5:var o=e.type;return s=s.nodeType!==1||o.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(e.stateNode=s,vn=e,wn=Ms(s.firstChild),!0):!1;case 6:return s=e.pendingProps===""||s.nodeType!==3?null:s,s!==null?(e.stateNode=s,vn=e,wn=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(o=lr!==null?{id:hs,overflow:ds}:null,e.memoizedState={dehydrated:s,treeContext:o,retryLane:1073741824},o=Ln(18,null,null,0),o.stateNode=s,o.return=e,e.child=o,vn=e,wn=null,!0):!1;default:return!1}}function Ta(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ra(e){if(Tt){var s=wn;if(s){var o=s;if(!Ch(e,s)){if(Ta(e))throw Error(i(418));s=Ms(o.nextSibling);var y=vn;s&&Ch(e,s)?Sh(y,o):(e.flags=e.flags&-4097|2,Tt=!1,vn=e)}}else{if(Ta(e))throw Error(i(418));e.flags=e.flags&-4097|2,Tt=!1,vn=e}}}function xh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;vn=e}function Yo(e){if(e!==vn)return!1;if(!Tt)return xh(e),Tt=!0,!1;var s;if((s=e.tag!==3)&&!(s=e.tag!==5)&&(s=e.type,s=s!=="head"&&s!=="body"&&!ya(e.type,e.memoizedProps)),s&&(s=wn)){if(Ta(e))throw kh(),Error(i(418));for(;s;)Sh(e,s),s=Ms(s.nextSibling)}if(xh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));e:{for(e=e.nextSibling,s=0;e;){if(e.nodeType===8){var o=e.data;if(o==="/$"){if(s===0){wn=Ms(e.nextSibling);break e}s--}else o!=="$"&&o!=="$!"&&o!=="$?"||s++}e=e.nextSibling}wn=null}}else wn=vn?Ms(e.stateNode.nextSibling):null;return!0}function kh(){for(var e=wn;e;)e=Ms(e.nextSibling)}function Fr(){wn=vn=null,Tt=!1}function Ma(e){jn===null?jn=[e]:jn.push(e)}var d_=x.ReactCurrentBatchConfig;function Di(e,s,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 y=o.stateNode}if(!y)throw Error(i(147,e));var A=y,P=""+e;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===P?s.ref:(s=function(W){var J=A.refs;W===null?delete J[P]:J[P]=W},s._stringRef=P,s)}if(typeof e!="string")throw Error(i(284));if(!o._owner)throw Error(i(290,e))}return e}function Xo(e,s){throw e=Object.prototype.toString.call(s),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":e))}function Eh(e){var s=e._init;return s(e._payload)}function Lh(e){function s(ie,ne){if(e){var oe=ie.deletions;oe===null?(ie.deletions=[ne],ie.flags|=16):oe.push(ne)}}function o(ie,ne){if(!e)return null;for(;ne!==null;)s(ie,ne),ne=ne.sibling;return null}function y(ie,ne){for(ie=new Map;ne!==null;)ne.key!==null?ie.set(ne.key,ne):ie.set(ne.index,ne),ne=ne.sibling;return ie}function A(ie,ne){return ie=$s(ie,ne),ie.index=0,ie.sibling=null,ie}function P(ie,ne,oe){return ie.index=oe,e?(oe=ie.alternate,oe!==null?(oe=oe.index,oe<ne?(ie.flags|=2,ne):oe):(ie.flags|=2,ne)):(ie.flags|=1048576,ne)}function W(ie){return e&&ie.alternate===null&&(ie.flags|=2),ie}function J(ie,ne,oe,Le){return ne===null||ne.tag!==6?(ne=bc(oe,ie.mode,Le),ne.return=ie,ne):(ne=A(ne,oe),ne.return=ie,ne)}function ee(ie,ne,oe,Le){var $e=oe.type;return $e===M?we(ie,ne,oe.props.children,Le,oe.key):ne!==null&&(ne.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===X&&Eh($e)===ne.type)?(Le=A(ne,oe.props),Le.ref=Di(ie,ne,oe),Le.return=ie,Le):(Le=yl(oe.type,oe.key,oe.props,null,ie.mode,Le),Le.ref=Di(ie,ne,oe),Le.return=ie,Le)}function ce(ie,ne,oe,Le){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==oe.containerInfo||ne.stateNode.implementation!==oe.implementation?(ne=Sc(oe,ie.mode,Le),ne.return=ie,ne):(ne=A(ne,oe.children||[]),ne.return=ie,ne)}function we(ie,ne,oe,Le,$e){return ne===null||ne.tag!==7?(ne=gr(oe,ie.mode,Le,$e),ne.return=ie,ne):(ne=A(ne,oe),ne.return=ie,ne)}function Se(ie,ne,oe){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=bc(""+ne,ie.mode,oe),ne.return=ie,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case I:return oe=yl(ne.type,ne.key,ne.props,null,ie.mode,oe),oe.ref=Di(ie,null,ne),oe.return=ie,oe;case E:return ne=Sc(ne,ie.mode,oe),ne.return=ie,ne;case X:var Le=ne._init;return Se(ie,Le(ne._payload),oe)}if(ge(ne)||j(ne))return ne=gr(ne,ie.mode,oe,null),ne.return=ie,ne;Xo(ie,ne)}return null}function _e(ie,ne,oe,Le){var $e=ne!==null?ne.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return $e!==null?null:J(ie,ne,""+oe,Le);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case I:return oe.key===$e?ee(ie,ne,oe,Le):null;case E:return oe.key===$e?ce(ie,ne,oe,Le):null;case X:return $e=oe._init,_e(ie,ne,$e(oe._payload),Le)}if(ge(oe)||j(oe))return $e!==null?null:we(ie,ne,oe,Le,null);Xo(ie,oe)}return null}function De(ie,ne,oe,Le,$e){if(typeof Le=="string"&&Le!==""||typeof Le=="number")return ie=ie.get(oe)||null,J(ne,ie,""+Le,$e);if(typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case I:return ie=ie.get(Le.key===null?oe:Le.key)||null,ee(ne,ie,Le,$e);case E:return ie=ie.get(Le.key===null?oe:Le.key)||null,ce(ne,ie,Le,$e);case X:var Ge=Le._init;return De(ie,ne,oe,Ge(Le._payload),$e)}if(ge(Le)||j(Le))return ie=ie.get(oe)||null,we(ne,ie,Le,$e,null);Xo(ne,Le)}return null}function Be(ie,ne,oe,Le){for(var $e=null,Ge=null,Ye=ne,Je=ne=0,zt=null;Ye!==null&&Je<oe.length;Je++){Ye.index>Je?(zt=Ye,Ye=null):zt=Ye.sibling;var mt=_e(ie,Ye,oe[Je],Le);if(mt===null){Ye===null&&(Ye=zt);break}e&&Ye&&mt.alternate===null&&s(ie,Ye),ne=P(mt,ne,Je),Ge===null?$e=mt:Ge.sibling=mt,Ge=mt,Ye=zt}if(Je===oe.length)return o(ie,Ye),Tt&&ar(ie,Je),$e;if(Ye===null){for(;Je<oe.length;Je++)Ye=Se(ie,oe[Je],Le),Ye!==null&&(ne=P(Ye,ne,Je),Ge===null?$e=Ye:Ge.sibling=Ye,Ge=Ye);return Tt&&ar(ie,Je),$e}for(Ye=y(ie,Ye);Je<oe.length;Je++)zt=De(Ye,ie,Je,oe[Je],Le),zt!==null&&(e&&zt.alternate!==null&&Ye.delete(zt.key===null?Je:zt.key),ne=P(zt,ne,Je),Ge===null?$e=zt:Ge.sibling=zt,Ge=zt);return e&&Ye.forEach(function(Us){return s(ie,Us)}),Tt&&ar(ie,Je),$e}function He(ie,ne,oe,Le){var $e=j(oe);if(typeof $e!="function")throw Error(i(150));if(oe=$e.call(oe),oe==null)throw Error(i(151));for(var Ge=$e=null,Ye=ne,Je=ne=0,zt=null,mt=oe.next();Ye!==null&&!mt.done;Je++,mt=oe.next()){Ye.index>Je?(zt=Ye,Ye=null):zt=Ye.sibling;var Us=_e(ie,Ye,mt.value,Le);if(Us===null){Ye===null&&(Ye=zt);break}e&&Ye&&Us.alternate===null&&s(ie,Ye),ne=P(Us,ne,Je),Ge===null?$e=Us:Ge.sibling=Us,Ge=Us,Ye=zt}if(mt.done)return o(ie,Ye),Tt&&ar(ie,Je),$e;if(Ye===null){for(;!mt.done;Je++,mt=oe.next())mt=Se(ie,mt.value,Le),mt!==null&&(ne=P(mt,ne,Je),Ge===null?$e=mt:Ge.sibling=mt,Ge=mt);return Tt&&ar(ie,Je),$e}for(Ye=y(ie,Ye);!mt.done;Je++,mt=oe.next())mt=De(Ye,ie,Je,mt.value,Le),mt!==null&&(e&&mt.alternate!==null&&Ye.delete(mt.key===null?Je:mt.key),ne=P(mt,ne,Je),Ge===null?$e=mt:Ge.sibling=mt,Ge=mt);return e&&Ye.forEach(function(V_){return s(ie,V_)}),Tt&&ar(ie,Je),$e}function jt(ie,ne,oe,Le){if(typeof oe=="object"&&oe!==null&&oe.type===M&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case I:e:{for(var $e=oe.key,Ge=ne;Ge!==null;){if(Ge.key===$e){if($e=oe.type,$e===M){if(Ge.tag===7){o(ie,Ge.sibling),ne=A(Ge,oe.props.children),ne.return=ie,ie=ne;break e}}else if(Ge.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===X&&Eh($e)===Ge.type){o(ie,Ge.sibling),ne=A(Ge,oe.props),ne.ref=Di(ie,Ge,oe),ne.return=ie,ie=ne;break e}o(ie,Ge);break}else s(ie,Ge);Ge=Ge.sibling}oe.type===M?(ne=gr(oe.props.children,ie.mode,Le,oe.key),ne.return=ie,ie=ne):(Le=yl(oe.type,oe.key,oe.props,null,ie.mode,Le),Le.ref=Di(ie,ne,oe),Le.return=ie,ie=Le)}return W(ie);case E:e:{for(Ge=oe.key;ne!==null;){if(ne.key===Ge)if(ne.tag===4&&ne.stateNode.containerInfo===oe.containerInfo&&ne.stateNode.implementation===oe.implementation){o(ie,ne.sibling),ne=A(ne,oe.children||[]),ne.return=ie,ie=ne;break e}else{o(ie,ne);break}else s(ie,ne);ne=ne.sibling}ne=Sc(oe,ie.mode,Le),ne.return=ie,ie=ne}return W(ie);case X:return Ge=oe._init,jt(ie,ne,Ge(oe._payload),Le)}if(ge(oe))return Be(ie,ne,oe,Le);if(j(oe))return He(ie,ne,oe,Le);Xo(ie,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,ne!==null&&ne.tag===6?(o(ie,ne.sibling),ne=A(ne,oe),ne.return=ie,ie=ne):(o(ie,ne),ne=bc(oe,ie.mode,Le),ne.return=ie,ie=ne),W(ie)):o(ie,ne)}return jt}var Hr=Lh(!0),Th=Lh(!1),Qo=As(null),Jo=null,$r=null,Aa=null;function Na(){Aa=$r=Jo=null}function Da(e){var s=Qo.current;Et(Qo),e._currentValue=s}function Ia(e,s,o){for(;e!==null;){var y=e.alternate;if((e.childLanes&s)!==s?(e.childLanes|=s,y!==null&&(y.childLanes|=s)):y!==null&&(y.childLanes&s)!==s&&(y.childLanes|=s),e===o)break;e=e.return}}function Ur(e,s){Jo=e,Aa=$r=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&s)!==0&&(an=!0),e.firstContext=null)}function xn(e){var s=e._currentValue;if(Aa!==e)if(e={context:e,memoizedValue:s,next:null},$r===null){if(Jo===null)throw Error(i(308));$r=e,Jo.dependencies={lanes:0,firstContext:e}}else $r=$r.next=e;return s}var cr=null;function ja(e){cr===null?cr=[e]:cr.push(e)}function Rh(e,s,o,y){var A=s.interleaved;return A===null?(o.next=o,ja(s)):(o.next=A.next,A.next=o),s.interleaved=o,fs(e,y)}function fs(e,s){e.lanes|=s;var o=e.alternate;for(o!==null&&(o.lanes|=s),o=e,e=e.return;e!==null;)e.childLanes|=s,o=e.alternate,o!==null&&(o.childLanes|=s),o=e,e=e.return;return o.tag===3?o.stateNode:null}var Is=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mh(e,s){e=e.updateQueue,s.updateQueue===e&&(s.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ps(e,s){return{eventTime:e,lane:s,tag:0,payload:null,callback:null,next:null}}function js(e,s,o){var y=e.updateQueue;if(y===null)return null;if(y=y.shared,(ft&2)!==0){var A=y.pending;return A===null?s.next=s:(s.next=A.next,A.next=s),y.pending=s,fs(e,o)}return A=y.interleaved,A===null?(s.next=s,ja(y)):(s.next=A.next,A.next=s),y.interleaved=s,fs(e,o)}function Zo(e,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194240)!==0)){var y=s.lanes;y&=e.pendingLanes,o|=y,s.lanes=o,Ft(e,o)}}function Ah(e,s){var o=e.updateQueue,y=e.alternate;if(y!==null&&(y=y.updateQueue,o===y)){var A=null,P=null;if(o=o.firstBaseUpdate,o!==null){do{var W={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};P===null?A=P=W:P=P.next=W,o=o.next}while(o!==null);P===null?A=P=s:P=P.next=s}else A=P=s;o={baseState:y.baseState,firstBaseUpdate:A,lastBaseUpdate:P,shared:y.shared,effects:y.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=s:e.next=s,o.lastBaseUpdate=s}function el(e,s,o,y){var A=e.updateQueue;Is=!1;var P=A.firstBaseUpdate,W=A.lastBaseUpdate,J=A.shared.pending;if(J!==null){A.shared.pending=null;var ee=J,ce=ee.next;ee.next=null,W===null?P=ce:W.next=ce,W=ee;var we=e.alternate;we!==null&&(we=we.updateQueue,J=we.lastBaseUpdate,J!==W&&(J===null?we.firstBaseUpdate=ce:J.next=ce,we.lastBaseUpdate=ee))}if(P!==null){var Se=A.baseState;W=0,we=ce=ee=null,J=P;do{var _e=J.lane,De=J.eventTime;if((y&_e)===_e){we!==null&&(we=we.next={eventTime:De,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var Be=e,He=J;switch(_e=s,De=o,He.tag){case 1:if(Be=He.payload,typeof Be=="function"){Se=Be.call(De,Se,_e);break e}Se=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=He.payload,_e=typeof Be=="function"?Be.call(De,Se,_e):Be,_e==null)break e;Se=$({},Se,_e);break e;case 2:Is=!0}}J.callback!==null&&J.lane!==0&&(e.flags|=64,_e=A.effects,_e===null?A.effects=[J]:_e.push(J))}else De={eventTime:De,lane:_e,tag:J.tag,payload:J.payload,callback:J.callback,next:null},we===null?(ce=we=De,ee=Se):we=we.next=De,W|=_e;if(J=J.next,J===null){if(J=A.shared.pending,J===null)break;_e=J,J=_e.next,_e.next=null,A.lastBaseUpdate=_e,A.shared.pending=null}}while(!0);if(we===null&&(ee=Se),A.baseState=ee,A.firstBaseUpdate=ce,A.lastBaseUpdate=we,s=A.shared.interleaved,s!==null){A=s;do W|=A.lane,A=A.next;while(A!==s)}else P===null&&(A.shared.lanes=0);dr|=W,e.lanes=W,e.memoizedState=Se}}function Nh(e,s,o){if(e=s.effects,s.effects=null,e!==null)for(s=0;s<e.length;s++){var y=e[s],A=y.callback;if(A!==null){if(y.callback=null,y=o,typeof A!="function")throw Error(i(191,A));A.call(y)}}}var Ii={},Yn=As(Ii),ji=As(Ii),Pi=As(Ii);function ur(e){if(e===Ii)throw Error(i(174));return e}function Oa(e,s){switch(Ct(Pi,s),Ct(ji,e),Ct(Yn,Ii),e=s.nodeType,e){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:wt(null,"");break;default:e=e===8?s.parentNode:s,s=e.namespaceURI||null,e=e.tagName,s=wt(s,e)}Et(Yn),Ct(Yn,s)}function Wr(){Et(Yn),Et(ji),Et(Pi)}function Dh(e){ur(Pi.current);var s=ur(Yn.current),o=wt(s,e.type);s!==o&&(Ct(ji,e),Ct(Yn,o))}function Ba(e){ji.current===e&&(Et(Yn),Et(ji))}var Mt=As(0);function tl(e){for(var s=e;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Fa=[];function Ha(){for(var e=0;e<Fa.length;e++)Fa[e]._workInProgressVersionPrimary=null;Fa.length=0}var nl=x.ReactCurrentDispatcher,$a=x.ReactCurrentBatchConfig,hr=0,At=null,Ht=null,Ut=null,sl=!1,Oi=!1,Bi=0,f_=0;function Xt(){throw Error(i(321))}function Ua(e,s){if(s===null)return!1;for(var o=0;o<s.length&&o<e.length;o++)if(!In(e[o],s[o]))return!1;return!0}function Wa(e,s,o,y,A,P){if(hr=P,At=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,nl.current=e===null||e.memoizedState===null?__:v_,e=o(y,A),Oi){P=0;do{if(Oi=!1,Bi=0,25<=P)throw Error(i(301));P+=1,Ut=Ht=null,s.updateQueue=null,nl.current=w_,e=o(y,A)}while(Oi)}if(nl.current=ol,s=Ht!==null&&Ht.next!==null,hr=0,Ut=Ht=At=null,sl=!1,s)throw Error(i(300));return e}function za(){var e=Bi!==0;return Bi=0,e}function Xn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ut===null?At.memoizedState=Ut=e:Ut=Ut.next=e,Ut}function kn(){if(Ht===null){var e=At.alternate;e=e!==null?e.memoizedState:null}else e=Ht.next;var s=Ut===null?At.memoizedState:Ut.next;if(s!==null)Ut=s,Ht=e;else{if(e===null)throw Error(i(310));Ht=e,e={memoizedState:Ht.memoizedState,baseState:Ht.baseState,baseQueue:Ht.baseQueue,queue:Ht.queue,next:null},Ut===null?At.memoizedState=Ut=e:Ut=Ut.next=e}return Ut}function Fi(e,s){return typeof s=="function"?s(e):s}function Va(e){var s=kn(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=e;var y=Ht,A=y.baseQueue,P=o.pending;if(P!==null){if(A!==null){var W=A.next;A.next=P.next,P.next=W}y.baseQueue=A=P,o.pending=null}if(A!==null){P=A.next,y=y.baseState;var J=W=null,ee=null,ce=P;do{var we=ce.lane;if((hr&we)===we)ee!==null&&(ee=ee.next={lane:0,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),y=ce.hasEagerState?ce.eagerState:e(y,ce.action);else{var Se={lane:we,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null};ee===null?(J=ee=Se,W=y):ee=ee.next=Se,At.lanes|=we,dr|=we}ce=ce.next}while(ce!==null&&ce!==P);ee===null?W=y:ee.next=J,In(y,s.memoizedState)||(an=!0),s.memoizedState=y,s.baseState=W,s.baseQueue=ee,o.lastRenderedState=y}if(e=o.interleaved,e!==null){A=e;do P=A.lane,At.lanes|=P,dr|=P,A=A.next;while(A!==e)}else A===null&&(o.lanes=0);return[s.memoizedState,o.dispatch]}function qa(e){var s=kn(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=e;var y=o.dispatch,A=o.pending,P=s.memoizedState;if(A!==null){o.pending=null;var W=A=A.next;do P=e(P,W.action),W=W.next;while(W!==A);In(P,s.memoizedState)||(an=!0),s.memoizedState=P,s.baseQueue===null&&(s.baseState=P),o.lastRenderedState=P}return[P,y]}function Ih(){}function jh(e,s){var o=At,y=kn(),A=s(),P=!In(y.memoizedState,A);if(P&&(y.memoizedState=A,an=!0),y=y.queue,Ka(Bh.bind(null,o,y,e),[e]),y.getSnapshot!==s||P||Ut!==null&&Ut.memoizedState.tag&1){if(o.flags|=2048,Hi(9,Oh.bind(null,o,y,A,s),void 0,null),Wt===null)throw Error(i(349));(hr&30)!==0||Ph(o,s,A)}return A}function Ph(e,s,o){e.flags|=16384,e={getSnapshot:s,value:o},s=At.updateQueue,s===null?(s={lastEffect:null,stores:null},At.updateQueue=s,s.stores=[e]):(o=s.stores,o===null?s.stores=[e]:o.push(e))}function Oh(e,s,o,y){s.value=o,s.getSnapshot=y,Fh(s)&&Hh(e)}function Bh(e,s,o){return o(function(){Fh(s)&&Hh(e)})}function Fh(e){var s=e.getSnapshot;e=e.value;try{var o=s();return!In(e,o)}catch{return!0}}function Hh(e){var s=fs(e,1);s!==null&&Fn(s,e,1,-1)}function $h(e){var s=Xn();return typeof e=="function"&&(e=e()),s.memoizedState=s.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Fi,lastRenderedState:e},s.queue=e,e=e.dispatch=g_.bind(null,At,e),[s.memoizedState,e]}function Hi(e,s,o,y){return e={tag:e,create:s,destroy:o,deps:y,next:null},s=At.updateQueue,s===null?(s={lastEffect:null,stores:null},At.updateQueue=s,s.lastEffect=e.next=e):(o=s.lastEffect,o===null?s.lastEffect=e.next=e:(y=o.next,o.next=e,e.next=y,s.lastEffect=e)),e}function Uh(){return kn().memoizedState}function rl(e,s,o,y){var A=Xn();At.flags|=e,A.memoizedState=Hi(1|s,o,void 0,y===void 0?null:y)}function il(e,s,o,y){var A=kn();y=y===void 0?null:y;var P=void 0;if(Ht!==null){var W=Ht.memoizedState;if(P=W.destroy,y!==null&&Ua(y,W.deps)){A.memoizedState=Hi(s,o,P,y);return}}At.flags|=e,A.memoizedState=Hi(1|s,o,P,y)}function Wh(e,s){return rl(8390656,8,e,s)}function Ka(e,s){return il(2048,8,e,s)}function zh(e,s){return il(4,2,e,s)}function Vh(e,s){return il(4,4,e,s)}function qh(e,s){if(typeof s=="function")return e=e(),s(e),function(){s(null)};if(s!=null)return e=e(),s.current=e,function(){s.current=null}}function Kh(e,s,o){return o=o!=null?o.concat([e]):null,il(4,4,qh.bind(null,s,e),o)}function Ga(){}function Gh(e,s){var o=kn();s=s===void 0?null:s;var y=o.memoizedState;return y!==null&&s!==null&&Ua(s,y[1])?y[0]:(o.memoizedState=[e,s],e)}function Yh(e,s){var o=kn();s=s===void 0?null:s;var y=o.memoizedState;return y!==null&&s!==null&&Ua(s,y[1])?y[0]:(e=e(),o.memoizedState=[e,s],e)}function Xh(e,s,o){return(hr&21)===0?(e.baseState&&(e.baseState=!1,an=!0),e.memoizedState=o):(In(o,s)||(o=hi(),At.lanes|=o,dr|=o,e.baseState=!0),s)}function p_(e,s){var o=dt;dt=o!==0&&4>o?o:4,e(!0);var y=$a.transition;$a.transition={};try{e(!1),s()}finally{dt=o,$a.transition=y}}function Qh(){return kn().memoizedState}function m_(e,s,o){var y=Fs(e);if(o={lane:y,action:o,hasEagerState:!1,eagerState:null,next:null},Jh(e))Zh(s,o);else if(o=Rh(e,s,o,y),o!==null){var A=sn();Fn(o,e,y,A),ed(o,s,y)}}function g_(e,s,o){var y=Fs(e),A={lane:y,action:o,hasEagerState:!1,eagerState:null,next:null};if(Jh(e))Zh(s,A);else{var P=e.alternate;if(e.lanes===0&&(P===null||P.lanes===0)&&(P=s.lastRenderedReducer,P!==null))try{var W=s.lastRenderedState,J=P(W,o);if(A.hasEagerState=!0,A.eagerState=J,In(J,W)){var ee=s.interleaved;ee===null?(A.next=A,ja(s)):(A.next=ee.next,ee.next=A),s.interleaved=A;return}}catch{}finally{}o=Rh(e,s,A,y),o!==null&&(A=sn(),Fn(o,e,y,A),ed(o,s,y))}}function Jh(e){var s=e.alternate;return e===At||s!==null&&s===At}function Zh(e,s){Oi=sl=!0;var o=e.pending;o===null?s.next=s:(s.next=o.next,o.next=s),e.pending=s}function ed(e,s,o){if((o&4194240)!==0){var y=s.lanes;y&=e.pendingLanes,o|=y,s.lanes=o,Ft(e,o)}}var ol={readContext:xn,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useInsertionEffect:Xt,useLayoutEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useMutableSource:Xt,useSyncExternalStore:Xt,useId:Xt,unstable_isNewReconciler:!1},__={readContext:xn,useCallback:function(e,s){return Xn().memoizedState=[e,s===void 0?null:s],e},useContext:xn,useEffect:Wh,useImperativeHandle:function(e,s,o){return o=o!=null?o.concat([e]):null,rl(4194308,4,qh.bind(null,s,e),o)},useLayoutEffect:function(e,s){return rl(4194308,4,e,s)},useInsertionEffect:function(e,s){return rl(4,2,e,s)},useMemo:function(e,s){var o=Xn();return s=s===void 0?null:s,e=e(),o.memoizedState=[e,s],e},useReducer:function(e,s,o){var y=Xn();return s=o!==void 0?o(s):s,y.memoizedState=y.baseState=s,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},y.queue=e,e=e.dispatch=m_.bind(null,At,e),[y.memoizedState,e]},useRef:function(e){var s=Xn();return e={current:e},s.memoizedState=e},useState:$h,useDebugValue:Ga,useDeferredValue:function(e){return Xn().memoizedState=e},useTransition:function(){var e=$h(!1),s=e[0];return e=p_.bind(null,e[1]),Xn().memoizedState=e,[s,e]},useMutableSource:function(){},useSyncExternalStore:function(e,s,o){var y=At,A=Xn();if(Tt){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),Wt===null)throw Error(i(349));(hr&30)!==0||Ph(y,s,o)}A.memoizedState=o;var P={value:o,getSnapshot:s};return A.queue=P,Wh(Bh.bind(null,y,P,e),[e]),y.flags|=2048,Hi(9,Oh.bind(null,y,P,o,s),void 0,null),o},useId:function(){var e=Xn(),s=Wt.identifierPrefix;if(Tt){var o=ds,y=hs;o=(y&~(1<<32-_n(y)-1)).toString(32)+o,s=":"+s+"R"+o,o=Bi++,0<o&&(s+="H"+o.toString(32)),s+=":"}else o=f_++,s=":"+s+"r"+o.toString(32)+":";return e.memoizedState=s},unstable_isNewReconciler:!1},v_={readContext:xn,useCallback:Gh,useContext:xn,useEffect:Ka,useImperativeHandle:Kh,useInsertionEffect:zh,useLayoutEffect:Vh,useMemo:Yh,useReducer:Va,useRef:Uh,useState:function(){return Va(Fi)},useDebugValue:Ga,useDeferredValue:function(e){var s=kn();return Xh(s,Ht.memoizedState,e)},useTransition:function(){var e=Va(Fi)[0],s=kn().memoizedState;return[e,s]},useMutableSource:Ih,useSyncExternalStore:jh,useId:Qh,unstable_isNewReconciler:!1},w_={readContext:xn,useCallback:Gh,useContext:xn,useEffect:Ka,useImperativeHandle:Kh,useInsertionEffect:zh,useLayoutEffect:Vh,useMemo:Yh,useReducer:qa,useRef:Uh,useState:function(){return qa(Fi)},useDebugValue:Ga,useDeferredValue:function(e){var s=kn();return Ht===null?s.memoizedState=e:Xh(s,Ht.memoizedState,e)},useTransition:function(){var e=qa(Fi)[0],s=kn().memoizedState;return[e,s]},useMutableSource:Ih,useSyncExternalStore:jh,useId:Qh,unstable_isNewReconciler:!1};function Pn(e,s){if(e&&e.defaultProps){s=$({},s),e=e.defaultProps;for(var o in e)s[o]===void 0&&(s[o]=e[o]);return s}return s}function Ya(e,s,o,y){s=e.memoizedState,o=o(y,s),o=o==null?s:$({},s,o),e.memoizedState=o,e.lanes===0&&(e.updateQueue.baseState=o)}var ll={isMounted:function(e){return(e=e._reactInternals)?Ve(e)===e:!1},enqueueSetState:function(e,s,o){e=e._reactInternals;var y=sn(),A=Fs(e),P=ps(y,A);P.payload=s,o!=null&&(P.callback=o),s=js(e,P,A),s!==null&&(Fn(s,e,A,y),Zo(s,e,A))},enqueueReplaceState:function(e,s,o){e=e._reactInternals;var y=sn(),A=Fs(e),P=ps(y,A);P.tag=1,P.payload=s,o!=null&&(P.callback=o),s=js(e,P,A),s!==null&&(Fn(s,e,A,y),Zo(s,e,A))},enqueueForceUpdate:function(e,s){e=e._reactInternals;var o=sn(),y=Fs(e),A=ps(o,y);A.tag=2,s!=null&&(A.callback=s),s=js(e,A,y),s!==null&&(Fn(s,e,y,o),Zo(s,e,y))}};function td(e,s,o,y,A,P,W){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(y,P,W):s.prototype&&s.prototype.isPureReactComponent?!Ei(o,y)||!Ei(A,P):!0}function nd(e,s,o){var y=!1,A=Ns,P=s.contextType;return typeof P=="object"&&P!==null?P=xn(P):(A=ln(s)?or:Yt.current,y=s.contextTypes,P=(y=y!=null)?Pr(e,A):Ns),s=new s(o,P),e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=ll,e.stateNode=s,s._reactInternals=e,y&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=A,e.__reactInternalMemoizedMaskedChildContext=P),s}function sd(e,s,o,y){e=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,y),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,y),s.state!==e&&ll.enqueueReplaceState(s,s.state,null)}function Xa(e,s,o,y){var A=e.stateNode;A.props=o,A.state=e.memoizedState,A.refs={},Pa(e);var P=s.contextType;typeof P=="object"&&P!==null?A.context=xn(P):(P=ln(s)?or:Yt.current,A.context=Pr(e,P)),A.state=e.memoizedState,P=s.getDerivedStateFromProps,typeof P=="function"&&(Ya(e,s,P,o),A.state=e.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(s=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),s!==A.state&&ll.enqueueReplaceState(A,A.state,null),el(e,o,A,y),A.state=e.memoizedState),typeof A.componentDidMount=="function"&&(e.flags|=4194308)}function zr(e,s){try{var o="",y=s;do o+=le(y),y=y.return;while(y);var A=o}catch(P){A=`
39
- Error generating stack: `+P.message+`
40
- `+P.stack}return{value:e,source:s,stack:A,digest:null}}function Qa(e,s,o){return{value:e,source:null,stack:o??null,digest:s??null}}function Ja(e,s){try{console.error(s.value)}catch(o){setTimeout(function(){throw o})}}var y_=typeof WeakMap=="function"?WeakMap:Map;function rd(e,s,o){o=ps(-1,o),o.tag=3,o.payload={element:null};var y=s.value;return o.callback=function(){pl||(pl=!0,fc=y),Ja(e,s)},o}function id(e,s,o){o=ps(-1,o),o.tag=3;var y=e.type.getDerivedStateFromError;if(typeof y=="function"){var A=s.value;o.payload=function(){return y(A)},o.callback=function(){Ja(e,s)}}var P=e.stateNode;return P!==null&&typeof P.componentDidCatch=="function"&&(o.callback=function(){Ja(e,s),typeof y!="function"&&(Os===null?Os=new Set([this]):Os.add(this));var W=s.stack;this.componentDidCatch(s.value,{componentStack:W!==null?W:""})}),o}function od(e,s,o){var y=e.pingCache;if(y===null){y=e.pingCache=new y_;var A=new Set;y.set(s,A)}else A=y.get(s),A===void 0&&(A=new Set,y.set(s,A));A.has(o)||(A.add(o),e=I_.bind(null,e,s,o),s.then(e,e))}function ld(e){do{var s;if((s=e.tag===13)&&(s=e.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return e;e=e.return}while(e!==null);return null}function ad(e,s,o,y,A){return(e.mode&1)===0?(e===s?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(s=ps(-1,1),s.tag=2,js(o,s,1))),o.lanes|=1),e):(e.flags|=65536,e.lanes=A,e)}var b_=x.ReactCurrentOwner,an=!1;function nn(e,s,o,y){s.child=e===null?Th(s,null,o,y):Hr(s,e.child,o,y)}function cd(e,s,o,y,A){o=o.render;var P=s.ref;return Ur(s,A),y=Wa(e,s,o,y,P,A),o=za(),e!==null&&!an?(s.updateQueue=e.updateQueue,s.flags&=-2053,e.lanes&=~A,ms(e,s,A)):(Tt&&o&&Ea(s),s.flags|=1,nn(e,s,y,A),s.child)}function ud(e,s,o,y,A){if(e===null){var P=o.type;return typeof P=="function"&&!yc(P)&&P.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(s.tag=15,s.type=P,hd(e,s,P,y,A)):(e=yl(o.type,null,y,s,s.mode,A),e.ref=s.ref,e.return=s,s.child=e)}if(P=e.child,(e.lanes&A)===0){var W=P.memoizedProps;if(o=o.compare,o=o!==null?o:Ei,o(W,y)&&e.ref===s.ref)return ms(e,s,A)}return s.flags|=1,e=$s(P,y),e.ref=s.ref,e.return=s,s.child=e}function hd(e,s,o,y,A){if(e!==null){var P=e.memoizedProps;if(Ei(P,y)&&e.ref===s.ref)if(an=!1,s.pendingProps=y=P,(e.lanes&A)!==0)(e.flags&131072)!==0&&(an=!0);else return s.lanes=e.lanes,ms(e,s,A)}return Za(e,s,o,y,A)}function dd(e,s,o){var y=s.pendingProps,A=y.children,P=e!==null?e.memoizedState:null;if(y.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ct(qr,yn),yn|=o;else{if((o&1073741824)===0)return e=P!==null?P.baseLanes|o:o,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:e,cachePool:null,transitions:null},s.updateQueue=null,Ct(qr,yn),yn|=e,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},y=P!==null?P.baseLanes:o,Ct(qr,yn),yn|=y}else P!==null?(y=P.baseLanes|o,s.memoizedState=null):y=o,Ct(qr,yn),yn|=y;return nn(e,s,A,o),s.child}function fd(e,s){var o=s.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(s.flags|=512,s.flags|=2097152)}function Za(e,s,o,y,A){var P=ln(o)?or:Yt.current;return P=Pr(s,P),Ur(s,A),o=Wa(e,s,o,y,P,A),y=za(),e!==null&&!an?(s.updateQueue=e.updateQueue,s.flags&=-2053,e.lanes&=~A,ms(e,s,A)):(Tt&&y&&Ea(s),s.flags|=1,nn(e,s,o,A),s.child)}function pd(e,s,o,y,A){if(ln(o)){var P=!0;Vo(s)}else P=!1;if(Ur(s,A),s.stateNode===null)cl(e,s),nd(s,o,y),Xa(s,o,y,A),y=!0;else if(e===null){var W=s.stateNode,J=s.memoizedProps;W.props=J;var ee=W.context,ce=o.contextType;typeof ce=="object"&&ce!==null?ce=xn(ce):(ce=ln(o)?or:Yt.current,ce=Pr(s,ce));var we=o.getDerivedStateFromProps,Se=typeof we=="function"||typeof W.getSnapshotBeforeUpdate=="function";Se||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(J!==y||ee!==ce)&&sd(s,W,y,ce),Is=!1;var _e=s.memoizedState;W.state=_e,el(s,y,W,A),ee=s.memoizedState,J!==y||_e!==ee||on.current||Is?(typeof we=="function"&&(Ya(s,o,we,y),ee=s.memoizedState),(J=Is||td(s,o,J,y,_e,ee,ce))?(Se||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(s.flags|=4194308)):(typeof W.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=y,s.memoizedState=ee),W.props=y,W.state=ee,W.context=ce,y=J):(typeof W.componentDidMount=="function"&&(s.flags|=4194308),y=!1)}else{W=s.stateNode,Mh(e,s),J=s.memoizedProps,ce=s.type===s.elementType?J:Pn(s.type,J),W.props=ce,Se=s.pendingProps,_e=W.context,ee=o.contextType,typeof ee=="object"&&ee!==null?ee=xn(ee):(ee=ln(o)?or:Yt.current,ee=Pr(s,ee));var De=o.getDerivedStateFromProps;(we=typeof De=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(J!==Se||_e!==ee)&&sd(s,W,y,ee),Is=!1,_e=s.memoizedState,W.state=_e,el(s,y,W,A);var Be=s.memoizedState;J!==Se||_e!==Be||on.current||Is?(typeof De=="function"&&(Ya(s,o,De,y),Be=s.memoizedState),(ce=Is||td(s,o,ce,y,_e,Be,ee)||!1)?(we||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(y,Be,ee),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(y,Be,ee)),typeof W.componentDidUpdate=="function"&&(s.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof W.componentDidUpdate!="function"||J===e.memoizedProps&&_e===e.memoizedState||(s.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||J===e.memoizedProps&&_e===e.memoizedState||(s.flags|=1024),s.memoizedProps=y,s.memoizedState=Be),W.props=y,W.state=Be,W.context=ee,y=ce):(typeof W.componentDidUpdate!="function"||J===e.memoizedProps&&_e===e.memoizedState||(s.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||J===e.memoizedProps&&_e===e.memoizedState||(s.flags|=1024),y=!1)}return ec(e,s,o,y,P,A)}function ec(e,s,o,y,A,P){fd(e,s);var W=(s.flags&128)!==0;if(!y&&!W)return A&&wh(s,o,!1),ms(e,s,P);y=s.stateNode,b_.current=s;var J=W&&typeof o.getDerivedStateFromError!="function"?null:y.render();return s.flags|=1,e!==null&&W?(s.child=Hr(s,e.child,null,P),s.child=Hr(s,null,J,P)):nn(e,s,J,P),s.memoizedState=y.state,A&&wh(s,o,!0),s.child}function md(e){var s=e.stateNode;s.pendingContext?_h(e,s.pendingContext,s.pendingContext!==s.context):s.context&&_h(e,s.context,!1),Oa(e,s.containerInfo)}function gd(e,s,o,y,A){return Fr(),Ma(A),s.flags|=256,nn(e,s,o,y),s.child}var tc={dehydrated:null,treeContext:null,retryLane:0};function nc(e){return{baseLanes:e,cachePool:null,transitions:null}}function _d(e,s,o){var y=s.pendingProps,A=Mt.current,P=!1,W=(s.flags&128)!==0,J;if((J=W)||(J=e!==null&&e.memoizedState===null?!1:(A&2)!==0),J?(P=!0,s.flags&=-129):(e===null||e.memoizedState!==null)&&(A|=1),Ct(Mt,A&1),e===null)return Ra(s),e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((s.mode&1)===0?s.lanes=1:e.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(W=y.children,e=y.fallback,P?(y=s.mode,P=s.child,W={mode:"hidden",children:W},(y&1)===0&&P!==null?(P.childLanes=0,P.pendingProps=W):P=bl(W,y,0,null),e=gr(e,y,o,null),P.return=s,e.return=s,P.sibling=e,s.child=P,s.child.memoizedState=nc(o),s.memoizedState=tc,e):sc(s,W));if(A=e.memoizedState,A!==null&&(J=A.dehydrated,J!==null))return S_(e,s,W,y,J,A,o);if(P){P=y.fallback,W=s.mode,A=e.child,J=A.sibling;var ee={mode:"hidden",children:y.children};return(W&1)===0&&s.child!==A?(y=s.child,y.childLanes=0,y.pendingProps=ee,s.deletions=null):(y=$s(A,ee),y.subtreeFlags=A.subtreeFlags&14680064),J!==null?P=$s(J,P):(P=gr(P,W,o,null),P.flags|=2),P.return=s,y.return=s,y.sibling=P,s.child=y,y=P,P=s.child,W=e.child.memoizedState,W=W===null?nc(o):{baseLanes:W.baseLanes|o,cachePool:null,transitions:W.transitions},P.memoizedState=W,P.childLanes=e.childLanes&~o,s.memoizedState=tc,y}return P=e.child,e=P.sibling,y=$s(P,{mode:"visible",children:y.children}),(s.mode&1)===0&&(y.lanes=o),y.return=s,y.sibling=null,e!==null&&(o=s.deletions,o===null?(s.deletions=[e],s.flags|=16):o.push(e)),s.child=y,s.memoizedState=null,y}function sc(e,s){return s=bl({mode:"visible",children:s},e.mode,0,null),s.return=e,e.child=s}function al(e,s,o,y){return y!==null&&Ma(y),Hr(s,e.child,null,o),e=sc(s,s.pendingProps.children),e.flags|=2,s.memoizedState=null,e}function S_(e,s,o,y,A,P,W){if(o)return s.flags&256?(s.flags&=-257,y=Qa(Error(i(422))),al(e,s,W,y)):s.memoizedState!==null?(s.child=e.child,s.flags|=128,null):(P=y.fallback,A=s.mode,y=bl({mode:"visible",children:y.children},A,0,null),P=gr(P,A,W,null),P.flags|=2,y.return=s,P.return=s,y.sibling=P,s.child=y,(s.mode&1)!==0&&Hr(s,e.child,null,W),s.child.memoizedState=nc(W),s.memoizedState=tc,P);if((s.mode&1)===0)return al(e,s,W,null);if(A.data==="$!"){if(y=A.nextSibling&&A.nextSibling.dataset,y)var J=y.dgst;return y=J,P=Error(i(419)),y=Qa(P,y,void 0),al(e,s,W,y)}if(J=(W&e.childLanes)!==0,an||J){if(y=Wt,y!==null){switch(W&-W){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&(y.suspendedLanes|W))!==0?0:A,A!==0&&A!==P.retryLane&&(P.retryLane=A,fs(e,A),Fn(y,e,A,-1))}return wc(),y=Qa(Error(i(421))),al(e,s,W,y)}return A.data==="$?"?(s.flags|=128,s.child=e.child,s=j_.bind(null,e),A._reactRetry=s,null):(e=P.treeContext,wn=Ms(A.nextSibling),vn=s,Tt=!0,jn=null,e!==null&&(Sn[Cn++]=hs,Sn[Cn++]=ds,Sn[Cn++]=lr,hs=e.id,ds=e.overflow,lr=s),s=sc(s,y.children),s.flags|=4096,s)}function vd(e,s,o){e.lanes|=s;var y=e.alternate;y!==null&&(y.lanes|=s),Ia(e.return,s,o)}function rc(e,s,o,y,A){var P=e.memoizedState;P===null?e.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:y,tail:o,tailMode:A}:(P.isBackwards=s,P.rendering=null,P.renderingStartTime=0,P.last=y,P.tail=o,P.tailMode=A)}function wd(e,s,o){var y=s.pendingProps,A=y.revealOrder,P=y.tail;if(nn(e,s,y.children,o),y=Mt.current,(y&2)!==0)y=y&1|2,s.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=s.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vd(e,o,s);else if(e.tag===19)vd(e,o,s);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===s)break e;for(;e.sibling===null;){if(e.return===null||e.return===s)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}y&=1}if(Ct(Mt,y),(s.mode&1)===0)s.memoizedState=null;else switch(A){case"forwards":for(o=s.child,A=null;o!==null;)e=o.alternate,e!==null&&tl(e)===null&&(A=o),o=o.sibling;o=A,o===null?(A=s.child,s.child=null):(A=o.sibling,o.sibling=null),rc(s,!1,A,o,P);break;case"backwards":for(o=null,A=s.child,s.child=null;A!==null;){if(e=A.alternate,e!==null&&tl(e)===null){s.child=A;break}e=A.sibling,A.sibling=o,o=A,A=e}rc(s,!0,o,null,P);break;case"together":rc(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function cl(e,s){(s.mode&1)===0&&e!==null&&(e.alternate=null,s.alternate=null,s.flags|=2)}function ms(e,s,o){if(e!==null&&(s.dependencies=e.dependencies),dr|=s.lanes,(o&s.childLanes)===0)return null;if(e!==null&&s.child!==e.child)throw Error(i(153));if(s.child!==null){for(e=s.child,o=$s(e,e.pendingProps),s.child=o,o.return=s;e.sibling!==null;)e=e.sibling,o=o.sibling=$s(e,e.pendingProps),o.return=s;o.sibling=null}return s.child}function C_(e,s,o){switch(s.tag){case 3:md(s),Fr();break;case 5:Dh(s);break;case 1:ln(s.type)&&Vo(s);break;case 4:Oa(s,s.stateNode.containerInfo);break;case 10:var y=s.type._context,A=s.memoizedProps.value;Ct(Qo,y._currentValue),y._currentValue=A;break;case 13:if(y=s.memoizedState,y!==null)return y.dehydrated!==null?(Ct(Mt,Mt.current&1),s.flags|=128,null):(o&s.child.childLanes)!==0?_d(e,s,o):(Ct(Mt,Mt.current&1),e=ms(e,s,o),e!==null?e.sibling:null);Ct(Mt,Mt.current&1);break;case 19:if(y=(o&s.childLanes)!==0,(e.flags&128)!==0){if(y)return wd(e,s,o);s.flags|=128}if(A=s.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),Ct(Mt,Mt.current),y)break;return null;case 22:case 23:return s.lanes=0,dd(e,s,o)}return ms(e,s,o)}var yd,ic,bd,Sd;yd=function(e,s){for(var o=s.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===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},ic=function(){},bd=function(e,s,o,y){var A=e.memoizedProps;if(A!==y){e=s.stateNode,ur(Yn.current);var P=null;switch(o){case"input":A=Ae(e,A),y=Ae(e,y),P=[];break;case"select":A=$({},A,{value:void 0}),y=$({},y,{value:void 0}),P=[];break;case"textarea":A=Ue(e,A),y=Ue(e,y),P=[];break;default:typeof A.onClick!="function"&&typeof y.onClick=="function"&&(e.onclick=Uo)}it(o,y);var W;o=null;for(ce in A)if(!y.hasOwnProperty(ce)&&A.hasOwnProperty(ce)&&A[ce]!=null)if(ce==="style"){var J=A[ce];for(W in J)J.hasOwnProperty(W)&&(o||(o={}),o[W]="")}else ce!=="dangerouslySetInnerHTML"&&ce!=="children"&&ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&ce!=="autoFocus"&&(g.hasOwnProperty(ce)?P||(P=[]):(P=P||[]).push(ce,null));for(ce in y){var ee=y[ce];if(J=A!=null?A[ce]:void 0,y.hasOwnProperty(ce)&&ee!==J&&(ee!=null||J!=null))if(ce==="style")if(J){for(W in J)!J.hasOwnProperty(W)||ee&&ee.hasOwnProperty(W)||(o||(o={}),o[W]="");for(W in ee)ee.hasOwnProperty(W)&&J[W]!==ee[W]&&(o||(o={}),o[W]=ee[W])}else o||(P||(P=[]),P.push(ce,o)),o=ee;else ce==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,J=J?J.__html:void 0,ee!=null&&J!==ee&&(P=P||[]).push(ce,ee)):ce==="children"?typeof ee!="string"&&typeof ee!="number"||(P=P||[]).push(ce,""+ee):ce!=="suppressContentEditableWarning"&&ce!=="suppressHydrationWarning"&&(g.hasOwnProperty(ce)?(ee!=null&&ce==="onScroll"&&kt("scroll",e),P||J===ee||(P=[])):(P=P||[]).push(ce,ee))}o&&(P=P||[]).push("style",o);var ce=P;(s.updateQueue=ce)&&(s.flags|=4)}},Sd=function(e,s,o,y){o!==y&&(s.flags|=4)};function $i(e,s){if(!Tt)switch(e.tailMode){case"hidden":s=e.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?e.tail=null:o.sibling=null;break;case"collapsed":o=e.tail;for(var y=null;o!==null;)o.alternate!==null&&(y=o),o=o.sibling;y===null?s||e.tail===null?e.tail=null:e.tail.sibling=null:y.sibling=null}}function Qt(e){var s=e.alternate!==null&&e.alternate.child===e.child,o=0,y=0;if(s)for(var A=e.child;A!==null;)o|=A.lanes|A.childLanes,y|=A.subtreeFlags&14680064,y|=A.flags&14680064,A.return=e,A=A.sibling;else for(A=e.child;A!==null;)o|=A.lanes|A.childLanes,y|=A.subtreeFlags,y|=A.flags,A.return=e,A=A.sibling;return e.subtreeFlags|=y,e.childLanes=o,s}function x_(e,s,o){var y=s.pendingProps;switch(La(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(s),null;case 1:return ln(s.type)&&zo(),Qt(s),null;case 3:return y=s.stateNode,Wr(),Et(on),Et(Yt),Ha(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(e===null||e.child===null)&&(Yo(s)?s.flags|=4:e===null||e.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,jn!==null&&(gc(jn),jn=null))),ic(e,s),Qt(s),null;case 5:Ba(s);var A=ur(Pi.current);if(o=s.type,e!==null&&s.stateNode!=null)bd(e,s,o,y,A),e.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!y){if(s.stateNode===null)throw Error(i(166));return Qt(s),null}if(e=ur(Yn.current),Yo(s)){y=s.stateNode,o=s.type;var P=s.memoizedProps;switch(y[Gn]=s,y[Ai]=P,e=(s.mode&1)!==0,o){case"dialog":kt("cancel",y),kt("close",y);break;case"iframe":case"object":case"embed":kt("load",y);break;case"video":case"audio":for(A=0;A<Ti.length;A++)kt(Ti[A],y);break;case"source":kt("error",y);break;case"img":case"image":case"link":kt("error",y),kt("load",y);break;case"details":kt("toggle",y);break;case"input":ze(y,P),kt("invalid",y);break;case"select":y._wrapperState={wasMultiple:!!P.multiple},kt("invalid",y);break;case"textarea":ke(y,P),kt("invalid",y)}it(o,P),A=null;for(var W in P)if(P.hasOwnProperty(W)){var J=P[W];W==="children"?typeof J=="string"?y.textContent!==J&&(P.suppressHydrationWarning!==!0&&$o(y.textContent,J,e),A=["children",J]):typeof J=="number"&&y.textContent!==""+J&&(P.suppressHydrationWarning!==!0&&$o(y.textContent,J,e),A=["children",""+J]):g.hasOwnProperty(W)&&J!=null&&W==="onScroll"&&kt("scroll",y)}switch(o){case"input":ae(y),he(y,P,!0);break;case"textarea":ae(y),st(y);break;case"select":case"option":break;default:typeof P.onClick=="function"&&(y.onclick=Uo)}y=A,s.updateQueue=y,y!==null&&(s.flags|=4)}else{W=A.nodeType===9?A:A.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=ot(o)),e==="http://www.w3.org/1999/xhtml"?o==="script"?(e=W.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof y.is=="string"?e=W.createElement(o,{is:y.is}):(e=W.createElement(o),o==="select"&&(W=e,y.multiple?W.multiple=!0:y.size&&(W.size=y.size))):e=W.createElementNS(e,o),e[Gn]=s,e[Ai]=y,yd(e,s,!1,!1),s.stateNode=e;e:{switch(W=pe(o,y),o){case"dialog":kt("cancel",e),kt("close",e),A=y;break;case"iframe":case"object":case"embed":kt("load",e),A=y;break;case"video":case"audio":for(A=0;A<Ti.length;A++)kt(Ti[A],e);A=y;break;case"source":kt("error",e),A=y;break;case"img":case"image":case"link":kt("error",e),kt("load",e),A=y;break;case"details":kt("toggle",e),A=y;break;case"input":ze(e,y),A=Ae(e,y),kt("invalid",e);break;case"option":A=y;break;case"select":e._wrapperState={wasMultiple:!!y.multiple},A=$({},y,{value:void 0}),kt("invalid",e);break;case"textarea":ke(e,y),A=Ue(e,y),kt("invalid",e);break;default:A=y}it(o,A),J=A;for(P in J)if(J.hasOwnProperty(P)){var ee=J[P];P==="style"?Gt(e,ee):P==="dangerouslySetInnerHTML"?(ee=ee?ee.__html:void 0,ee!=null&&bt(e,ee)):P==="children"?typeof ee=="string"?(o!=="textarea"||ee!=="")&&Pe(e,ee):typeof ee=="number"&&Pe(e,""+ee):P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&P!=="autoFocus"&&(g.hasOwnProperty(P)?ee!=null&&P==="onScroll"&&kt("scroll",e):ee!=null&&d(e,P,ee,W))}switch(o){case"input":ae(e),he(e,y,!1);break;case"textarea":ae(e),st(e);break;case"option":y.value!=null&&e.setAttribute("value",""+z(y.value));break;case"select":e.multiple=!!y.multiple,P=y.value,P!=null?Re(e,!!y.multiple,P,!1):y.defaultValue!=null&&Re(e,!!y.multiple,y.defaultValue,!0);break;default:typeof A.onClick=="function"&&(e.onclick=Uo)}switch(o){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}}y&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Qt(s),null;case 6:if(e&&s.stateNode!=null)Sd(e,s,e.memoizedProps,y);else{if(typeof y!="string"&&s.stateNode===null)throw Error(i(166));if(o=ur(Pi.current),ur(Yn.current),Yo(s)){if(y=s.stateNode,o=s.memoizedProps,y[Gn]=s,(P=y.nodeValue!==o)&&(e=vn,e!==null))switch(e.tag){case 3:$o(y.nodeValue,o,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&$o(y.nodeValue,o,(e.mode&1)!==0)}P&&(s.flags|=4)}else y=(o.nodeType===9?o:o.ownerDocument).createTextNode(y),y[Gn]=s,s.stateNode=y}return Qt(s),null;case 13:if(Et(Mt),y=s.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Tt&&wn!==null&&(s.mode&1)!==0&&(s.flags&128)===0)kh(),Fr(),s.flags|=98560,P=!1;else if(P=Yo(s),y!==null&&y.dehydrated!==null){if(e===null){if(!P)throw Error(i(318));if(P=s.memoizedState,P=P!==null?P.dehydrated:null,!P)throw Error(i(317));P[Gn]=s}else Fr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Qt(s),P=!1}else jn!==null&&(gc(jn),jn=null),P=!0;if(!P)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=o,s):(y=y!==null,y!==(e!==null&&e.memoizedState!==null)&&y&&(s.child.flags|=8192,(s.mode&1)!==0&&(e===null||(Mt.current&1)!==0?$t===0&&($t=3):wc())),s.updateQueue!==null&&(s.flags|=4),Qt(s),null);case 4:return Wr(),ic(e,s),e===null&&Ri(s.stateNode.containerInfo),Qt(s),null;case 10:return Da(s.type._context),Qt(s),null;case 17:return ln(s.type)&&zo(),Qt(s),null;case 19:if(Et(Mt),P=s.memoizedState,P===null)return Qt(s),null;if(y=(s.flags&128)!==0,W=P.rendering,W===null)if(y)$i(P,!1);else{if($t!==0||e!==null&&(e.flags&128)!==0)for(e=s.child;e!==null;){if(W=tl(e),W!==null){for(s.flags|=128,$i(P,!1),y=W.updateQueue,y!==null&&(s.updateQueue=y,s.flags|=4),s.subtreeFlags=0,y=o,o=s.child;o!==null;)P=o,e=y,P.flags&=14680066,W=P.alternate,W===null?(P.childLanes=0,P.lanes=e,P.child=null,P.subtreeFlags=0,P.memoizedProps=null,P.memoizedState=null,P.updateQueue=null,P.dependencies=null,P.stateNode=null):(P.childLanes=W.childLanes,P.lanes=W.lanes,P.child=W.child,P.subtreeFlags=0,P.deletions=null,P.memoizedProps=W.memoizedProps,P.memoizedState=W.memoizedState,P.updateQueue=W.updateQueue,P.type=W.type,e=W.dependencies,P.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),o=o.sibling;return Ct(Mt,Mt.current&1|2),s.child}e=e.sibling}P.tail!==null&&Rt()>Kr&&(s.flags|=128,y=!0,$i(P,!1),s.lanes=4194304)}else{if(!y)if(e=tl(W),e!==null){if(s.flags|=128,y=!0,o=e.updateQueue,o!==null&&(s.updateQueue=o,s.flags|=4),$i(P,!0),P.tail===null&&P.tailMode==="hidden"&&!W.alternate&&!Tt)return Qt(s),null}else 2*Rt()-P.renderingStartTime>Kr&&o!==1073741824&&(s.flags|=128,y=!0,$i(P,!1),s.lanes=4194304);P.isBackwards?(W.sibling=s.child,s.child=W):(o=P.last,o!==null?o.sibling=W:s.child=W,P.last=W)}return P.tail!==null?(s=P.tail,P.rendering=s,P.tail=s.sibling,P.renderingStartTime=Rt(),s.sibling=null,o=Mt.current,Ct(Mt,y?o&1|2:o&1),s):(Qt(s),null);case 22:case 23:return vc(),y=s.memoizedState!==null,e!==null&&e.memoizedState!==null!==y&&(s.flags|=8192),y&&(s.mode&1)!==0?(yn&1073741824)!==0&&(Qt(s),s.subtreeFlags&6&&(s.flags|=8192)):Qt(s),null;case 24:return null;case 25:return null}throw Error(i(156,s.tag))}function k_(e,s){switch(La(s),s.tag){case 1:return ln(s.type)&&zo(),e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 3:return Wr(),Et(on),Et(Yt),Ha(),e=s.flags,(e&65536)!==0&&(e&128)===0?(s.flags=e&-65537|128,s):null;case 5:return Ba(s),null;case 13:if(Et(Mt),e=s.memoizedState,e!==null&&e.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Fr()}return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 19:return Et(Mt),null;case 4:return Wr(),null;case 10:return Da(s.type._context),null;case 22:case 23:return vc(),null;case 24:return null;default:return null}}var ul=!1,Jt=!1,E_=typeof WeakSet=="function"?WeakSet:Set,Oe=null;function Vr(e,s){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(y){Dt(e,s,y)}else o.current=null}function oc(e,s,o){try{o()}catch(y){Dt(e,s,y)}}var Cd=!1;function L_(e,s){if(va=Er,e=th(),ua(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var y=o.getSelection&&o.getSelection();if(y&&y.rangeCount!==0){o=y.anchorNode;var A=y.anchorOffset,P=y.focusNode;y=y.focusOffset;try{o.nodeType,P.nodeType}catch{o=null;break e}var W=0,J=-1,ee=-1,ce=0,we=0,Se=e,_e=null;t:for(;;){for(var De;Se!==o||A!==0&&Se.nodeType!==3||(J=W+A),Se!==P||y!==0&&Se.nodeType!==3||(ee=W+y),Se.nodeType===3&&(W+=Se.nodeValue.length),(De=Se.firstChild)!==null;)_e=Se,Se=De;for(;;){if(Se===e)break t;if(_e===o&&++ce===A&&(J=W),_e===P&&++we===y&&(ee=W),(De=Se.nextSibling)!==null)break;Se=_e,_e=Se.parentNode}Se=De}o=J===-1||ee===-1?null:{start:J,end:ee}}else o=null}o=o||{start:0,end:0}}else o=null;for(wa={focusedElem:e,selectionRange:o},Er=!1,Oe=s;Oe!==null;)if(s=Oe,e=s.child,(s.subtreeFlags&1028)!==0&&e!==null)e.return=s,Oe=e;else for(;Oe!==null;){s=Oe;try{var Be=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(Be!==null){var He=Be.memoizedProps,jt=Be.memoizedState,ie=s.stateNode,ne=ie.getSnapshotBeforeUpdate(s.elementType===s.type?He:Pn(s.type,He),jt);ie.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var oe=s.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(Le){Dt(s,s.return,Le)}if(e=s.sibling,e!==null){e.return=s.return,Oe=e;break}Oe=s.return}return Be=Cd,Cd=!1,Be}function Ui(e,s,o){var y=s.updateQueue;if(y=y!==null?y.lastEffect:null,y!==null){var A=y=y.next;do{if((A.tag&e)===e){var P=A.destroy;A.destroy=void 0,P!==void 0&&oc(s,o,P)}A=A.next}while(A!==y)}}function hl(e,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var o=s=s.next;do{if((o.tag&e)===e){var y=o.create;o.destroy=y()}o=o.next}while(o!==s)}}function lc(e){var s=e.ref;if(s!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof s=="function"?s(e):s.current=e}}function xd(e){var s=e.alternate;s!==null&&(e.alternate=null,xd(s)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(s=e.stateNode,s!==null&&(delete s[Gn],delete s[Ai],delete s[Ca],delete s[c_],delete s[u_])),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 kd(e){return e.tag===5||e.tag===3||e.tag===4}function Ed(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||kd(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 ac(e,s,o){var y=e.tag;if(y===5||y===6)e=e.stateNode,s?o.nodeType===8?o.parentNode.insertBefore(e,s):o.insertBefore(e,s):(o.nodeType===8?(s=o.parentNode,s.insertBefore(e,o)):(s=o,s.appendChild(e)),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=Uo));else if(y!==4&&(e=e.child,e!==null))for(ac(e,s,o),e=e.sibling;e!==null;)ac(e,s,o),e=e.sibling}function cc(e,s,o){var y=e.tag;if(y===5||y===6)e=e.stateNode,s?o.insertBefore(e,s):o.appendChild(e);else if(y!==4&&(e=e.child,e!==null))for(cc(e,s,o),e=e.sibling;e!==null;)cc(e,s,o),e=e.sibling}var Vt=null,On=!1;function Ps(e,s,o){for(o=o.child;o!==null;)Ld(e,s,o),o=o.sibling}function Ld(e,s,o){if(gn&&typeof gn.onCommitFiberUnmount=="function")try{gn.onCommitFiberUnmount(is,o)}catch{}switch(o.tag){case 5:Jt||Vr(o,s);case 6:var y=Vt,A=On;Vt=null,Ps(e,s,o),Vt=y,On=A,Vt!==null&&(On?(e=Vt,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):Vt.removeChild(o.stateNode));break;case 18:Vt!==null&&(On?(e=Vt,o=o.stateNode,e.nodeType===8?Sa(e.parentNode,o):e.nodeType===1&&Sa(e,o),rn(e)):Sa(Vt,o.stateNode));break;case 4:y=Vt,A=On,Vt=o.stateNode.containerInfo,On=!0,Ps(e,s,o),Vt=y,On=A;break;case 0:case 11:case 14:case 15:if(!Jt&&(y=o.updateQueue,y!==null&&(y=y.lastEffect,y!==null))){A=y=y.next;do{var P=A,W=P.destroy;P=P.tag,W!==void 0&&((P&2)!==0||(P&4)!==0)&&oc(o,s,W),A=A.next}while(A!==y)}Ps(e,s,o);break;case 1:if(!Jt&&(Vr(o,s),y=o.stateNode,typeof y.componentWillUnmount=="function"))try{y.props=o.memoizedProps,y.state=o.memoizedState,y.componentWillUnmount()}catch(J){Dt(o,s,J)}Ps(e,s,o);break;case 21:Ps(e,s,o);break;case 22:o.mode&1?(Jt=(y=Jt)||o.memoizedState!==null,Ps(e,s,o),Jt=y):Ps(e,s,o);break;default:Ps(e,s,o)}}function Td(e){var s=e.updateQueue;if(s!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new E_),s.forEach(function(y){var A=P_.bind(null,e,y);o.has(y)||(o.add(y),y.then(A,A))})}}function Bn(e,s){var o=s.deletions;if(o!==null)for(var y=0;y<o.length;y++){var A=o[y];try{var P=e,W=s,J=W;e:for(;J!==null;){switch(J.tag){case 5:Vt=J.stateNode,On=!1;break e;case 3:Vt=J.stateNode.containerInfo,On=!0;break e;case 4:Vt=J.stateNode.containerInfo,On=!0;break e}J=J.return}if(Vt===null)throw Error(i(160));Ld(P,W,A),Vt=null,On=!1;var ee=A.alternate;ee!==null&&(ee.return=null),A.return=null}catch(ce){Dt(A,s,ce)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)Rd(s,e),s=s.sibling}function Rd(e,s){var o=e.alternate,y=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Bn(s,e),Qn(e),y&4){try{Ui(3,e,e.return),hl(3,e)}catch(He){Dt(e,e.return,He)}try{Ui(5,e,e.return)}catch(He){Dt(e,e.return,He)}}break;case 1:Bn(s,e),Qn(e),y&512&&o!==null&&Vr(o,o.return);break;case 5:if(Bn(s,e),Qn(e),y&512&&o!==null&&Vr(o,o.return),e.flags&32){var A=e.stateNode;try{Pe(A,"")}catch(He){Dt(e,e.return,He)}}if(y&4&&(A=e.stateNode,A!=null)){var P=e.memoizedProps,W=o!==null?o.memoizedProps:P,J=e.type,ee=e.updateQueue;if(e.updateQueue=null,ee!==null)try{J==="input"&&P.type==="radio"&&P.name!=null&&ue(A,P),pe(J,W);var ce=pe(J,P);for(W=0;W<ee.length;W+=2){var we=ee[W],Se=ee[W+1];we==="style"?Gt(A,Se):we==="dangerouslySetInnerHTML"?bt(A,Se):we==="children"?Pe(A,Se):d(A,we,Se,ce)}switch(J){case"input":Me(A,P);break;case"textarea":Ne(A,P);break;case"select":var _e=A._wrapperState.wasMultiple;A._wrapperState.wasMultiple=!!P.multiple;var De=P.value;De!=null?Re(A,!!P.multiple,De,!1):_e!==!!P.multiple&&(P.defaultValue!=null?Re(A,!!P.multiple,P.defaultValue,!0):Re(A,!!P.multiple,P.multiple?[]:"",!1))}A[Ai]=P}catch(He){Dt(e,e.return,He)}}break;case 6:if(Bn(s,e),Qn(e),y&4){if(e.stateNode===null)throw Error(i(162));A=e.stateNode,P=e.memoizedProps;try{A.nodeValue=P}catch(He){Dt(e,e.return,He)}}break;case 3:if(Bn(s,e),Qn(e),y&4&&o!==null&&o.memoizedState.isDehydrated)try{rn(s.containerInfo)}catch(He){Dt(e,e.return,He)}break;case 4:Bn(s,e),Qn(e);break;case 13:Bn(s,e),Qn(e),A=e.child,A.flags&8192&&(P=A.memoizedState!==null,A.stateNode.isHidden=P,!P||A.alternate!==null&&A.alternate.memoizedState!==null||(dc=Rt())),y&4&&Td(e);break;case 22:if(we=o!==null&&o.memoizedState!==null,e.mode&1?(Jt=(ce=Jt)||we,Bn(s,e),Jt=ce):Bn(s,e),Qn(e),y&8192){if(ce=e.memoizedState!==null,(e.stateNode.isHidden=ce)&&!we&&(e.mode&1)!==0)for(Oe=e,we=e.child;we!==null;){for(Se=Oe=we;Oe!==null;){switch(_e=Oe,De=_e.child,_e.tag){case 0:case 11:case 14:case 15:Ui(4,_e,_e.return);break;case 1:Vr(_e,_e.return);var Be=_e.stateNode;if(typeof Be.componentWillUnmount=="function"){y=_e,o=_e.return;try{s=y,Be.props=s.memoizedProps,Be.state=s.memoizedState,Be.componentWillUnmount()}catch(He){Dt(y,o,He)}}break;case 5:Vr(_e,_e.return);break;case 22:if(_e.memoizedState!==null){Nd(Se);continue}}De!==null?(De.return=_e,Oe=De):Nd(Se)}we=we.sibling}e:for(we=null,Se=e;;){if(Se.tag===5){if(we===null){we=Se;try{A=Se.stateNode,ce?(P=A.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none"):(J=Se.stateNode,ee=Se.memoizedProps.style,W=ee!=null&&ee.hasOwnProperty("display")?ee.display:null,J.style.display=et("display",W))}catch(He){Dt(e,e.return,He)}}}else if(Se.tag===6){if(we===null)try{Se.stateNode.nodeValue=ce?"":Se.memoizedProps}catch(He){Dt(e,e.return,He)}}else if((Se.tag!==22&&Se.tag!==23||Se.memoizedState===null||Se===e)&&Se.child!==null){Se.child.return=Se,Se=Se.child;continue}if(Se===e)break e;for(;Se.sibling===null;){if(Se.return===null||Se.return===e)break e;we===Se&&(we=null),Se=Se.return}we===Se&&(we=null),Se.sibling.return=Se.return,Se=Se.sibling}}break;case 19:Bn(s,e),Qn(e),y&4&&Td(e);break;case 21:break;default:Bn(s,e),Qn(e)}}function Qn(e){var s=e.flags;if(s&2){try{e:{for(var o=e.return;o!==null;){if(kd(o)){var y=o;break e}o=o.return}throw Error(i(160))}switch(y.tag){case 5:var A=y.stateNode;y.flags&32&&(Pe(A,""),y.flags&=-33);var P=Ed(e);cc(e,P,A);break;case 3:case 4:var W=y.stateNode.containerInfo,J=Ed(e);ac(e,J,W);break;default:throw Error(i(161))}}catch(ee){Dt(e,e.return,ee)}e.flags&=-3}s&4096&&(e.flags&=-4097)}function T_(e,s,o){Oe=e,Md(e)}function Md(e,s,o){for(var y=(e.mode&1)!==0;Oe!==null;){var A=Oe,P=A.child;if(A.tag===22&&y){var W=A.memoizedState!==null||ul;if(!W){var J=A.alternate,ee=J!==null&&J.memoizedState!==null||Jt;J=ul;var ce=Jt;if(ul=W,(Jt=ee)&&!ce)for(Oe=A;Oe!==null;)W=Oe,ee=W.child,W.tag===22&&W.memoizedState!==null?Dd(A):ee!==null?(ee.return=W,Oe=ee):Dd(A);for(;P!==null;)Oe=P,Md(P),P=P.sibling;Oe=A,ul=J,Jt=ce}Ad(e)}else(A.subtreeFlags&8772)!==0&&P!==null?(P.return=A,Oe=P):Ad(e)}}function Ad(e){for(;Oe!==null;){var s=Oe;if((s.flags&8772)!==0){var o=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Jt||hl(5,s);break;case 1:var y=s.stateNode;if(s.flags&4&&!Jt)if(o===null)y.componentDidMount();else{var A=s.elementType===s.type?o.memoizedProps:Pn(s.type,o.memoizedProps);y.componentDidUpdate(A,o.memoizedState,y.__reactInternalSnapshotBeforeUpdate)}var P=s.updateQueue;P!==null&&Nh(s,P,y);break;case 3:var W=s.updateQueue;if(W!==null){if(o=null,s.child!==null)switch(s.child.tag){case 5:o=s.child.stateNode;break;case 1:o=s.child.stateNode}Nh(s,W,o)}break;case 5:var J=s.stateNode;if(o===null&&s.flags&4){o=J;var ee=s.memoizedProps;switch(s.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(s.memoizedState===null){var ce=s.alternate;if(ce!==null){var we=ce.memoizedState;if(we!==null){var Se=we.dehydrated;Se!==null&&rn(Se)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(i(163))}Jt||s.flags&512&&lc(s)}catch(_e){Dt(s,s.return,_e)}}if(s===e){Oe=null;break}if(o=s.sibling,o!==null){o.return=s.return,Oe=o;break}Oe=s.return}}function Nd(e){for(;Oe!==null;){var s=Oe;if(s===e){Oe=null;break}var o=s.sibling;if(o!==null){o.return=s.return,Oe=o;break}Oe=s.return}}function Dd(e){for(;Oe!==null;){var s=Oe;try{switch(s.tag){case 0:case 11:case 15:var o=s.return;try{hl(4,s)}catch(ee){Dt(s,o,ee)}break;case 1:var y=s.stateNode;if(typeof y.componentDidMount=="function"){var A=s.return;try{y.componentDidMount()}catch(ee){Dt(s,A,ee)}}var P=s.return;try{lc(s)}catch(ee){Dt(s,P,ee)}break;case 5:var W=s.return;try{lc(s)}catch(ee){Dt(s,W,ee)}}}catch(ee){Dt(s,s.return,ee)}if(s===e){Oe=null;break}var J=s.sibling;if(J!==null){J.return=s.return,Oe=J;break}Oe=s.return}}var R_=Math.ceil,dl=x.ReactCurrentDispatcher,uc=x.ReactCurrentOwner,En=x.ReactCurrentBatchConfig,ft=0,Wt=null,Bt=null,qt=0,yn=0,qr=As(0),$t=0,Wi=null,dr=0,fl=0,hc=0,zi=null,cn=null,dc=0,Kr=1/0,gs=null,pl=!1,fc=null,Os=null,ml=!1,Bs=null,gl=0,Vi=0,pc=null,_l=-1,vl=0;function sn(){return(ft&6)!==0?Rt():_l!==-1?_l:_l=Rt()}function Fs(e){return(e.mode&1)===0?1:(ft&2)!==0&&qt!==0?qt&-qt:d_.transition!==null?(vl===0&&(vl=hi()),vl):(e=dt,e!==0||(e=window.event,e=e===void 0?16:yo(e.type)),e)}function Fn(e,s,o,y){if(50<Vi)throw Vi=0,pc=null,Error(i(185));zn(e,o,y),((ft&2)===0||e!==Wt)&&(e===Wt&&((ft&2)===0&&(fl|=o),$t===4&&Hs(e,qt)),un(e,y),o===1&&ft===0&&(s.mode&1)===0&&(Kr=Rt()+500,qo&&Ds()))}function un(e,s){var o=e.callbackNode;bn(e,s);var y=Mn(e,e===Wt?qt:0);if(y===0)o!==null&&ho(o),e.callbackNode=null,e.callbackPriority=0;else if(s=y&-y,e.callbackPriority!==s){if(o!=null&&ho(o),s===1)e.tag===0?h_(jd.bind(null,e)):yh(jd.bind(null,e)),l_(function(){(ft&6)===0&&Ds()}),o=null;else{switch(di(y)){case 1:o=oi;break;case 4:o=yr;break;case 16:o=ys;break;case 536870912:o=bs;break;default:o=ys}o=Wd(o,Id.bind(null,e))}e.callbackPriority=s,e.callbackNode=o}}function Id(e,s){if(_l=-1,vl=0,(ft&6)!==0)throw Error(i(327));var o=e.callbackNode;if(Gr()&&e.callbackNode!==o)return null;var y=Mn(e,e===Wt?qt:0);if(y===0)return null;if((y&30)!==0||(y&e.expiredLanes)!==0||s)s=wl(e,y);else{s=y;var A=ft;ft|=2;var P=Od();(Wt!==e||qt!==s)&&(gs=null,Kr=Rt()+500,pr(e,s));do try{N_();break}catch(J){Pd(e,J)}while(!0);Na(),dl.current=P,ft=A,Bt!==null?s=0:(Wt=null,qt=0,s=$t)}if(s!==0){if(s===2&&(A=ui(e),A!==0&&(y=A,s=mc(e,A))),s===1)throw o=Wi,pr(e,0),Hs(e,y),un(e,Rt()),o;if(s===6)Hs(e,y);else{if(A=e.current.alternate,(y&30)===0&&!M_(A)&&(s=wl(e,y),s===2&&(P=ui(e),P!==0&&(y=P,s=mc(e,P))),s===1))throw o=Wi,pr(e,0),Hs(e,y),un(e,Rt()),o;switch(e.finishedWork=A,e.finishedLanes=y,s){case 0:case 1:throw Error(i(345));case 2:mr(e,cn,gs);break;case 3:if(Hs(e,y),(y&130023424)===y&&(s=dc+500-Rt(),10<s)){if(Mn(e,0)!==0)break;if(A=e.suspendedLanes,(A&y)!==y){sn(),e.pingedLanes|=e.suspendedLanes&A;break}e.timeoutHandle=ba(mr.bind(null,e,cn,gs),s);break}mr(e,cn,gs);break;case 4:if(Hs(e,y),(y&4194240)===y)break;for(s=e.eventTimes,A=-1;0<y;){var W=31-_n(y);P=1<<W,W=s[W],W>A&&(A=W),y&=~P}if(y=A,y=Rt()-y,y=(120>y?120:480>y?480:1080>y?1080:1920>y?1920:3e3>y?3e3:4320>y?4320:1960*R_(y/1960))-y,10<y){e.timeoutHandle=ba(mr.bind(null,e,cn,gs),y);break}mr(e,cn,gs);break;case 5:mr(e,cn,gs);break;default:throw Error(i(329))}}}return un(e,Rt()),e.callbackNode===o?Id.bind(null,e):null}function mc(e,s){var o=zi;return e.current.memoizedState.isDehydrated&&(pr(e,s).flags|=256),e=wl(e,s),e!==2&&(s=cn,cn=o,s!==null&&gc(s)),e}function gc(e){cn===null?cn=e:cn.push.apply(cn,e)}function M_(e){for(var s=e;;){if(s.flags&16384){var o=s.updateQueue;if(o!==null&&(o=o.stores,o!==null))for(var y=0;y<o.length;y++){var A=o[y],P=A.getSnapshot;A=A.value;try{if(!In(P(),A))return!1}catch{return!1}}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Hs(e,s){for(s&=~hc,s&=~fl,e.suspendedLanes|=s,e.pingedLanes&=~s,e=e.expirationTimes;0<s;){var o=31-_n(s),y=1<<o;e[o]=-1,s&=~y}}function jd(e){if((ft&6)!==0)throw Error(i(327));Gr();var s=Mn(e,0);if((s&1)===0)return un(e,Rt()),null;var o=wl(e,s);if(e.tag!==0&&o===2){var y=ui(e);y!==0&&(s=y,o=mc(e,y))}if(o===1)throw o=Wi,pr(e,0),Hs(e,s),un(e,Rt()),o;if(o===6)throw Error(i(345));return e.finishedWork=e.current.alternate,e.finishedLanes=s,mr(e,cn,gs),un(e,Rt()),null}function _c(e,s){var o=ft;ft|=1;try{return e(s)}finally{ft=o,ft===0&&(Kr=Rt()+500,qo&&Ds())}}function fr(e){Bs!==null&&Bs.tag===0&&(ft&6)===0&&Gr();var s=ft;ft|=1;var o=En.transition,y=dt;try{if(En.transition=null,dt=1,e)return e()}finally{dt=y,En.transition=o,ft=s,(ft&6)===0&&Ds()}}function vc(){yn=qr.current,Et(qr)}function pr(e,s){e.finishedWork=null,e.finishedLanes=0;var o=e.timeoutHandle;if(o!==-1&&(e.timeoutHandle=-1,o_(o)),Bt!==null)for(o=Bt.return;o!==null;){var y=o;switch(La(y),y.tag){case 1:y=y.type.childContextTypes,y!=null&&zo();break;case 3:Wr(),Et(on),Et(Yt),Ha();break;case 5:Ba(y);break;case 4:Wr();break;case 13:Et(Mt);break;case 19:Et(Mt);break;case 10:Da(y.type._context);break;case 22:case 23:vc()}o=o.return}if(Wt=e,Bt=e=$s(e.current,null),qt=yn=s,$t=0,Wi=null,hc=fl=dr=0,cn=zi=null,cr!==null){for(s=0;s<cr.length;s++)if(o=cr[s],y=o.interleaved,y!==null){o.interleaved=null;var A=y.next,P=o.pending;if(P!==null){var W=P.next;P.next=A,y.next=W}o.pending=y}cr=null}return e}function Pd(e,s){do{var o=Bt;try{if(Na(),nl.current=ol,sl){for(var y=At.memoizedState;y!==null;){var A=y.queue;A!==null&&(A.pending=null),y=y.next}sl=!1}if(hr=0,Ut=Ht=At=null,Oi=!1,Bi=0,uc.current=null,o===null||o.return===null){$t=1,Wi=s,Bt=null;break}e:{var P=e,W=o.return,J=o,ee=s;if(s=qt,J.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var ce=ee,we=J,Se=we.tag;if((we.mode&1)===0&&(Se===0||Se===11||Se===15)){var _e=we.alternate;_e?(we.updateQueue=_e.updateQueue,we.memoizedState=_e.memoizedState,we.lanes=_e.lanes):(we.updateQueue=null,we.memoizedState=null)}var De=ld(W);if(De!==null){De.flags&=-257,ad(De,W,J,P,s),De.mode&1&&od(P,ce,s),s=De,ee=ce;var Be=s.updateQueue;if(Be===null){var He=new Set;He.add(ee),s.updateQueue=He}else Be.add(ee);break e}else{if((s&1)===0){od(P,ce,s),wc();break e}ee=Error(i(426))}}else if(Tt&&J.mode&1){var jt=ld(W);if(jt!==null){(jt.flags&65536)===0&&(jt.flags|=256),ad(jt,W,J,P,s),Ma(zr(ee,J));break e}}P=ee=zr(ee,J),$t!==4&&($t=2),zi===null?zi=[P]:zi.push(P),P=W;do{switch(P.tag){case 3:P.flags|=65536,s&=-s,P.lanes|=s;var ie=rd(P,ee,s);Ah(P,ie);break e;case 1:J=ee;var ne=P.type,oe=P.stateNode;if((P.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(Os===null||!Os.has(oe)))){P.flags|=65536,s&=-s,P.lanes|=s;var Le=id(P,J,s);Ah(P,Le);break e}}P=P.return}while(P!==null)}Fd(o)}catch($e){s=$e,Bt===o&&o!==null&&(Bt=o=o.return);continue}break}while(!0)}function Od(){var e=dl.current;return dl.current=ol,e===null?ol:e}function wc(){($t===0||$t===3||$t===2)&&($t=4),Wt===null||(dr&268435455)===0&&(fl&268435455)===0||Hs(Wt,qt)}function wl(e,s){var o=ft;ft|=2;var y=Od();(Wt!==e||qt!==s)&&(gs=null,pr(e,s));do try{A_();break}catch(A){Pd(e,A)}while(!0);if(Na(),ft=o,dl.current=y,Bt!==null)throw Error(i(261));return Wt=null,qt=0,$t}function A_(){for(;Bt!==null;)Bd(Bt)}function N_(){for(;Bt!==null&&!fo();)Bd(Bt)}function Bd(e){var s=Ud(e.alternate,e,yn);e.memoizedProps=e.pendingProps,s===null?Fd(e):Bt=s,uc.current=null}function Fd(e){var s=e;do{var o=s.alternate;if(e=s.return,(s.flags&32768)===0){if(o=x_(o,s,yn),o!==null){Bt=o;return}}else{if(o=k_(o,s),o!==null){o.flags&=32767,Bt=o;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{$t=6,Bt=null;return}}if(s=s.sibling,s!==null){Bt=s;return}Bt=s=e}while(s!==null);$t===0&&($t=5)}function mr(e,s,o){var y=dt,A=En.transition;try{En.transition=null,dt=1,D_(e,s,o,y)}finally{En.transition=A,dt=y}return null}function D_(e,s,o,y){do Gr();while(Bs!==null);if((ft&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 P=o.lanes|o.childLanes;if(ta(e,P),e===Wt&&(Bt=Wt=null,qt=0),(o.subtreeFlags&2064)===0&&(o.flags&2064)===0||ml||(ml=!0,Wd(ys,function(){return Gr(),null})),P=(o.flags&15990)!==0,(o.subtreeFlags&15990)!==0||P){P=En.transition,En.transition=null;var W=dt;dt=1;var J=ft;ft|=4,uc.current=null,L_(e,o),Rd(o,e),Zg(wa),Er=!!va,wa=va=null,e.current=o,T_(o),Jl(),ft=J,dt=W,En.transition=P}else e.current=o;if(ml&&(ml=!1,Bs=e,gl=A),P=e.pendingLanes,P===0&&(Os=null),po(o.stateNode),un(e,Rt()),s!==null)for(y=e.onRecoverableError,o=0;o<s.length;o++)A=s[o],y(A.value,{componentStack:A.stack,digest:A.digest});if(pl)throw pl=!1,e=fc,fc=null,e;return(gl&1)!==0&&e.tag!==0&&Gr(),P=e.pendingLanes,(P&1)!==0?e===pc?Vi++:(Vi=0,pc=e):Vi=0,Ds(),null}function Gr(){if(Bs!==null){var e=di(gl),s=En.transition,o=dt;try{if(En.transition=null,dt=16>e?16:e,Bs===null)var y=!1;else{if(e=Bs,Bs=null,gl=0,(ft&6)!==0)throw Error(i(331));var A=ft;for(ft|=4,Oe=e.current;Oe!==null;){var P=Oe,W=P.child;if((Oe.flags&16)!==0){var J=P.deletions;if(J!==null){for(var ee=0;ee<J.length;ee++){var ce=J[ee];for(Oe=ce;Oe!==null;){var we=Oe;switch(we.tag){case 0:case 11:case 15:Ui(8,we,P)}var Se=we.child;if(Se!==null)Se.return=we,Oe=Se;else for(;Oe!==null;){we=Oe;var _e=we.sibling,De=we.return;if(xd(we),we===ce){Oe=null;break}if(_e!==null){_e.return=De,Oe=_e;break}Oe=De}}}var Be=P.alternate;if(Be!==null){var He=Be.child;if(He!==null){Be.child=null;do{var jt=He.sibling;He.sibling=null,He=jt}while(He!==null)}}Oe=P}}if((P.subtreeFlags&2064)!==0&&W!==null)W.return=P,Oe=W;else e:for(;Oe!==null;){if(P=Oe,(P.flags&2048)!==0)switch(P.tag){case 0:case 11:case 15:Ui(9,P,P.return)}var ie=P.sibling;if(ie!==null){ie.return=P.return,Oe=ie;break e}Oe=P.return}}var ne=e.current;for(Oe=ne;Oe!==null;){W=Oe;var oe=W.child;if((W.subtreeFlags&2064)!==0&&oe!==null)oe.return=W,Oe=oe;else e:for(W=ne;Oe!==null;){if(J=Oe,(J.flags&2048)!==0)try{switch(J.tag){case 0:case 11:case 15:hl(9,J)}}catch($e){Dt(J,J.return,$e)}if(J===W){Oe=null;break e}var Le=J.sibling;if(Le!==null){Le.return=J.return,Oe=Le;break e}Oe=J.return}}if(ft=A,Ds(),gn&&typeof gn.onPostCommitFiberRoot=="function")try{gn.onPostCommitFiberRoot(is,e)}catch{}y=!0}return y}finally{dt=o,En.transition=s}}return!1}function Hd(e,s,o){s=zr(o,s),s=rd(e,s,1),e=js(e,s,1),s=sn(),e!==null&&(zn(e,1,s),un(e,s))}function Dt(e,s,o){if(e.tag===3)Hd(e,e,o);else for(;s!==null;){if(s.tag===3){Hd(s,e,o);break}else if(s.tag===1){var y=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(Os===null||!Os.has(y))){e=zr(o,e),e=id(s,e,1),s=js(s,e,1),e=sn(),s!==null&&(zn(s,1,e),un(s,e));break}}s=s.return}}function I_(e,s,o){var y=e.pingCache;y!==null&&y.delete(s),s=sn(),e.pingedLanes|=e.suspendedLanes&o,Wt===e&&(qt&o)===o&&($t===4||$t===3&&(qt&130023424)===qt&&500>Rt()-dc?pr(e,0):hc|=o),un(e,s)}function $d(e,s){s===0&&((e.mode&1)===0?s=1:(s=os,os<<=1,(os&130023424)===0&&(os=4194304)));var o=sn();e=fs(e,s),e!==null&&(zn(e,s,o),un(e,o))}function j_(e){var s=e.memoizedState,o=0;s!==null&&(o=s.retryLane),$d(e,o)}function P_(e,s){var o=0;switch(e.tag){case 13:var y=e.stateNode,A=e.memoizedState;A!==null&&(o=A.retryLane);break;case 19:y=e.stateNode;break;default:throw Error(i(314))}y!==null&&y.delete(s),$d(e,o)}var Ud;Ud=function(e,s,o){if(e!==null)if(e.memoizedProps!==s.pendingProps||on.current)an=!0;else{if((e.lanes&o)===0&&(s.flags&128)===0)return an=!1,C_(e,s,o);an=(e.flags&131072)!==0}else an=!1,Tt&&(s.flags&1048576)!==0&&bh(s,Go,s.index);switch(s.lanes=0,s.tag){case 2:var y=s.type;cl(e,s),e=s.pendingProps;var A=Pr(s,Yt.current);Ur(s,o),A=Wa(null,s,y,e,A,o);var P=za();return s.flags|=1,typeof A=="object"&&A!==null&&typeof A.render=="function"&&A.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,ln(y)?(P=!0,Vo(s)):P=!1,s.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,Pa(s),A.updater=ll,s.stateNode=A,A._reactInternals=s,Xa(s,y,e,o),s=ec(null,s,y,!0,P,o)):(s.tag=0,Tt&&P&&Ea(s),nn(null,s,A,o),s=s.child),s;case 16:y=s.elementType;e:{switch(cl(e,s),e=s.pendingProps,A=y._init,y=A(y._payload),s.type=y,A=s.tag=B_(y),e=Pn(y,e),A){case 0:s=Za(null,s,y,e,o);break e;case 1:s=pd(null,s,y,e,o);break e;case 11:s=cd(null,s,y,e,o);break e;case 14:s=ud(null,s,y,Pn(y.type,e),o);break e}throw Error(i(306,y,""))}return s;case 0:return y=s.type,A=s.pendingProps,A=s.elementType===y?A:Pn(y,A),Za(e,s,y,A,o);case 1:return y=s.type,A=s.pendingProps,A=s.elementType===y?A:Pn(y,A),pd(e,s,y,A,o);case 3:e:{if(md(s),e===null)throw Error(i(387));y=s.pendingProps,P=s.memoizedState,A=P.element,Mh(e,s),el(s,y,null,o);var W=s.memoizedState;if(y=W.element,P.isDehydrated)if(P={element:y,isDehydrated:!1,cache:W.cache,pendingSuspenseBoundaries:W.pendingSuspenseBoundaries,transitions:W.transitions},s.updateQueue.baseState=P,s.memoizedState=P,s.flags&256){A=zr(Error(i(423)),s),s=gd(e,s,y,o,A);break e}else if(y!==A){A=zr(Error(i(424)),s),s=gd(e,s,y,o,A);break e}else for(wn=Ms(s.stateNode.containerInfo.firstChild),vn=s,Tt=!0,jn=null,o=Th(s,null,y,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Fr(),y===A){s=ms(e,s,o);break e}nn(e,s,y,o)}s=s.child}return s;case 5:return Dh(s),e===null&&Ra(s),y=s.type,A=s.pendingProps,P=e!==null?e.memoizedProps:null,W=A.children,ya(y,A)?W=null:P!==null&&ya(y,P)&&(s.flags|=32),fd(e,s),nn(e,s,W,o),s.child;case 6:return e===null&&Ra(s),null;case 13:return _d(e,s,o);case 4:return Oa(s,s.stateNode.containerInfo),y=s.pendingProps,e===null?s.child=Hr(s,null,y,o):nn(e,s,y,o),s.child;case 11:return y=s.type,A=s.pendingProps,A=s.elementType===y?A:Pn(y,A),cd(e,s,y,A,o);case 7:return nn(e,s,s.pendingProps,o),s.child;case 8:return nn(e,s,s.pendingProps.children,o),s.child;case 12:return nn(e,s,s.pendingProps.children,o),s.child;case 10:e:{if(y=s.type._context,A=s.pendingProps,P=s.memoizedProps,W=A.value,Ct(Qo,y._currentValue),y._currentValue=W,P!==null)if(In(P.value,W)){if(P.children===A.children&&!on.current){s=ms(e,s,o);break e}}else for(P=s.child,P!==null&&(P.return=s);P!==null;){var J=P.dependencies;if(J!==null){W=P.child;for(var ee=J.firstContext;ee!==null;){if(ee.context===y){if(P.tag===1){ee=ps(-1,o&-o),ee.tag=2;var ce=P.updateQueue;if(ce!==null){ce=ce.shared;var we=ce.pending;we===null?ee.next=ee:(ee.next=we.next,we.next=ee),ce.pending=ee}}P.lanes|=o,ee=P.alternate,ee!==null&&(ee.lanes|=o),Ia(P.return,o,s),J.lanes|=o;break}ee=ee.next}}else if(P.tag===10)W=P.type===s.type?null:P.child;else if(P.tag===18){if(W=P.return,W===null)throw Error(i(341));W.lanes|=o,J=W.alternate,J!==null&&(J.lanes|=o),Ia(W,o,s),W=P.sibling}else W=P.child;if(W!==null)W.return=P;else for(W=P;W!==null;){if(W===s){W=null;break}if(P=W.sibling,P!==null){P.return=W.return,W=P;break}W=W.return}P=W}nn(e,s,A.children,o),s=s.child}return s;case 9:return A=s.type,y=s.pendingProps.children,Ur(s,o),A=xn(A),y=y(A),s.flags|=1,nn(e,s,y,o),s.child;case 14:return y=s.type,A=Pn(y,s.pendingProps),A=Pn(y.type,A),ud(e,s,y,A,o);case 15:return hd(e,s,s.type,s.pendingProps,o);case 17:return y=s.type,A=s.pendingProps,A=s.elementType===y?A:Pn(y,A),cl(e,s),s.tag=1,ln(y)?(e=!0,Vo(s)):e=!1,Ur(s,o),nd(s,y,A),Xa(s,y,A,o),ec(null,s,y,!0,e,o);case 19:return wd(e,s,o);case 22:return dd(e,s,o)}throw Error(i(156,s.tag))};function Wd(e,s){return uo(e,s)}function O_(e,s,o,y){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=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ln(e,s,o,y){return new O_(e,s,o,y)}function yc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function B_(e){if(typeof e=="function")return yc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===O)return 11;if(e===q)return 14}return 2}function $s(e,s){var o=e.alternate;return o===null?(o=Ln(e.tag,s,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=s,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,s=e.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function yl(e,s,o,y,A,P){var W=2;if(y=e,typeof e=="function")yc(e)&&(W=1);else if(typeof e=="string")W=5;else e:switch(e){case M:return gr(o.children,A,P,s);case b:W=8,A|=8;break;case R:return e=Ln(12,o,s,A|2),e.elementType=R,e.lanes=P,e;case F:return e=Ln(13,o,s,A),e.elementType=F,e.lanes=P,e;case U:return e=Ln(19,o,s,A),e.elementType=U,e.lanes=P,e;case Y:return bl(o,A,P,s);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:W=10;break e;case B:W=9;break e;case O:W=11;break e;case q:W=14;break e;case X:W=16,y=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return s=Ln(W,o,s,A),s.elementType=e,s.type=y,s.lanes=P,s}function gr(e,s,o,y){return e=Ln(7,e,y,s),e.lanes=o,e}function bl(e,s,o,y){return e=Ln(22,e,y,s),e.elementType=Y,e.lanes=o,e.stateNode={isHidden:!1},e}function bc(e,s,o){return e=Ln(6,e,null,s),e.lanes=o,e}function Sc(e,s,o){return s=Ln(4,e.children!==null?e.children:[],e.key,s),s.lanes=o,s.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},s}function F_(e,s,o,y,A){this.tag=s,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=Wn(0),this.expirationTimes=Wn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wn(0),this.identifierPrefix=y,this.onRecoverableError=A,this.mutableSourceEagerHydrationData=null}function Cc(e,s,o,y,A,P,W,J,ee){return e=new F_(e,s,o,J,ee),s===1?(s=1,P===!0&&(s|=8)):s=0,P=Ln(3,null,null,s),e.current=P,P.stateNode=e,P.memoizedState={element:y,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Pa(P),e}function H_(e,s,o){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:y==null?null:""+y,children:e,containerInfo:s,implementation:o}}function zd(e){if(!e)return Ns;e=e._reactInternals;e:{if(Ve(e)!==e||e.tag!==1)throw Error(i(170));var s=e;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(ln(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(i(171))}if(e.tag===1){var o=e.type;if(ln(o))return vh(e,o,s)}return s}function Vd(e,s,o,y,A,P,W,J,ee){return e=Cc(o,y,!0,e,A,P,W,J,ee),e.context=zd(null),o=e.current,y=sn(),A=Fs(o),P=ps(y,A),P.callback=s??null,js(o,P,A),e.current.lanes=A,zn(e,A,y),un(e,y),e}function Sl(e,s,o,y){var A=s.current,P=sn(),W=Fs(A);return o=zd(o),s.context===null?s.context=o:s.pendingContext=o,s=ps(P,W),s.payload={element:e},y=y===void 0?null:y,y!==null&&(s.callback=y),e=js(A,s,W),e!==null&&(Fn(e,A,W,P),Zo(e,A,W)),W}function Cl(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 qd(e,s){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var o=e.retryLane;e.retryLane=o!==0&&o<s?o:s}}function xc(e,s){qd(e,s),(e=e.alternate)&&qd(e,s)}function $_(){return null}var Kd=typeof reportError=="function"?reportError:function(e){console.error(e)};function kc(e){this._internalRoot=e}xl.prototype.render=kc.prototype.render=function(e){var s=this._internalRoot;if(s===null)throw Error(i(409));Sl(e,s,null,null)},xl.prototype.unmount=kc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var s=e.containerInfo;fr(function(){Sl(null,e,null,null)}),s[cs]=null}};function xl(e){this._internalRoot=e}xl.prototype.unstable_scheduleHydration=function(e){if(e){var s=fi();e={blockedOn:null,target:e,priority:s};for(var o=0;o<Vn.length&&s!==0&&s<Vn[o].priority;o++);Vn.splice(o,0,e),o===0&&xr(e)}};function Ec(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function kl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Gd(){}function U_(e,s,o,y,A){if(A){if(typeof y=="function"){var P=y;y=function(){var ce=Cl(W);P.call(ce)}}var W=Vd(s,y,e,0,null,!1,!1,"",Gd);return e._reactRootContainer=W,e[cs]=W.current,Ri(e.nodeType===8?e.parentNode:e),fr(),W}for(;A=e.lastChild;)e.removeChild(A);if(typeof y=="function"){var J=y;y=function(){var ce=Cl(ee);J.call(ce)}}var ee=Cc(e,0,!1,null,null,!1,!1,"",Gd);return e._reactRootContainer=ee,e[cs]=ee.current,Ri(e.nodeType===8?e.parentNode:e),fr(function(){Sl(s,ee,o,y)}),ee}function El(e,s,o,y,A){var P=o._reactRootContainer;if(P){var W=P;if(typeof A=="function"){var J=A;A=function(){var ee=Cl(W);J.call(ee)}}Sl(s,W,e,A)}else W=U_(o,s,e,A,y);return Cl(W)}mo=function(e){switch(e.tag){case 3:var s=e.stateNode;if(s.current.memoizedState.isDehydrated){var o=Un(s.pendingLanes);o!==0&&(Ft(s,o|1),un(s,Rt()),(ft&6)===0&&(Kr=Rt()+500,Ds()))}break;case 13:fr(function(){var y=fs(e,1);if(y!==null){var A=sn();Fn(y,e,1,A)}}),xc(e,1)}},br=function(e){if(e.tag===13){var s=fs(e,134217728);if(s!==null){var o=sn();Fn(s,e,134217728,o)}xc(e,134217728)}},go=function(e){if(e.tag===13){var s=Fs(e),o=fs(e,s);if(o!==null){var y=sn();Fn(o,e,s,y)}xc(e,s)}},fi=function(){return dt},pi=function(e,s){var o=dt;try{return dt=e,s()}finally{dt=o}},xe=function(e,s,o){switch(s){case"input":if(Me(e,o),s=o.name,o.type==="radio"&&s!=null){for(o=e;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<o.length;s++){var y=o[s];if(y!==e&&y.form===e.form){var A=Wo(y);if(!A)throw Error(i(90));fe(y),Me(y,A)}}}break;case"textarea":Ne(e,o);break;case"select":s=o.value,s!=null&&Re(e,!!o.multiple,s,!1)}},gt=_c,Qe=fr;var W_={usingClientEntryPoint:!1,Events:[Ni,Ir,Wo,rt,St,_c]},qi={findFiberByHostInstance:ir,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},z_={bundleType:qi.bundleType,version:qi.version,rendererPackageName:qi.rendererPackageName,rendererConfig:qi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Rn(e),e===null?null:e.stateNode},findFiberByHostInstance:qi.findFiberByHostInstance||$_,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 Ll=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ll.isDisabled&&Ll.supportsFiber)try{is=Ll.inject(z_),gn=Ll}catch{}}return hn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W_,hn.createPortal=function(e,s){var o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ec(s))throw Error(i(200));return H_(e,s,null,o)},hn.createRoot=function(e,s){if(!Ec(e))throw Error(i(299));var o=!1,y="",A=Kd;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(y=s.identifierPrefix),s.onRecoverableError!==void 0&&(A=s.onRecoverableError)),s=Cc(e,1,!1,null,null,o,!1,y,A),e[cs]=s.current,Ri(e.nodeType===8?e.parentNode:e),new kc(s)},hn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var s=e._reactInternals;if(s===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=Rn(s),e=e===null?null:e.stateNode,e},hn.flushSync=function(e){return fr(e)},hn.hydrate=function(e,s,o){if(!kl(s))throw Error(i(200));return El(null,e,s,!0,o)},hn.hydrateRoot=function(e,s,o){if(!Ec(e))throw Error(i(405));var y=o!=null&&o.hydratedSources||null,A=!1,P="",W=Kd;if(o!=null&&(o.unstable_strictMode===!0&&(A=!0),o.identifierPrefix!==void 0&&(P=o.identifierPrefix),o.onRecoverableError!==void 0&&(W=o.onRecoverableError)),s=Vd(s,null,e,1,o??null,A,!1,P,W),e[cs]=s.current,Ri(e),y)for(e=0;e<y.length;e++)o=y[e],A=o._getVersion,A=A(o._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[o,A]:s.mutableSourceEagerHydrationData.push(o,A);return new xl(s)},hn.render=function(e,s,o){if(!kl(s))throw Error(i(200));return El(null,e,s,!1,o)},hn.unmountComponentAtNode=function(e){if(!kl(e))throw Error(i(40));return e._reactRootContainer?(fr(function(){El(null,null,e,!1,function(){e._reactRootContainer=null,e[cs]=null})}),!0):!1},hn.unstable_batchedUpdates=_c,hn.unstable_renderSubtreeIntoContainer=function(e,s,o,y){if(!kl(o))throw Error(i(200));if(e==null||e._reactInternals===void 0)throw Error(i(38));return El(e,s,o,!1,y)},hn.version="18.3.1-next-f1338f8080-20240426",hn}var nf;function Qp(){if(nf)return Rc.exports;nf=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(n){console.error(n)}}return t(),Rc.exports=ev(),Rc.exports}var sf;function tv(){if(sf)return Tl;sf=1;var t=Qp();return Tl.createRoot=t.createRoot,Tl.hydrateRoot=t.hydrateRoot,Tl}var nv=tv(),N=Eu();const sv=G_(N);function Fe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function Ie(t){return typeof t=="string"?t:null}function ve(t){return typeof t=="string"&&t.length>0?t:null}function yt(t){return typeof t=="boolean"?t:null}function We(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function Ji(t){if(!Array.isArray(t))return null;const n=[];for(const i of t){if(typeof i!="string")return null;n.push(i)}return n}function Lt(t,n){if(!Array.isArray(t))return null;const i=[];for(const c of t){const g=n(c);if(g===null)return null;i.push(g)}return i}function dn(t,n){if(!Array.isArray(t))return null;const i=[];for(const c of t){const g=n(c);g!==null&&i.push(g)}return i}function nt(t,n){return typeof t=="string"&&n.includes(t)?t:null}function rv(t){try{return JSON.parse(t)}catch{return}}const iv=["auto","default","acceptEdits","plan"];function Jr(t){return typeof t=="string"&&iv.includes(t)}const ov={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 lv(t){return Object.prototype.hasOwnProperty.call(ov,t)}function ts(t,n=0){const i=Fe(t);if(i===null)return null;const c=Ie(i.key);if(c===null||c.length===0)return null;const g=i.params;if(g===void 0)return{key:c};const T=Fe(g);if(T===null)return null;const C={};for(const[r,u]of Object.entries(T)){if(typeof u=="string"||typeof u=="number"&&Number.isFinite(u)){C[r]=u;continue}const _=n===0?ts(u,n+1):null;if(_===null)return null;C[r]=_}return{key:c,params:C}}function av(t){if(!Array.isArray(t))return null;const n=[];for(const i of t){const c=ts(i);if(c===null)return null;n.push(c)}return n}const Zr=["claude-code","codex","opencode","antigravity","pi"],cv=["gemini-cli","antigravity-ide"],Kl=[...Zr,...cv],uv={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function si(t){return Zr.includes(t)}const hv=["at-quoted","bare-path-paste","quoted-path-line"],dv=["at"],fv=["usage-with-variants","token-count","usage-with-catalog","status-line"],pv=["child-session-marker"],mv=["active","missing","other-command","disabled","unreadable"];function Jp(t,n=null){return!t.statusSource||n==="unknown"}const Zp={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 Lu(t){return t.filter(n=>n.available).length>1}function gv(t){const n=Fe(t);if(n===null)return null;const i=n.modes;if(!Array.isArray(i)||i.length===0)return null;const c=[];for(const C of i){if(!Jr(C))return null;c.push(C)}const g=n.launchMode;if(!Jr(g)||!c.includes(g))return null;const T=ve(n.keyLabel);return T===null?null:{modes:c,launchMode:g,keyLabel:T,approvesPendingOnCycle:n.approvesPendingOnCycle===!0}}function _v(t){const n=Fe(t);if(n===null)return null;const i=nt(n.state,mv),c=ve(n.settingsPath),g=ve(n.scriptPath),T=n.fragment,C=T===null?null:ve(T);return i===null||c===null||g===null||T!==null&&C===null?null:{state:i,settingsPath:c,scriptPath:g,fragment:C}}function vv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.value),c=Ie(n.label),g=Ie(n.family),T=yt(n.long),C=n.window,r=C===null?null:We(C);return i===null||c===null||g===null||T===null||C!==null&&r===null?null:{value:i,label:c,family:g,long:T,window:r}}function wv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.value),c=Ie(n.label);return i===null||c===null?null:{value:i,label:c}}function rf(t,n){const i=Lt(t,n);return i===null||i.length===0?null:i}function yv(t){const n=Fe(t);return n===null?{...Zp}:{sessionIdAtLaunch:n.sessionIdAtLaunch===!0,resume:n.resume===!0,statusSource:n.statusSource===!0,readySignal:n.readySignal===!0,permissionCycle:gv(n.permissionCycle),models:rf(n.models,vv),efforts:rf(n.efforts,wv),questionCards:n.questionCards===!0,imagesByPath:nt(n.imagesByPath,hv),fileMentions:nt(n.fileMentions,dv),rewind:n.rewind===!0,contextWindowSource:nt(n.contextWindowSource,fv),plans:n.plans===!0,waitingBlocksSubmit:n.waitingBlocksSubmit===!0}}function of(t){const n=Fe(t);if(n===null)return null;const i=nt(n.id,Zr),c=Ie(n.label),g=Ie(n.command),T=Ie(n.installUrl);return i===null||c===null||g===null||T===null?null:{id:i,label:c,command:g,available:n.available===!0,version:Ie(n.version),installUrl:T,missingMessage:ts(n.missingMessage),capabilities:yv(n.capabilities),environmentNotice:nt(n.environmentNotice,pv),statusLine:_v(n.statusLine)}}const bv=["custom","ai","first-message","none"],Sv=["native","vault"],Cv=["idle","scanning","ready"],xv=["agent","shell"],kv=["busy","idle","waiting","offline","unknown"],Ev=["server-closed"];function Lv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.sessionId),c=Ie(n.title),g=nt(n.titleSource,bv),T=We(n.updatedAt),C=We(n.sizeBytes);if(i===null||c===null||g===null||T===null||C===null)return null;const r=n.agent===void 0?"claude-code":nt(n.agent,Kl);if(r===null)return null;const u=Ie(n.cwd)??"";return{agent:r,sessionId:i,cwd:u,title:c,titleSource:g,updatedAt:T,sizeBytes:C,archived:n.archived===!0,storage:nt(n.storage,Sv)??"native",partial:n.partial===!0}}function Tv(t){const n=Fe(t);if(n===null)return null;const i=Ie(n.cwd),c=yt(n.cwdExists),g=dn(n.sessions,Lv),T=We(n.lastActivityAt);if(i===null||c===null||g===null||T===null)return null;const C=ve(n.key);if(C!==null)return{key:C,fallbackName:Ie(n.fallbackName)??"",cwd:i,cwdExists:c,sessions:g,lastActivityAt:T};const r=ve(n.slug);return r===null?null:{key:r,fallbackName:i.length===0?r:"",cwd:i,cwdExists:c,sessions:g,lastActivityAt:T}}function Rv(t){const n=Fe(t);if(n===null)return null;const i=nt(n.state,Cv),c=We(n.scannedFiles),g=We(n.totalFiles);return i===null||c===null||g===null?null:{state:i,scannedFiles:c,totalFiles:g}}function lf(t){const n=Fe(t);if(n===null)return null;const i=ve(n.terminalId),c=nt(n.kind,xv)??"agent";let g=null;if(c==="agent"&&(g=n.agent===void 0?"claude-code":nt(n.agent,Zr),g===null))return null;const T=Ie(n.cwd),C=Ie(n.sessionId),r=Ie(n.label),u=yt(n.resumed),_=We(n.createdAt),v=yt(n.alive);if(i===null||T===null||C===null||r===null||u===null||_===null||v===null)return null;const h=n.exitCode;return{terminalId:i,kind:c,agent:g,cwd:T,sessionId:C,label:r,resumed:u,createdAt:_,alive:v,exitCode:typeof h=="number"?h:null,sleeping:n.sleeping===!0,launchedAt:We(n.launchedAt)}}const em=["user","assistant"],tm=["content","attachment","pasted"],Mv=["compacted","interrupted","error"],Av=["cli-plans","project","scratch"],Nv=120,Dv=20,Nc={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},af=["waiting","live","unavailable","no-transcript"];function Iv(t){const n=Fe(t);if(n===null)return null;const i=We(n.inputTokens),c=We(n.outputTokens),g=We(n.cacheCreationInputTokens),T=We(n.cacheReadInputTokens);return i===null||c===null||g===null||T===null?null:{inputTokens:i,outputTokens:c,cacheCreationInputTokens:g,cacheReadInputTokens:T}}function jv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.label);return i===null?null:{label:i,description:Ie(n.description)??""}}function Pv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.question),c=Lt(n.options,jv);return i===null||c===null||c.length===0?null:{question:i,header:Ie(n.header)??"",multiSelect:n.multiSelect===!0,options:c}}function nm(t){const n=Fe(t);if(n===null)return null;switch(n.kind){case"text":{const i=Ie(n.text),c=yt(n.truncated);return i===null||c===null?null:{kind:"text",text:i,truncated:c}}case"tool-call":{const i=Ie(n.toolUseId),c=Ie(n.name),g=Ie(n.input),T=yt(n.truncated);return i===null||c===null||g===null||T===null?null:{kind:"tool-call",toolUseId:i,name:c,input:g,truncated:T}}case"tool-result":{const i=Ie(n.toolUseId),c=Ie(n.text),g=yt(n.isError),T=yt(n.truncated),C=We(n.imageCount);return i===null||c===null||g===null||T===null||C===null?null:{kind:"tool-result",toolUseId:i,text:c,isError:g,truncated:T,imageCount:C}}case"thinking":return{kind:"thinking"};case"question":{const i=ve(n.toolUseId),c=Lt(n.questions,Pv);return i===null||c===null||c.length===0?null:{kind:"question",toolUseId:i,questions:c}}case"image":{const i=We(n.index),c=Ie(n.mediaType);if(i===null||c===null)return null;const g=nt(n.source,tm)??"content";return{kind:"image",index:i,mediaType:c,source:g}}case"notice":{const i=nt(n.notice,Mv);return i===null?null:{kind:"notice",notice:i,detail:Ie(n.detail)??""}}default:return null}}function Dc(t){const n=Fe(t);if(n===null)return null;const i=ve(n.eventId),c=nt(n.role,em),g=We(n.at),T=Lt(n.parts,nm);return i===null||c===null||g===null||T===null?null:{eventId:i,role:c,at:g,parts:T,model:Ie(n.model),usage:Iv(n.usage),effort:Ie(n.effort),durationMs:We(n.durationMs),queued:n.queued===!0}}function Ov(t){const n=Fe(t);if(n===null)return null;const i=ve(n.toolUseId),c=Ie(n.description),g=We(n.startedAt);return i===null||c===null||g===null?null:{toolUseId:i,description:c.slice(0,Nv),background:n.background===!0,startedAt:g}}function cf(t){const n=Fe(t);if(n===null)return null;const i=We(n.lastRequestTokens),c=We(n.lastOutputTokens),g=We(n.totalInputTokens),T=We(n.totalOutputTokens),C=We(n.totalCacheReadTokens),r=We(n.assistantMessages);if(i===null||c===null||g===null||T===null||C===null||r===null)return null;const u=Ie(n.lastEffort);return{lastRequestTokens:i,lastOutputTokens:c,lastModel:Ie(n.lastModel),contextWindow:We(n.contextWindow),contextWindowEstimated:n.contextWindowEstimated===!0,totalInputTokens:g,totalOutputTokens:T,totalCacheReadTokens:C,assistantMessages:r,...u!==null?{lastEffort:u}:{}}}function Bv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.fileName),c=ve(n.title),g=We(n.modifiedAt),T=We(n.sizeBytes);if(i===null||c===null||g===null||T===null)return null;const C=n.origin,r=Av.find(_=>_===C)??"cli-plans",u=Ie(n.path)??"";return{fileName:i,title:c,origin:r,path:u,absolutePath:Ie(n.absolutePath)??"",exists:n.exists===!0,modifiedAt:g,sizeBytes:T}}function Fv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.fileName),c=Ie(n.text);return i===null||c===null?null:{fileName:i,text:c,truncated:n.truncated===!0}}const sm=[{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 Hv(t){if(t.window===null)return t.label;const n=t.window>=1e6?`${Math.round(t.window/1e6)}M`:`${Math.round(t.window/1e3)}k`;return`${t.label} · ${n}`}function $v(t,n=sm){const i=Uv(t,n);if(i===null||t===null)return null;const c=t.includes("[1m]");return n.find(g=>g.family===i&&g.long===c)??null}function Uv(t,n=sm){var c;return t===null||t.length===0?null:((c=n.filter(g=>g.family.length>0).sort((g,T)=>T.family.length-g.family.length).find(g=>t.includes(g.family)))==null?void 0:c.family)??null}function Wv(t){return`/model ${t}`}const Tu="/effort";function zv(t,n=Tu){return`${n} ${t}`}const Vv=["staged","unstaged","untracked","conflict"],qv=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],Kv=["ready","not-a-repo","git-missing","error"],Ic={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},Gv=["meta","hunk","context","added","removed"];function Yv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.path),c=nt(n.kind,qv),g=nt(n.stage,Vv);return i===null||c===null||g===null?null:{path:i,kind:c,stage:g,oldPath:Ie(n.oldPath)}}function Xv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.path);return i===null?null:{path:i,branch:Ie(n.branch),isCurrent:n.isCurrent===!0}}function Qv(t){const n=Fe(t);if(n===null)return null;const i=nt(n.state,Kv),c=Ie(n.repoRoot),g=We(n.ahead),T=We(n.behind),C=Lt(n.changes,Yv),r=Lt(n.worktrees,Xv),u=We(n.updatedAt);return i===null||c===null||g===null||T===null||C===null||r===null||u===null?null:{state:i,message:ts(n.message),repoRoot:c,branch:Ie(n.branch),head:Ie(n.head),upstream:Ie(n.upstream),ahead:g,behind:T,changes:C,worktrees:r,truncated:n.truncated===!0,updatedAt:u}}function Jv(t){const n=Fe(t);if(n===null)return null;const i=nt(n.kind,Gv),c=Ie(n.text);return i===null||c===null?null:{kind:i,text:c,oldLine:We(n.oldLine),newLine:We(n.newLine)}}function Zv(t){const n=Fe(t);if(n===null)return null;const i=ve(n.path),c=yt(n.staged),g=Lt(n.lines,Jv);return i===null||c===null||g===null?null:{path:i,staged:c,lines:g,truncated:n.truncated===!0,binary:n.binary===!0,message:ts(n.message)}}const e0=["dir","file"],t0=["ignored","always"];function rm(t){const n=Fe(t);if(n===null)return null;const i=ve(n.name),c=ve(n.path),g=nt(n.kind,e0),T=We(n.sizeBytes),C=We(n.modifiedAt);if(i===null||c===null||g===null||T===null||C===null)return null;const r=nt(n.hidden,t0),u={name:i,path:c,kind:g,sizeBytes:T,modifiedAt:C};return r===null?u:{...u,hidden:r}}function n0(t){const n=Fe(t);if(n===null)return null;const i=Ie(n.query),c=Lt(n.entries,rm);return i===null||c===null?null:{query:i,entries:c,truncated:n.truncated===!0}}function s0(t){const n=Fe(t);if(n===null)return null;const i=Ie(n.path),c=Lt(n.entries,rm),g=We(n.hiddenCount);return i===null||c===null||g===null?null:{path:i,entries:c,truncated:n.truncated===!0,hiddenCount:g}}function r0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.path),c=Ie(n.text),g=We(n.sizeBytes),T=yt(n.binary);return i===null||c===null||g===null||T===null?null:{path:i,language:Ie(n.language),text:c,sizeBytes:g,truncated:n.truncated===!0,binary:T}}function i0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.pickerId),c=ve(n.path),g=Lt(n.entries,C=>ve(C)),T=Lt(n.roots,C=>ve(C));return i===null||c===null||g===null||T===null?null:{pickerId:i,path:c,entries:g,roots:T,canGoUp:n.canGoUp===!0,truncated:n.truncated===!0}}const im=1e6,o0=100,l0=999999;function om(t){return t.pasted.reduce((n,i)=>n+i.text.length,t.text.length)}function Ol(t){return t.text.trim().length===0&&t.pasted.every(n=>n.text.trim().length===0)}function lm(t,n){return t.text!==n.text||t.pasted.length!==n.pasted.length?!1:t.pasted.every((i,c)=>{const g=n.pasted[c];return g!==void 0&&g.number===i.number&&g.text===i.text})}function a0(t){const n=Fe(t);if(n===null)return null;const i=n.number,c=Ie(n.text);return typeof i!="number"||!Number.isInteger(i)||i<1||i>l0||c===null?null:{number:i,text:c}}function c0(t){const n=Fe(t);if(n===null)return null;const i=Ie(n.text),c=Lt(n.pasted,a0);return i===null||c===null||c.length>o0||new Set(c.map(g=>g.number)).size!==c.length?null:{text:i,pasted:c}}const Bl="MEMORY.md",Ru=["AGENTS.md","CLAUDE.md"],am=["claude-code","codex","antigravity","opencode","pi"],u0=["outside","encoding"],h0=["create","append-block","replace-block","append-lines","copy"];function d0(t){return{instructionFiles:[...Ru],gitMode:t!==null&&t.git.kind==="error"?"version":"ignore",importNative:t!==null&&t.native.pending>0,copyFromMainWorktree:t!==null&&t.git.kind==="repo"&&t.git.worktree!==null&&t.git.worktree.mainHasMemory}}function f0(t){const n=Fe(t);if(n===null)return null;const i=nt(n.name,Ru),c=yt(n.exists),g=yt(n.hasBlock),T=yt(n.blockCurrent),C=yt(n.brokenBlock),r=n.problem,u=r===null?null:nt(r,u0);return i===null||c===null||g===null||T===null||C===null||r!==null&&u===null?null:{name:i,exists:c,hasBlock:g,blockCurrent:T,brokenBlock:C,problem:u}}function p0(t){const n=Fe(t);if(n===null)return null;switch(n.kind){case"not-repo":return{kind:"not-repo"};case"error":{const i=ts(n.message);return i===null?null:{kind:"error",message:i}}case"repo":{const i=yt(n.ignored);if(i===null)return null;if(n.worktree===null)return{kind:"repo",ignored:i,worktree:null};const c=Fe(n.worktree);if(c===null)return null;const g=ve(c.mainPath),T=yt(c.mainHasMemory);return g===null||T===null?null:{kind:"repo",ignored:i,worktree:{mainPath:g,mainHasMemory:T}}}default:return null}}function m0(t){const n=Fe(t);if(n===null)return null;const i=nt(n.agent,am),c=ve(n.label),g=yt(n.reaches),T=ts(n.via);return i===null||c===null||g===null||T===null?null:{agent:i,label:c,reaches:g,via:T}}function g0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.name),c=Ie(n.title),g=Ie(n.description),T=We(n.sizeBytes),C=We(n.modifiedAt);return i===null||c===null||g===null||T===null||C===null?null:{name:i,title:c,description:g,sizeBytes:T,modifiedAt:C}}const _0=["line","command","json"];function v0(t){const n=Fe(t);if(n===null)return null;const i=nt(n.agent,am),c=ve(n.label),g=ve(n.target),T=nt(n.kind,_0),C=ve(n.text),r=ts(n.note);return i===null||c===null||g===null||T===null||C===null||r===null?null:{agent:i,label:c,target:g,kind:T,text:C,note:r}}function w0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.cwd),c=yt(n.folderExists),g=yt(n.indexExists),T=yt(n.installed),C=Lt(n.notes,g0),r=Lt(n.files,f0),u=p0(n.git),_=Lt(n.reach,m0),v=Fe(n.native),h=v===null?null:We(v.available),w=v===null?null:We(v.pending),k=Lt(n.globalFragments,v0);return i===null||c===null||g===null||T===null||C===null||r===null||u===null||_===null||h===null||w===null||k===null?null:{cwd:i,folderExists:c,indexExists:g,installed:T,notes:C,files:r,git:u,reach:_,native:{available:h,pending:w},globalFragments:k}}function uf(t){const n=Fe(t);if(n===null)return null;const i=ve(n.file),c=nt(n.action,h0),g=Ie(n.preview),T=Ie(n.copiedFrom);return i===null||c===null||g===null?null:{file:i,action:c,preview:g,copiedFrom:T}}function y0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.name),c=Ie(n.text),g=yt(n.truncated);return i===null||c===null||g===null?null:{name:i,text:c,truncated:g}}const hf=20;function b0(t,n="Nota"){const i=t.text.split(`
41
- `).map(c=>c.trim()).find(c=>c.length>0);return i===void 0?t.images.length>0?"Imagen":n:i.length>40?`${i.slice(0,40)}…`:i}function S0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.imageId),c=ve(n.mediaType),g=We(n.bytes);return i===null||c===null||g===null?null:{imageId:i,mediaType:c,bytes:g}}function C0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.noteId),c=Ie(n.text),g=Lt(n.images,S0),T=We(n.createdAt),C=We(n.updatedAt);return i===null||c===null||g===null?null:{noteId:i,text:c,images:g,createdAt:T??0,updatedAt:C??0}}const cm=3,x0=3e4,k0=["results","time"];function ei(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function Zi(t,n){if(t==null)return null;const i=n(t);return i===null?void 0:i}function um(t){const n=Fe(t);if(n===null)return null;const i=nt(n.agent,Kl),c=ve(n.sessionId),g=Zi(n.cwd,Ie),T=Ie(n.title),C=Zi(n.eventId,ve),r=Zi(n.role,w=>nt(w,em)),u=Zi(n.at,We),_=Ie(n.snippet),v=ei(n.matchStart),h=ei(n.matchLength);return i===null||c===null||g===void 0||T===null||C===void 0||r===void 0||u===void 0||_===null||v===null||h===null||v+h>_.length?null:{agent:i,sessionId:c,cwd:g,title:T,eventId:C,role:r,at:u,snippet:_,matchStart:v,matchLength:h}}function E0(t){const n=Fe(t);if(n===null)return null;const i=Ie(n.query),c=dn(n.hits,um),g=ei(n.sessionsScanned),T=ei(n.sessionsTotal),C=Zi(n.truncated,r=>nt(r,k0));return i===null||c===null||g===null||T===null||g>T||C===void 0?null:{query:i,hits:c,sessionsScanned:g,sessionsTotal:T,truncated:C}}function L0(t){const n=Fe(t);if(n===null)return null;const i=Ie(n.query),c=dn(n.hits,um),g=ei(n.sessionsScanned),T=ei(n.sessionsTotal);return i===null||c===null||g===null||T===null||g>T?null:{query:i,hits:c,sessionsScanned:g,sessionsTotal:T}}const T0=["off","idle","measuring","writing","moving"];function en(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function Gi(t,n){if(t==null)return null;const i=n(t);return i===null?void 0:i}function R0(t){const n=Fe(t);if(n===null)return null;const i=nt(n.agent,Kl),c=en(n.sessions),g=en(n.eventBytes),T=en(n.images),C=en(n.imageBytes),r=en(n.skippedArchived),u=en(n.skippedEmpty),_=en(n.unsupported),v=en(n.failed),h=av(n.failureReasons);return i===null||c===null||g===null||T===null||C===null||r===null||u===null||_===null||v===null||h===null?null:{agent:i,sessions:c,eventBytes:g,images:T,imageBytes:C,skippedArchived:r,skippedEmpty:u,unsupported:_,failed:v,failureReasons:h}}function M0(t){const n=Fe(t);if(n===null)return null;const i=We(n.measuredAt),c=We(n.durationMs),g=dn(n.byAgent,R0),T=en(n.memoryProjects),C=en(n.memoryBytes);return i===null||c===null||g===null||T===null||C===null?null:{measuredAt:i,durationMs:c,byAgent:g,memoryProjects:T,memoryBytes:C}}function A0(t){const n=Fe(t);if(n===null)return null;const i=en(n.done),c=en(n.total);return i===null||c===null?null:{done:i,total:c}}function N0(t){const n=Fe(t);if(n===null)return null;const i=yt(n.enabled),c=Ie(n.dir),g=yt(n.isDefaultDir),T=nt(n.state,T0),C=en(n.sessions),r=en(n.passSessions),u=en(n.bytes),_=en(n.pending),v=Gi(n.progress,A0),h=Gi(n.lastPassAt,We),w=Gi(n.measurement,M0),k=Gi(n.previousDir,Ie),L=Gi(n.lastError,ts);return i===null||c===null||g===null||T===null||C===null||r===null||u===null||_===null||v===void 0||h===void 0||w===void 0||k===void 0||L===void 0?null:{enabled:i,dir:c,isDefaultDir:g,state:T,progress:v,sessions:C,passSessions:r,bytes:u,lastPassAt:h,pending:_,measurement:w,previousDir:k,lastError:L}}const hm=1024,dm=65535,D0="pair",I0=4001;function j0(t){return typeof t=="number"&&Number.isInteger(t)&&t>=hm&&t<=dm}const P0=["off","active","restart-needed","port-busy"];function O0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.id),c=Ie(n.label),g=We(n.createdAt),T=yt(n.connected);if(i===null||c===null||g===null||T===null)return null;const C=n.lastSeenAt,r=C==null?null:We(C);return C!=null&&r===null?null:{id:i,label:c,createdAt:g,lastSeenAt:r,connected:T}}function B0(t){const n=Fe(t);if(n===null)return null;const i=yt(n.enabled),c=We(n.port),g=nt(n.state,P0),T=We(n.listeningPort),C=Ie(n.sshUser),r=Ji(n.hostNames),u=yt(n.pairingActive),_=Lt(n.devices,O0);return i===null||c===null||g===null||T===null||C===null||r===null||u===null||_===null?null:{enabled:i,port:c,state:g,listeningPort:T,sshUser:C,hostNames:r,pairingActive:u,devices:_}}function F0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.code),c=We(n.expiresAt);return i===null||c===null?null:{code:i,expiresAt:c}}const H0=["powershell-admin","powershell","terminal"];function $0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.payload),c=ve(n.authorizeCommand),g=nt(n.shell,H0),T=ve(n.code),C=We(n.expiresAt);return i===null||c===null||g===null||T===null||C===null?null:{payload:i,authorizeCommand:c,shell:g,code:T,expiresAt:C}}const U0=["auto","pwsh","powershell","cmd","git-bash","login","bash","sh","zsh"];function fm(t){return nt(t,U0)}function W0(t){const n=Fe(t);if(n===null)return null;const i=fm(n.id),c=ve(n.label);return i===null||i==="auto"||c===null?null:{id:i,label:c}}function df(t){return Array.isArray(t)?[...new Set(t.filter(n=>typeof n=="string"&&si(n)))]:null}function z0(t){const n=Fe(t);if(n===null)return null;const i=fm(n.consoleShell),c=dn(n.consoleShells,W0),g=n.shellName,T=g===null?null:ve(g),C=df(n.disabledAgents),r=df(n.disabledAtStart);return i===null||c===null||C===null||r===null||g!==null&&T===null?null:{consoleShell:i,consoleShells:c,shellName:T,disabledAgents:C,disabledAtStart:r}}const Xr=8,V0="/ws",ou="token",Fl=12*1024*1024,jc=8,ff=10*1024*1024,Pc=4,pf=100,q0=512,K0=["sending","prefilled"],G0=["no-delivery","not-ready","send-failed","returned-by-cli"],Y0=["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 X0(t){const n={model:null,effort:null,contextWindow:null};if(typeof t!="object"||t===null)return n;const i=t;return{model:ve(i.model),effort:ve(i.effort),contextWindow:We(i.contextWindow)}}function Q0(t){const n=Fe(t);if(n===null)return null;const i=ve(n.terminalId),c=c0(n.draft);return i===null||c===null?null:{terminalId:i,draft:c}}function mf(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function Rl(t,n){const i=ve(n.requestId);return i!==null&&(t.requestId=i),t}function gf(t){var n;return((n=dn(t,Ov))==null?void 0:n.slice(0,Dv))??null}function J0(t){const n=Fe(rv(t));if(n===null)return null;switch(n.type){case"hello":{const i=We(n.protocolVersion),c=Ie(n.platform),g=Ie(n.defaultCwd);return i===null||c===null||g===null?null:{type:"hello",protocolVersion:i,agents:dn(n.agents,of)??[],defaultAgent:nt(n.defaultAgent,Zr),platform:c,defaultCwd:g,shellName:ve(n.shellName),remoteClient:n.remoteClient===!0,fileCheck:n.fileCheck===!0}}case"agents":{const i=dn(n.agents,of);return i===null?null:{type:"agents",agents:i,defaultAgent:nt(n.defaultAgent,Zr)}}case"terminal.list":{const i=dn(n.terminals,lf),c=Ji(n.order);return i===null||c===null?null:{type:"terminal.list",terminals:i,order:c}}case"terminal.opened":{const i=ve(n.requestId),c=lf(n.terminal);return i===null||c===null?null:{type:"terminal.opened",requestId:i,terminal:c}}case"terminal.output":{const i=ve(n.terminalId),c=Ie(n.data);return i===null||c===null?null:{type:"terminal.output",terminalId:i,data:c}}case"terminal.replay":{const i=ve(n.terminalId),c=Ie(n.data);return i===null||c===null?null:{type:"terminal.replay",terminalId:i,data:c,truncated:n.truncated===!0}}case"terminal.exit":{const i=ve(n.terminalId),c=We(n.exitCode);if(i===null||c===null)return null;const g=n.signal;return{type:"terminal.exit",terminalId:i,exitCode:c,signal:typeof g=="number"?g:null}}case"terminal.closed":{const i=ve(n.terminalId);return i===null?null:{type:"terminal.closed",terminalId:i}}case"terminal.activity":{const i=ve(n.terminalId),c=nt(n.activity,kv);if(i===null||c===null)return null;const g=c==="offline"?nt(n.offlineReason,Ev):null;return g===null?{type:"terminal.activity",terminalId:i,activity:c}:{type:"terminal.activity",terminalId:i,activity:c,offlineReason:g}}case"index.status":{const i=Rv(n.status);return i===null?null:{type:"index.status",status:i}}case"index.projects":{const i=dn(n.projects,Tv);return i===null?null:{type:"index.projects",projects:i,replace:n.replace===!0}}case"conversation.reset":{const i=ve(n.terminalId),c=Ie(n.sessionId),g=nt(n.state,af),T=dn(n.events,Dc),C=cf(n.usage);return i===null||c===null||g===null||T===null||C===null?null:{type:"conversation.reset",terminalId:i,sessionId:c,state:g,events:T,hasMore:n.hasMore===!0,usage:C,permissionMode:Jr(n.permissionMode)?n.permissionMode:null,defaults:X0(n.defaults),waitingFor:ve(n.waitingFor),openToolCall:n.openToolCall===!0,subagents:gf(n.subagents)??[]}}case"conversation.subagents":{const i=ve(n.terminalId),c=gf(n.subagents);return i===null||c===null?null:{type:"conversation.subagents",terminalId:i,subagents:c}}case"agent.submitted":{const i=ve(n.terminalId),c=ve(n.requestId),g=yt(n.delivered);return i===null||c===null||g===null?null:{type:"agent.submitted",terminalId:i,requestId:c,delivered:g}}case"conversation.append":{const i=ve(n.terminalId),c=dn(n.events,Dc),g=cf(n.usage);return i===null||c===null||g===null?null:{type:"conversation.append",terminalId:i,events:c,usage:g,permissionMode:Jr(n.permissionMode)?n.permissionMode:null}}case"conversation.mode":{const i=ve(n.terminalId),c=n.mode;return i===null||!Jr(c)?null:{type:"conversation.mode",terminalId:i,mode:c}}case"conversation.waiting":{const i=ve(n.terminalId);return i===null?null:{type:"conversation.waiting",terminalId:i,waitingFor:ve(n.waitingFor)}}case"conversation.toolCall":{const i=ve(n.terminalId),c=yt(n.open);return i===null||c===null?null:{type:"conversation.toolCall",terminalId:i,open:c}}case"conversation.page":{const i=ve(n.terminalId),c=dn(n.events,Dc);return i===null||c===null?null:{type:"conversation.page",terminalId:i,events:c,hasMore:n.hasMore===!0}}case"conversation.turns":{const i=ve(n.terminalId),c=Lt(n.turns,g=>{const T=Fe(g);if(T===null)return null;const C=ve(T.eventId),r=We(T.durationMs);return C===null||r===null?null:{eventId:C,durationMs:r}});return i===null||c===null?null:{type:"conversation.turns",terminalId:i,turns:c}}case"conversation.parts":{const i=ve(n.terminalId),c=Lt(n.updates,g=>{const T=Fe(g);if(T===null)return null;const C=ve(T.eventId),r=Lt(T.parts,nm);return C===null||r===null?null:{eventId:C,parts:r}});return i===null||c===null?null:{type:"conversation.parts",terminalId:i,updates:c}}case"conversation.imageData":{const i=ve(n.terminalId),c=ve(n.eventId),g=We(n.index),T=Ie(n.mediaType);if(i===null||c===null||g===null||T===null)return null;const C=n.data;return{type:"conversation.imageData",terminalId:i,eventId:c,index:g,source:nt(n.source,tm)??"content",mediaType:T,data:typeof C=="string"?C:null}}case"conversation.state":{const i=ve(n.terminalId),c=nt(n.state,af);return i===null||c===null?null:{type:"conversation.state",terminalId:i,state:c}}case"git.status":{const i=ve(n.terminalId),c=Qv(n.status);return i===null||c===null?null:{type:"git.status",terminalId:i,status:c}}case"git.diff":{const i=ve(n.terminalId),c=Zv(n.diff);return i===null||c===null?null:{type:"git.diff",terminalId:i,diff:c}}case"files.listing":{const i=ve(n.terminalId),c=s0(n.listing);return i===null||c===null?null:{type:"files.listing",terminalId:i,listing:c}}case"picker.listing":{const i=i0(n.listing);return i===null?null:{type:"picker.listing",listing:i}}case"files.preview":{const i=ve(n.terminalId),c=r0(n.preview);return i===null||c===null?null:{type:"files.preview",terminalId:i,preview:c}}case"files.checked":{const i=ve(n.terminalId),c=ve(n.requestId),g=Ji(n.existing);return i===null||c===null||g===null?null:{type:"files.checked",terminalId:i,requestId:c,existing:g}}case"conversation.plans":{const i=ve(n.terminalId),c=Lt(n.plans,Bv);return i===null||c===null?null:{type:"conversation.plans",terminalId:i,plans:c}}case"plans.content":{const i=ve(n.terminalId),c=Fv(n.plan);return i===null||c===null?null:{type:"plans.content",terminalId:i,plan:c}}case"files.results":{const i=ve(n.terminalId),c=n0(n.result);return i===null||c===null?null:{type:"files.results",terminalId:i,result:c}}case"notes.list":{const i=Lt(n.notes,C0);return i===null?null:{type:"notes.list",notes:i}}case"notes.imageData":{const i=ve(n.imageId),c=Ie(n.mediaType);if(i===null||c===null)return null;const g=n.data;return{type:"notes.imageData",imageId:i,mediaType:c,data:typeof g=="string"?g:null}}case"memory.status":{const i=ve(n.terminalId),c=w0(n.status);return i===null||c===null?null:{type:"memory.status",terminalId:i,status:c}}case"memory.planned":{const i=ve(n.terminalId),c=Lt(n.changes,uf);return i===null||c===null?null:Rl({type:"memory.planned",terminalId:i,changes:c},n)}case"memory.installed":{const i=ve(n.terminalId),c=Lt(n.applied,uf);return i===null||c===null?null:Rl({type:"memory.installed",terminalId:i,applied:c},n)}case"memory.imported":{const i=ve(n.terminalId),c=Ji(n.copied),g=Ji(n.skipped);return i===null||c===null||g===null?null:Rl({type:"memory.imported",terminalId:i,copied:c,skipped:g},n)}case"memory.content":{const i=ve(n.terminalId),c=y0(n.note);return i===null||c===null?null:Rl({type:"memory.content",terminalId:i,note:c},n)}case"vault.status":{const i=N0(n.status);return i===null?null:{type:"vault.status",status:i}}case"vault.exported":{const i=ve(n.projectKey),c=We(n.sessions);return i===null||c===null?null:{type:"vault.exported",projectKey:i,sessions:c}}case"session.continued":{const i=ve(n.requestId),c=ve(n.terminalId),g=Fe(n.source),T=nt(g==null?void 0:g.agent,Kl),C=ve(g==null?void 0:g.sessionId),r=Ie(g==null?void 0:g.title),u=mf(n.includedTurns),_=mf(n.totalTurns),v=nt(n.delivery,K0);return i===null||c===null||T===null||C===null||r===null||u===null||_===null||u>_||v===null?null:{type:"session.continued",requestId:i,terminalId:c,source:{agent:T,sessionId:C,title:r},includedTurns:u,totalTurns:_,totalTurnsIsMinimum:n.totalTurnsIsMinimum===!0,delivery:v}}case"composer.prefill":{const i=ve(n.terminalId),c=ve(n.text),g=nt(n.reason,G0);return i===null||c===null||g===null?null:{type:"composer.prefill",terminalId:i,text:c,reason:g}}case"composer.drafts":{const i=dn(n.drafts,Q0);return i===null?null:{type:"composer.drafts",drafts:i}}case"search.progress":{const i=ve(n.searchId),c=L0(n.progress);return i===null||c===null?null:{type:"search.progress",searchId:i,progress:c}}case"remote.status":{const i=B0(n.status);return i===null?null:{type:"remote.status",status:i}}case"settings.status":{const i=z0(n.settings);return i===null?null:{type:"settings.status",settings:i}}case"remote.pairing.code":{const i=F0(n.pairing);return i===null?null:{type:"remote.pairing.code",pairing:i}}case"remote.phone.pairing":{const i=$0(n.pairing);return i===null?null:{type:"remote.phone.pairing",pairing:i}}case"search.results":{const i=ve(n.searchId),c=E0(n.result);return i===null||c===null?null:{type:"search.results",searchId:i,result:c}}case"error":{const i=ts(n.text);if(i===null)return null;const g={type:"error",code:nt(n.code,Y0)??"internal",text:i},T=Ie(n.detail);T!==null&&(g.detail=T);const C=ve(n.requestId);return C!==null&&(g.requestId=C),g}default:return null}}function _f(t){return JSON.stringify(t)}const Z0=/^[A-Za-z]:\\$/;function ti(t,n){return t.length===0?"":n==="win32"?ew(t):tw(t)}function ew(t){let n=t.replace(/\//g,"\\");for(n.startsWith("\\\\?\\UNC\\")?n=`\\\\${n.slice(8)}`:n.startsWith("\\\\?\\")&&(n=n.slice(4)),n=n.startsWith("\\\\")?`\\\\${n.slice(2).replace(/\\+/g,"\\")}`:n.replace(/\\+/g,"\\");n.endsWith("\\")&&!Z0.test(n);)n=n.slice(0,-1);return n.toLowerCase()}function pm(t,n,i){return t.length===0||i==="win32"&&t!==n&&t.toLowerCase()===n.toLowerCase()?n:t}function tw(t){let n=t.replace(/\/+/g,"/");for(;n.length>1&&n.endsWith("/");)n=n.slice(0,-1);return n}function nw(t,n,i,c){const g=ti(i.cwd,c);let T=-1;for(const[C,r]of t.entries()){const u=n(r);u===void 0||u.kind!=="agent"||ti(u.cwd,c)===g&&(T=C)}return T===-1?t.length:T+1}function mm(t){return`[Pasted text #${t}]`}function sw(t){return`[Start of pasted text #${t}]`}function rw(t){return`[End of pasted text #${t}]`}function iw(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function ow(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function lw(){return/\[Pasted text #(\d{1,6})\]/g}const gm="https://buymeacoffee.com/cvelasquez",aw="modulepreload",cw=function(t){return"/"+t},vf={},Jn=function(n,i,c){let g=Promise.resolve();if(i&&i.length>0){let C=function(_){return Promise.all(_.map(v=>Promise.resolve(v).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),u=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));g=C(i.map(_=>{if(_=cw(_),_ in vf)return;vf[_]=!0;const v=_.endsWith(".css"),h=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${_}"]${h}`))return;const w=document.createElement("link");if(w.rel=v?"stylesheet":aw,v||(w.as="script"),w.crossOrigin="",w.href=_,u&&w.setAttribute("nonce",u),document.head.appendChild(w),v)return new Promise((k,L)=>{w.addEventListener("load",k),w.addEventListener("error",()=>L(new Error(`Unable to preload CSS for ${_}`)))})}))}function T(C){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=C,window.dispatchEvent(r),!r.defaultPrevented)throw C}return g.then(C=>{for(const r of C||[])r.status==="rejected"&&T(r.reason);return n().catch(T)})},uw={"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.queueReturned.noLabel":"The CLI didn't get to deliver the message you sent while it was working: the interrupt came first. It's back in the message box, unsent.","agent.queueReturned.withLabel":"{{label}} didn't get to deliver the message you sent while it was working: the interrupt came first. It's back in the message box, unsent.","agent.serverClosed.noLabel":"The CLI server closed and this tab lost its connection.","agent.serverClosed.relaunch":"Relaunch","agent.serverClosed.relaunching":"Relaunching…","agent.serverClosed.withLabel":"The {{label}} server closed and this tab lost its connection.","agent.session.cliMissing":"{{label}} isn't installed.","agent.shortcuts.antigravity.answerPermission":"Answer a permission request: 1 allows it, 4 rejects it","agent.shortcuts.antigravity.cycleMode":"Change the mode: accept-edits, plan and default (with focus on the terminal)","agent.shortcuts.antigravity.help":"Show the CLI's shortcuts","agent.shortcuts.antigravity.interrupt":"Interrupt the current turn, or cancel a permission request","agent.shortcuts.claudeCode.cancel":"Cancel","agent.shortcuts.claudeCode.cycleMode":"Change the permission mode (with focus on the terminal)","agent.shortcuts.claudeCode.fullOutput":"Show the full output","agent.shortcuts.claudeCode.pasteImage":"Paste an image from the clipboard","agent.shortcuts.claudeCode.pasteText":"Paste text from the clipboard","agent.shortcuts.claudeCode.rewind":"Open the rewind menu","agent.shortcuts.claudeCode.searchHistory":"Search the command history","agent.shortcuts.codex.cycleMode":"Switch between the default mode and Plan (with focus on the terminal)","agent.shortcuts.codex.editPrevious":"Edit a previous message","agent.shortcuts.codex.effort":"Lower / raise the effort","agent.shortcuts.codex.externalEditor":"Edit the message in the external editor","agent.shortcuts.codex.interruptOrExit":"Interrupt, or exit if there's no turn","agent.shortcuts.codex.interruptTurn":"Interrupt the current turn","agent.shortcuts.codex.mention":"Mention a file, a skill or a plugin","agent.shortcuts.codex.note":"Alt + ← / → switch agents inside Codex, but here the app uses them to switch tabs.","agent.shortcuts.codex.queue":"Queue the message while the agent works","agent.shortcuts.codex.searchHistory":"Search the message history","agent.shortcuts.codex.transcript":"Show the transcript","agent.shortcuts.commands":"Commands","agent.shortcuts.composer.newline":"New line without sending","agent.shortcuts.composer.pasteText":"Paste text","agent.shortcuts.composer.pasteWithImages":"Paste text or an image (it stays as a thumbnail)","agent.shortcuts.composer.send":"Send the message","agent.shortcuts.interruptCli":"Interrupt whatever the CLI is doing","agent.shortcuts.leaderThen":"Ctrl + X, then {{key}}","agent.shortcuts.opencode.clearInput":"Clear the input; twice, exit","agent.shortcuts.opencode.commandList":"Command list, with the model variants","agent.shortcuts.opencode.cycleAgent":"Switch agent, build or plan (with focus on the terminal)","agent.shortcuts.opencode.interrupt":"Interrupt (the first press only warns)","agent.shortcuts.opencode.model":"Choose a model","agent.shortcuts.opencode.newSession":"New session: the tab stays tied to the session it was opened with","agent.shortcuts.opencode.newline":"New line","agent.shortcuts.opencode.note":"Ctrl + T switches the model variant inside OpenCode, but the browser keeps it for itself: it's under Ctrl + P.","agent.shortcuts.opencode.paste":"Paste","agent.shortcuts.pi.bash":"Run a shell command","agent.shortcuts.pi.clearOrExit":"Clear the editor; twice, exit","agent.shortcuts.pi.cycleThinking":"Change the thinking level (with focus on the terminal)","agent.shortcuts.pi.model":"Choose a model","agent.shortcuts.pi.newline":"New line","agent.shortcuts.pi.nextModel":"Switch to the next model","agent.shortcuts.pi.toolOutput":"Collapse or expand tool output","agent.shortcuts.pi.tree":"With the editor empty: open the session tree","agent.statusLine.noFragment":"The app's folder has characters the console interprets (such as & % ! or quotes), and with them there's no line the CLI can run: on Windows it runs it with cmd /c and no quote gets through. Moving the configuration folder to a path without those characters fixes it.","agent.statusLine.state.active":"Configured","agent.statusLine.state.disabled":"Disabled (enabled: false)","agent.statusLine.state.missing":"Not configured","agent.statusLine.state.otherCommand":"You have another status line: pasting this one replaces it","agent.statusLine.state.unreadable":"Couldn't read settings.json","agent.thread.discovering":"The session shows up in the history with the first message.","agent.thread.noTranscript":"This conversation comes from a CLI version that didn't leave a readable transcript. It can be resumed from the sidebar, but there's nothing to show here.","agent.waiting.answer":"The CLI is waiting for an answer from you.","agent.waiting.permission":"The CLI is waiting for you to authorize a tool.","agent.waiting.question":"The agent asked you a question: answer it in the thread.","agentMenu.chooseTitle":"Choose which CLI to open with","agentMenu.openWith":"Open with","agentMenu.titleWithAgent":"{{title}} — with {{label}}","app.banner.revoked":"This device's access was revoked, or remote access was turned off. To come back, pair it again from the computer running Agent Workbench.","app.divider.consoleHeight":"Drag to change the console's height","app.divider.width":"Drag to change the width","app.empty.hint":"Pick a project on the left, or open a session from the history to resume it.","app.empty.newSession":"New session in {{cwd}}","app.empty.noTabs":"No open tabs.","app.empty.opening":"Opening…","app.header.cliVersion":"CLI {{version}}","app.header.remoteAccess":"Remote access","app.header.remoteBadge":"Remote","app.header.remoteBadgeTitle":"This window is connected from a paired device. Managing remote access, and anything that opens a file with the apps of the computer running Agent Workbench, is only available on that computer.","app.header.shortcuts":"Show keyboard shortcuts","app.markerNotice":"This server was started from inside a CLI session. The <code>{{variable}}</code> variable was removed from the tabs' environment: it turns off history saving, and without that there would be no conversation or context meter. The rest of the environment is left untouched.","app.panel.name":"Panel","app.panel.show":"Show the right panel (Alt+P)","app.picker.project.confirm":"Open here","app.picker.project.confirmTitle":"Open an agent tab in {{path}}","app.picker.project.title":"New project","app.picker.vault.confirm":"Use this folder","app.picker.vault.confirmTitle":"Move the backup to {{path}}. The current folder stays untouched","app.picker.vault.title":"Backup folder","app.sidebar.name":"Projects","app.sidebar.show":"Show the project list","app.status.connecting":"Connecting","app.status.failed":"No connection","app.status.open":"Connected","app.status.reconnecting":"Reconnecting","app.status.revoked":"Access revoked","archive.allBlocked_one":"Its only conversation has an open tab. Close it first.","archive.allBlocked_other":"Its {{count}} conversations have an open tab. Close them first.","archive.blockedStays_one":"Another one has an open tab and stays.","archive.blockedStays_other":"{{count}} others have an open tab and stay.","archive.confirm_one":"Archive {{count}} conversation?","archive.confirm_other":"Archive the {{count}} conversations?","archive.withBlocked":"{{confirm}} {{blocked}}","common.cancel":"Cancel","common.close":"Close","common.closeEsc":"Close (Esc)","common.copied":"Copied","common.copyCode":"Copy code","common.dismissNotice":"Dismiss the notice","common.gotIt":"Got it","composer.attach":"Attach a file","composer.attachTitle":"Attach a file: a log, a PDF, a document or an image","composer.chip.editHint":"Show and edit the pasted text","composer.chip.editorLabel":"Edit pasted text #{{number}}","composer.chip.pastedTextEmpty":"#{{number}} · Pasted text · empty, won't be sent","composer.chip.pastedText_one":"#{{number}} · Pasted text · {{count}} line","composer.chip.pastedText_other":"#{{number}} · Pasted text · {{count}} lines","composer.chip.remove":"Remove","composer.pastedImage":"pasted image","composer.placeholder.ended":"This tab's session has ended.","composer.placeholder.ready":"Type your message.","composer.placeholder.sleeping":"This tab doesn't have the CLI open yet.","composer.problem.draftTooLong":"This message is too long to keep as a draft: if you close Agent Workbench before sending it, it will be lost.","composer.problem.empty":'"{{name}}" is empty.',"composer.problem.imageTooBig":"The image is {{size}} MB; the maximum is {{max}} MB.","composer.problem.imageUnreadable":"Couldn't read the image from the clipboard.","composer.problem.tooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"composer.problem.tooManyFiles_one":"Up to {{count}} file per message.","composer.problem.tooManyFiles_other":"Up to {{count}} files per message.","composer.problem.tooManyImages_one":"Up to {{count}} image per message.","composer.problem.tooManyImages_other":"Up to {{count}} images per message.","composer.problem.unreadable":`Couldn't read "{{name}}".`,"composer.resizeTitle":"Drag to resize the message box","composer.send":"Send","composer.sendTitle":"Send (Enter)","composer.stop":"Stop","composer.stopTitle":"Interrupt whatever the CLI is doing (Esc)","console.collapse":"Collapse. The processes keep running: to end them, use each terminal's ×","console.name":"Console","console.noShell":"No system console was found to open.","console.openAnother":"Open another {{shell}} in {{cwd}}","console.openAnyIn":"Open a console in {{cwd}}","console.openIn":"Open {{shell}} in {{cwd}}","console.tab.close":"Close this terminal and end its process","console.tab.exited":"Exited with code {{code}}","console.tab.label":"Terminal {{number}}","console.tab.title":"{{shell}} {{number}} in {{cwd}}","continue.menuLabel":"Continue with","controls.effort.high":"High","controls.effort.inUse":"Effort in use: {{effort}}. Changing it sends {{command}} to the CLI tab","controls.effort.inUseSaved":"Effort in use: {{effort}}. Changing it sends {{command}} to the CLI tab, and the CLI saves it as the default for the next tabs","controls.effort.low":"Low","controls.effort.max":"Max","controls.effort.medium":"Medium","controls.effort.minimal":"Minimal","controls.effort.noData":"Effort: no data. Not every model has levels — with haiku, /effort leaves no trace","controls.effort.off":"Off","controls.effort.placeholder":"effort — no data","controls.effort.provisional":"Effort from your configuration: {{effort}}. No response has confirmed it yet","controls.effort.xhigh":"Very high","controls.model.default":"Default","controls.model.inUse":"Model in use: {{model}}. Changing it sends /model to the CLI tab","controls.model.inUseSaved":"Model in use: {{model}}. Changing it sends /model to the CLI tab, and the CLI saves it as the default for the next tabs","controls.model.noData":"Model: there hasn't been any response in this session yet","controls.model.placeholder":"model — no data","controls.model.provisional":"Model from your configuration: {{model}}. No response has confirmed it yet","conversation.answerUnconfirmed":"The CLI didn't confirm this answer. Try again, or answer in the CLI tab.","diff.binary":"Binary file: there's no diff to show.","diff.noChanges":"No changes.","diff.truncated":"The diff was cut off because of its size. The full file is easier to read outside this panel.","docs.backToList":"Show the list","docs.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.jumpToOwn":"Jump to your previous message","thread.loadEarlier":"Load earlier messages","thread.loadingMore":"Loading...","thread.notice.compacted":"Context compacted","thread.notice.compactedAuto":"Context compacted automatically","thread.notice.error":"The CLI returned an error: {{detail}}","thread.notice.errorNoDetail":"The CLI returned an error","thread.notice.interrupted":"Interrupted","thread.openInFiles":"Open {{path}} in the Files tab","thread.pasted_one":"Pasted text #{{number}} · {{count}} line","thread.pasted_other":"Pasted text #{{number}} · {{count}} lines","thread.question.answerInCli":"Answer in the CLI tab","thread.question.answered":"Answered","thread.question.multi":"multiple","thread.question.pickEach":"Pick an option in each question · you can also answer in the CLI tab","thread.question.pickOne":"Pick an option · you can also answer in the CLI tab","thread.question.placeholder":"Write your answer","thread.question.send":"Send","thread.question.sendAnswers":"Send answers","thread.question.useText":"Use this text","thread.question.writeOther":"Write another answer…","thread.question.writeOtherHint":"To suggest an alternative, or give more context","thread.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."},Mu=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],_m="en",Oc={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},hw={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},Au={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"},dw={es:()=>Jn(()=>import("./es-7g4wzPIf.js"),[]),de:()=>Jn(()=>import("./de-B1W5R6hb.js"),[]),fr:()=>Jn(()=>import("./fr-DaY5ttUk.js"),[]),"pt-BR":()=>Jn(()=>import("./pt-BR-BVIxhwAC.js"),[]),ru:()=>Jn(()=>import("./ru-CCRfyRi5.js"),[]),ja:()=>Jn(()=>import("./ja-C1rp47bG.js"),[]),ko:()=>Jn(()=>import("./ko-D0Bwy-Ri.js"),[]),"zh-CN":()=>Jn(()=>import("./zh-CN-CaghDQ5n.js"),[])},vm=uw,lu=new Map([["en",vm]]),wf=new Map,au=new Set;let no=_m,cu=Au[_m],yf=0;function wm(t){return Mu.includes(t)}function uu(){return no}function Gl(){return cu}function fw(t){return Au[t]}function ym(t){return au.add(t),()=>au.delete(t)}async function bm(t,n=Au[t]){const i=++yf;if(!lu.has(t)&&t!=="en"){const c=await dw[t]();lu.set(t,c.default)}if(i===yf&&!(no===t&&cu===n)){no=t,cu=n;for(const c of au)c()}}function pw(t,n){let i=wf.get(t);return i===void 0&&(i=new Intl.PluralRules(t),wf.set(t,i)),i.select(n)}function bf(t,n,i,c){if(c!==void 0){const g=t[`${i}_${pw(n,c)}`]??t[`${i}_other`];if(g!==void 0)return g}return t[i]}function mw(t,n,i,c){const g=c==null?void 0:c.count,T=typeof g=="number"?g:void 0;return(t===void 0?void 0:bf(t,n,i,T))??bf(vm,"en",i,T)??i}function Il(t,n){return n===void 0?t:t.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(i,c)=>{const g=n[c];return g===void 0?i:String(g)})}function Sm(t,n){return mw(lu.get(no),no,t,n)}function S(t,n){return Il(Sm(t,n),n)}function gw(){return[{keys:"Esc",description:S("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:S("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:S("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:S("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:S("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:S("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:S("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:S("agent.shortcuts.codex.searchHistory")},{keys:"@",description:S("agent.shortcuts.codex.mention")},{keys:"/",description:S("agent.shortcuts.commands")},{keys:"Ctrl + G",description:S("agent.shortcuts.codex.externalEditor")}]}function _w(){return[{keys:"Esc Esc",description:S("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:S("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:S("agent.shortcuts.opencode.commandList")},{keys:S("agent.shortcuts.leaderThen",{key:"M"}),description:S("agent.shortcuts.opencode.model")},{keys:S("agent.shortcuts.leaderThen",{key:"N"}),description:S("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:S("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:S("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:S("agent.shortcuts.opencode.paste")}]}function vw(){return[{keys:"Esc",description:S("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:S("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:S("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:S("agent.shortcuts.commands")},{keys:"?",description:S("agent.shortcuts.antigravity.help")}]}function ww(){return[{keys:"Esc",description:S("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:S("agent.shortcuts.pi.tree")},{keys:"Ctrl + C",description:S("agent.shortcuts.pi.clearOrExit")},{keys:"Shift + Tab",description:S("agent.shortcuts.pi.cycleThinking")},{keys:"Ctrl + L",description:S("agent.shortcuts.pi.model")},{keys:"Ctrl + P",description:S("agent.shortcuts.pi.nextModel")},{keys:"Ctrl + O",description:S("agent.shortcuts.pi.toolOutput")},{keys:"Ctrl + J",description:S("agent.shortcuts.pi.newline")},{keys:"!",description:S("agent.shortcuts.pi.bash")},{keys:"/",description:S("agent.shortcuts.commands")}]}function yw(){return[{keys:"Esc",description:S("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:S("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:S("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:S("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:S("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:S("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:S("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:S("agent.shortcuts.claudeCode.pasteText")}]}const vr={"claude-code":{shortLabel:"CC",get shortcuts(){return yw()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1},codex:{shortLabel:"CX",get shortcuts(){return gw()},get shortcutsNote(){return S("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},opencode:{shortLabel:"OC",get shortcuts(){return _w()},get shortcutsNote(){return S("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1},antigravity:{shortLabel:"AG",get shortcuts(){return vw()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0},pi:{shortLabel:"PI",get shortcuts(){return ww()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!1,effortCommand:"/thinking"}};function bw(t){return(t===null?void 0:vr[t].effortCommand)??Tu}const Sw={"gemini-cli":"GC","antigravity-ide":"AI"};function Cw(t){return si(t)?vr[t].shortLabel:Sw[t]}function lo(t,n){var i;return si(t)?((i=n.find(c=>c.id===t))==null?void 0:i.label)??t:uv[t]}const Cm="Sesion sin titulo";function Zn(t,n){return n==="none"||t===Cm?S("session.untitled"):t}function xw(t,n){const i=new Map;for(const g of n)g.titleSource==="none"||g.title===Cm||i.set(`${g.agent}\0${g.sessionId}`,g.title);const c=new Map;for(const g of t){if(g.agent===null||g.sessionId.length===0)continue;const T=i.get(`${g.agent}\0${g.sessionId}`);T!==void 0&&c.set(g.terminalId,T)}return c}function hu(t){return t.storage==="native"&&si(t.agent)}function kw(t){return t!==null&&vr[t].savesModelChoice}function Ew(t,n,i){if(n!=null)return n;for(let c=t.length-1;c>=0;c-=1){const g=t[c];if(!(g===void 0||g.effort===null))return i===null||g.at>=i?g.effort:null}return null}function Lw(t){return t===null?null:vr[t].instructionsFile}function Tw(t){return{modeCycle:t.permissionCycle,models:t.models,efforts:t.efforts,imagesAllowed:t.imagesByPath!==null,rewind:t.rewind,questionsAnswerable:t.questionCards,fileMentions:t.fileMentions!==null,plansAvailable:t.plans,contextWindowSource:t.contextWindowSource,noteSendable:t.readySignal}}function Rw(t,n){const i=$v(n,t);return i===null?null:t.find(c=>c.value===i.value)??null}function Mw(t,n){return t??n.launchMode}const Aw={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},Nw={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function xm(t){return S(Aw[t])}function Dw(t){return S(Nw[t])}function Iw(t,n){return S("agent.mode.title",{mode:xm(t),hint:Dw(t),key:n.keyLabel})}function km(t,n){return t.approvesPendingOnCycle&&n!==null}function jw(t,n,i,c){if(km(n,c))return S("agent.mode.blocked");const g=Iw(t,n);return!n.approvesPendingOnCycle||i?g:S("agent.mode.titleBlind",{title:g})}const Pw={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 Ow(t){return S(Pw[t])}function Bw(){return S("agent.statusLine.noFragment")}function Fw(t,n,i=new Set){return t.filter(c=>(n||c.id!=="plans")&&(c.id==="cli"||!i.has(c.id)))}function Hw(t,n,i=new Set){return t==="plans"&&!n||t!=="cli"&&i.has(t)?"cli":t}function $w(t,n,i){const c=g=>g===null?void 0:n.find(T=>T.id===g);return c(t)??c(i)??n[0]??null}function Uw(t){return[{keys:"Enter",description:S("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:S("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:S(t?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:S("agent.shortcuts.interruptCli")}]}function Ww(){return S("agent.composer.imagesRefused")}function zw(t,n,i){return i??(t==="token-count"||t==="status-line"?n.contextWindow:null)}function Vw(t,n){return t==="status-line"?n.lastRequestTokens>0:n.assistantMessages>0}function qw(t,n){return t===null&&n!==null&&n.state!=="active"}function Kw(t){return S(t==="other-command"?"agent.meter.setup.otherCommand":t==="disabled"?"agent.meter.setup.disabled":t==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function Gw(t,n){return n.contextWindowEstimated?S("agent.meter.origin.estimated"):t==="usage-with-catalog"&&n.contextWindow!==null?S("agent.meter.origin.catalog"):null}function Yw(t,n=null){return n==="status-line"?S("agent.meter.idle.statusLine"):t===null?S("agent.meter.idle.noFile"):S("agent.meter.idle.withFile",{file:t})}function Xw(t,n=null){return t==="idle"?S("agent.dot.idle"):t==="unknown"?n===null?S("agent.dot.noStatus"):n.state==="active"?S("agent.dot.statusLinePending"):S("agent.dot.statusLineOnly"):S("agent.dot.open")}function Sf(t,n){return t.length===0?!0:t.some(i=>i.id===n&&i.available&&i.capabilities.resume)}function Qw(t,n,i){return t?i?S("agent.note.empty"):S("agent.note.send",{cwd:n??""}):S(n===null?"agent.note.needsTab":"agent.note.noReadySignal")}function Em(t,n,i){const c=ti(n,i);let g=null;for(const T of t)T.kind!=="agent"||T.agent===null||ti(T.cwd,i)===c&&(g=T.agent);return g}function Lm(t,n){var c;const i=n.filter(g=>g.available);for(const g of t)if(g!==null&&i.some(T=>T.id===g))return g;return((c=i[0])==null?void 0:c.id)??null}function Jw(t){let n=null;for(const i of t){const c=i.agent;si(c)&&(n===null||i.updatedAt>n.updatedAt)&&(n={agent:c,updatedAt:i.updatedAt})}return(n==null?void 0:n.agent)??null}function Zw(t,n,i,c,g){return Lm([Em(t,n,i),g],c)}function ey(t,n,i,c,g){return Lm([Em(t,n.cwd,i),Jw(n.sessions),g],c)}function Tm(t){return t.filter(n=>n.available)}function ty(t,n){const i=t.findIndex(c=>c.id===n);return i===-1?0:i}function ny(t,n,i){return i<=0?0:((t+n)%i+i)%i}function sy(t,n,i,c=4){const g=t.bottom+2,T=t.top-2-n.height,C=g+n.height+c<=i.height||T<c?Math.max(c,Math.min(g,i.height-n.height-c)):T;return{left:Math.max(c,Math.min(t.left,i.width-n.width-c)),top:C}}function ry(t,n,i){const c=t;return c===null||typeof c!="object"||typeof c.contains!="function"?!0:i!==null&&i.contains(t)?!1:c.contains(n)}function Rm(t,n,i=!1){return n===null||i||!Lu(t)?[]:Tm(t).filter(c=>c.id!==n)}function iy(){return S("agent.continue.title")}function oy(t,n,i){return n?S("agent.continue.discovering"):t.length===0?S("agent.continue.noConversation"):i?null:S("agent.continue.noMessages")}function ly(t,n,i,c){const g=n>=i&&!c?i===1?S("agent.handoff.turns.single"):S("agent.handoff.turns.all",{count:i}):n===1?c?S("agent.handoff.turns.lastOneOfMore",{total:i}):S("agent.handoff.turns.lastOne",{total:i}):c?S("agent.handoff.turns.lastManyOfMore",{count:i,included:n}):S("agent.handoff.turns.lastMany",{count:i,included:n});return S("agent.handoff.notice",{label:t,turns:g})}const Cf=40;function xf(t){const n=t.replace(/\s+/g," ").trim(),i=[...n],c=i.length>Cf?`${i.slice(0,Cf).join("").trimEnd()}…`:n;return c.length>0?S("agent.handoff.tabLabel",{title:c}):S("agent.handoff.tabLabelNoTitle")}function ay(){return S("agent.handoff.sending")}function cy(t){return t===null?S("agent.queueReturned.noLabel"):S("agent.queueReturned.withLabel",{label:t})}function uy(t){switch(t){case"no-delivery":return S("agent.handoff.prefill.noDelivery");case"not-ready":return S("agent.handoff.prefill.notReady");case"send-failed":return S("agent.handoff.prefill.sendFailed")}}function kf(t,n){return t.trim().length===0?n:`${n}
42
-
43
- ${t}`}function hy(t,n){return t&&n!==null}function dy(t,n,i){if(!si(t))return{badge:!0,unavailableTitle:null};const c=n.find(C=>C.id===t),g=n.some(C=>C.available),T=c!==void 0&&!c.available&&g;return{badge:i||T,unavailableTitle:T?S("agent.session.cliMissing",{label:c.label}):null}}function fy(t,n,i){return t!==null&&n===""&&!i.sessionIdAtLaunch}function py(){return S("agent.thread.noTranscript")}function my(){return S("agent.thread.discovering")}function gy(t,n,i,c,g=null){return!c||!Jp(t,g)||!n?null:i===null?S("agent.openTool.noLabel"):S("agent.openTool.withLabel",{label:i})}function Mm(t,n=!1){return S(t==="permission prompt"?"agent.waiting.permission":t==="question"&&n?"agent.waiting.question":"agent.waiting.answer")}function _y(t){return t.relaunching?"relaunching":t.offlineReason==="server-closed"&&t.alive?"offer":null}function vy(t){return t===null?S("agent.serverClosed.noLabel"):S("agent.serverClosed.withLabel",{label:t})}function wy(){return S("agent.serverClosed.relaunch")}function yy(){return S("agent.serverClosed.relaunching")}function by(t,n){const i=new Map,c=[];for(const[g,T]of t){const C=n.find(r=>r.terminalId===g);C===void 0||C.alive&&T==="exited"?c.push(g):i.set(g,C.alive?T:"exited")}return{phases:i,finished:c}}function Sy(t,n,i){var c;return!i||n===null||((c=t.permissionCycle)==null?void 0:c.approvesPendingOnCycle)!==!0&&!t.waitingBlocksSubmit?null:Mm(n,t.questionCards)}const Cy=2e4;function xy(t){if(t.label.length>0)return t.label;const n=t.cwd.split(/[\\/]/).filter(i=>i.length>0);return n[n.length-1]??t.cwd}function ky(t,n,i){const c=t.map(T=>({terminalId:T.terminalId,kind:T.kind,cwd:T.cwd})),g=[];for(const T of n){const C=nw(c.map(r=>r.terminalId),r=>c.find(u=>u.terminalId===r),{cwd:T.cwd},i);g.push({pending:T,index:C,label:xy(T)}),c.splice(C,0,{terminalId:`pending:${T.requestId}`,kind:"agent",cwd:T.cwd})}return g}function Ef(t,n,i){const c=ti(n,i);return t.some(g=>ti(g.cwd,i)===c)}function Am(){return S("agent.openBlocked")}const Ey={off:"controls.effort.off",minimal:"controls.effort.minimal",low:"controls.effort.low",medium:"controls.effort.medium",high:"controls.effort.high",xhigh:"controls.effort.xhigh",max:"controls.effort.max"};function Ly(t){const n=Ey[t.value];return n===void 0?t.label:S(n)}function Ty(t){return t.value==="default"?S("controls.model.default"):Hv(t)}function Ry({models:t,efforts:n,model:i,effort:c,modelProvisional:g=!1,effortProvisional:T=!1,savesChoice:C=!1,effortCommandName:r=Tu,disabled:u,onCommand:_}){const v=t===null?null:Rw(t,i),h=v===null&&i!==null;return l.jsxs(l.Fragment,{children:[t!==null&&l.jsxs("select",{className:"agent-select",value:(v==null?void 0:v.value)??"",disabled:u,onChange:w=>{w.target.value.length>0&&_(Wv(w.target.value))},title:i===null?S("controls.model.noData"):g?S("controls.model.provisional",{model:i}):C?S("controls.model.inUseSaved",{model:i}):S("controls.model.inUse",{model:i}),children:[v===null&&l.jsx("option",{value:"",children:h?i??"":S("controls.model.placeholder")}),t.map(w=>l.jsx("option",{value:w.value,children:Ty(w)},w.value))]}),n!==null&&l.jsxs("select",{className:"agent-select",value:c??"",disabled:u,onChange:w=>{w.target.value.length>0&&_(zv(w.target.value,r))},title:c===null?S("controls.effort.noData"):T?S("controls.effort.provisional",{effort:c}):C?S("controls.effort.inUseSaved",{effort:c,command:r}):S("controls.effort.inUse",{effort:c,command:r}),children:[c===null&&l.jsx("option",{value:"",children:S("controls.effort.placeholder")}),n.map(w=>l.jsx("option",{value:w.value,children:Ly(w)},w.value))]})]})}function My({mode:t,cycle:n,disabled:i,waitingFor:c=null,statusKnown:g=!0,onChange:T}){const C=Mw(t,n);return l.jsx("select",{className:"agent-select agent-select-mode",value:C,disabled:i||km(n,c),onChange:r=>{Jr(r.target.value)&&T(r.target.value)},title:jw(C,n,g,c),children:n.modes.map(r=>l.jsx("option",{value:r,children:xm(r)},r))})}function Hl(t){const n=t.replace(/(\r?\n)+$/,"");return n.length===0?0:n.split(`
44
- `).length}function Ay(t,n){return n===0?S("composer.chip.pastedTextEmpty",{number:t}):S("composer.chip.pastedText",{number:t,count:n})}function Ny(t){return t.length===0?1:Math.max(...t)+1}function Dy(t){const n=new Set;for(const i of t.matchAll(lw()))n.add(Number(i[1]));return[...n].sort((i,c)=>i-c)}const Iy=/[^\s([{"'¿¡«]/u,jy=/[\p{L}\p{N}]/u;function Py(t,n,i,c){const{start:g,end:T,before:C,after:r}=Nm(t,n,i),u=`${C!==""&&Iy.test(C)?" ":""}${mm(c)}${r!==""&&jy.test(r)?" ":""}`;return Dm(t,g,T,u)}const Oy=/[^\s([{¿¡«]/u,By=/[\p{L}\p{N}"'«]/u;function Lf(t,n,i,c){const{start:g,end:T,before:C,after:r}=Nm(t,n,i),u=C!==""&&Oy.test(C),_=r===""||By.test(r),v=`${u?" ":""}${c}${_?" ":""}`;return Dm(t,g,T,v)}function Nm(t,n,i){const c=Math.max(0,Math.min(n,t.length)),g=Math.max(c,Math.min(i,t.length));return{start:c,end:g,before:c>0?t.charAt(c-1):"",after:g<t.length?t.charAt(g):""}}function Dm(t,n,i,c){return{text:`${t.slice(0,n)}${c}${t.slice(i)}`,inserted:c,caret:n+c.length}}function Im(t,n){const i=new RegExp(`( ?)${$y(mm(n))}( ?)`,"g");return t.replace(i,(c,g,T)=>g!==""&&T!==""?" ":"")}function Fy(t,n){let i=n;const c=[];for(const g of t){const T=g.text.replace(/\r\n?/g,`
45
- `).replace(/\n+$/,"");if(T.trim().length===0){i=Im(i,g.number);continue}c.push(`${sw(g.number)}
46
- ${T}
47
- ${rw(g.number)}`)}return i.trim().length>0&&c.push(i),c.join(`
48
-
49
- `)}function Hy(t,n=!1){const i=t.replace(/\r\n?/g,`
50
- `),c=[],g=u=>{const _=u.replace(/^\n+|\n+$/g,"");_.trim().length>0&&c.push({kind:"text",text:_})};let T=0;for(const u of i.matchAll(iw())){const _=u[1]??"",v=(u.index??0)+_.length;g(i.slice(T,v)),c.push({kind:"pasted",number:Number(u[2]),text:u[3]??"",complete:!0}),T=(u.index??0)+u[0].length}const C=i.slice(T),r=n?ow().exec(C):null;if(r!==null){const u=r.index+(r[1]??"").length;g(C.slice(0,u)),c.push({kind:"pasted",number:Number(r[2]),text:C.slice(r.index+r[0].length),complete:!1})}else g(C);return c.some(u=>u.kind==="pasted")?c:[{kind:"text",text:t}]}function $y(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Uy=800;function jl(t){return{text:t.text,pasted:t.items.flatMap(n=>n.kind==="text"?[{number:n.number,text:n.text}]:[])}}function Wy(t,n){return{text:t.text,items:t.pasted.map(i=>({id:n(),kind:"text",number:i.number,text:i.text,lines:Hl(i.text)}))}}function zy(t,n){if(n===void 0)return{start:t,end:t,direction:"forward",scrollTop:"end"};const i=T=>Math.min(Math.max(0,T),t),c=i(n.selectionStart),g=Math.max(c,i(n.selectionEnd));return{start:c,end:g,direction:n.backward?"backward":"forward",scrollTop:Math.max(0,n.scrollTop)}}function Vy(t){return om(jl(t))>im}function Yr(t,n){return t===void 0||Ol(t)?Ol(n):lm(t,n)}const Tf={text:"",pasted:[]};function qy(t,n,i){const c=Wy(t,i),g=((n==null?void 0:n.items)??[]).filter(T=>T.kind!=="text");return{text:c.text,items:[...c.items,...g]}}class Ky{constructor(n){It(this,"local",new Map);It(this,"views",new Map);It(this,"saved",new Map);It(this,"heard",new Map);It(this,"unconfirmed",new Map);It(this,"submitting",new Map);It(this,"pending",new Map);It(this,"listeners",new Set);It(this,"serverKeeps",!1);this.deps=n}get(n){return this.local.get(n)}put(n,i){this.local.set(n,i),this.schedule(n,jl(i))}rememberView(n,i){this.views.set(n,i)}viewOf(n){return this.views.get(n)}submitted(n,i){this.cancel(n),this.local.delete(n),this.views.delete(n),this.saved.delete(n),this.unconfirmed.delete(n),this.submitting.set(n,i?"sent":"queued")}restore(n){const i=!this.serverKeeps;this.serverKeeps=!0;const c=[];for(const{terminalId:g,draft:T}of n)this.receive(g,T,i)&&c.push(g);for(const g of c)for(const T of this.listeners)T(g);for(const[g,T]of[...this.pending])T.handle===null&&this.sendNow(g)}reconnected(){this.serverKeeps=!1;for(const[n,i]of[...this.submitting])i==="sent"?this.submitting.delete(n):this.submitting.set(n,"sent")}retain(n){const i=new Set(n);for(const c of new Set([...this.local.keys(),...this.views.keys(),...this.saved.keys(),...this.heard.keys(),...this.unconfirmed.keys(),...this.submitting.keys(),...this.pending.keys()]))i.has(c)||(this.cancel(c),this.local.delete(c),this.views.delete(c),this.saved.delete(c),this.heard.delete(c),this.unconfirmed.delete(c),this.submitting.delete(c))}flushAll(){for(const n of[...this.pending.keys()])this.sendNow(n)}onRestored(n){return this.listeners.add(n),()=>this.listeners.delete(n)}receive(n,i,c){const g=this.heard.get(n);if(this.heard.set(n,i),this.submitting.has(n)){if(!Ol(i))return!1;this.submitting.delete(n)}const T=this.unconfirmed.get(n);if(T!==void 0)if(Yr(T,i))this.unconfirmed.delete(n);else if(c)if(Yr(g,i)){this.unconfirmed.delete(n),this.setSaved(n,i);const _=this.local.get(n);return _!==void 0&&this.schedule(n,jl(_)),!1}else this.unconfirmed.delete(n);else return!1;const C=this.local.get(n),r=C===void 0?Tf:jl(C),u=Yr(this.saved.get(n),r);return this.setSaved(n,i),this.pending.has(n)||!u||Yr(i,r)?!1:(this.local.set(n,qy(i,C,this.deps.newId)),this.views.delete(n),!0)}setSaved(n,i){Ol(i)?this.saved.delete(n):this.saved.set(n,i)}schedule(n,i){const c=this.pending.get(n);if(c!==void 0&&lm(c.draft,i)||(this.cancel(n),Yr(this.saved.get(n),i)))return;const g=this.deps.setTimer(()=>this.sendNow(n),this.deps.delayMs??Uy);this.pending.set(n,{handle:g,draft:i})}cancel(n){const i=this.pending.get(n);i!==void 0&&(i.handle!==null&&this.deps.clearTimer(i.handle),this.pending.delete(n))}sendNow(n){const i=this.pending.get(n);if(i===void 0)return;if(i.handle!==null&&this.deps.clearTimer(i.handle),!this.serverKeeps||!this.deps.connected()){this.pending.set(n,{handle:null,draft:i.draft});return}this.pending.delete(n);const c=om(i.draft)>im?Tf:i.draft;Yr(this.saved.get(n),c)||(this.deps.send(n,c),this.unconfirmed.set(n,c),this.setSaved(n,c))}}const du=1024,fu=du*1024,Rf=fu*1024;function Qr(t,n=0){return new Intl.NumberFormat(Gl(),{minimumFractionDigits:n,maximumFractionDigits:n,useGrouping:!1}).format(t)}function fn(t){return!Number.isFinite(t)||t<du?S("format.bytes.b",{value:Qr(Math.max(0,Math.round(t)||0))}):t<fu?S("format.bytes.kb",{value:Qr(Math.round(t/du))}):t<Rf?S("format.bytes.mb",{value:Qr(t/fu,1)}):S("format.bytes.gb",{value:Qr(t/Rf,2)})}function jm(t){const n=Math.floor(t/60),i=t%60;return i===0?S("format.duration.minutes",{value:n}):S("format.duration.minutesSeconds",{minutes:n,seconds:i})}function Gy(t){if(t<1e3)return S("format.duration.ms",{value:t});const n=Math.round(t/1e3);return n<60?S("format.duration.seconds",{value:n}):jm(n)}function so(t){if(!Number.isFinite(t)||t<1e3)return S("format.duration.underSecond");const n=Math.round(t/1e3);return n<60?S("format.duration.seconds",{value:n}):jm(n)}function es(t,n=Date.now()){if(t<=0)return"";const i=Math.floor((n-t)/6e4);if(i<1)return S("time.justNow");if(i<60)return S("time.minutesAgo",{count:i});const c=Math.floor(i/60);if(c<24)return S("time.hoursAgo",{count:c});const g=Math.floor(c/24);return g<30?S("time.daysAgo",{count:g}):Yy(t)}function Yy(t){return new Date(t).toLocaleDateString(Gl())}function Pm(t){return new Date(t).toLocaleTimeString(Gl(),{hour:"2-digit",minute:"2-digit"})}function Nu(t){return new Intl.ListFormat(Gl(),{type:"conjunction"}).format(t)}var Om=Qp();function Bm({src:t,caption:n,onClose:i}){return N.useEffect(()=>{const c=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),i())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[i]),Om.createPortal(l.jsxs("div",{className:"viewer",onClick:i,role:"presentation",children:[l.jsx("div",{className:"viewer-frame",onClick:c=>c.stopPropagation(),children:l.jsx("img",{className:"viewer-image",src:t,alt:n})}),l.jsxs("div",{className:"viewer-bar",children:[l.jsx("span",{className:"viewer-caption",children:n}),l.jsx("button",{className:"viewer-close",onClick:i,title:S("common.closeEsc"),children:"×"})]})]}),document.body)}const Xy=768,Qy=`(max-width: ${Xy}px)`,Jy="(hover: none)",Mf="agent-workbench.narrow-view",Fm="tab",Hm=["chat","cli","git","files","plans","memory","notes","console"];function Zy(t){return typeof t=="string"&&Hm.includes(t)}function e1(t){return Zy(t)?t:null}function t1(t){const n=t.hidden??new Set,i=c=>c==="chat"||c==="cli"||!n.has(c);return t.hasTab?Hm.filter(c=>(c!=="plans"||t.plansAvailable)&&i(c)):["chat","notes"].filter(i)}function n1(t,n){return n.includes(t)?t:"chat"}function Af(t){switch(t){case"cli":case"git":case"files":case"plans":case"memory":return t;default:return null}}const s1={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 r1(t){return s1[t]}const i1=/^[A-Za-z0-9_-]{1,80}$/;function o1(t){const n=new URLSearchParams(t).get(Fm);return n!==null&&i1.test(n)?n:null}function l1(t,n){const i=new URLSearchParams(t);for(const g of n)i.delete(g);const c=i.toString();return c.length>0?`?${c}`:""}const a1=[{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 c1(t,n){return t.shiftKey||t.altKey?!1:!n||t.ctrlKey||t.metaKey}const u1="AgentWorkbenchAndroid/",h1="agentworkbench://settings",d1="agentworkbench://disconnect",Nf="agentWorkbenchBack";function $m(t){return t.includes(u1)}function f1(t){return t.dialogOpen?"close-dialog":t.sheetOpen?"close-sheet":t.drawerOpen?"close-drawer":t.view!=="chat"?"show-chat":null}const p1=6e4,m1=10*6e4,g1=15e3,_1=4e3,v1=3,Um={runStartedAt:null,busySeenAt:null};function w1(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function y1(t,n){var c;let i=0;if(t!==null){const g=n.findIndex(T=>T.eventId===t);if(g===-1)return!0;i=g+1}for(let g=i;g<n.length;g+=1)if(((c=n[g])==null?void 0:c.role)==="assistant")return!0;return!1}function b1(t,n,i,c){const g=n==="busy"||t==="busy"?c:i.busySeenAt;let T=null;return n==="busy"?t==="idle"?T=c:(t==="busy"||t==="waiting")&&(T=i.runStartedAt):n==="waiting"&&(T=i.runStartedAt),{runStartedAt:T,busySeenAt:g}}function S1(t,n,i,c){const g=new Map;for(const[T,C]of n){const r=t.get(T),u=i.get(T);g.set(T,u!==void 0&&r===C?u:b1(r,C,u??Um,c))}return g}function C1(t,n){const i=new Map;for(const[c,g]of t)g.phase!=="sending"?i.set(c,g):g.queued&&i.set(c,{...g,queued:!1,sentAt:n});return i}function x1(t,n,i){const c=t.get(n.terminalId);if(c===void 0||c.requestId!==n.requestId)return t;const g=new Map(t);return n.delivered?g.set(n.terminalId,{...c,phase:"delivered",queued:!1,deliveredAt:i}):g.delete(n.terminalId),g}function k1(t){if(!t.live||t.waitingFor!==null)return null;const{receipt:n,activity:i,now:c}=t,g=t.clock??Um;if((n==null?void 0:n.phase)==="sending"&&(n.queued||c-n.sentAt<p1))return{kind:"sending"};const T=(n==null?void 0:n.phase)==="delivered"?n.deliveredAt:null;return i==="busy"?{kind:"working",since:g.runStartedAt,justDelivered:T!==null&&c-T<_1}:n===null||T===null||y1(n.afterEventId,t.events)?null:i==="unknown"?c-T<m1?{kind:"awaiting-reply",since:T}:null:i!=="idle"&&i!==null||g.busySeenAt!==null&&g.busySeenAt>=n.sentAt?null:c-T<g1?{kind:"delivered"}:null}function E1(t,n){switch(t.kind){case"sending":return S("thread.status.sending");case"delivered":return S("thread.status.delivered");case"working":{const i=t.since===null?0:n-t.since;if(i<1e3)return t.justDelivered?S("thread.status.workingDelivered"):S("thread.status.working");const c={elapsed:so(i)};return t.justDelivered?S("thread.status.workingForDelivered",c):S("thread.status.workingFor",c)}case"awaiting-reply":{const i=n-t.since;return i<1e3?S("thread.status.delivered"):S("thread.status.awaitingReply",{elapsed:so(i)})}}}function L1(t,n){const i=t.slice(0,v1).map(g=>S("thread.status.subagent",{name:g.description.length>0?g.description:S("thread.status.subagentUnnamed"),elapsed:so(Math.max(0,n-g.startedAt))})),c=t.length-i.length;return c>0&&i.push(S("thread.status.subagentsMore",{count:c})),S("thread.status.subagents",{count:t.length,list:Nu(i)})}const T1=5,R1=1200;function Bc(){return crypto.randomUUID()}function M1(t=!0){const[n,i]=N.useState([]),[c,g]=N.useState(null),T=N.useCallback(L=>{if(n.filter(a=>a.kind==="image").length>=jc){g(S("composer.problem.tooManyImages",{count:jc}));return}if(L.size>Fl){const a=Math.round(L.size/1024/1024),p=Fl/1024/1024;g(L.name.length>0?S("composer.problem.tooBig",{name:L.name,size:a,max:p}):S("composer.problem.imageTooBig",{size:a,max:p}));return}const f=new FileReader;f.onload=()=>{const a=f.result;if(typeof a!="string")return;const p=a.indexOf(",");p!==-1&&i(m=>m.filter(d=>d.kind==="image").length>=jc?m:[...m,{id:Bc(),kind:"image",mediaType:L.type,base64:a.slice(p+1),dataUrl:a,bytes:L.size,name:L.name.length>0?L.name:S("composer.pastedImage")}])},f.onerror=()=>g(S("composer.problem.imageUnreadable")),f.readAsDataURL(L)},[n]),C=N.useCallback(L=>{if(n.filter(a=>a.kind==="file").length>=Pc){g(S("composer.problem.tooManyFiles",{count:Pc}));return}if(L.size===0){g(S("composer.problem.empty",{name:L.name}));return}if(L.size>ff){g(S("composer.problem.tooBig",{name:L.name,size:Math.round(L.size/1024/1024),max:ff/1024/1024}));return}const f=new FileReader;f.onload=()=>{const a=f.result;if(typeof a!="string")return;const p=a.indexOf(",");p!==-1&&i(m=>m.filter(d=>d.kind==="file").length>=Pc?m:[...m,{id:Bc(),kind:"file",name:L.name.length>0?L.name:"archivo",base64:a.slice(p+1),bytes:L.size}])},f.onerror=()=>g(S("composer.problem.unreadable",{name:L.name})),f.readAsDataURL(L)},[n]),r=N.useCallback(L=>{const f=Array.from(L),a=f.filter(m=>m.type.startsWith("image/")),p=f.filter(m=>!m.type.startsWith("image/"));if(a.length>0&&!t)g(Ww());else for(const m of a)T(m);for(const m of p)C(m)},[T,C,t]),u=N.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<T1&&a.length<R1)return{consumed:!1,pastedNumber:null};const p=Ny([...n.flatMap(m=>m.kind==="text"?[m.number]:[]),...f]);return i(m=>[...m,{id:Bc(),kind:"text",number:p,text:a,lines:Hl(a)}]),{consumed:!0,pastedNumber:p}},[r,n]),_=N.useCallback(L=>{i(f=>f.filter(a=>a.id!==L))},[]),v=N.useCallback((L,f)=>{i(a=>a.map(p=>p.id===L&&p.kind==="text"?{...p,text:f,lines:Hl(f)}:p))},[]),h=N.useCallback(L=>{i(L),g(null)},[]),w=N.useCallback(()=>h([]),[h]),k=N.useCallback(()=>g(null),[]);return{items:n,problem:c,acceptPaste:u,acceptFiles:r,remove:_,updateText:v,replace:h,clear:w,dismissProblem:k}}function Pl({min:t,max:n,value:i,measure:c,onChange:g,onCommit:T,onStart:C}){const r=N.useRef(!1),u=N.useRef(i),_=N.useCallback(w=>{r.current=!0,u.current=i,C==null||C(w),w.currentTarget.setPointerCapture(w.pointerId),w.preventDefault()},[C,i]),v=N.useCallback(w=>{if(!r.current)return;const k=Math.min(n,Math.max(t,c(w)));u.current=k,g(k)},[n,t,c,g]),h=N.useCallback(w=>{r.current&&(r.current=!1,w.currentTarget.releasePointerCapture(w.pointerId),T(u.current))},[T]);return{onPointerDown:_,onPointerMove:v,onPointerUp:h,onPointerCancel:h}}function Wm(t){const[n,i]=N.useState(()=>typeof window<"u"&&window.matchMedia(t).matches);return N.useEffect(()=>{const c=window.matchMedia(t),g=()=>i(c.matches);return g(),c.addEventListener("change",g),()=>c.removeEventListener("change",g)},[t]),n}function A1(){return Wm(Qy)}function N1(){return Wm(Jy)}const zm="agent_workbench_prefs",pu="agent-workbench.",Vm=/^[a-z0-9][a-z0-9.-]{0,59}$/,qm=200,D1=400*24*60*60,I1=3500;function j1(t){const n=new Map;for(const i of t.split(";")){const c=i.indexOf("=");if(c===-1||i.slice(0,c).trim()!==zm)continue;let g;try{g=JSON.parse(decodeURIComponent(i.slice(c+1).trim()))}catch{return n}if(g===null||typeof g!="object"||Array.isArray(g))return n;for(const[T,C]of Object.entries(g))!Vm.test(T)||typeof C!="string"||C.length>qm||n.set(`${pu}${T}`,C);return n}return n}function P1(t){const n={};for(const[c,g]of t){if(!c.startsWith(pu))continue;const T=c.slice(pu.length);!Vm.test(T)||g.length>qm||(n[T]=g)}const i=encodeURIComponent(JSON.stringify(n));return i.length>I1?null:i}function O1(t){return`${zm}=${t}; Path=/; Max-Age=${D1}; SameSite=Strict`}function Km(){try{return j1(document.cookie)}catch{return new Map}}function Gm(t,n){const i=Km();if(i.get(t)===n)return;i.set(t,n);const c=P1(i);if(c!==null)try{document.cookie=O1(c)}catch{}}function xt(t,n,i){const c=Km().get(t);if(c!==void 0){const g=i(c);if(g!==null)return g}try{const g=window.localStorage.getItem(t);if(g===null)return n;const T=i(g);return T===null?n:(c===void 0&&Gm(t,g),T)}catch{return n}}function vt(t,n){Gm(t,n);try{window.localStorage.setItem(t,n)}catch{}}function B1(t,n,i){const c=Number.parseInt(t,10);return Number.isFinite(c)&&c>=n&&c<=i?c:null}const Df=90,F1=260,If=720,jf="agent-workbench.composer-height";function Pf(t){return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd,backward:t.selectionDirection==="backward",scrollTop:t.scrollTop}}function H1({connection:t,drafts:n,terminalId:i,alive:c,sleeping:g=!1,projectColor:T,activity:C,controls:r,leading:u,imagesAllowed:_=!0,blockedReason:v=null,prefills:h,onPrefillApplied:w,notice:k=null,onDismissNotice:L,onSubmitted:f,fontSize:a,insertRef:p}){const[m,d]=N.useState(""),[x,I]=N.useState(!1),E=M1(_),M=N.useRef(null),b=N1(),[R,D]=N.useState(()=>xt(jf,F1,he=>B1(he,Df,If))),[B,O]=N.useState(!1),F=N.useCallback(()=>{const he=M.current;if(he===null)return;he.style.height="auto";const Te=he.offsetHeight-he.clientHeight,ge=he.scrollHeight+Te,Re=B?R:Math.min(ge,R);he.style.height=`${Re}px`,he.style.overflowY=ge>Re?"auto":"hidden"},[R,B]);N.useEffect(F,[m,F,a]);const U=N.useRef(0),q=N.useRef(0),X=Pl({min:Df,max:If,value:R,measure:N.useCallback(he=>U.current-he.clientY-q.current,[]),onChange:D,onCommit:N.useCallback(he=>{O(!1),vt(jf,String(he))},[]),onStart:N.useCallback(he=>{const Te=M.current,ge=Te==null?void 0:Te.getBoundingClientRect();U.current=(ge==null?void 0:ge.bottom)??he.clientY,q.current=((ge==null?void 0:ge.bottom)??he.clientY)-he.clientY-((ge==null?void 0:ge.height)??0),O(!0)},[])}),Y=N.useRef(null),[V,j]=N.useState(0),$=N.useCallback(()=>j(he=>he+1),[]),H=N.useRef(m);H.current=m;const K=N.useRef(E.items);K.current=E.items;const{replace:te}=E;N.useEffect(()=>{const he=Y.current;he!==null&&n.put(he,{text:m,items:E.items})},[m,E.items,n]),N.useEffect(()=>{var ge;const he=Y.current;if(he===i)return;if(Y.current=i,he!==null){n.put(he,{text:H.current,items:K.current});const Re=M.current;Re!==null&&n.rememberView(he,Pf(Re))}const Te=i===null?void 0:n.get(i);d((Te==null?void 0:Te.text)??""),te((Te==null?void 0:Te.items)??[]),$(),i!==null&&((ge=M.current)==null||ge.focus())},[i,te,n,$]),N.useEffect(()=>()=>{const he=Y.current;he!==null&&n.put(he,{text:H.current,items:K.current})},[n]),N.useLayoutEffect(()=>()=>{const he=Y.current,Te=M.current;he!==null&&Te!==null&&n.rememberView(he,Pf(Te))},[n]),N.useEffect(()=>{if(V===0)return;const he=Y.current,Te=M.current;if(he===null||Te===null)return;const ge=zy(Te.value.length,n.viewOf(he));Te.setSelectionRange(ge.start,ge.end,ge.direction),Te.scrollTop=ge.scrollTop==="end"?Te.scrollHeight:ge.scrollTop},[V,n]),N.useEffect(()=>n.onRestored(he=>{if(he!==Y.current)return;const Te=n.get(he);Te!==void 0&&(d(Te.text),te(Te.items),$())}),[n,te,$]);const re=N.useRef(new Set);N.useEffect(()=>{if(!(h===void 0||h.length===0)){for(const he of h)if(!re.current.has(he.id)){if(re.current.add(he.id),he.terminalId===Y.current)d(Te=>kf(Te,he.text));else{const Te=n.get(he.terminalId);n.put(he.terminalId,{text:kf((Te==null?void 0:Te.text)??"",he.text),items:(Te==null?void 0:Te.items)??[]})}w==null||w(he.id)}}},[h,w,n]);const le=N.useCallback(()=>{if(i===null||v!==null)return;const he=E.items.filter(Ne=>Ne.kind==="text").map(Ne=>({number:Ne.number,text:Ne.text})),Te=E.items.filter(Ne=>Ne.kind==="image").map(Ne=>({mediaType:Ne.mediaType,data:Ne.base64})),ge=E.items.filter(Ne=>Ne.kind==="file").map(Ne=>({name:Ne.name,data:Ne.base64})),Re=Fy(he,m);if(Re.length===0&&Te.length===0&&ge.length===0)return;const Ue=w1(),ke=t.send({type:"agent.submit",terminalId:i,text:Re,images:Te,...ge.length>0?{files:ge}:{},requestId:Ue});n.submitted(i,ke),d(""),E.clear(),f==null||f(i,Ue,!ke)},[t,n,i,m,E,v,f]),de=N.useCallback(()=>{i!==null&&t.send({type:"agent.interrupt",terminalId:i})},[t,i]),G=N.useCallback(he=>{if(he.key==="Enter"&&c1(he,b)){he.preventDefault(),le();return}he.key==="Escape"&&(he.preventDefault(),de())},[le,de,b]),z=N.useCallback((he,Te)=>{const{inserted:ge}=Py(he.value,he.selectionStart,he.selectionEnd,Te);let Re=!1;try{Re=document.execCommand("insertText",!1,ge)}catch{Re=!1}Re||(he.setRangeText(ge,he.selectionStart,he.selectionEnd,"end"),d(he.value))},[]),Q=N.useCallback((he,Te)=>{const ge=M.current;if(ge===null||ge.disabled){d(ke=>Lf(ke,ke.length,ke.length,he).text);return}const{inserted:Re}=Lf(ge.value,ge.selectionStart,ge.selectionEnd,he);let Ue=!1;if(Te){ge.focus();try{Ue=document.execCommand("insertText",!1,Re)}catch{Ue=!1}}Ue||(ge.setRangeText(Re,ge.selectionStart,ge.selectionEnd,"end"),d(ge.value))},[]);N.useEffect(()=>{if(p!==void 0)return p.current=Q,()=>{p.current===Q&&(p.current=null)}},[p,Q]);const Z=N.useCallback(he=>{if(he.clipboardData===null)return;const Te=E.acceptPaste(he.clipboardData,Dy(he.currentTarget.value));Te.consumed&&(he.preventDefault(),Te.pastedNumber!==null&&z(he.currentTarget,Te.pastedNumber))},[E,z]),ae=N.useCallback(he=>{E.remove(he.id),he.kind==="text"&&d(Te=>Im(Te,he.number))},[E]),fe=N.useRef(null),Ee=i===null||!c,Ae=m.trim().length>0||E.items.some(he=>he.kind!=="text"||he.text.trim().length>0),ze=c&&C!=="idle",ue=Ae||!ze,Me=Vy({text:m,items:E.items});return l.jsxs("div",{className:`composer${x?" composer-dragging":""}`,style:T===void 0?void 0:{"--composer-accent":T},onDragOver:he=>{Array.from(he.dataTransfer.types).includes("Files")&&(he.preventDefault(),I(!0))},onDragLeave:()=>I(!1),onDrop:he=>{he.preventDefault(),I(!1),E.acceptFiles(he.dataTransfer.files)},children:[l.jsx("div",{className:"hdivider composer-divider",...X,title:S("composer.resizeTitle")}),k!==null&&l.jsxs("div",{className:"handoff-notice",role:"status",children:[l.jsxs("span",{className:"handoff-notice-text",children:[k.text,k.status!==null&&l.jsx("span",{className:"handoff-notice-status",children:k.status})]}),L!==void 0&&l.jsx("button",{className:"icon-button",onClick:L,title:S("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:S("common.close"),children:"×"})]}),Me&&l.jsx("div",{className:"composer-problem",role:"status",children:l.jsx("span",{children:S("composer.problem.draftTooLong")})}),E.items.length>0&&l.jsx("div",{className:"composer-chips",children:E.items.map(he=>l.jsx($1,{item:he,onRemove:()=>ae(he),onEdit:Te=>E.updateText(he.id,Te),onDoneEditing:()=>{var Te;return(Te=M.current)==null?void 0:Te.focus()}},he.id))}),l.jsxs("div",{className:`composer-field${ze&&ue?" composer-field-two":""}`,children:[l.jsx("textarea",{ref:M,className:"composer-input",value:m,rows:1,placeholder:S(Ee?g?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:Ee,onChange:he=>d(he.target.value),onKeyDown:G,onPaste:Z,spellCheck:!1}),l.jsxs("div",{className:"composer-field-actions",children:[ze&&l.jsx("button",{className:"composer-icon composer-stop",onClick:de,disabled:Ee,title:S("composer.stopTitle"),"aria-label":S("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"})})}),ue&&l.jsx("button",{className:"composer-icon composer-send",onClick:le,disabled:Ee||!Ae||v!==null,title:v??S("composer.sendTitle"),"aria-label":S("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:fe,type:"file",multiple:!0,hidden:!0,onChange:he=>{he.target.files!==null&&E.acceptFiles(he.target.files),he.target.value=""}}),l.jsx("button",{className:"icon-button composer-attach",onClick:()=>{var he;return(he=fe.current)==null?void 0:he.click()},disabled:Ee,title:S("composer.attachTitle"),"aria-label":S("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"})})}),u,l.jsx("span",{className:"composer-spacer"}),r]})]})}function $1({item:t,onRemove:n,onEdit:i,onDoneEditing:c}){const[g,T]=N.useState(!1);if(t.kind==="image"){const C=`${t.name} · ${fn(t.bytes)}`;return l.jsxs("figure",{className:"chip chip-image",title:C,children:[l.jsx("img",{src:t.dataUrl,alt:t.name,onClick:()=>T(!0)}),l.jsx("button",{className:"chip-remove",onClick:n,title:S("composer.chip.remove"),children:"×"}),g&&l.jsx(Bm,{src:t.dataUrl,caption:C,onClose:()=>T(!1)})]})}return t.kind==="file"?l.jsxs("div",{className:"chip chip-text chip-file",title:`${t.name} · ${fn(t.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:t.name}),l.jsx("span",{className:"chip-file-size",children:fn(t.bytes)})]}),l.jsx("button",{className:"chip-remove",onClick:n,title:S("composer.chip.remove"),children:"×"})]}):l.jsxs("div",{className:`chip chip-text${g?" chip-open":""}`,children:[l.jsxs("button",{className:"chip-toggle",onClick:()=>T(C=>!C),title:S("composer.chip.editHint"),"aria-expanded":g,children:[l.jsx("span",{className:"chip-icon",children:"¶"}),Ay(t.number,t.lines),l.jsx("span",{className:"chip-chevron",children:g?"▾":"▸"})]}),l.jsx("button",{className:"chip-remove",onClick:n,title:S("composer.chip.remove"),children:"×"}),g&&l.jsx("textarea",{className:"chip-editor",value:t.text,onChange:C=>i(C.target.value),onKeyDown:C=>{C.key==="Escape"&&(C.preventDefault(),T(!1),c())},"aria-label":S("composer.chip.editorLabel",{number:t.number}),spellCheck:!1,autoFocus:!0})]})}var Fc={exports:{}},Of;function U1(){return Of||(Of=1,(function(t,n){(function(i,c){t.exports=c()})(self,(()=>(()=>{var i={};return(()=>{var c=i;Object.defineProperty(c,"__esModule",{value:!0}),c.FitAddon=void 0,c.FitAddon=class{activate(g){this._terminal=g}dispose(){}fit(){const g=this.proposeDimensions();if(!g||!this._terminal||isNaN(g.cols)||isNaN(g.rows))return;const T=this._terminal._core;this._terminal.rows===g.rows&&this._terminal.cols===g.cols||(T._renderService.clear(),this._terminal.resize(g.cols,g.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const g=this._terminal._core,T=g._renderService.dimensions;if(T.css.cell.width===0||T.css.cell.height===0)return;const C=this._terminal.options.scrollback===0?0:g.viewport.scrollBarWidth,r=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(r.getPropertyValue("height")),_=Math.max(0,parseInt(r.getPropertyValue("width"))),v=window.getComputedStyle(this._terminal.element),h=u-(parseInt(v.getPropertyValue("padding-top"))+parseInt(v.getPropertyValue("padding-bottom"))),w=_-(parseInt(v.getPropertyValue("padding-right"))+parseInt(v.getPropertyValue("padding-left")))-C;return{cols:Math.max(2,Math.floor(w/T.css.cell.width)),rows:Math.max(1,Math.floor(h/T.css.cell.height))}}}})(),i})()))})(Fc)),Fc.exports}var W1=U1(),Hc={exports:{}},Bf;function z1(){return Bf||(Bf=1,(function(t,n){(function(i,c){t.exports=c()})(self,(()=>(()=>{var i={6:(C,r)=>{function u(v){try{const h=new URL(v),w=h.password&&h.username?`${h.protocol}//${h.username}:${h.password}@${h.host}`:h.username?`${h.protocol}//${h.username}@${h.host}`:`${h.protocol}//${h.host}`;return v.toLocaleLowerCase().startsWith(w.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(r,"__esModule",{value:!0}),r.LinkComputer=r.WebLinkProvider=void 0,r.WebLinkProvider=class{constructor(v,h,w,k={}){this._terminal=v,this._regex=h,this._handler=w,this._options=k}provideLinks(v,h){const w=_.computeLink(v,this._regex,this._terminal,this._handler);h(this._addCallbacks(w))}_addCallbacks(v){return v.map((h=>(h.leave=this._options.leave,h.hover=(w,k)=>{if(this._options.hover){const{range:L}=h;this._options.hover(w,k,L)}},h)))}};class _{static computeLink(h,w,k,L){const f=new RegExp(w.source,(w.flags||"")+"g"),[a,p]=_._getWindowedLineStrings(h-1,k),m=a.join("");let d;const x=[];for(;d=f.exec(m);){const I=d[0];if(!u(I))continue;const[E,M]=_._mapStrIdx(k,p,0,d.index),[b,R]=_._mapStrIdx(k,E,M,I.length);if(E===-1||M===-1||b===-1||R===-1)continue;const D={start:{x:M+1,y:E+1},end:{x:R,y:b+1}};x.push({range:D,text:I,activate:L})}return x}static _getWindowedLineStrings(h,w){let k,L=h,f=h,a=0,p="";const m=[];if(k=w.buffer.active.getLine(h)){const d=k.translateToString(!0);if(k.isWrapped&&d[0]!==" "){for(a=0;(k=w.buffer.active.getLine(--L))&&a<2048&&(p=k.translateToString(!0),a+=p.length,m.push(p),k.isWrapped&&p.indexOf(" ")===-1););m.reverse()}for(m.push(d),a=0;(k=w.buffer.active.getLine(++f))&&k.isWrapped&&a<2048&&(p=k.translateToString(!0),a+=p.length,m.push(p),p.indexOf(" ")===-1););}return[m,L]}static _mapStrIdx(h,w,k,L){const f=h.buffer.active,a=f.getNullCell();let p=k;for(;L;){const m=f.getLine(w);if(!m)return[-1,-1];for(let d=p;d<m.length;++d){m.getCell(d,a);const x=a.getChars();if(a.getWidth()&&(L-=x.length||1,d===m.length-1&&x==="")){const I=f.getLine(w+1);I&&I.isWrapped&&(I.getCell(0,a),a.getWidth()===2&&(L+=1))}if(L<0)return[w,d]}w++,p=0}return[w,p]}}r.LinkComputer=_}},c={};function g(C){var r=c[C];if(r!==void 0)return r.exports;var u=c[C]={exports:{}};return i[C](u,u.exports,g),u.exports}var T={};return(()=>{var C=T;Object.defineProperty(C,"__esModule",{value:!0}),C.WebLinksAddon=void 0;const r=g(6),u=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function _(v,h){const w=window.open();if(w){try{w.opener=null}catch{}w.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}C.WebLinksAddon=class{constructor(v=_,h={}){this._handler=v,this._options=h}activate(v){this._terminal=v;const h=this._options,w=h.urlRegex||u;this._linkProvider=this._terminal.registerLinkProvider(new r.WebLinkProvider(this._terminal,w,this._handler,h))}dispose(){var v;(v=this._linkProvider)==null||v.dispose()}}})(),T})()))})(Hc)),Hc.exports}var V1=z1(),$c={exports:{}},Ff;function q1(){return Ff||(Ff=1,(function(t,n){(function(i,c){t.exports=c()})(self,(()=>(()=>{var i={965:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GlyphRenderer=void 0;const _=u(374),v=u(509),h=u(855),w=u(859),k=u(381),L=11,f=L*Float32Array.BYTES_PER_ELEMENT;let a,p=0,m=0,d=0;class x extends w.Disposable{constructor(E,M,b,R){super(),this._terminal=E,this._gl=M,this._dimensions=b,this._optionsService=R,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const D=this._gl;v.TextureAtlas.maxAtlasPages===void 0&&(v.TextureAtlas.maxAtlasPages=Math.min(32,(0,_.throwIfFalsy)(D.getParameter(D.MAX_TEXTURE_IMAGE_UNITS))),v.TextureAtlas.maxTextureSize=(0,_.throwIfFalsy)(D.getParameter(D.MAX_TEXTURE_SIZE))),this._program=(0,_.throwIfFalsy)((0,k.createProgram)(D,`#version 300 es
52
- layout (location = 0) in vec2 a_unitquad;
53
- layout (location = 1) in vec2 a_cellpos;
54
- layout (location = 2) in vec2 a_offset;
55
- layout (location = 3) in vec2 a_size;
56
- layout (location = 4) in float a_texpage;
57
- layout (location = 5) in vec2 a_texcoord;
58
- layout (location = 6) in vec2 a_texsize;
59
-
60
- uniform mat4 u_projection;
61
- uniform vec2 u_resolution;
62
-
63
- out vec2 v_texcoord;
64
- flat out int v_texpage;
65
-
66
- void main() {
67
- vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
68
- gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
69
- v_texpage = int(a_texpage);
70
- v_texcoord = a_texcoord + a_unitquad * a_texsize;
71
- }`,(function(X){let Y="";for(let V=1;V<X;V++)Y+=` else if (v_texpage == ${V}) { outColor = texture(u_texture[${V}], v_texcoord); }`;return`#version 300 es
72
- precision lowp float;
73
-
74
- in vec2 v_texcoord;
75
- flat in int v_texpage;
76
-
77
- uniform sampler2D u_texture[${X}];
78
-
79
- out vec4 outColor;
80
-
81
- void main() {
82
- if (v_texpage == 0) {
83
- outColor = texture(u_texture[0], v_texcoord);
84
- } ${Y}
85
- }`})(v.TextureAtlas.maxAtlasPages))),this.register((0,w.toDisposable)((()=>D.deleteProgram(this._program)))),this._projectionLocation=(0,_.throwIfFalsy)(D.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,_.throwIfFalsy)(D.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,_.throwIfFalsy)(D.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=D.createVertexArray(),D.bindVertexArray(this._vertexArrayObject);const B=new Float32Array([0,0,1,0,0,1,1,1]),O=D.createBuffer();this.register((0,w.toDisposable)((()=>D.deleteBuffer(O)))),D.bindBuffer(D.ARRAY_BUFFER,O),D.bufferData(D.ARRAY_BUFFER,B,D.STATIC_DRAW),D.enableVertexAttribArray(0),D.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const F=new Uint8Array([0,1,2,3]),U=D.createBuffer();this.register((0,w.toDisposable)((()=>D.deleteBuffer(U)))),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,U),D.bufferData(D.ELEMENT_ARRAY_BUFFER,F,D.STATIC_DRAW),this._attributesBuffer=(0,_.throwIfFalsy)(D.createBuffer()),this.register((0,w.toDisposable)((()=>D.deleteBuffer(this._attributesBuffer)))),D.bindBuffer(D.ARRAY_BUFFER,this._attributesBuffer),D.enableVertexAttribArray(2),D.vertexAttribPointer(2,2,D.FLOAT,!1,f,0),D.vertexAttribDivisor(2,1),D.enableVertexAttribArray(3),D.vertexAttribPointer(3,2,D.FLOAT,!1,f,2*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(3,1),D.enableVertexAttribArray(4),D.vertexAttribPointer(4,1,D.FLOAT,!1,f,4*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(4,1),D.enableVertexAttribArray(5),D.vertexAttribPointer(5,2,D.FLOAT,!1,f,5*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(5,1),D.enableVertexAttribArray(6),D.vertexAttribPointer(6,2,D.FLOAT,!1,f,7*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(6,1),D.enableVertexAttribArray(1),D.vertexAttribPointer(1,2,D.FLOAT,!1,f,9*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(1,1),D.useProgram(this._program);const q=new Int32Array(v.TextureAtlas.maxAtlasPages);for(let X=0;X<v.TextureAtlas.maxAtlasPages;X++)q[X]=X;D.uniform1iv(this._textureLocation,q),D.uniformMatrix4fv(this._projectionLocation,!1,k.PROJECTION_MATRIX),this._atlasTextures=[];for(let X=0;X<v.TextureAtlas.maxAtlasPages;X++){const Y=new k.GLTexture((0,_.throwIfFalsy)(D.createTexture()));this.register((0,w.toDisposable)((()=>D.deleteTexture(Y.texture)))),D.activeTexture(D.TEXTURE0+X),D.bindTexture(D.TEXTURE_2D,Y.texture),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texImage2D(D.TEXTURE_2D,0,D.RGBA,1,1,0,D.RGBA,D.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[X]=Y}D.enable(D.BLEND),D.blendFunc(D.SRC_ALPHA,D.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(E,M,b,R,D,B,O,F,U){this._updateCell(this._vertices.attributes,E,M,b,R,D,B,O,F,U)}_updateCell(E,M,b,R,D,B,O,F,U,q){p=(b*this._terminal.cols+M)*L,R!==h.NULL_CELL_CODE&&R!==void 0?this._atlas&&(a=F&&F.length>1?this._atlas.getRasterizedGlyphCombinedChar(F,D,B,O,!1):this._atlas.getRasterizedGlyph(R,D,B,O,!1),m=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),D!==q&&a.offset.x>m?(d=a.offset.x-m,E[p]=-(a.offset.x-d)+this._dimensions.device.char.left,E[p+1]=-a.offset.y+this._dimensions.device.char.top,E[p+2]=(a.size.x-d)/this._dimensions.device.canvas.width,E[p+3]=a.size.y/this._dimensions.device.canvas.height,E[p+4]=a.texturePage,E[p+5]=a.texturePositionClipSpace.x+d/this._atlas.pages[a.texturePage].canvas.width,E[p+6]=a.texturePositionClipSpace.y,E[p+7]=a.sizeClipSpace.x-d/this._atlas.pages[a.texturePage].canvas.width,E[p+8]=a.sizeClipSpace.y):(E[p]=-a.offset.x+this._dimensions.device.char.left,E[p+1]=-a.offset.y+this._dimensions.device.char.top,E[p+2]=a.size.x/this._dimensions.device.canvas.width,E[p+3]=a.size.y/this._dimensions.device.canvas.height,E[p+4]=a.texturePage,E[p+5]=a.texturePositionClipSpace.x,E[p+6]=a.texturePositionClipSpace.y,E[p+7]=a.sizeClipSpace.x,E[p+8]=a.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,_.allowRescaling)(R,U,a.size.x,this._dimensions.device.cell.width)&&(E[p+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):E.fill(0,p,p+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 R=0;R<E.rows;R++)for(let D=0;D<E.cols;D++)this._vertices.attributes[b+9]=D/E.cols,this._vertices.attributes[b+10]=R/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 R=0;for(let D=0;D<E.lineLengths.length;D++){const B=D*this._terminal.cols*L,O=this._vertices.attributes.subarray(B,B+E.lineLengths[D]*L);b.set(O,R),R+=O.length}M.bindBuffer(M.ARRAY_BUFFER,this._attributesBuffer),M.bufferData(M.ARRAY_BUFFER,b.subarray(0,R),M.STREAM_DRAW);for(let D=0;D<this._atlas.pages.length;D++)this._atlas.pages[D].version!==this._atlasTextures[D].version&&this._bindAtlasPageTexture(M,this._atlas,D);M.drawElementsInstanced(M.TRIANGLE_STRIP,4,M.UNSIGNED_BYTE,0,R/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=x},742:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RectangleRenderer=void 0;const _=u(374),v=u(859),h=u(310),w=u(381),k=8*Float32Array.BYTES_PER_ELEMENT;class L{constructor(){this.attributes=new Float32Array(160),this.count=0}}let f=0,a=0,p=0,m=0,d=0,x=0,I=0;class E extends v.Disposable{constructor(b,R,D,B){super(),this._terminal=b,this._gl=R,this._dimensions=D,this._themeService=B,this._vertices=new L,this._verticesCursor=new L;const O=this._gl;this._program=(0,_.throwIfFalsy)((0,w.createProgram)(O,`#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,v.toDisposable)((()=>O.deleteProgram(this._program)))),this._projectionLocation=(0,_.throwIfFalsy)(O.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=O.createVertexArray(),O.bindVertexArray(this._vertexArrayObject);const F=new Float32Array([0,0,1,0,0,1,1,1]),U=O.createBuffer();this.register((0,v.toDisposable)((()=>O.deleteBuffer(U)))),O.bindBuffer(O.ARRAY_BUFFER,U),O.bufferData(O.ARRAY_BUFFER,F,O.STATIC_DRAW),O.enableVertexAttribArray(3),O.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const q=new Uint8Array([0,1,2,3]),X=O.createBuffer();this.register((0,v.toDisposable)((()=>O.deleteBuffer(X)))),O.bindBuffer(O.ELEMENT_ARRAY_BUFFER,X),O.bufferData(O.ELEMENT_ARRAY_BUFFER,q,O.STATIC_DRAW),this._attributesBuffer=(0,_.throwIfFalsy)(O.createBuffer()),this.register((0,v.toDisposable)((()=>O.deleteBuffer(this._attributesBuffer)))),O.bindBuffer(O.ARRAY_BUFFER,this._attributesBuffer),O.enableVertexAttribArray(0),O.vertexAttribPointer(0,2,O.FLOAT,!1,k,0),O.vertexAttribDivisor(0,1),O.enableVertexAttribArray(1),O.vertexAttribPointer(1,2,O.FLOAT,!1,k,2*Float32Array.BYTES_PER_ELEMENT),O.vertexAttribDivisor(1,1),O.enableVertexAttribArray(2),O.vertexAttribPointer(2,4,O.FLOAT,!1,k,4*Float32Array.BYTES_PER_ELEMENT),O.vertexAttribDivisor(2,1),this._updateCachedColors(B.colors),this.register(this._themeService.onChangeColors((Y=>{this._updateCachedColors(Y),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(b){const R=this._gl;R.useProgram(this._program),R.bindVertexArray(this._vertexArrayObject),R.uniformMatrix4fv(this._projectionLocation,!1,w.PROJECTION_MATRIX),R.bindBuffer(R.ARRAY_BUFFER,this._attributesBuffer),R.bufferData(R.ARRAY_BUFFER,b.attributes,R.DYNAMIC_DRAW),R.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,R.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 R=this._terminal,D=this._vertices;let B,O,F,U,q,X,Y,V,j,$,H,K=1;for(B=0;B<R.rows;B++){for(F=-1,U=0,q=0,X=!1,O=0;O<R.cols;O++)Y=(B*R.cols+O)*h.RENDER_MODEL_INDICIES_PER_CELL,V=b.cells[Y+h.RENDER_MODEL_BG_OFFSET],j=b.cells[Y+h.RENDER_MODEL_FG_OFFSET],$=!!(67108864&j),(V!==U||j!==q&&(X||$))&&((U!==0||X&&q!==0)&&(H=8*K++,this._updateRectangle(D,H,q,U,F,O,B)),F=O,U=V,q=j,X=$);(U!==0||X&&q!==0)&&(H=8*K++,this._updateRectangle(D,H,q,U,F,R.cols,B))}D.count=K}updateCursor(b){const R=this._verticesCursor,D=b.cursor;if(!D||D.style==="block")return void(R.count=0);let B,O=0;D.style!=="bar"&&D.style!=="outline"||(B=8*O++,this._addRectangleFloat(R.attributes,B,D.x*this._dimensions.device.cell.width,D.y*this._dimensions.device.cell.height,D.style==="bar"?D.dpr*D.cursorWidth:D.dpr,this._dimensions.device.cell.height,this._cursorFloat)),D.style!=="underline"&&D.style!=="outline"||(B=8*O++,this._addRectangleFloat(R.attributes,B,D.x*this._dimensions.device.cell.width,(D.y+1)*this._dimensions.device.cell.height-D.dpr,D.width*this._dimensions.device.cell.width,D.dpr,this._cursorFloat)),D.style==="outline"&&(B=8*O++,this._addRectangleFloat(R.attributes,B,D.x*this._dimensions.device.cell.width,D.y*this._dimensions.device.cell.height,D.width*this._dimensions.device.cell.width,D.dpr,this._cursorFloat),B=8*O++,this._addRectangleFloat(R.attributes,B,(D.x+D.width)*this._dimensions.device.cell.width-D.dpr,D.y*this._dimensions.device.cell.height,D.dpr,this._dimensions.device.cell.height,this._cursorFloat)),R.count=O}_updateRectangle(b,R,D,B,O,F,U){if(67108864&D)switch(50331648&D){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&D].rgba;break;case 50331648:f=(16777215&D)<<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<R+4&&(b.attributes=(0,w.expandFloat32Array)(b.attributes,this._terminal.rows*this._terminal.cols*8)),a=O*this._dimensions.device.cell.width,p=U*this._dimensions.device.cell.height,m=(f>>24&255)/255,d=(f>>16&255)/255,x=(f>>8&255)/255,I=1,this._addRectangle(b.attributes,R,a,p,(F-O)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,m,d,x,I)}_addRectangle(b,R,D,B,O,F,U,q,X,Y){b[R]=D/this._dimensions.device.canvas.width,b[R+1]=B/this._dimensions.device.canvas.height,b[R+2]=O/this._dimensions.device.canvas.width,b[R+3]=F/this._dimensions.device.canvas.height,b[R+4]=U,b[R+5]=q,b[R+6]=X,b[R+7]=Y}_addRectangleFloat(b,R,D,B,O,F,U){b[R]=D/this._dimensions.device.canvas.width,b[R+1]=B/this._dimensions.device.canvas.height,b[R+2]=O/this._dimensions.device.canvas.width,b[R+3]=F/this._dimensions.device.canvas.height,b[R+4]=U[0],b[R+5]=U[1],b[R+6]=U[2],b[R+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:(C,r,u)=>{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 _=u(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,_.createSelectionRenderModel)()}resize(v,h){const w=v*h*r.RENDER_MODEL_INDICIES_PER_CELL;w!==this.cells.length&&(this.cells=new Uint32Array(w),this.lineLengths=new Uint32Array(h))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.JoinedCellData=r.WebglRenderer=void 0;const _=u(820),v=u(274),h=u(627),w=u(457),k=u(56),L=u(374),f=u(345),a=u(859),p=u(147),m=u(782),d=u(855),x=u(965),I=u(742),E=u(310),M=u(733);class b extends a.Disposable{constructor(O,F,U,q,X,Y,V,j,$){super(),this._terminal=O,this._characterJoinerService=F,this._charSizeService=U,this._coreBrowserService=q,this._coreService=X,this._decorationService=Y,this._optionsService=V,this._themeService=j,this._cursorBlinkStateManager=new a.MutableDisposable,this._charAtlasDisposable=this.register(new a.MutableDisposable),this._observerDisposable=this.register(new a.MutableDisposable),this._model=new E.RenderModel,this._workCell=new m.CellData,this._workCell2=new m.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 v.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,V,this._themeService)],this.dimensions=(0,L.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(V.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,_.addDisposableDomListener)(this._canvas,"webglcontextlost",(K=>{console.log("webglcontextlost event received"),K.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(K)}),3e3)}))),this.register((0,_.addDisposableDomListener)(this._canvas,"webglcontextrestored",(K=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,h.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,k.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((K,te)=>this._setCanvasDevicePixelDimensions(K,te))),this.register(this._coreBrowserService.onWindowChange((K=>{this._observerDisposable.value=(0,k.observeDevicePixelDimensions)(this._canvas,K,((te,re)=>this._setCanvasDevicePixelDimensions(te,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 K;for(const te of this._renderLayers)te.dispose();(K=this._canvas.parentElement)==null||K.removeChild(this._canvas),(0,h.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var O;return(O=this._charAtlas)==null?void 0:O.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(O,F){var U,q,X,Y;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const V of this._renderLayers)V.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(U=this._rectangleRenderer.value)==null||U.setDimensions(this.dimensions),(q=this._rectangleRenderer.value)==null||q.handleResize(),(X=this._glyphRenderer.value)==null||X.setDimensions(this.dimensions),(Y=this._glyphRenderer.value)==null||Y.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var O;for(const F of this._renderLayers)F.handleBlur(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.pause(),this._requestRedrawViewport()}handleFocus(){var O;for(const F of this._renderLayers)F.handleFocus(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.resume(),this._requestRedrawViewport()}handleSelectionChanged(O,F,U){for(const q of this._renderLayers)q.handleSelectionChanged(this._terminal,O,F,U);this._model.selection.update(this._core,O,F,U),this._requestRedrawViewport()}handleCursorMove(){var O;for(const F of this._renderLayers)F.handleCursorMove(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new I.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new x.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var F;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const O=(0,h.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==O&&(this._onChangeTextureAtlas.fire(O.pages[0].canvas),this._charAtlasDisposable.value=(0,a.getDisposeArrayDisposable)([(0,f.forwardEvent)(O.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,f.forwardEvent)(O.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=O,this._charAtlas.warmUp(),(F=this._glyphRenderer.value)==null||F.setAtlas(this._charAtlas)}_clearModel(O){var F;this._model.clear(),O&&((F=this._glyphRenderer.value)==null||F.clear())}clearTextureAtlas(){var O;(O=this._charAtlas)==null||O.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var O;this._clearModel(!0);for(const F of this._renderLayers)F.reset(this._terminal);(O=this._cursorBlinkStateManager.value)==null||O.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(O){return-1}deregisterCharacterJoiner(O){return!1}renderRows(O,F){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const U of this._renderLayers)U.handleGridChanged(this._terminal,O,F);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(O,F),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new w.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(O,F){const U=this._core;let q,X,Y,V,j,$,H,K,te,re,le,de,G,z,Q=this._workCell;O=D(O,U.rows-1,0),F=D(F,U.rows-1,0);const Z=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,ae=Z-U.buffer.ydisp,fe=Math.min(this._terminal.buffer.active.cursorX,U.cols-1);let Ee=-1;const Ae=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ze=!1;for(X=O;X<=F;X++)for(Y=X+U.buffer.ydisp,V=U.buffer.lines.get(Y),this._model.lineLengths[X]=0,j=this._characterJoinerService.getJoinedCharacters(Y),G=0;G<U.cols;G++)if(q=this._cellColorResolver.result.bg,V.loadCell(G,Q),G===0&&(q=this._cellColorResolver.result.bg),$=!1,H=G,j.length>0&&G===j[0][0]&&($=!0,K=j.shift(),Q=new R(Q,V.translateToString(!0,K[0],K[1]),K[1]-K[0]),H=K[1]-1),te=Q.getChars(),re=Q.getCode(),de=(X*U.cols+G)*E.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(Q,G,Y,this.dimensions.device.cell.width),Ae&&Y===Z&&(G===fe&&(this._model.cursor={x:fe,y:ae,width:Q.getWidth(),style:this._coreBrowserService.isFocused?U.options.cursorStyle||"block":U.options.cursorInactiveStyle,cursorWidth:U.options.cursorWidth,dpr:this._devicePixelRatio},Ee=fe+Q.getWidth()-1),G>=fe&&G<=Ee&&(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[X]=G+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)&&(ze=!0,te.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,le=Q.getWidth(),this._glyphRenderer.value.updateCell(G,X,re,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,te,le,q),$))for(Q=this._workCell,G++;G<H;G++)z=(X*U.cols+G)*E.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(G,X,d.NULL_CELL_CODE,0,0,0,d.NULL_CELL_CHAR,0,0),this._model.cells[z]=d.NULL_CELL_CODE,this._model.cells[z+E.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[z+E.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[z+E.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ze&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(O,F){this._canvas.width===O&&this._canvas.height===F||(this._canvas.width=O,this._canvas.height=F,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const O=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:O,end:O})}}r.WebglRenderer=b;class R extends p.AttributeData{constructor(O,F,U){super(),this.content=0,this.combinedData="",this.fg=O.fg,this.bg=O.bg,this.combinedData=F,this._width=U}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(O){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function D(B,O,F=0){return Math.max(Math.min(B,O),F)}r.JoinedCellData=R},381:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GLTexture=r.expandFloat32Array=r.createShader=r.createProgram=r.PROJECTION_MATRIX=void 0;const _=u(374);function v(h,w,k){const L=(0,_.throwIfFalsy)(h.createShader(w));if(h.shaderSource(L,k),h.compileShader(L),h.getShaderParameter(L,h.COMPILE_STATUS))return L;console.error(h.getShaderInfoLog(L)),h.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(h,w,k){const L=(0,_.throwIfFalsy)(h.createProgram());if(h.attachShader(L,(0,_.throwIfFalsy)(v(h,h.VERTEX_SHADER,w))),h.attachShader(L,(0,_.throwIfFalsy)(v(h,h.FRAGMENT_SHADER,k))),h.linkProgram(L),h.getProgramParameter(L,h.LINK_STATUS))return L;console.error(h.getProgramInfoLog(L)),h.deleteProgram(L)},r.createShader=v,r.expandFloat32Array=function(h,w){const k=Math.min(2*h.length,w),L=new Float32Array(k);for(let f=0;f<h.length;f++)L[f]=h[f];return L},r.GLTexture=class{constructor(h){this.texture=h,this.version=-1}}},592:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BaseRenderLayer=void 0;const _=u(627),v=u(237),h=u(374),w=u(859);class k extends w.Disposable{constructor(f,a,p,m,d,x,I,E){super(),this._container=a,this._alpha=d,this._coreBrowserService=x,this._optionsService=I,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-${p}-layer`),this._canvas.style.zIndex=m.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((M=>{this._refreshCharAtlas(f,M),this.reset(f)}))),this.register((0,w.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,h.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(f){}handleFocus(f){}handleCursorMove(f){}handleGridChanged(f,a,p){}handleSelectionChanged(f,a,p,m=!1){}_setTransparency(f,a){if(a===this._alpha)return;const p=this._canvas;this._alpha=a,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,p),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,_.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,p=1){this._ctx.fillRect(f*this._deviceCellWidth,(a+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,p*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(f,a,p,m){this._alpha?this._ctx.clearRect(f*this._deviceCellWidth,a*this._deviceCellHeight,p*this._deviceCellWidth,m*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(f*this._deviceCellWidth,a*this._deviceCellHeight,p*this._deviceCellWidth,m*this._deviceCellHeight))}_fillCharTrueColor(f,a,p,m){this._ctx.font=this._getFont(f,!1,!1),this._ctx.textBaseline=v.TEXT_BASELINE,this._clipCell(p,m,a.getWidth()),this._ctx.fillText(a.getChars(),p*this._deviceCellWidth+this._deviceCharLeft,m*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(f,a,p){this._ctx.beginPath(),this._ctx.rect(f*this._deviceCellWidth,a*this._deviceCellHeight,p*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(f,a,p){return`${p?"italic":""} ${a?f.options.fontWeightBold:f.options.fontWeight} ${f.options.fontSize*this._coreBrowserService.dpr}px ${f.options.fontFamily}`}}r.BaseRenderLayer=k},733:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkRenderLayer=void 0;const _=u(197),v=u(237),h=u(592);class w extends h.BaseRenderLayer{constructor(L,f,a,p,m,d,x){super(a,L,"link",f,!0,m,d,x),this.register(p.onShowLinkUnderline((I=>this._handleShowLinkUnderline(I)))),this.register(p.onHideLinkUnderline((I=>this._handleHideLinkUnderline(I))))}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===v.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:L.fg!==void 0&&(0,_.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=w},820:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(u,_,v,h){u.addEventListener(_,v,h);let w=!1;return{dispose:()=>{w||(w=!0,u.removeEventListener(_,v,h))}}}},274:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellColorResolver=void 0;const _=u(855),v=u(160),h=u(374);let w,k=0,L=0,f=!1,a=!1,p=!1,m=0;r.CellColorResolver=class{constructor(d,x,I,E,M,b){this._terminal=d,this._optionService=x,this._selectionRenderModel=I,this._decorationService=E,this._coreBrowserService=M,this._themeService=b,this.result={fg:0,bg:0,ext:0}}resolve(d,x,I,E){if(this.result.bg=d.bg,this.result.fg=d.fg,this.result.ext=268435456&d.bg?d.extended.ext:0,L=0,k=0,a=!1,f=!1,p=!1,w=this._themeService.colors,m=0,d.getCode()!==_.NULL_CELL_CODE&&d.extended.underlineStyle===4){const M=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));m=x*E%(2*Math.round(M))}if(this._decorationService.forEachDecorationAtCell(x,I,"bottom",(M=>{M.backgroundColorRGB&&(L=M.backgroundColorRGB.rgba>>8&16777215,a=!0),M.foregroundColorRGB&&(k=M.foregroundColorRGB.rgba>>8&16777215,f=!0)})),p=this._selectionRenderModel.isCellSelected(this._terminal,x,I),p){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432: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=v.rgba.blend(L,4294967040&(this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else L=(this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(a=!0,w.selectionForeground&&(k=w.selectionForeground.rgba>>8&16777215,f=!0),(0,h.treatGlyphAsBackgroundColor)(d.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)k=(this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:k=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:k=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:k=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:k=(16777215&this.result.fg)<<8|255;break;default:k=this._themeService.colors.foreground.rgba}k=v.rgba.blend(k,4294967040&(this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}f=!0}}this._decorationService.forEachDecorationAtCell(x,I,"top",(M=>{M.backgroundColorRGB&&(L=M.backgroundColorRGB.rgba>>8&16777215,a=!0),M.foregroundColorRGB&&(k=M.foregroundColorRGB.rgba>>8&16777215,f=!0)})),a&&(L=p?-16777216&d.bg&-134217729|L|50331648:-16777216&d.bg|L|50331648),f&&(k=-16777216&d.fg&-67108865|k|50331648),67108864&this.result.fg&&(a&&!f&&(k=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&w.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&w.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,a=!0)),w=void 0,this.result.bg=a?L:this.result.bg,this.result.fg=f?k:this.result.fg,this.result.ext&=536870911,this.result.ext|=m<<29&3758096384}}},627:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.removeTerminalFromCache=r.acquireTextureAtlas=void 0;const _=u(509),v=u(197),h=[];r.acquireTextureAtlas=function(w,k,L,f,a,p,m,d){const x=(0,v.generateConfig)(f,a,p,m,k,L,d);for(let M=0;M<h.length;M++){const b=h[M],R=b.ownedBy.indexOf(w);if(R>=0){if((0,v.configEquals)(b.config,x))return b.atlas;b.ownedBy.length===1?(b.atlas.dispose(),h.splice(M,1)):b.ownedBy.splice(R,1);break}}for(let M=0;M<h.length;M++){const b=h[M];if((0,v.configEquals)(b.config,x))return b.ownedBy.push(w),b.atlas}const I=w._core,E={atlas:new _.TextureAtlas(document,x,I.unicodeService),config:x,ownedBy:[w]};return h.push(E),E.atlas},r.removeTerminalFromCache=function(w){for(let k=0;k<h.length;k++){const L=h[k].ownedBy.indexOf(w);if(L!==-1){h[k].ownedBy.length===1?(h[k].atlas.dispose(),h.splice(k,1)):h[k].ownedBy.splice(L,1);break}}}},197:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.is256Color=r.configEquals=r.generateConfig=void 0;const _=u(160);r.generateConfig=function(v,h,w,k,L,f,a){const p={foreground:f.foreground,background:f.background,cursor:_.NULL_COLOR,cursorAccent:_.NULL_COLOR,selectionForeground:_.NULL_COLOR,selectionBackgroundTransparent:_.NULL_COLOR,selectionBackgroundOpaque:_.NULL_COLOR,selectionInactiveBackgroundTransparent:_.NULL_COLOR,selectionInactiveBackgroundOpaque:_.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:v,deviceCellHeight:h,deviceCharWidth:w,deviceCharHeight:k,fontFamily:L.fontFamily,fontSize:L.fontSize,fontWeight:L.fontWeight,fontWeightBold:L.fontWeightBold,allowTransparency:L.allowTransparency,drawBoldTextInBrightColors:L.drawBoldTextInBrightColors,minimumContrastRatio:L.minimumContrastRatio,colors:p}},r.configEquals=function(v,h){for(let w=0;w<v.colors.ansi.length;w++)if(v.colors.ansi[w].rgba!==h.colors.ansi[w].rgba)return!1;return v.devicePixelRatio===h.devicePixelRatio&&v.customGlyphs===h.customGlyphs&&v.lineHeight===h.lineHeight&&v.letterSpacing===h.letterSpacing&&v.fontFamily===h.fontFamily&&v.fontSize===h.fontSize&&v.fontWeight===h.fontWeight&&v.fontWeightBold===h.fontWeightBold&&v.allowTransparency===h.allowTransparency&&v.deviceCharWidth===h.deviceCharWidth&&v.deviceCharHeight===h.deviceCharHeight&&v.drawBoldTextInBrightColors===h.drawBoldTextInBrightColors&&v.minimumContrastRatio===h.minimumContrastRatio&&v.colors.foreground.rgba===h.colors.foreground.rgba&&v.colors.background.rgba===h.colors.background.rgba},r.is256Color=function(v){return(50331648&v)==16777216||(50331648&v)==33554432}},237:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const _=u(399);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=_.isFirefox||_.isLegacyEdge?"bottom":"ideographic"},457:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CursorBlinkStateManager=void 0,r.CursorBlinkStateManager=class{constructor(u,_){this._renderCallback=u,this._coreBrowserService=_,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(u=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const _=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,_>0)return void this._restartInterval(_)}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 _=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(_)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),u)}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:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryDrawCustomChar=r.powerlineDefinitions=r.boxDrawingDefinitions=r.blockElementDefinitions=void 0;const _=u(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 v={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};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,p,m,d,x,I,E){const M=r.blockElementDefinitions[a];if(M)return(function(B,O,F,U,q,X){for(let Y=0;Y<O.length;Y++){const V=O[Y],j=q/8,$=X/8;B.fillRect(F+V.x*j,U+V.y*$,V.w*j,V.h*$)}})(f,M,p,m,d,x),!0;const b=v[a];if(b)return(function(B,O,F,U,q,X){let Y=h.get(O);Y||(Y=new Map,h.set(O,Y));const V=B.fillStyle;if(typeof V!="string")throw new Error(`Unexpected fillStyle type "${V}"`);let j=Y.get(V);if(!j){const $=O[0].length,H=O.length,K=B.canvas.ownerDocument.createElement("canvas");K.width=$,K.height=H;const te=(0,_.throwIfFalsy)(K.getContext("2d")),re=new ImageData($,H);let le,de,G,z;if(V.startsWith("#"))le=parseInt(V.slice(1,3),16),de=parseInt(V.slice(3,5),16),G=parseInt(V.slice(5,7),16),z=V.length>7&&parseInt(V.slice(7,9),16)||1;else{if(!V.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${V}" when drawing pattern glyph`);[le,de,G,z]=V.substring(5,V.length-1).split(",").map((Q=>parseFloat(Q)))}for(let Q=0;Q<H;Q++)for(let Z=0;Z<$;Z++)re.data[4*(Q*$+Z)]=le,re.data[4*(Q*$+Z)+1]=de,re.data[4*(Q*$+Z)+2]=G,re.data[4*(Q*$+Z)+3]=O[Q][Z]*(255*z);te.putImageData(re,0,0),j=(0,_.throwIfFalsy)(B.createPattern(K,null)),Y.set(V,j)}B.fillStyle=j,B.fillRect(F,U,q,X)})(f,b,p,m,d,x),!0;const R=r.boxDrawingDefinitions[a];if(R)return(function(B,O,F,U,q,X,Y){B.strokeStyle=B.fillStyle;for(const[V,j]of Object.entries(O)){let $;B.beginPath(),B.lineWidth=Y*Number.parseInt(V),$=typeof j=="function"?j(.15,.15/X*q):j;for(const H of $.split(" ")){const K=H[0],te=k[K];if(!te){console.error(`Could not find drawing instructions for "${K}"`);continue}const re=H.substring(1).split(",");re[0]&&re[1]&&te(B,L(re,q,X,F,U,!0,Y))}B.stroke(),B.closePath()}})(f,R,p,m,d,x,E),!0;const D=r.powerlineDefinitions[a];return!!D&&((function(B,O,F,U,q,X,Y,V){const j=new Path2D;j.rect(F,U,q,X),B.clip(j),B.beginPath();const $=Y/12;B.lineWidth=V*$;for(const H of O.d.split(" ")){const K=H[0],te=k[K];if(!te){console.error(`Could not find drawing instructions for "${K}"`);continue}const re=H.substring(1).split(",");re[0]&&re[1]&&te(B,L(re,q,X,F,U,!1,V,(O.leftPadding??0)*($/2),(O.rightPadding??0)*($/2)))}O.type===1?(B.strokeStyle=B.fillStyle,B.stroke()):B.fill(),B.closePath()})(f,D,p,m,d,x,I,E),!0)};const h=new Map;function w(f,a,p=0){return Math.max(Math.min(f,a),p)}const k={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,p,m,d,x,I,E=0,M=0){const b=f.map((R=>parseFloat(R)||parseInt(R)));if(b.length<2)throw new Error("Too few arguments for instruction");for(let R=0;R<b.length;R+=2)b[R]*=a-E*I-M*I,x&&b[R]!==0&&(b[R]=w(Math.round(b[R]+.5)-.5,a,0)),b[R]+=m+E*I;for(let R=1;R<b.length;R+=2)b[R]*=p,x&&b[R]!==0&&(b[R]=w(Math.round(b[R]+.5)-.5,p,0)),b[R]+=d;return b}},56:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.observeDevicePixelDimensions=void 0;const _=u(859);r.observeDevicePixelDimensions=function(v,h,w){let k=new h.ResizeObserver((L=>{const f=L.find((m=>m.target===v));if(!f)return;if(!("devicePixelContentBoxSize"in f))return k==null||k.disconnect(),void(k=void 0);const a=f.devicePixelContentBoxSize[0].inlineSize,p=f.devicePixelContentBoxSize[0].blockSize;a>0&&p>0&&w(a,p)}));try{k.observe(v,{box:["device-pixel-content-box"]})}catch{k.disconnect(),k=void 0}return(0,_.toDisposable)((()=>k==null?void 0:k.disconnect()))}},374:(C,r)=>{function u(v){return 57508<=v&&v<=57558}function _(v){return v>=128512&&v<=128591||v>=127744&&v<=128511||v>=128640&&v<=128767||v>=9728&&v<=9983||v>=9984&&v<=10175||v>=65024&&v<=65039||v>=129280&&v<=129535||v>=127462&&v<=127487}Object.defineProperty(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(v){if(!v)throw new Error("value must not be falsy");return v},r.isPowerlineGlyph=u,r.isRestrictedPowerlineGlyph=function(v){return 57520<=v&&v<=57527},r.isEmoji=_,r.allowRescaling=function(v,h,w,k){return h===1&&w>Math.ceil(1.5*k)&&v!==void 0&&v>255&&!_(v)&&!u(v)&&!(function(L){return 57344<=L&&L<=63743})(v)},r.treatGlyphAsBackgroundColor=function(v){return u(v)||(function(h){return 9472<=h&&h<=9631})(v)},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(v,h,w=0){return(v-(2*Math.round(h)-w))%(2*Math.round(h))}},296:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class u{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(v,h,w,k=!1){if(this.selectionStart=h,this.selectionEnd=w,!h||!w||h[0]===w[0]&&h[1]===w[1])return void this.clear();const L=v.buffers.active.ydisp,f=h[1]-L,a=w[1]-L,p=Math.max(f,0),m=Math.min(a,v.rows-1);p>=v.rows||m<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=k,this.viewportStartRow=f,this.viewportEndRow=a,this.viewportCappedStartRow=p,this.viewportCappedEndRow=m,this.startCol=h[0],this.endCol=w[0])}isCellSelected(v,h,w){return!!this.hasSelection&&(w-=v.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&w>=this.viewportCappedStartRow&&h<this.endCol&&w<=this.viewportCappedEndRow:h<this.startCol&&w>=this.viewportCappedStartRow&&h>=this.endCol&&w<=this.viewportCappedEndRow:w>this.viewportStartRow&&w<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&w===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportStartRow&&h>=this.startCol)}}r.createSelectionRenderModel=function(){return new u}},509:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TextureAtlas=void 0;const _=u(237),v=u(860),h=u(374),w=u(160),k=u(345),L=u(485),f=u(385),a=u(147),p=u(855),m={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let d;class x{get pages(){return this._pages}constructor(R,D,B){this._document=R,this._config=D,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 k.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new k.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=M(R,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,h.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const R of this.pages)R.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const R=new f.IdleTaskQueue;for(let D=33;D<126;D++)R.enqueue((()=>{if(!this._cacheMap.get(D,p.DEFAULT_COLOR,p.DEFAULT_COLOR,p.DEFAULT_EXT)){const B=this._drawToCache(D,p.DEFAULT_COLOR,p.DEFAULT_COLOR,p.DEFAULT_EXT);this._cacheMap.set(D,p.DEFAULT_COLOR,p.DEFAULT_COLOR,p.DEFAULT_EXT,B)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const R of this._pages)R.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(x.maxAtlasPages&&this._pages.length>=Math.max(4,x.maxAtlasPages)){const D=this._pages.filter((Y=>2*Y.canvas.width<=(x.maxTextureSize||4096))).sort(((Y,V)=>V.canvas.width!==Y.canvas.width?V.canvas.width-Y.canvas.width:V.percentageUsed-Y.percentageUsed));let B=-1,O=0;for(let Y=0;Y<D.length;Y++)if(D[Y].canvas.width!==O)B=Y,O=D[Y].canvas.width;else if(Y-B==3)break;const F=D.slice(B,B+4),U=F.map((Y=>Y.glyphs[0].texturePage)).sort(((Y,V)=>Y>V?1:-1)),q=this.pages.length-F.length,X=this._mergePages(F,q);X.version++;for(let Y=U.length-1;Y>=0;Y--)this._deletePage(U[Y]);this.pages.push(X),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(X.canvas)}const R=new I(this._document,this._textureSize);return this._pages.push(R),this._activePages.push(R),this._onAddTextureAtlasCanvas.fire(R.canvas),R}_mergePages(R,D){const B=2*R[0].canvas.width,O=new I(this._document,B,R);for(const[F,U]of R.entries()){const q=F*U.canvas.width%B,X=Math.floor(F/2)*U.canvas.height;O.ctx.drawImage(U.canvas,q,X);for(const V of U.glyphs)V.texturePage=D,V.sizeClipSpace.x=V.size.x/B,V.sizeClipSpace.y=V.size.y/B,V.texturePosition.x+=q,V.texturePosition.y+=X,V.texturePositionClipSpace.x=V.texturePosition.x/B,V.texturePositionClipSpace.y=V.texturePosition.y/B;this._onRemoveTextureAtlasCanvas.fire(U.canvas);const Y=this._activePages.indexOf(U);Y!==-1&&this._activePages.splice(Y,1)}return O}_deletePage(R){this._pages.splice(R,1);for(let D=R;D<this._pages.length;D++){const B=this._pages[D];for(const O of B.glyphs)O.texturePage--;B.version++}}getRasterizedGlyphCombinedChar(R,D,B,O,F){return this._getFromCacheMap(this._cacheMapCombined,R,D,B,O,F)}getRasterizedGlyph(R,D,B,O,F){return this._getFromCacheMap(this._cacheMap,R,D,B,O,F)}_getFromCacheMap(R,D,B,O,F,U=!1){return d=R.get(D,B,O,F),d||(d=this._drawToCache(D,B,O,F,U),R.set(D,B,O,F,d)),d}_getColorFromAnsiIndex(R){if(R>=this._config.colors.ansi.length)throw new Error("No color found for idx "+R);return this._config.colors.ansi[R]}_getBackgroundColor(R,D,B,O){if(this._config.allowTransparency)return w.NULL_COLOR;let F;switch(R){case 16777216:case 33554432:F=this._getColorFromAnsiIndex(D);break;case 50331648:const U=a.AttributeData.toColorRGB(D);F=w.channels.toColor(U[0],U[1],U[2]);break;default:F=B?w.color.opaque(this._config.colors.foreground):this._config.colors.background}return F}_getForegroundColor(R,D,B,O,F,U,q,X,Y,V){const j=this._getMinimumContrastColor(R,D,B,O,F,U,q,Y,X,V);if(j)return j;let $;switch(F){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&Y&&U<8&&(U+=8),$=this._getColorFromAnsiIndex(U);break;case 50331648:const H=a.AttributeData.toColorRGB(U);$=w.channels.toColor(H[0],H[1],H[2]);break;default:$=q?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&($=w.color.opaque($)),X&&($=w.color.multiplyOpacity($,_.DIM_OPACITY)),$}_resolveBackgroundRgba(R,D,B){switch(R){case 16777216:case 33554432:return this._getColorFromAnsiIndex(D).rgba;case 50331648:return D<<8;default:return B?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(R,D,B,O){switch(R){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&O&&D<8&&(D+=8),this._getColorFromAnsiIndex(D).rgba;case 50331648:return D<<8;default:return B?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(R,D,B,O,F,U,q,X,Y,V){if(this._config.minimumContrastRatio===1||V)return;const j=this._getContrastCache(Y),$=j.getColor(R,O);if($!==void 0)return $||void 0;const H=this._resolveBackgroundRgba(D,B,q),K=this._resolveForegroundRgba(F,U,q,X),te=w.rgba.ensureContrastRatio(H,K,this._config.minimumContrastRatio/(Y?2:1));if(!te)return void j.setColor(R,O,null);const re=w.channels.toColor(te>>24&255,te>>16&255,te>>8&255);return j.setColor(R,O,re),re}_getContrastCache(R){return R?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(R,D,B,O,F=!1){const U=typeof R=="number"?String.fromCharCode(R):R,q=Math.min(this._config.deviceCellWidth*Math.max(U.length,2)+4,this._textureSize);this._tmpCanvas.width<q&&(this._tmpCanvas.width=q);const X=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<X&&(this._tmpCanvas.height=X),this._tmpCtx.save(),this._workAttributeData.fg=B,this._workAttributeData.bg=D,this._workAttributeData.extended.ext=O,this._workAttributeData.isInvisible())return m;const Y=!!this._workAttributeData.isBold(),V=!!this._workAttributeData.isInverse(),j=!!this._workAttributeData.isDim(),$=!!this._workAttributeData.isItalic(),H=!!this._workAttributeData.isUnderline(),K=!!this._workAttributeData.isStrikethrough(),te=!!this._workAttributeData.isOverline();let re=this._workAttributeData.getFgColor(),le=this._workAttributeData.getFgColorMode(),de=this._workAttributeData.getBgColor(),G=this._workAttributeData.getBgColorMode();if(V){const ke=re;re=de,de=ke;const Ne=le;le=G,G=Ne}const z=this._getBackgroundColor(G,de,V,j);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=z.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const Q=Y?this._config.fontWeightBold:this._config.fontWeight,Z=$?"italic":"";this._tmpCtx.font=`${Z} ${Q} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=_.TEXT_BASELINE;const ae=U.length===1&&(0,h.isPowerlineGlyph)(U.charCodeAt(0)),fe=U.length===1&&(0,h.isRestrictedPowerlineGlyph)(U.charCodeAt(0)),Ee=this._getForegroundColor(D,G,de,B,le,re,V,j,Y,(0,h.treatGlyphAsBackgroundColor)(U.charCodeAt(0)));this._tmpCtx.fillStyle=Ee.css;const Ae=fe?0:4;let ze=!1;this._config.customGlyphs!==!1&&(ze=(0,v.tryDrawCustomChar)(this._tmpCtx,U,Ae,Ae,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let ue,Me=!ae;if(ue=typeof R=="number"?this._unicodeService.wcwidth(R):this._unicodeService.getStringCellWidth(R),H){this._tmpCtx.save();const ke=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ne=ke%2==1?.5:0;if(this._tmpCtx.lineWidth=ke,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Me=!1,this._tmpCtx.strokeStyle=`rgb(${a.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Me=!1;let Pe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Pe<8&&(Pe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Pe).css}this._tmpCtx.beginPath();const st=Ae,ot=Math.ceil(Ae+this._config.deviceCharHeight)-Ne-(F?2*ke:0),wt=ot+ke,ct=ot+2*ke;let bt=this._workAttributeData.getUnderlineVariantOffset();for(let Pe=0;Pe<ue;Pe++){this._tmpCtx.save();const Ze=st+Pe*this._config.deviceCellWidth,qe=st+(Pe+1)*this._config.deviceCellWidth,et=Ze+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Ze,ot),this._tmpCtx.lineTo(qe,ot),this._tmpCtx.moveTo(Ze,ct),this._tmpCtx.lineTo(qe,ct);break;case 3:const Gt=ke<=1?ct:Math.ceil(Ae+this._config.deviceCharHeight-ke/2)-Ne,pt=ke<=1?ot:Math.ceil(Ae+this._config.deviceCharHeight+ke/2)-Ne,it=new Path2D;it.rect(Ze,ot,this._config.deviceCellWidth,ct-ot),this._tmpCtx.clip(it),this._tmpCtx.moveTo(Ze-this._config.deviceCellWidth/2,wt),this._tmpCtx.bezierCurveTo(Ze-this._config.deviceCellWidth/2,pt,Ze,pt,Ze,wt),this._tmpCtx.bezierCurveTo(Ze,Gt,et,Gt,et,wt),this._tmpCtx.bezierCurveTo(et,pt,qe,pt,qe,wt),this._tmpCtx.bezierCurveTo(qe,Gt,qe+this._config.deviceCellWidth/2,Gt,qe+this._config.deviceCellWidth/2,wt);break;case 4:const pe=bt===0?0:bt>=ke?2*ke-bt:ke-bt;bt>=ke||pe===0?(this._tmpCtx.setLineDash([Math.round(ke),Math.round(ke)]),this._tmpCtx.moveTo(Ze+pe,ot),this._tmpCtx.lineTo(qe,ot)):(this._tmpCtx.setLineDash([Math.round(ke),Math.round(ke)]),this._tmpCtx.moveTo(Ze,ot),this._tmpCtx.lineTo(Ze+pe,ot),this._tmpCtx.moveTo(Ze+pe+ke,ot),this._tmpCtx.lineTo(qe,ot)),bt=(0,h.computeNextVariantOffset)(qe-Ze,ke,bt);break;case 5:const Ke=.6,Xe=.3,xe=qe-Ze,be=Math.floor(Ke*xe),tt=Math.floor(Xe*xe),Ce=xe-be-tt;this._tmpCtx.setLineDash([be,tt,Ce]),this._tmpCtx.moveTo(Ze,ot),this._tmpCtx.lineTo(qe,ot);break;default:this._tmpCtx.moveTo(Ze,ot),this._tmpCtx.lineTo(qe,ot)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ze&&this._config.fontSize>=12&&!this._config.allowTransparency&&U!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Pe=this._tmpCtx.measureText(U);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Pe&&Pe.actualBoundingBoxDescent>0){this._tmpCtx.save();const Ze=new Path2D;Ze.rect(st,ot-Math.ceil(ke/2),this._config.deviceCellWidth*ue,ct-ot+Math.ceil(ke/2)),this._tmpCtx.clip(Ze),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=z.css,this._tmpCtx.strokeText(U,Ae,Ae+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(te){const ke=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),Ne=ke%2==1?.5:0;this._tmpCtx.lineWidth=ke,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ae,Ae+Ne),this._tmpCtx.lineTo(Ae+this._config.deviceCharWidth*ue,Ae+Ne),this._tmpCtx.stroke()}if(ze||this._tmpCtx.fillText(U,Ae,Ae+this._config.deviceCharHeight),U==="_"&&!this._config.allowTransparency){let ke=E(this._tmpCtx.getImageData(Ae,Ae,this._config.deviceCellWidth,this._config.deviceCellHeight),z,Ee,Me);if(ke)for(let Ne=1;Ne<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=z.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(U,Ae,Ae+this._config.deviceCharHeight-Ne),ke=E(this._tmpCtx.getImageData(Ae,Ae,this._config.deviceCellWidth,this._config.deviceCellHeight),z,Ee,Me),ke);Ne++);}if(K){const ke=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Ne=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=ke,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Ae,Ae+Math.floor(this._config.deviceCharHeight/2)-Ne),this._tmpCtx.lineTo(Ae+this._config.deviceCharWidth*ue,Ae+Math.floor(this._config.deviceCharHeight/2)-Ne),this._tmpCtx.stroke()}this._tmpCtx.restore();const he=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Te;if(Te=this._config.allowTransparency?(function(ke){for(let Ne=0;Ne<ke.data.length;Ne+=4)if(ke.data[Ne+3]>0)return!1;return!0})(he):E(he,z,Ee,Me),Te)return m;const ge=this._findGlyphBoundingBox(he,this._workBoundingBox,q,fe,ze,Ae);let Re,Ue;for(;;){if(this._activePages.length===0){const ke=this._createNewPage();Re=ke,Ue=ke.currentRow,Ue.height=ge.size.y;break}Re=this._activePages[this._activePages.length-1],Ue=Re.currentRow;for(const ke of this._activePages)ge.size.y<=ke.currentRow.height&&(Re=ke,Ue=ke.currentRow);for(let ke=this._activePages.length-1;ke>=0;ke--)for(const Ne of this._activePages[ke].fixedRows)Ne.height<=Ue.height&&ge.size.y<=Ne.height&&(Re=this._activePages[ke],Ue=Ne);if(Ue.y+ge.size.y>=Re.canvas.height||Ue.height>ge.size.y+2){let ke=!1;if(Re.currentRow.y+Re.currentRow.height+ge.size.y>=Re.canvas.height){let Ne;for(const st of this._activePages)if(st.currentRow.y+st.currentRow.height+ge.size.y<st.canvas.height){Ne=st;break}if(Ne)Re=Ne;else if(x.maxAtlasPages&&this._pages.length>=x.maxAtlasPages&&Ue.y+ge.size.y<=Re.canvas.height&&Ue.height>=ge.size.y&&Ue.x+ge.size.x<=Re.canvas.width)ke=!0;else{const st=this._createNewPage();Re=st,Ue=st.currentRow,Ue.height=ge.size.y,ke=!0}}ke||(Re.currentRow.height>0&&Re.fixedRows.push(Re.currentRow),Ue={x:0,y:Re.currentRow.y+Re.currentRow.height,height:ge.size.y},Re.fixedRows.push(Ue),Re.currentRow={x:0,y:Ue.y+Ue.height,height:0})}if(Ue.x+ge.size.x<=Re.canvas.width)break;Ue===Re.currentRow?(Ue.x=0,Ue.y+=Ue.height,Ue.height=0):Re.fixedRows.splice(Re.fixedRows.indexOf(Ue),1)}return ge.texturePage=this._pages.indexOf(Re),ge.texturePosition.x=Ue.x,ge.texturePosition.y=Ue.y,ge.texturePositionClipSpace.x=Ue.x/Re.canvas.width,ge.texturePositionClipSpace.y=Ue.y/Re.canvas.height,ge.sizeClipSpace.x/=Re.canvas.width,ge.sizeClipSpace.y/=Re.canvas.height,Ue.height=Math.max(Ue.height,ge.size.y),Ue.x+=ge.size.x,Re.ctx.putImageData(he,ge.texturePosition.x-this._workBoundingBox.left,ge.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,ge.size.x,ge.size.y),Re.addGlyph(ge),Re.version++,ge}_findGlyphBoundingBox(R,D,B,O,F,U){D.top=0;const q=O?this._config.deviceCellHeight:this._tmpCanvas.height,X=O?this._config.deviceCellWidth:B;let Y=!1;for(let V=0;V<q;V++){for(let j=0;j<X;j++){const $=V*this._tmpCanvas.width*4+4*j+3;if(R.data[$]!==0){D.top=V,Y=!0;break}}if(Y)break}D.left=0,Y=!1;for(let V=0;V<U+X;V++){for(let j=0;j<q;j++){const $=j*this._tmpCanvas.width*4+4*V+3;if(R.data[$]!==0){D.left=V,Y=!0;break}}if(Y)break}D.right=X,Y=!1;for(let V=U+X-1;V>=U;V--){for(let j=0;j<q;j++){const $=j*this._tmpCanvas.width*4+4*V+3;if(R.data[$]!==0){D.right=V,Y=!0;break}}if(Y)break}D.bottom=q,Y=!1;for(let V=q-1;V>=0;V--){for(let j=0;j<X;j++){const $=V*this._tmpCanvas.width*4+4*j+3;if(R.data[$]!==0){D.bottom=V,Y=!0;break}}if(Y)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:D.right-D.left+1,y:D.bottom-D.top+1},sizeClipSpace:{x:D.right-D.left+1,y:D.bottom-D.top+1},offset:{x:-D.left+U+(O||F?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-D.top+U+(O||F?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}r.TextureAtlas=x;class I{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(R){this._glyphs.push(R),this._usedPixels+=R.size.x*R.size.y}constructor(R,D,B){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],B)for(const O of B)this._glyphs.push(...O.glyphs),this._usedPixels+=O._usedPixels;this.canvas=M(R,D,D),this.ctx=(0,h.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function E(b,R,D,B){const O=R.rgba>>>24,F=R.rgba>>>16&255,U=R.rgba>>>8&255,q=D.rgba>>>24,X=D.rgba>>>16&255,Y=D.rgba>>>8&255,V=Math.floor((Math.abs(O-q)+Math.abs(F-X)+Math.abs(U-Y))/12);let j=!0;for(let $=0;$<b.data.length;$+=4)b.data[$]===O&&b.data[$+1]===F&&b.data[$+2]===U||B&&Math.abs(b.data[$]-O)+Math.abs(b.data[$+1]-F)+Math.abs(b.data[$+2]-U)<V?b.data[$+3]=0:j=!1;return j}function M(b,R,D){const B=b.createElement("canvas");return B.width=R,B.height=D,B}},160:(C,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 u=0,_=0,v=0,h=0;var w,k,L,f,a;function p(d){const x=d.toString(16);return x.length<2?"0"+x:x}function m(d,x){return d<x?(x+.05)/(d+.05):(d+.05)/(x+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(d){d.toCss=function(x,I,E,M){return M!==void 0?`#${p(x)}${p(I)}${p(E)}${p(M)}`:`#${p(x)}${p(I)}${p(E)}`},d.toRgba=function(x,I,E,M=255){return(x<<24|I<<16|E<<8|M)>>>0},d.toColor=function(x,I,E,M){return{css:d.toCss(x,I,E,M),rgba:d.toRgba(x,I,E,M)}}})(w||(r.channels=w={})),(function(d){function x(I,E){return h=Math.round(255*E),[u,_,v]=a.toChannels(I.rgba),{css:w.toCss(u,_,v,h),rgba:w.toRgba(u,_,v,h)}}d.blend=function(I,E){if(h=(255&E.rgba)/255,h===1)return{css:E.css,rgba:E.rgba};const M=E.rgba>>24&255,b=E.rgba>>16&255,R=E.rgba>>8&255,D=I.rgba>>24&255,B=I.rgba>>16&255,O=I.rgba>>8&255;return u=D+Math.round((M-D)*h),_=B+Math.round((b-B)*h),v=O+Math.round((R-O)*h),{css:w.toCss(u,_,v),rgba:w.toRgba(u,_,v)}},d.isOpaque=function(I){return(255&I.rgba)==255},d.ensureContrastRatio=function(I,E,M){const b=a.ensureContrastRatio(I.rgba,E.rgba,M);if(b)return w.toColor(b>>24&255,b>>16&255,b>>8&255)},d.opaque=function(I){const E=(255|I.rgba)>>>0;return[u,_,v]=a.toChannels(E),{css:w.toCss(u,_,v),rgba:E}},d.opacity=x,d.multiplyOpacity=function(I,E){return h=255&I.rgba,x(I,h*E/255)},d.toColorRGB=function(I){return[I.rgba>>24&255,I.rgba>>16&255,I.rgba>>8&255]}})(k||(r.color=k={})),(function(d){let x,I;try{const E=document.createElement("canvas");E.width=1,E.height=1;const M=E.getContext("2d",{willReadFrequently:!0});M&&(x=M,x.globalCompositeOperation="copy",I=x.createLinearGradient(0,0,1,1))}catch{}d.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return u=parseInt(E.slice(1,2).repeat(2),16),_=parseInt(E.slice(2,3).repeat(2),16),v=parseInt(E.slice(3,4).repeat(2),16),w.toColor(u,_,v);case 5:return u=parseInt(E.slice(1,2).repeat(2),16),_=parseInt(E.slice(2,3).repeat(2),16),v=parseInt(E.slice(3,4).repeat(2),16),h=parseInt(E.slice(4,5).repeat(2),16),w.toColor(u,_,v,h);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 u=parseInt(M[1]),_=parseInt(M[2]),v=parseInt(M[3]),h=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),w.toColor(u,_,v,h);if(!x||!I)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=I,x.fillStyle=E,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[u,_,v,h]=x.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:w.toRgba(u,_,v,h),css:E}}})(L||(r.css=L={})),(function(d){function x(I,E,M){const b=I/255,R=E/255,D=M/255;return .2126*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.7152*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}d.relativeLuminance=function(I){return x(I>>16&255,I>>8&255,255&I)},d.relativeLuminance2=x})(f||(r.rgb=f={})),(function(d){function x(E,M,b){const R=E>>24&255,D=E>>16&255,B=E>>8&255;let O=M>>24&255,F=M>>16&255,U=M>>8&255,q=m(f.relativeLuminance2(O,F,U),f.relativeLuminance2(R,D,B));for(;q<b&&(O>0||F>0||U>0);)O-=Math.max(0,Math.ceil(.1*O)),F-=Math.max(0,Math.ceil(.1*F)),U-=Math.max(0,Math.ceil(.1*U)),q=m(f.relativeLuminance2(O,F,U),f.relativeLuminance2(R,D,B));return(O<<24|F<<16|U<<8|255)>>>0}function I(E,M,b){const R=E>>24&255,D=E>>16&255,B=E>>8&255;let O=M>>24&255,F=M>>16&255,U=M>>8&255,q=m(f.relativeLuminance2(O,F,U),f.relativeLuminance2(R,D,B));for(;q<b&&(O<255||F<255||U<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),F=Math.min(255,F+Math.ceil(.1*(255-F))),U=Math.min(255,U+Math.ceil(.1*(255-U))),q=m(f.relativeLuminance2(O,F,U),f.relativeLuminance2(R,D,B));return(O<<24|F<<16|U<<8|255)>>>0}d.blend=function(E,M){if(h=(255&M)/255,h===1)return M;const b=M>>24&255,R=M>>16&255,D=M>>8&255,B=E>>24&255,O=E>>16&255,F=E>>8&255;return u=B+Math.round((b-B)*h),_=O+Math.round((R-O)*h),v=F+Math.round((D-F)*h),w.toRgba(u,_,v)},d.ensureContrastRatio=function(E,M,b){const R=f.relativeLuminance(E>>8),D=f.relativeLuminance(M>>8);if(m(R,D)<b){if(D<R){const F=x(E,M,b),U=m(R,f.relativeLuminance(F>>8));if(U<b){const q=I(E,M,b);return U>m(R,f.relativeLuminance(q>>8))?F:q}return F}const B=I(E,M,b),O=m(R,f.relativeLuminance(B>>8));if(O<b){const F=x(E,M,b);return O>m(R,f.relativeLuminance(F>>8))?B:F}return B}},d.reduceLuminance=x,d.increaseLuminance=I,d.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(a||(r.rgba=a={})),r.toPaddedHex=p,r.contrastRatio=m},345:(C,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=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let _=0;_<this._listeners.length;_++)if(this._listeners[_]===u)return void this._listeners.splice(_,1)}}})),this._event}fire(u,_){const v=[];for(let h=0;h<this._listeners.length;h++)v.push(this._listeners[h]);for(let h=0;h<v.length;h++)v[h].call(void 0,u,_)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(u,_){return u((v=>_.fire(v)))},r.runAndSubscribe=function(u,_){return _(void 0),u((v=>_(v)))}},859:(C,r)=>{function u(_){for(const v of _)v.dispose();_.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 _ of this._disposables)_.dispose();this._disposables.length=0}register(_){return this._disposables.push(_),_}unregister(_){const v=this._disposables.indexOf(_);v!==-1&&this._disposables.splice(v,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(_){var v;this._isDisposed||_===this._value||((v=this._value)==null||v.dispose(),this._value=_)}clear(){this.value=void 0}dispose(){var _;this._isDisposed=!0,(_=this._value)==null||_.dispose(),this._value=void 0}},r.toDisposable=function(_){return{dispose:_}},r.disposeArray=u,r.getDisposeArrayDisposable=function(_){return{dispose:()=>u(_)}}},485:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(v,h,w){this._data[v]||(this._data[v]={}),this._data[v][h]=w}get(v,h){return this._data[v]?this._data[v][h]:void 0}clear(){this._data={}}}r.TwoKeyMap=u,r.FourKeyMap=class{constructor(){this._data=new u}set(_,v,h,w,k){this._data.get(_,v)||this._data.set(_,v,new u),this._data.get(_,v).set(h,w,k)}get(_,v,h,w){var k;return(k=this._data.get(_,v))==null?void 0:k.get(h,w)}clear(){this._data.clear()}}},399:(C,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 u=r.isNode?"node":navigator.userAgent,_=r.isNode?"node":navigator.platform;r.isFirefox=u.includes("Firefox"),r.isLegacyEdge=u.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(u),r.getSafariVersion=function(){if(!r.isSafari)return 0;const v=u.match(/Version\/(\d+)/);return v===null||v.length<2?0:parseInt(v[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_),r.isIpad=_==="iPad",r.isIphone=_==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(_),r.isLinux=_.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(u)},385:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const _=u(399);class v{constructor(){this._tasks=[],this._i=0}enqueue(k){this._tasks.push(k),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(k){this._idleCallback=void 0;let L=0,f=0,a=k.timeRemaining(),p=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),p=k.timeRemaining(),1.5*f>p)return a-L<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-L))}ms`),void this._start();a=p}this.clear()}}class h extends v{_requestCallback(k){return setTimeout((()=>k(this._createDeadline(16))))}_cancelCallback(k){clearTimeout(k)}_createDeadline(k){const L=Date.now()+k;return{timeRemaining:()=>Math.max(0,L-Date.now())}}}r.PriorityTaskQueue=h,r.IdleTaskQueue=!_.isNode&&"requestIdleCallback"in window?class extends v{_requestCallback(w){return requestIdleCallback(w)}_cancelCallback(w){cancelIdleCallback(w)}}:h,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(w){this._queue.clear(),this._queue.enqueue(w)}flush(){this._queue.flush()}}},147:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new _}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new u;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=u;class _{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,w=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=w}clone(){return new _(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=_},782:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const _=u(133),v=u(855),h=u(147);class w extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(L){const f=new w;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,_.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(L){this.fg=L[v.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(L[v.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(L[v.CHAR_DATA_CHAR_INDEX].length===2){const a=L[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const p=L[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=p&&p<=57343?this.content=1024*(a-55296)+p-56320+65536|L[v.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=L[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|L[v.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=L[v.CHAR_DATA_CHAR_INDEX],this.content=2097152|L[v.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=w},855:(C,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:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},r.utf32ToString=function(u,_=0,v=u.length){let h="";for(let w=_;w<v;++w){let k=u[w];k>65535?(k-=65536,h+=String.fromCharCode(55296+(k>>10))+String.fromCharCode(k%1024+56320)):h+=String.fromCharCode(k)}return h},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,_){const v=u.length;if(!v)return 0;let h=0,w=0;if(this._interim){const k=u.charCodeAt(w++);56320<=k&&k<=57343?_[h++]=1024*(this._interim-55296)+k-56320+65536:(_[h++]=this._interim,_[h++]=k),this._interim=0}for(let k=w;k<v;++k){const L=u.charCodeAt(k);if(55296<=L&&L<=56319){if(++k>=v)return this._interim=L,h;const f=u.charCodeAt(k);56320<=f&&f<=57343?_[h++]=1024*(L-55296)+f-56320+65536:(_[h++]=L,_[h++]=f)}else L!==65279&&(_[h++]=L)}return h}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,_){const v=u.length;if(!v)return 0;let h,w,k,L,f=0,a=0,p=0;if(this.interim[0]){let x=!1,I=this.interim[0];I&=(224&I)==192?31:(240&I)==224?15:7;let E,M=0;for(;(E=63&this.interim[++M])&&M<4;)I<<=6,I|=E;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=b-M;for(;p<R;){if(p>=v)return 0;if(E=u[p++],(192&E)!=128){p--,x=!0;break}this.interim[M++]=E,I<<=6,I|=63&E}x||(b===2?I<128?p--:_[f++]=I:b===3?I<2048||I>=55296&&I<=57343||I===65279||(_[f++]=I):I<65536||I>1114111||(_[f++]=I)),this.interim.fill(0)}const m=v-4;let d=p;for(;d<v;){for(;!(!(d<m)||128&(h=u[d])||128&(w=u[d+1])||128&(k=u[d+2])||128&(L=u[d+3]));)_[f++]=h,_[f++]=w,_[f++]=k,_[f++]=L,d+=4;if(h=u[d++],h<128)_[f++]=h;else if((224&h)==192){if(d>=v)return this.interim[0]=h,f;if(w=u[d++],(192&w)!=128){d--;continue}if(a=(31&h)<<6|63&w,a<128){d--;continue}_[f++]=a}else if((240&h)==224){if(d>=v)return this.interim[0]=h,f;if(w=u[d++],(192&w)!=128){d--;continue}if(d>=v)return this.interim[0]=h,this.interim[1]=w,f;if(k=u[d++],(192&k)!=128){d--;continue}if(a=(15&h)<<12|(63&w)<<6|63&k,a<2048||a>=55296&&a<=57343||a===65279)continue;_[f++]=a}else if((248&h)==240){if(d>=v)return this.interim[0]=h,f;if(w=u[d++],(192&w)!=128){d--;continue}if(d>=v)return this.interim[0]=h,this.interim[1]=w,f;if(k=u[d++],(192&k)!=128){d--;continue}if(d>=v)return this.interim[0]=h,this.interim[1]=w,this.interim[2]=k,f;if(L=u[d++],(192&L)!=128){d--;continue}if(a=(7&h)<<18|(63&w)<<12|(63&k)<<6|63&L,a<65536||a>1114111)continue;_[f++]=a}}return f}}},776:function(C,r,u){var _=this&&this.__decorate||function(a,p,m,d){var x,I=arguments.length,E=I<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(a,p,m,d);else for(var M=a.length-1;M>=0;M--)(x=a[M])&&(E=(I<3?x(E):I>3?x(p,m,E):x(p,m))||E);return I>3&&E&&Object.defineProperty(p,m,E),E},v=this&&this.__param||function(a,p){return function(m,d){p(m,d,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const h=u(859),w=u(97),k={trace:w.LogLevelEnum.TRACE,debug:w.LogLevelEnum.DEBUG,info:w.LogLevelEnum.INFO,warn:w.LogLevelEnum.WARN,error:w.LogLevelEnum.ERROR,off:w.LogLevelEnum.OFF};let L,f=r.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(a){super(),this._optionsService=a,this._logLevel=w.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),L=this}_updateLogLevel(){this._logLevel=k[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let p=0;p<a.length;p++)typeof a[p]=="function"&&(a[p]=a[p]())}_log(a,p,m){this._evalLazyOptionalParams(m),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+p,...m)}trace(a,...p){var m;this._logLevel<=w.LogLevelEnum.TRACE&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.trace.bind(this._optionsService.options.logger))??console.log,a,p)}debug(a,...p){var m;this._logLevel<=w.LogLevelEnum.DEBUG&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.debug.bind(this._optionsService.options.logger))??console.log,a,p)}info(a,...p){var m;this._logLevel<=w.LogLevelEnum.INFO&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.info.bind(this._optionsService.options.logger))??console.info,a,p)}warn(a,...p){var m;this._logLevel<=w.LogLevelEnum.WARN&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.warn.bind(this._optionsService.options.logger))??console.warn,a,p)}error(a,...p){var m;this._logLevel<=w.LogLevelEnum.ERROR&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.error.bind(this._optionsService.options.logger))??console.error,a,p)}};r.LogService=f=_([v(0,w.IOptionsService)],f),r.setTraceLogger=function(a){L=a},r.traceCall=function(a,p,m){if(typeof m.value!="function")throw new Error("not supported");const d=m.value;m.value=function(...x){if(L.logLevel!==w.LogLevelEnum.TRACE)return d.apply(this,x);L.trace(`GlyphRenderer#${d.name}(${x.map((E=>JSON.stringify(E))).join(", ")})`);const I=d.apply(this,x);return L.trace(`GlyphRenderer#${d.name} return`,I),I}}},726:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const u="di$target",_="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(v){return v[_]||[]},r.createDecorator=function(v){if(r.serviceRegistry.has(v))return r.serviceRegistry.get(v);const h=function(w,k,L){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,a,p){a[u]===a?a[_].push({id:f,index:p}):(a[_]=[{id:f,index:p}],a[u]=a)})(h,w,L)};return h.toString=()=>v,r.serviceRegistry.set(v,h),h}},97:(C,r,u)=>{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 _=u(726);var v;r.IBufferService=(0,_.createDecorator)("BufferService"),r.ICoreMouseService=(0,_.createDecorator)("CoreMouseService"),r.ICoreService=(0,_.createDecorator)("CoreService"),r.ICharsetService=(0,_.createDecorator)("CharsetService"),r.IInstantiationService=(0,_.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(v||(r.LogLevelEnum=v={})),r.ILogService=(0,_.createDecorator)("LogService"),r.IOptionsService=(0,_.createDecorator)("OptionsService"),r.IOscLinkService=(0,_.createDecorator)("OscLinkService"),r.IUnicodeService=(0,_.createDecorator)("UnicodeService"),r.IDecorationService=(0,_.createDecorator)("DecorationService")}},c={};function g(C){var r=c[C];if(r!==void 0)return r.exports;var u=c[C]={exports:{}};return i[C].call(u.exports,u,u.exports,g),u.exports}var T={};return(()=>{var C=T;Object.defineProperty(C,"__esModule",{value:!0}),C.WebglAddon=void 0;const r=g(345),u=g(859),_=g(399),v=g(666),h=g(776);class w extends u.Disposable{constructor(L){if(_.isSafari&&(0,_.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,p=f.optionsService,m=f,d=m._renderService,x=m._characterJoinerService,I=m._charSizeService,E=m._coreBrowserService,M=m._decorationService,b=m._logService,R=m._themeService;(0,h.setTraceLogger)(b),this._renderer=this.register(new v.WebglRenderer(L,x,I,E,a,M,p,R,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,u.toDisposable)((()=>{const D=this._terminal._core._renderService;D.setRenderer(this._terminal._core._createRenderer()),D.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()}}C.WebglAddon=w})(),T})()))})($c)),$c.exports}var K1=q1(),Uc={exports:{}},Hf;function G1(){return Hf||(Hf=1,(function(t,n){(function(i,c){t.exports=c()})(globalThis,(()=>(()=>{var i={4567:function(C,r,u){var _=this&&this.__decorate||function(m,d,x,I){var E,M=arguments.length,b=M<3?d:I===null?I=Object.getOwnPropertyDescriptor(d,x):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(m,d,x,I);else for(var R=m.length-1;R>=0;R--)(E=m[R])&&(b=(M<3?E(b):M>3?E(d,x,b):E(d,x))||b);return M>3&&b&&Object.defineProperty(d,x,b),b},v=this&&this.__param||function(m,d){return function(x,I){d(x,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const h=u(9042),w=u(9924),k=u(844),L=u(4725),f=u(2585),a=u(3656);let p=r.AccessibilityManager=class extends k.Disposable{constructor(m,d,x,I){super(),this._terminal=m,this._coreBrowserService=x,this._renderService=I,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 w.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,k.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(m){for(let d=0;d<m;d++)this._handleChar(" ")}_handleChar(m){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==m&&(this._charsToAnnounce+=m):this._charsToAnnounce+=m,m===`
110
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(m){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(m)||this._charsToConsume.push(m)}_refreshRows(m,d){this._liveRegionDebouncer.refresh(m,d,this._terminal.rows)}_renderRows(m,d){const x=this._terminal.buffer,I=x.lines.length.toString();for(let E=m;E<=d;E++){const M=x.lines.get(x.ydisp+E),b=[],R=(M==null?void 0:M.translateToString(!0,void 0,void 0,b))||"",D=(x.ydisp+E+1).toString(),B=this._rowElements[E];B&&(R.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=R,this._rowColumns.set(B,b)),B.setAttribute("aria-posinset",D),B.setAttribute("aria-setsize",I))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(m,d){const x=m.target,I=this._rowElements[d===0?1:this._rowElements.length-2];if(x.getAttribute("aria-posinset")===(d===0?"1":`${this._terminal.buffer.lines.length}`)||m.relatedTarget!==I)return;let E,M;if(d===0?(E=x,M=this._rowElements.pop(),this._rowContainer.removeChild(M)):(E=this._rowElements.shift(),M=x,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(),m.preventDefault(),m.stopImmediatePropagation()}_handleSelectionChange(){var R;if(this._rowElements.length===0)return;const m=document.getSelection();if(!m)return;if(m.isCollapsed)return void(this._rowContainer.contains(m.anchorNode)&&this._terminal.clearSelection());if(!m.anchorNode||!m.focusNode)return void console.error("anchorNode and/or focusNode are null");let d={node:m.anchorNode,offset:m.anchorOffset},x={node:m.focusNode,offset:m.focusOffset};if((d.node.compareDocumentPosition(x.node)&Node.DOCUMENT_POSITION_PRECEDING||d.node===x.node&&d.offset>x.offset)&&([d,x]=[x,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 I=this._rowElements.slice(-1)[0];if(x.node.compareDocumentPosition(I)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(x={node:I,offset:((R=I.textContent)==null?void 0:R.length)??0}),!this._rowContainer.contains(x.node))return;const E=({node:D,offset:B})=>{const O=D instanceof Text?D.parentNode:D;let F=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const U=this._rowColumns.get(O);if(!U)return console.warn("columns is null. Race condition?"),null;let q=B<U.length?U[B]:U.slice(-1)[0]+1;return q>=this._terminal.cols&&(++F,q=0),{row:F,column:q}},M=E(d),b=E(x);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(m){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>m;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const m=this._coreBrowserService.mainDocument.createElement("div");return m.setAttribute("role","listitem"),m.tabIndex=-1,this._refreshRowDimensions(m),m}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let m=0;m<this._terminal.rows;m++)this._refreshRowDimensions(this._rowElements[m])}}_refreshRowDimensions(m){m.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=p=_([v(1,f.IInstantiationService),v(2,L.ICoreBrowserService),v(3,L.IRenderService)],p)},3614:(C,r)=>{function u(w){return w.replace(/\r?\n/g,"\r")}function _(w,k){return k?"\x1B[200~"+w+"\x1B[201~":w}function v(w,k,L,f){w=_(w=u(w),L.decPrivateModes.bracketedPasteMode&&f.rawOptions.ignoreBracketedPasteMode!==!0),L.triggerDataEvent(w,!0),k.value=""}function h(w,k,L){const f=L.getBoundingClientRect(),a=w.clientX-f.left-10,p=w.clientY-f.top-10;k.style.width="20px",k.style.height="20px",k.style.left=`${a}px`,k.style.top=`${p}px`,k.style.zIndex="1000",k.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=u,r.bracketTextForPaste=_,r.copyHandler=function(w,k){w.clipboardData&&w.clipboardData.setData("text/plain",k.selectionText),w.preventDefault()},r.handlePasteEvent=function(w,k,L,f){w.stopPropagation(),w.clipboardData&&v(w.clipboardData.getData("text/plain"),k,L,f)},r.paste=v,r.moveTextAreaUnderMouseCursor=h,r.rightClickHandler=function(w,k,L,f,a){h(w,k,L),a&&f.rightClickSelect(w),k.value=f.selectionText,k.select()}},7239:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const _=u(1505);r.ColorContrastCache=class{constructor(){this._color=new _.TwoKeyMap,this._css=new _.TwoKeyMap}setCss(v,h,w){this._css.set(v,h,w)}getCss(v,h){return this._css.get(v,h)}setColor(v,h,w){this._color.set(v,h,w)}getColor(v,h){return this._color.get(v,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(u,_,v,h){u.addEventListener(_,v,h);let w=!1;return{dispose:()=>{w||(w=!0,u.removeEventListener(_,v,h))}}}},3551:function(C,r,u){var _=this&&this.__decorate||function(p,m,d,x){var I,E=arguments.length,M=E<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,d):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(p,m,d,x);else for(var b=p.length-1;b>=0;b--)(I=p[b])&&(M=(E<3?I(M):E>3?I(m,d,M):I(m,d))||M);return E>3&&M&&Object.defineProperty(m,d,M),M},v=this&&this.__param||function(p,m){return function(d,x){m(d,x,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;const h=u(3656),w=u(8460),k=u(844),L=u(2585),f=u(4725);let a=r.Linkifier=class extends k.Disposable{get currentLink(){return this._currentLink}constructor(p,m,d,x,I){super(),this._element=p,this._mouseService=m,this._renderService=d,this._bufferService=x,this._linkProviderService=I,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new w.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new w.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,k.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,k.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,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(p){this._lastMouseEvent=p;const m=this._positionFromMouseEvent(p,this._element,this._mouseService);if(!m)return;this._isMouseOut=!1;const d=p.composedPath();for(let x=0;x<d.length;x++){const I=d[x];if(I.classList.contains("xterm"))break;if(I.classList.contains("xterm-hover"))return}this._lastBufferCell&&m.x===this._lastBufferCell.x&&m.y===this._lastBufferCell.y||(this._handleHover(m),this._lastBufferCell=m)}_handleHover(p){if(this._activeLine!==p.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(p,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,p)||(this._clearCurrentLink(),this._askForLink(p,!0))}_askForLink(p,m){var x,I;this._activeProviderReplies&&m||((x=this._activeProviderReplies)==null||x.forEach((E=>{E==null||E.forEach((M=>{M.link.dispose&&M.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=p.y);let d=!1;for(const[E,M]of this._linkProviderService.linkProviders.entries())m?(I=this._activeProviderReplies)!=null&&I.get(E)&&(d=this._checkLinkProviderResult(E,p,d)):M.provideLinks(p.y,(b=>{var D,B;if(this._isMouseOut)return;const R=b==null?void 0:b.map((O=>({link:O})));(D=this._activeProviderReplies)==null||D.set(E,R),d=this._checkLinkProviderResult(E,p,d),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(p.y,this._activeProviderReplies)}))}_removeIntersectingLinks(p,m){const d=new Set;for(let x=0;x<m.size;x++){const I=m.get(x);if(I)for(let E=0;E<I.length;E++){const M=I[E],b=M.link.range.start.y<p?0:M.link.range.start.x,R=M.link.range.end.y>p?this._bufferService.cols:M.link.range.end.x;for(let D=b;D<=R;D++){if(d.has(D)){I.splice(E--,1);break}d.add(D)}}}}_checkLinkProviderResult(p,m,d){var E;if(!this._activeProviderReplies)return d;const x=this._activeProviderReplies.get(p);let I=!1;for(let M=0;M<p;M++)this._activeProviderReplies.has(M)&&!this._activeProviderReplies.get(M)||(I=!0);if(!I&&x){const M=x.find((b=>this._linkAtPosition(b.link,m)));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((R=>this._linkAtPosition(R.link,m)));if(b){d=!0,this._handleNewLink(b);break}}return d}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(p){if(!this._currentLink)return;const m=this._positionFromMouseEvent(p,this._element,this._mouseService);m&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,m)&&this._currentLink.link.activate(p,this._currentLink.link.text)}_clearCurrentLink(p,m){this._currentLink&&this._lastMouseEvent&&(!p||!m||this._currentLink.link.range.start.y>=p&&this._currentLink.link.range.end.y<=m)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,k.disposeArray)(this._linkCacheDisposables))}_handleNewLink(p){if(!this._lastMouseEvent)return;const m=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);m&&this._linkAtPosition(p.link,m)&&(this._currentLink=p,this._currentLink.state={decorations:{underline:p.link.decorations===void 0||p.link.decorations.underline,pointerCursor:p.link.decorations===void 0||p.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,p.link,this._lastMouseEvent),p.link.decorations={},Object.defineProperties(p.link.decorations,{pointerCursor:{get:()=>{var d,x;return(x=(d=this._currentLink)==null?void 0:d.state)==null?void 0:x.decorations.pointerCursor},set:d=>{var x;(x=this._currentLink)!=null&&x.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,x;return(x=(d=this._currentLink)==null?void 0:d.state)==null?void 0:x.decorations.underline},set:d=>{var x,I,E;(x=this._currentLink)!=null&&x.state&&((E=(I=this._currentLink)==null?void 0:I.state)==null?void 0:E.decorations.underline)!==d&&(this._currentLink.state.decorations.underline=d,this._currentLink.state.isHovered&&this._fireUnderlineEvent(p.link,d))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((d=>{if(!this._currentLink)return;const x=d.start===0?0:d.start+1+this._bufferService.buffer.ydisp,I=this._bufferService.buffer.ydisp+1+d.end;if(this._currentLink.link.range.start.y>=x&&this._currentLink.link.range.end.y<=I&&(this._clearCurrentLink(x,I),this._lastMouseEvent)){const E=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);E&&this._askForLink(E,!1)}}))))}_linkHover(p,m,d){var x;(x=this._currentLink)!=null&&x.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!0),this._currentLink.state.decorations.pointerCursor&&p.classList.add("xterm-cursor-pointer")),m.hover&&m.hover(d,m.text)}_fireUnderlineEvent(p,m){const d=p.range,x=this._bufferService.buffer.ydisp,I=this._createLinkUnderlineEvent(d.start.x-1,d.start.y-x-1,d.end.x,d.end.y-x-1,void 0);(m?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(I)}_linkLeave(p,m,d){var x;(x=this._currentLink)!=null&&x.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!1),this._currentLink.state.decorations.pointerCursor&&p.classList.remove("xterm-cursor-pointer")),m.leave&&m.leave(d,m.text)}_linkAtPosition(p,m){const d=p.range.start.y*this._bufferService.cols+p.range.start.x,x=p.range.end.y*this._bufferService.cols+p.range.end.x,I=m.y*this._bufferService.cols+m.x;return d<=I&&I<=x}_positionFromMouseEvent(p,m,d){const x=d.getCoords(p,m,this._bufferService.cols,this._bufferService.rows);if(x)return{x:x[0],y:x[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(p,m,d,x,I){return{x1:p,y1:m,x2:d,y2:x,cols:this._bufferService.cols,fg:I}}};r.Linkifier=a=_([v(1,f.IMouseService),v(2,f.IRenderService),v(3,L.IBufferService),v(4,f.ILinkProviderService)],a)},9042:(C,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(C,r,u){var _=this&&this.__decorate||function(f,a,p,m){var d,x=arguments.length,I=x<3?a:m===null?m=Object.getOwnPropertyDescriptor(a,p):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(f,a,p,m);else for(var E=f.length-1;E>=0;E--)(d=f[E])&&(I=(x<3?d(I):x>3?d(a,p,I):d(a,p))||I);return x>3&&I&&Object.defineProperty(a,p,I),I},v=this&&this.__param||function(f,a){return function(p,m){a(p,m,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const h=u(511),w=u(2585);let k=r.OscLinkProvider=class{constructor(f,a,p){this._bufferService=f,this._optionsService=a,this._oscLinkService=p}provideLinks(f,a){var R;const p=this._bufferService.buffer.lines.get(f-1);if(!p)return void a(void 0);const m=[],d=this._optionsService.rawOptions.linkHandler,x=new h.CellData,I=p.getTrimmedLength();let E=-1,M=-1,b=!1;for(let D=0;D<I;D++)if(M!==-1||p.hasContent(D)){if(p.loadCell(D,x),x.hasExtendedAttrs()&&x.extended.urlId){if(M===-1){M=D,E=x.extended.urlId;continue}b=x.extended.urlId!==E}else M!==-1&&(b=!0);if(b||M!==-1&&D===I-1){const B=(R=this._oscLinkService.getLinkData(E))==null?void 0:R.uri;if(B){const O={start:{x:M+1,y:f},end:{x:D+(b||D!==I-1?0:1),y:f}};let F=!1;if(!(d!=null&&d.allowNonHttpProtocols))try{const U=new URL(B);["http:","https:"].includes(U.protocol)||(F=!0)}catch{F=!0}F||m.push({text:B,range:O,activate:(U,q)=>d?d.activate(U,q,O):L(0,q),hover:(U,q)=>{var X;return(X=d==null?void 0:d.hover)==null?void 0:X.call(d,U,q,O)},leave:(U,q)=>{var X;return(X=d==null?void 0:d.leave)==null?void 0:X.call(d,U,q,O)}})}b=!1,x.hasExtendedAttrs()&&x.extended.urlId?(M=D,E=x.extended.urlId):(M=-1,E=-1)}}a(m)}};function L(f,a){if(confirm(`Do you want to navigate to ${a}?
111
-
112
- WARNING: This link could potentially be dangerous`)){const p=window.open();if(p){try{p.opener=null}catch{}p.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}}r.OscLinkProvider=k=_([v(0,w.IBufferService),v(1,w.IOptionsService),v(2,w.IOscLinkService)],k)},6193:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(u,_){this._renderCallback=u,this._coreBrowserService=_,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,_,v){this._rowCount=v,u=u!==void 0?u:0,_=_!==void 0?_:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,_):_,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 u=Math.max(this._rowStart,0),_=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,_),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const _=u(3614),v=u(3656),h=u(3551),w=u(9042),k=u(3730),L=u(1680),f=u(3107),a=u(5744),p=u(2950),m=u(1296),d=u(428),x=u(4269),I=u(5114),E=u(8934),M=u(3230),b=u(9312),R=u(4725),D=u(6731),B=u(8055),O=u(8969),F=u(8460),U=u(844),q=u(6114),X=u(8437),Y=u(2584),V=u(7399),j=u(5941),$=u(9074),H=u(2585),K=u(5435),te=u(4567),re=u(779);class le extends O.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(G={}){super(G),this.browser=q,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new U.MutableDisposable),this._onCursorMove=this.register(new F.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new F.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new F.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new F.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new F.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new F.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new F.EventEmitter),this._onBlur=this.register(new F.EventEmitter),this._onA11yCharEmitter=this.register(new F.EventEmitter),this._onA11yTabEmitter=this.register(new F.EventEmitter),this._onWillOpen=this.register(new F.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance($.DecorationService),this._instantiationService.setService(H.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(re.LinkProviderService),this._instantiationService.setService(R.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(k.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((z,Q)=>this.refresh(z,Q)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((z=>this._reportWindowsOptions(z)))),this.register(this._inputHandler.onColor((z=>this._handleColorEvent(z)))),this.register((0,F.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,F.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((z=>this._afterResize(z.cols,z.rows)))),this.register((0,U.toDisposable)((()=>{var z,Q;this._customKeyEventHandler=void 0,(Q=(z=this.element)==null?void 0:z.parentNode)==null||Q.removeChild(this.element)})))}_handleColorEvent(G){if(this._themeService)for(const z of G){let Q,Z="";switch(z.index){case 256:Q="foreground",Z="10";break;case 257:Q="background",Z="11";break;case 258:Q="cursor",Z="12";break;default:Q="ansi",Z="4;"+z.index}switch(z.type){case 0:const ae=B.color.toColorRGB(Q==="ansi"?this._themeService.colors.ansi[z.index]:this._themeService.colors[Q]);this.coreService.triggerDataEvent(`${Y.C0.ESC}]${Z};${(0,j.toRgbString)(ae)}${Y.C1_ESCAPED.ST}`);break;case 1:if(Q==="ansi")this._themeService.modifyColors((fe=>fe.ansi[z.index]=B.channels.toColor(...z.color)));else{const fe=Q;this._themeService.modifyColors((Ee=>Ee[fe]=B.channels.toColor(...z.color)))}break;case 2:this._themeService.restoreColor(z.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(G){G?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(te.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(G){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var G;return(G=this.textarea)==null?void 0:G.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const G=this.buffer.ybase+this.buffer.y,z=this.buffer.lines.get(G);if(!z)return;const Q=Math.min(this.buffer.x,this.cols-1),Z=this._renderService.dimensions.css.cell.height,ae=z.getWidth(Q),fe=this._renderService.dimensions.css.cell.width*ae,Ee=this.buffer.y*this._renderService.dimensions.css.cell.height,Ae=Q*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ae+"px",this.textarea.style.top=Ee+"px",this.textarea.style.width=fe+"px",this.textarea.style.height=Z+"px",this.textarea.style.lineHeight=Z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,v.addDisposableDomListener)(this.element,"copy",(z=>{this.hasSelection()&&(0,_.copyHandler)(z,this._selectionService)})));const G=z=>(0,_.handlePasteEvent)(z,this.textarea,this.coreService,this.optionsService);this.register((0,v.addDisposableDomListener)(this.textarea,"paste",G)),this.register((0,v.addDisposableDomListener)(this.element,"paste",G)),q.isFirefox?this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(z=>{z.button===2&&(0,_.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,v.addDisposableDomListener)(this.element,"contextmenu",(z=>{(0,_.rightClickHandler)(z,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),q.isLinux&&this.register((0,v.addDisposableDomListener)(this.element,"auxclick",(z=>{z.button===1&&(0,_.moveTextAreaUnderMouseCursor)(z,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,v.addDisposableDomListener)(this.textarea,"keyup",(G=>this._keyUp(G)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keydown",(G=>this._keyDown(G)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keypress",(G=>this._keyPress(G)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionupdate",(G=>this._compositionHelper.compositionupdate(G)))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,v.addDisposableDomListener)(this.textarea,"input",(G=>this._inputEvent(G)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(G){var Q;if(!G)throw new Error("Terminal requires a parent element.");if(G.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((Q=this.element)==null?void 0:Q.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=G.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"),G.appendChild(this.element);const z=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),z.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,v.addDisposableDomListener)(this.screenElement,"mousemove",(Z=>this.updateCursorStyle(Z)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),z.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",w.promptLabel),q.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(I.CoreBrowserService,this.textarea,G.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(R.ICoreBrowserService,this._coreBrowserService),this.register((0,v.addDisposableDomListener)(this.textarea,"focus",(Z=>this._handleTextAreaFocus(Z)))),this.register((0,v.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(d.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(R.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(D.ThemeService),this._instantiationService.setService(R.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(x.CharacterJoinerService),this._instantiationService.setService(R.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(M.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(R.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(p.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(E.MouseService),this._instantiationService.setService(R.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(z);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(R.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((Z=>this.scrollLines(Z.amount,Z.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((Z=>this._renderService.handleSelectionChanged(Z.start,Z.end,Z.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((Z=>{this.textarea.value=Z,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((Z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,v.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(f.BufferDecorationRenderer,this.screenElement)),this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(Z=>this._selectionService.handleMouseDown(Z)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(te.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(Z=>this._handleScreenReaderModeOptionChange(Z)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(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(m.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const G=this,z=this.element;function Q(fe){const Ee=G._mouseService.getMouseReportCoords(fe,G.screenElement);if(!Ee)return!1;let Ae,ze;switch(fe.overrideType||fe.type){case"mousemove":ze=32,fe.buttons===void 0?(Ae=3,fe.button!==void 0&&(Ae=fe.button<3?fe.button:3)):Ae=1&fe.buttons?0:4&fe.buttons?1:2&fe.buttons?2:3;break;case"mouseup":ze=0,Ae=fe.button<3?fe.button:3;break;case"mousedown":ze=1,Ae=fe.button<3?fe.button:3;break;case"wheel":if(G._customWheelEventHandler&&G._customWheelEventHandler(fe)===!1||G.viewport.getLinesScrolled(fe)===0)return!1;ze=fe.deltaY<0?0:1,Ae=4;break;default:return!1}return!(ze===void 0||Ae===void 0||Ae>4)&&G.coreMouseService.triggerMouseEvent({col:Ee.col,row:Ee.row,x:Ee.x,y:Ee.y,button:Ae,action:ze,ctrl:fe.ctrlKey,alt:fe.altKey,shift:fe.shiftKey})}const Z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ae={mouseup:fe=>(Q(fe),fe.buttons||(this._document.removeEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.removeEventListener("mousemove",Z.mousedrag)),this.cancel(fe)),wheel:fe=>(Q(fe),this.cancel(fe,!0)),mousedrag:fe=>{fe.buttons&&Q(fe)},mousemove:fe=>{fe.buttons||Q(fe)}};this.register(this.coreMouseService.onProtocolChange((fe=>{fe?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(fe)),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&fe?Z.mousemove||(z.addEventListener("mousemove",ae.mousemove),Z.mousemove=ae.mousemove):(z.removeEventListener("mousemove",Z.mousemove),Z.mousemove=null),16&fe?Z.wheel||(z.addEventListener("wheel",ae.wheel,{passive:!1}),Z.wheel=ae.wheel):(z.removeEventListener("wheel",Z.wheel),Z.wheel=null),2&fe?Z.mouseup||(Z.mouseup=ae.mouseup):(this._document.removeEventListener("mouseup",Z.mouseup),Z.mouseup=null),4&fe?Z.mousedrag||(Z.mousedrag=ae.mousedrag):(this._document.removeEventListener("mousemove",Z.mousedrag),Z.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,v.addDisposableDomListener)(z,"mousedown",(fe=>{if(fe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(fe))return Q(fe),Z.mouseup&&this._document.addEventListener("mouseup",Z.mouseup),Z.mousedrag&&this._document.addEventListener("mousemove",Z.mousedrag),this.cancel(fe)}))),this.register((0,v.addDisposableDomListener)(z,"wheel",(fe=>{if(!Z.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(fe)===!1)return!1;if(!this.buffer.hasScrollback){const Ee=this.viewport.getLinesScrolled(fe);if(Ee===0)return;const Ae=Y.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(fe.deltaY<0?"A":"B");let ze="";for(let ue=0;ue<Math.abs(Ee);ue++)ze+=Ae;return this.coreService.triggerDataEvent(ze,!0),this.cancel(fe,!0)}return this.viewport.handleWheel(fe)?this.cancel(fe):void 0}}),{passive:!1})),this.register((0,v.addDisposableDomListener)(z,"touchstart",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(fe),this.cancel(fe)}),{passive:!0})),this.register((0,v.addDisposableDomListener)(z,"touchmove",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(fe)?void 0:this.cancel(fe)}),{passive:!1}))}refresh(G,z){var Q;(Q=this._renderService)==null||Q.refreshRows(G,z)}updateCursorStyle(G){var z;(z=this._selectionService)!=null&&z.shouldColumnSelect(G)?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(G,z,Q=0){var Z;Q===1?(super.scrollLines(G,z,Q),this.refresh(0,this.rows-1)):(Z=this.viewport)==null||Z.scrollLines(G)}paste(G){(0,_.paste)(G,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(G){this._customKeyEventHandler=G}attachCustomWheelEventHandler(G){this._customWheelEventHandler=G}registerLinkProvider(G){return this._linkProviderService.registerLinkProvider(G)}registerCharacterJoiner(G){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const z=this._characterJoinerService.register(G);return this.refresh(0,this.rows-1),z}deregisterCharacterJoiner(G){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(G)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(G){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+G)}registerDecoration(G){return this._decorationService.registerDecoration(G)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(G,z,Q){this._selectionService.setSelection(G,z,Q)}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 G;(G=this._selectionService)==null||G.clearSelection()}selectAll(){var G;(G=this._selectionService)==null||G.selectAll()}selectLines(G,z){var Q;(Q=this._selectionService)==null||Q.selectLines(G,z)}_keyDown(G){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(G)===!1)return!1;const z=this.browser.isMac&&this.options.macOptionIsMeta&&G.altKey;if(!z&&!this._compositionHelper.keydown(G))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;z||G.key!=="Dead"&&G.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const Q=(0,V.evaluateKeyboardEvent)(G,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(G),Q.type===3||Q.type===2){const Z=this.rows-1;return this.scrollLines(Q.type===2?-Z:Z),this.cancel(G,!0)}return Q.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,G)||(Q.cancel&&this.cancel(G,!0),!Q.key||!!(G.key&&!G.ctrlKey&&!G.altKey&&!G.metaKey&&G.key.length===1&&G.key.charCodeAt(0)>=65&&G.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(Q.key!==Y.C0.ETX&&Q.key!==Y.C0.CR||(this.textarea.value=""),this._onKey.fire({key:Q.key,domEvent:G}),this._showCursor(),this.coreService.triggerDataEvent(Q.key,!0),!this.optionsService.rawOptions.screenReaderMode||G.altKey||G.ctrlKey?this.cancel(G,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(G,z){const Q=G.isMac&&!this.options.macOptionIsMeta&&z.altKey&&!z.ctrlKey&&!z.metaKey||G.isWindows&&z.altKey&&z.ctrlKey&&!z.metaKey||G.isWindows&&z.getModifierState("AltGraph");return z.type==="keypress"?Q:Q&&(!z.keyCode||z.keyCode>47)}_keyUp(G){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(G)===!1||((function(z){return z.keyCode===16||z.keyCode===17||z.keyCode===18})(G)||this.focus(),this.updateCursorStyle(G),this._keyPressHandled=!1)}_keyPress(G){let z;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(G)===!1)return!1;if(this.cancel(G),G.charCode)z=G.charCode;else if(G.which===null||G.which===void 0)z=G.keyCode;else{if(G.which===0||G.charCode===0)return!1;z=G.which}return!(!z||(G.altKey||G.ctrlKey||G.metaKey)&&!this._isThirdLevelShift(this.browser,G)||(z=String.fromCharCode(z),this._onKey.fire({key:z,domEvent:G}),this._showCursor(),this.coreService.triggerDataEvent(z,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(G){if(G.data&&G.inputType==="insertText"&&(!G.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const z=G.data;return this.coreService.triggerDataEvent(z,!0),this.cancel(G),!0}return!1}resize(G,z){G!==this.cols||z!==this.rows?super.resize(G,z):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(G,z){var Q,Z;(Q=this._charSizeService)==null||Q.measure(),(Z=this.viewport)==null||Z.syncScrollArea(!0)}clear(){var G;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 z=1;z<this.rows;z++)this.buffer.lines.push(this.buffer.getBlankLine(X.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(G=this.viewport)==null||G.reset(),this.refresh(0,this.rows-1)}}reset(){var z,Q;this.options.rows=this.rows,this.options.cols=this.cols;const G=this._customKeyEventHandler;this._setup(),super.reset(),(z=this._selectionService)==null||z.reset(),this._decorationService.reset(),(Q=this.viewport)==null||Q.reset(),this._customKeyEventHandler=G,this.refresh(0,this.rows-1)}clearTextureAtlas(){var G;(G=this._renderService)==null||G.clearTextureAtlas()}_reportFocus(){var G;(G=this.element)!=null&&G.classList.contains("focus")?this.coreService.triggerDataEvent(Y.C0.ESC+"[I"):this.coreService.triggerDataEvent(Y.C0.ESC+"[O")}_reportWindowsOptions(G){if(this._renderService)switch(G){case K.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const z=this._renderService.dimensions.css.canvas.width.toFixed(0),Q=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[4;${Q};${z}t`);break;case K.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const Z=this._renderService.dimensions.css.cell.width.toFixed(0),ae=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[6;${ae};${Z}t`)}}cancel(G,z){if(this.options.cancelEvents||z)return G.preventDefault(),G.stopPropagation(),!1}}r.Terminal=le},9924:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(u,_=1e3){this._renderCallback=u,this._debounceThresholdMS=_,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,_,v){this._rowCount=v,u=u!==void 0?u:0,_=_!==void 0?_:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,_):_;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const w=h-this._lastRefreshMs,k=this._debounceThresholdMS-w;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),k)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),_=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,_)}}},1680:function(C,r,u){var _=this&&this.__decorate||function(p,m,d,x){var I,E=arguments.length,M=E<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,d):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(p,m,d,x);else for(var b=p.length-1;b>=0;b--)(I=p[b])&&(M=(E<3?I(M):E>3?I(m,d,M):I(m,d))||M);return E>3&&M&&Object.defineProperty(m,d,M),M},v=this&&this.__param||function(p,m){return function(d,x){m(d,x,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const h=u(3656),w=u(4725),k=u(8460),L=u(844),f=u(2585);let a=r.Viewport=class extends L.Disposable{constructor(p,m,d,x,I,E,M,b){super(),this._viewportElement=p,this._scrollArea=m,this._bufferService=d,this._optionsService=x,this._charSizeService=I,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 k.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((R=>this._activeBuffer=R.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((R=>this._renderDimensions=R))),this._handleThemeChange(b.colors),this.register(b.onChangeColors((R=>this._handleThemeChange(R)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(p){this._viewportElement.style.backgroundColor=p.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(p){if(p)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const m=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==m&&(this._lastRecordedBufferHeight=m,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const p=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==p&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=p),this._refreshAnimationFrame=null}syncScrollArea(p=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(p);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(p)}_handleScroll(p){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const m=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const p=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(p*(this._smoothScrollState.target-this._smoothScrollState.origin)),p<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(p,m){const d=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(m<0&&this._viewportElement.scrollTop!==0||m>0&&d<this._lastRecordedBufferHeight)||(p.cancelable&&p.preventDefault(),!1)}handleWheel(p){const m=this._getPixelsScrolled(p);return m!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+m:this._smoothScrollState.target+=m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=m,this._bubbleScroll(p,m))}scrollLines(p){if(p!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const m=p*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:p,suppressScrollEvent:!1})}_getPixelsScrolled(p){if(p.deltaY===0||p.shiftKey)return 0;let m=this._applyScrollModifier(p.deltaY,p);return p.deltaMode===WheelEvent.DOM_DELTA_LINE?m*=this._currentRowHeight:p.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._currentRowHeight*this._bufferService.rows),m}getBufferElements(p,m){var b;let d,x="";const I=[],E=m??this._bufferService.buffer.lines.length,M=this._bufferService.buffer.lines;for(let R=p;R<E;R++){const D=M.get(R);if(!D)continue;const B=(b=M.get(R+1))==null?void 0:b.isWrapped;if(x+=D.translateToString(!B),!B||R===M.length-1){const O=document.createElement("div");O.textContent=x,I.push(O),x.length>0&&(d=O),x=""}}return{bufferElements:I,cursorElement:d}}getLinesScrolled(p){if(p.deltaY===0||p.shiftKey)return 0;let m=this._applyScrollModifier(p.deltaY,p);return p.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(m/=this._currentRowHeight+0,this._wheelPartialScroll+=m,m=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):p.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._bufferService.rows),m}_applyScrollModifier(p,m){const d=this._optionsService.rawOptions.fastScrollModifier;return d==="alt"&&m.altKey||d==="ctrl"&&m.ctrlKey||d==="shift"&&m.shiftKey?p*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:p*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(p){this._lastTouchY=p.touches[0].pageY}handleTouchMove(p){const m=this._lastTouchY-p.touches[0].pageY;return this._lastTouchY=p.touches[0].pageY,m!==0&&(this._viewportElement.scrollTop+=m,this._bubbleScroll(p,m))}};r.Viewport=a=_([v(2,f.IBufferService),v(3,f.IOptionsService),v(4,w.ICharSizeService),v(5,w.IRenderService),v(6,w.ICoreBrowserService),v(7,w.IThemeService)],a)},3107:function(C,r,u){var _=this&&this.__decorate||function(f,a,p,m){var d,x=arguments.length,I=x<3?a:m===null?m=Object.getOwnPropertyDescriptor(a,p):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(f,a,p,m);else for(var E=f.length-1;E>=0;E--)(d=f[E])&&(I=(x<3?d(I):x>3?d(a,p,I):d(a,p))||I);return x>3&&I&&Object.defineProperty(a,p,I),I},v=this&&this.__param||function(f,a){return function(p,m){a(p,m,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const h=u(4725),w=u(844),k=u(2585);let L=r.BufferDecorationRenderer=class extends w.Disposable{constructor(f,a,p,m,d){super(),this._screenElement=f,this._bufferService=a,this._coreBrowserService=p,this._decorationService=m,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((x=>this._removeDecoration(x)))),this.register((0,w.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 m;const a=this._coreBrowserService.mainDocument.createElement("div");a.classList.add("xterm-decoration"),a.classList.toggle("xterm-decoration-top-layer",((m=f==null?void 0:f.options)==null?void 0:m.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 p=f.options.x??0;return p&&p>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 p=this._decorationElements.get(f);p||(p=this._createElement(f),f.element=p,this._decorationElements.set(f,p),this._container.appendChild(p),f.onDispose((()=>{this._decorationElements.delete(f),p.remove()}))),p.style.top=a*this._renderService.dimensions.css.cell.height+"px",p.style.display=this._altBufferIsActive?"none":"block",f.onRenderEmitter.fire(p)}}_refreshXPosition(f,a=f.element){if(!a)return;const p=f.options.x??0;(f.options.anchor||"left")==="right"?a.style.right=p?p*this._renderService.dimensions.css.cell.width+"px":"":a.style.left=p?p*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=_([v(1,k.IBufferService),v(2,h.ICoreBrowserService),v(3,k.IDecorationService),v(4,h.IRenderService)],L)},5871:(C,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(u){if(u.options.overviewRulerOptions){for(const _ of this._zones)if(_.color===u.options.overviewRulerOptions.color&&_.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(_,u.marker.line))return;if(this._lineAdjacentToZone(_,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(_,u.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=u.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=u.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=u.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=u.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:u.options.overviewRulerOptions.color,position:u.options.overviewRulerOptions.position,startBufferLine:u.marker.line,endBufferLine:u.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(u){this._linePadding=u}_lineIntersectsZone(u,_){return _>=u.startBufferLine&&_<=u.endBufferLine}_lineAdjacentToZone(u,_,v){return _>=u.startBufferLine-this._linePadding[v||"full"]&&_<=u.endBufferLine+this._linePadding[v||"full"]}_addLineToZone(u,_){u.startBufferLine=Math.min(u.startBufferLine,_),u.endBufferLine=Math.max(u.endBufferLine,_)}}},5744:function(C,r,u){var _=this&&this.__decorate||function(d,x,I,E){var M,b=arguments.length,R=b<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,I):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(d,x,I,E);else for(var D=d.length-1;D>=0;D--)(M=d[D])&&(R=(b<3?M(R):b>3?M(x,I,R):M(x,I))||R);return b>3&&R&&Object.defineProperty(x,I,R),R},v=this&&this.__param||function(d,x){return function(I,E){x(I,E,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const h=u(5871),w=u(4725),k=u(844),L=u(2585),f={full:0,left:0,center:0,right:0},a={full:0,left:0,center:0,right:0},p={full:0,left:0,center:0,right:0};let m=r.OverviewRulerRenderer=class extends k.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(d,x,I,E,M,b,R){var B;super(),this._viewportElement=d,this._screenElement=x,this._bufferService=I,this._decorationService=E,this._renderService=M,this._optionsService=b,this._coreBrowserService=R,this._colorZoneStore=new h.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const D=this._canvas.getContext("2d");if(!D)throw new Error("Ctx cannot be null");this._ctx=D,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,k.toDisposable)((()=>{var O;(O=this._canvas)==null||O.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const d=Math.floor(this._canvas.width/3),x=Math.ceil(this._canvas.width/3);a.full=this._canvas.width,a.left=d,a.center=x,a.right=d,this._refreshDrawHeightConstants(),p.full=0,p.left=0,p.center=a.left,p.right=a.left+a.center}_refreshDrawHeightConstants(){f.full=Math.round(2*this._coreBrowserService.dpr);const d=this._canvas.height/this._bufferService.buffer.lines.length,x=Math.round(Math.max(Math.min(d,12),6)*this._coreBrowserService.dpr);f.left=x,f.center=x,f.right=x}_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 x of this._decorationService.decorations)this._colorZoneStore.addDecoration(x);this._ctx.lineWidth=1;const d=this._colorZoneStore.zones;for(const x of d)x.position!=="full"&&this._renderColorZone(x);for(const x of d)x.position==="full"&&this._renderColorZone(x);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(d){this._ctx.fillStyle=d.color,this._ctx.fillRect(p[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,x){this._shouldUpdateDimensions=d||this._shouldUpdateDimensions,this._shouldUpdateAnchor=x||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};r.OverviewRulerRenderer=m=_([v(2,L.IBufferService),v(3,L.IDecorationService),v(4,w.IRenderService),v(5,L.IOptionsService),v(6,w.ICoreBrowserService)],m)},2950:function(C,r,u){var _=this&&this.__decorate||function(f,a,p,m){var d,x=arguments.length,I=x<3?a:m===null?m=Object.getOwnPropertyDescriptor(a,p):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(f,a,p,m);else for(var E=f.length-1;E>=0;E--)(d=f[E])&&(I=(x<3?d(I):x>3?d(a,p,I):d(a,p))||I);return x>3&&I&&Object.defineProperty(a,p,I),I},v=this&&this.__param||function(f,a){return function(p,m){a(p,m,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const h=u(4725),w=u(2585),k=u(2584);let L=r.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(f,a,p,m,d,x){this._textarea=f,this._compositionView=a,this._bufferService=p,this._optionsService=m,this._coreService=d,this._renderService=x,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(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 p;this._isSendingComposition=!1,a.start+=this._dataAlreadySent.length,p=this._isComposing?this._textarea.value.substring(a.start,a.end):this._textarea.value.substring(a.start),p.length>0&&this._coreService.triggerDataEvent(p,!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,p=a.replace(f,"");this._dataAlreadySent=p,a.length>f.length?this._coreService.triggerDataEvent(p,!0):a.length<f.length?this._coreService.triggerDataEvent(`${k.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),p=this._renderService.dimensions.css.cell.height,m=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=m+"px",this._compositionView.style.height=p+"px",this._compositionView.style.lineHeight=p+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const x=this._compositionView.getBoundingClientRect();this._textarea.style.left=d+"px",this._textarea.style.top=m+"px",this._textarea.style.width=Math.max(x.width,1)+"px",this._textarea.style.height=Math.max(x.height,1)+"px",this._textarea.style.lineHeight=x.height+"px"}f||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};r.CompositionHelper=L=_([v(2,w.IBufferService),v(3,w.IOptionsService),v(4,w.ICoreService),v(5,h.IRenderService)],L)},9806:(C,r)=>{function u(_,v,h){const w=h.getBoundingClientRect(),k=_.getComputedStyle(h),L=parseInt(k.getPropertyValue("padding-left")),f=parseInt(k.getPropertyValue("padding-top"));return[v.clientX-w.left-L,v.clientY-w.top-f]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=u,r.getCoords=function(_,v,h,w,k,L,f,a,p){if(!L)return;const m=u(_,v,h);return m?(m[0]=Math.ceil((m[0]+(p?f/2:0))/f),m[1]=Math.ceil(m[1]/a),m[0]=Math.min(Math.max(m[0],1),w+(p?1:0)),m[1]=Math.min(Math.max(m[1],1),k),m):void 0}},9504:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const _=u(2584);function v(a,p,m,d){const x=a-h(a,m),I=p-h(p,m),E=Math.abs(x-I)-(function(M,b,R){let D=0;const B=M-h(M,R),O=b-h(b,R);for(let F=0;F<Math.abs(B-O);F++){const U=w(M,b)==="A"?-1:1,q=R.buffer.lines.get(B+U*F);q!=null&&q.isWrapped&&D++}return D})(a,p,m);return f(E,L(w(a,p),d))}function h(a,p){let m=0,d=p.buffer.lines.get(a),x=d==null?void 0:d.isWrapped;for(;x&&a>=0&&a<p.rows;)m++,d=p.buffer.lines.get(--a),x=d==null?void 0:d.isWrapped;return m}function w(a,p){return a>p?"A":"B"}function k(a,p,m,d,x,I){let E=a,M=p,b="";for(;E!==m||M!==d;)E+=x?1:-1,x&&E>I.cols-1?(b+=I.buffer.translateBufferLineToString(M,!1,a,E),E=0,a=0,M++):!x&&E<0&&(b+=I.buffer.translateBufferLineToString(M,!1,0,a+1),E=I.cols-1,a=E,M--);return b+I.buffer.translateBufferLineToString(M,!1,a,E)}function L(a,p){const m=p?"O":"[";return _.C0.ESC+m+a}function f(a,p){a=Math.floor(a);let m="";for(let d=0;d<a;d++)m+=p;return m}r.moveToCellSequence=function(a,p,m,d){const x=m.buffer.x,I=m.buffer.y;if(!m.buffer.hasScrollback)return(function(b,R,D,B,O,F){return v(R,B,O,F).length===0?"":f(k(b,R,b,R-h(R,O),!1,O).length,L("D",F))})(x,I,0,p,m,d)+v(I,p,m,d)+(function(b,R,D,B,O,F){let U;U=v(R,B,O,F).length>0?B-h(B,O):R;const q=B,X=(function(Y,V,j,$,H,K){let te;return te=v(j,$,H,K).length>0?$-h($,H):V,Y<j&&te<=$||Y>=j&&te<$?"C":"D"})(b,R,D,B,O,F);return f(k(b,U,D,q,X==="C",O).length,L(X,F))})(x,I,a,p,m,d);let E;if(I===p)return E=x>a?"D":"C",f(Math.abs(x-a),L(E,d));E=I>p?"D":"C";const M=Math.abs(I-p);return f((function(b,R){return R.cols-b})(I>p?a:x,m)+(M-1)*m.cols+1+((I>p?x:a)-1),L(E,d))}},1296:function(C,r,u){var _=this&&this.__decorate||function(F,U,q,X){var Y,V=arguments.length,j=V<3?U:X===null?X=Object.getOwnPropertyDescriptor(U,q):X;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(F,U,q,X);else for(var $=F.length-1;$>=0;$--)(Y=F[$])&&(j=(V<3?Y(j):V>3?Y(U,q,j):Y(U,q))||j);return V>3&&j&&Object.defineProperty(U,q,j),j},v=this&&this.__param||function(F,U){return function(q,X){U(q,X,F)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const h=u(3787),w=u(2550),k=u(2223),L=u(6171),f=u(6052),a=u(4725),p=u(8055),m=u(8460),d=u(844),x=u(2585),I="xterm-dom-renderer-owner-",E="xterm-rows",M="xterm-fg-",b="xterm-bg-",R="xterm-focus",D="xterm-selection";let B=1,O=r.DomRenderer=class extends d.Disposable{constructor(F,U,q,X,Y,V,j,$,H,K,te,re,le){super(),this._terminal=F,this._document=U,this._element=q,this._screenElement=X,this._viewportElement=Y,this._helperContainer=V,this._linkifier2=j,this._charSizeService=H,this._optionsService=K,this._bufferService=te,this._coreBrowserService=re,this._themeService=le,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,f.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new m.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(D),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(h.DomRendererRowFactory,document),this._element.classList.add(I+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(I+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new w.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const F=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*F,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*F),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/F),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/F),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const q of this._rowElements)q.style.width=`${this.dimensions.css.canvas.width}px`,q.style.height=`${this.dimensions.css.cell.height}px`,q.style.lineHeight=`${this.dimensions.css.cell.height}px`,q.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const 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(F){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let U=`${this._terminalSelector} .${E} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;U+=`${this._terminalSelector} .${E} .xterm-dim { color: ${p.color.multiplyOpacity(F.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 q=`blink_underline_${this._terminalClass}`,X=`blink_bar_${this._terminalClass}`,Y=`blink_block_${this._terminalClass}`;U+=`@keyframes ${q} { 50% { border-bottom-style: hidden; }}`,U+=`@keyframes ${X} { 50% { box-shadow: none; }}`,U+=`@keyframes ${Y} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,U+=`${this._terminalSelector} .${E}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${q} 1s step-end infinite;}${this._terminalSelector} .${E}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${X} 1s step-end infinite;}${this._terminalSelector} .${E}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,U+=`${this._terminalSelector} .${D} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${D} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${D} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[V,j]of F.ansi.entries())U+=`${this._terminalSelector} .${M}${V} { color: ${j.css}; }${this._terminalSelector} .${M}${V}.xterm-dim { color: ${p.color.multiplyOpacity(j,.5).css}; }${this._terminalSelector} .${b}${V} { background-color: ${j.css}; }`;U+=`${this._terminalSelector} .${M}${k.INVERTED_DEFAULT_COLOR} { color: ${p.color.opaque(F.background).css}; }${this._terminalSelector} .${M}${k.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${p.color.multiplyOpacity(p.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${b}${k.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=U}_setDefaultSpacing(){const F=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${F}px`,this._rowFactory.defaultSpacing=F}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(F,U){for(let q=this._rowElements.length;q<=U;q++){const X=this._document.createElement("div");this._rowContainer.appendChild(X),this._rowElements.push(X)}for(;this._rowElements.length>U;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,U){this._refreshRowElements(F,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(R),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(R),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,U,q){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,U,q),this.renderRows(0,this._bufferService.rows-1),!F||!U)return;this._selectionRenderModel.update(this._terminal,F,U,q);const X=this._selectionRenderModel.viewportStartRow,Y=this._selectionRenderModel.viewportEndRow,V=this._selectionRenderModel.viewportCappedStartRow,j=this._selectionRenderModel.viewportCappedEndRow;if(V>=this._bufferService.rows||j<0)return;const $=this._document.createDocumentFragment();if(q){const H=F[0]>U[0];$.appendChild(this._createSelectionElement(V,H?U[0]:F[0],H?F[0]:U[0],j-V+1))}else{const H=X===V?F[0]:0,K=V===Y?U[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(V,H,K));const te=j-V-1;if($.appendChild(this._createSelectionElement(V+1,0,this._bufferService.cols,te)),V!==j){const re=Y===j?U[0]:this._bufferService.cols;$.appendChild(this._createSelectionElement(j,0,re))}}this._selectionContainer.appendChild($)}_createSelectionElement(F,U,q,X=1){const Y=this._document.createElement("div"),V=U*this.dimensions.css.cell.width;let j=this.dimensions.css.cell.width*(q-U);return V+j>this.dimensions.css.canvas.width&&(j=this.dimensions.css.canvas.width-V),Y.style.height=X*this.dimensions.css.cell.height+"px",Y.style.top=F*this.dimensions.css.cell.height+"px",Y.style.left=`${V}px`,Y.style.width=`${j}px`,Y}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const F of this._rowElements)F.replaceChildren()}renderRows(F,U){const q=this._bufferService.buffer,X=q.ybase+q.y,Y=Math.min(q.x,this._bufferService.cols-1),V=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,$=this._optionsService.rawOptions.cursorInactiveStyle;for(let H=F;H<=U;H++){const K=H+q.ydisp,te=this._rowElements[H],re=q.lines.get(K);if(!te||!re)break;te.replaceChildren(...this._rowFactory.createRow(re,K,K===X,j,$,Y,V,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${I}${this._terminalClass}`}_handleLinkHover(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!0)}_handleLinkLeave(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!1)}_setCellUnderline(F,U,q,X,Y,V){q<0&&(F=0),X<0&&(U=0);const j=this._bufferService.rows-1;q=Math.max(Math.min(q,j),0),X=Math.max(Math.min(X,j),0),Y=Math.min(Y,this._bufferService.cols);const $=this._bufferService.buffer,H=$.ybase+$.y,K=Math.min($.x,Y-1),te=this._optionsService.rawOptions.cursorBlink,re=this._optionsService.rawOptions.cursorStyle,le=this._optionsService.rawOptions.cursorInactiveStyle;for(let de=q;de<=X;++de){const G=de+$.ydisp,z=this._rowElements[de],Q=$.lines.get(G);if(!z||!Q)break;z.replaceChildren(...this._rowFactory.createRow(Q,G,G===H,re,le,K,te,this.dimensions.css.cell.width,this._widthCache,V?de===q?F:0:-1,V?(de===X?U:Y)-1:-1))}}};r.DomRenderer=O=_([v(7,x.IInstantiationService),v(8,a.ICharSizeService),v(9,x.IOptionsService),v(10,x.IBufferService),v(11,a.ICoreBrowserService),v(12,a.IThemeService)],O)},3787:function(C,r,u){var _=this&&this.__decorate||function(E,M,b,R){var D,B=arguments.length,O=B<3?M:R===null?R=Object.getOwnPropertyDescriptor(M,b):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(E,M,b,R);else for(var F=E.length-1;F>=0;F--)(D=E[F])&&(O=(B<3?D(O):B>3?D(M,b,O):D(M,b))||O);return B>3&&O&&Object.defineProperty(M,b,O),O},v=this&&this.__param||function(E,M){return function(b,R){M(b,R,E)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=void 0;const h=u(2223),w=u(643),k=u(511),L=u(2585),f=u(8055),a=u(4725),p=u(4269),m=u(6171),d=u(3734);let x=r.DomRendererRowFactory=class{constructor(E,M,b,R,D,B,O){this._document=E,this._characterJoinerService=M,this._optionsService=b,this._coreBrowserService=R,this._coreService=D,this._decorationService=B,this._themeService=O,this._workCell=new k.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(E,M,b){this._selectionStart=E,this._selectionEnd=M,this._columnSelectMode=b}createRow(E,M,b,R,D,B,O,F,U,q,X){const Y=[],V=this._characterJoinerService.getJoinedCharacters(M),j=this._themeService.colors;let $,H=E.getNoBgTrimmedLength();b&&H<B+1&&(H=B+1);let K=0,te="",re=0,le=0,de=0,G=!1,z=0,Q=!1,Z=0;const ae=[],fe=q!==-1&&X!==-1;for(let Ee=0;Ee<H;Ee++){E.loadCell(Ee,this._workCell);let Ae=this._workCell.getWidth();if(Ae===0)continue;let ze=!1,ue=Ee,Me=this._workCell;if(V.length>0&&Ee===V[0][0]){ze=!0;const qe=V.shift();Me=new p.JoinedCellData(this._workCell,E.translateToString(!0,qe[0],qe[1]),qe[1]-qe[0]),ue=qe[1]-1,Ae=Me.getWidth()}const he=this._isCellInSelection(Ee,M),Te=b&&Ee===B,ge=fe&&Ee>=q&&Ee<=X;let Re=!1;this._decorationService.forEachDecorationAtCell(Ee,M,void 0,(qe=>{Re=!0}));let Ue=Me.getChars()||w.WHITESPACE_CELL_CHAR;if(Ue===" "&&(Me.isUnderline()||Me.isOverline())&&(Ue=" "),Z=Ae*F-U.get(Ue,Me.isBold(),Me.isItalic()),$){if(K&&(he&&Q||!he&&!Q&&Me.bg===re)&&(he&&Q&&j.selectionForeground||Me.fg===le)&&Me.extended.ext===de&&ge===G&&Z===z&&!Te&&!ze&&!Re){Me.isInvisible()?te+=w.WHITESPACE_CELL_CHAR:te+=Ue,K++;continue}K&&($.textContent=te),$=this._document.createElement("span"),K=0,te=""}else $=this._document.createElement("span");if(re=Me.bg,le=Me.fg,de=Me.extended.ext,G=ge,z=Z,Q=he,ze&&B>=Ee&&B<=ue&&(B=Ee),!this._coreService.isCursorHidden&&Te&&this._coreService.isCursorInitialized){if(ae.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&ae.push("xterm-cursor-blink"),ae.push(R==="bar"?"xterm-cursor-bar":R==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(D)switch(D){case"outline":ae.push("xterm-cursor-outline");break;case"block":ae.push("xterm-cursor-block");break;case"bar":ae.push("xterm-cursor-bar");break;case"underline":ae.push("xterm-cursor-underline")}}if(Me.isBold()&&ae.push("xterm-bold"),Me.isItalic()&&ae.push("xterm-italic"),Me.isDim()&&ae.push("xterm-dim"),te=Me.isInvisible()?w.WHITESPACE_CELL_CHAR:Me.getChars()||w.WHITESPACE_CELL_CHAR,Me.isUnderline()&&(ae.push(`xterm-underline-${Me.extended.underlineStyle}`),te===" "&&(te=" "),!Me.isUnderlineColorDefault()))if(Me.isUnderlineColorRGB())$.style.textDecorationColor=`rgb(${d.AttributeData.toColorRGB(Me.getUnderlineColor()).join(",")})`;else{let qe=Me.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Me.isBold()&&qe<8&&(qe+=8),$.style.textDecorationColor=j.ansi[qe].css}Me.isOverline()&&(ae.push("xterm-overline"),te===" "&&(te=" ")),Me.isStrikethrough()&&ae.push("xterm-strikethrough"),ge&&($.style.textDecoration="underline");let ke=Me.getFgColor(),Ne=Me.getFgColorMode(),st=Me.getBgColor(),ot=Me.getBgColorMode();const wt=!!Me.isInverse();if(wt){const qe=ke;ke=st,st=qe;const et=Ne;Ne=ot,ot=et}let ct,bt,Pe,Ze=!1;switch(this._decorationService.forEachDecorationAtCell(Ee,M,void 0,(qe=>{qe.options.layer!=="top"&&Ze||(qe.backgroundColorRGB&&(ot=50331648,st=qe.backgroundColorRGB.rgba>>8&16777215,ct=qe.backgroundColorRGB),qe.foregroundColorRGB&&(Ne=50331648,ke=qe.foregroundColorRGB.rgba>>8&16777215,bt=qe.foregroundColorRGB),Ze=qe.options.layer==="top")})),!Ze&&he&&(ct=this._coreBrowserService.isFocused?j.selectionBackgroundOpaque:j.selectionInactiveBackgroundOpaque,st=ct.rgba>>8&16777215,ot=50331648,Ze=!0,j.selectionForeground&&(Ne=50331648,ke=j.selectionForeground.rgba>>8&16777215,bt=j.selectionForeground)),Ze&&ae.push("xterm-decoration-top"),ot){case 16777216:case 33554432:Pe=j.ansi[st],ae.push(`xterm-bg-${st}`);break;case 50331648:Pe=f.channels.toColor(st>>16,st>>8&255,255&st),this._addStyle($,`background-color:#${I((st>>>0).toString(16),"0",6)}`);break;default:wt?(Pe=j.foreground,ae.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):Pe=j.background}switch(ct||Me.isDim()&&(ct=f.color.multiplyOpacity(Pe,.5)),Ne){case 16777216:case 33554432:Me.isBold()&&ke<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ke+=8),this._applyMinimumContrast($,Pe,j.ansi[ke],Me,ct,void 0)||ae.push(`xterm-fg-${ke}`);break;case 50331648:const qe=f.channels.toColor(ke>>16&255,ke>>8&255,255&ke);this._applyMinimumContrast($,Pe,qe,Me,ct,bt)||this._addStyle($,`color:#${I(ke.toString(16),"0",6)}`);break;default:this._applyMinimumContrast($,Pe,j.foreground,Me,ct,bt)||wt&&ae.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}ae.length&&($.className=ae.join(" "),ae.length=0),Te||ze||Re?$.textContent=te:K++,Z!==this.defaultSpacing&&($.style.letterSpacing=`${Z}px`),Y.push($),Ee=ue}return $&&K&&($.textContent=te),Y}_applyMinimumContrast(E,M,b,R,D,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,m.treatGlyphAsBackgroundColor)(R.getCode()))return!1;const O=this._getContrastCache(R);let F;if(D||B||(F=O.getColor(M.rgba,b.rgba)),F===void 0){const U=this._optionsService.rawOptions.minimumContrastRatio/(R.isDim()?2:1);F=f.color.ensureContrastRatio(D||M,B||b,U),O.setColor((D||M).rgba,(B||b).rgba,F??null)}return!!F&&(this._addStyle(E,`color:${F.css}`),!0)}_getContrastCache(E){return E.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(E,M){E.setAttribute("style",`${E.getAttribute("style")||""}${M};`)}_isCellInSelection(E,M){const b=this._selectionStart,R=this._selectionEnd;return!(!b||!R)&&(this._columnSelectMode?b[0]<=R[0]?E>=b[0]&&M>=b[1]&&E<R[0]&&M<=R[1]:E<b[0]&&M>=b[1]&&E>=R[0]&&M<=R[1]:M>b[1]&&M<R[1]||b[1]===R[1]&&M===b[1]&&E>=b[0]&&E<R[0]||b[1]<R[1]&&M===R[1]&&E<R[0]||b[1]<R[1]&&M===b[1]&&E>=b[0])}};function I(E,M,b){for(;E.length<b;)E=M+E;return E}r.DomRendererRowFactory=x=_([v(1,a.ICharacterJoinerService),v(2,L.IOptionsService),v(3,a.ICoreBrowserService),v(4,L.ICoreService),v(5,L.IDecorationService),v(6,a.IThemeService)],x)},2550:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WidthCache=void 0,r.WidthCache=class{constructor(u,_){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const v=u.createElement("span");v.classList.add("xterm-char-measure-element");const h=u.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const w=u.createElement("span");w.classList.add("xterm-char-measure-element"),w.style.fontStyle="italic";const k=u.createElement("span");k.classList.add("xterm-char-measure-element"),k.style.fontWeight="bold",k.style.fontStyle="italic",this._measureElements=[v,h,w,k],this._container.appendChild(v),this._container.appendChild(h),this._container.appendChild(w),this._container.appendChild(k),_.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(u,_,v,h){u===this._font&&_===this._fontSize&&v===this._weight&&h===this._weightBold||(this._font=u,this._fontSize=_,this._weight=v,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${v}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${v}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(u,_,v){let h=0;if(!_&&!v&&u.length===1&&(h=u.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const L=this._measure(u,0);return L>0&&(this._flat[h]=L),L}let w=u;_&&(w+="B"),v&&(w+="I");let k=this._holey.get(w);if(k===void 0){let L=0;_&&(L|=1),v&&(L|=2),k=this._measure(u,L),k>0&&this._holey.set(w,k)}return k}_measure(u,_){const v=this._measureElements[_];return v.textContent=u.repeat(32),v.offsetWidth/32}}},2223:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const _=u(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=_.isFirefox||_.isLegacyEdge?"bottom":"ideographic"},6171:(C,r)=>{function u(v){return 57508<=v&&v<=57558}function _(v){return v>=128512&&v<=128591||v>=127744&&v<=128511||v>=128640&&v<=128767||v>=9728&&v<=9983||v>=9984&&v<=10175||v>=65024&&v<=65039||v>=129280&&v<=129535||v>=127462&&v<=127487}Object.defineProperty(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(v){if(!v)throw new Error("value must not be falsy");return v},r.isPowerlineGlyph=u,r.isRestrictedPowerlineGlyph=function(v){return 57520<=v&&v<=57527},r.isEmoji=_,r.allowRescaling=function(v,h,w,k){return h===1&&w>Math.ceil(1.5*k)&&v!==void 0&&v>255&&!_(v)&&!u(v)&&!(function(L){return 57344<=L&&L<=63743})(v)},r.treatGlyphAsBackgroundColor=function(v){return u(v)||(function(h){return 9472<=h&&h<=9631})(v)},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(v,h,w=0){return(v-(2*Math.round(h)-w))%(2*Math.round(h))}},6052:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createSelectionRenderModel=void 0;class u{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(v,h,w,k=!1){if(this.selectionStart=h,this.selectionEnd=w,!h||!w||h[0]===w[0]&&h[1]===w[1])return void this.clear();const L=v.buffers.active.ydisp,f=h[1]-L,a=w[1]-L,p=Math.max(f,0),m=Math.min(a,v.rows-1);p>=v.rows||m<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=k,this.viewportStartRow=f,this.viewportEndRow=a,this.viewportCappedStartRow=p,this.viewportCappedEndRow=m,this.startCol=h[0],this.endCol=w[0])}isCellSelected(v,h,w){return!!this.hasSelection&&(w-=v.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&w>=this.viewportCappedStartRow&&h<this.endCol&&w<=this.viewportCappedEndRow:h<this.startCol&&w>=this.viewportCappedStartRow&&h>=this.endCol&&w<=this.viewportCappedEndRow:w>this.viewportStartRow&&w<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&w===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&w===this.viewportStartRow&&h>=this.startCol)}}r.createSelectionRenderModel=function(){return new u}},456:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(u){this._bufferService=u,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 u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,_=this.selectionEnd;return!(!u||!_)&&(u[1]>_[1]||u[1]===_[1]&&u[0]>_[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(C,r,u){var _=this&&this.__decorate||function(m,d,x,I){var E,M=arguments.length,b=M<3?d:I===null?I=Object.getOwnPropertyDescriptor(d,x):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(m,d,x,I);else for(var R=m.length-1;R>=0;R--)(E=m[R])&&(b=(M<3?E(b):M>3?E(d,x,b):E(d,x))||b);return M>3&&b&&Object.defineProperty(d,x,b),b},v=this&&this.__param||function(m,d){return function(x,I){d(x,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const h=u(2585),w=u(8460),k=u(844);let L=r.CharSizeService=class extends k.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(m,d,x){super(),this._optionsService=x,this.width=0,this.height=0,this._onCharSizeChange=this.register(new w.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new p(this._optionsService))}catch{this._measureStrategy=this.register(new a(m,d,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const m=this._measureStrategy.measure();m.width===this.width&&m.height===this.height||(this.width=m.width,this.height=m.height,this._onCharSizeChange.fire())}};r.CharSizeService=L=_([v(2,h.IOptionsService)],L);class f extends k.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(d,x){d!==void 0&&d>0&&x!==void 0&&x>0&&(this._result.width=d,this._result.height=x)}}class a extends f{constructor(d,x,I){super(),this._document=d,this._parentElement=x,this._optionsService=I,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class p extends f{constructor(d){super(),this._optionsService=d,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const x=this._ctx.measureText("W");if(!("width"in x&&"fontBoundingBoxAscent"in x&&"fontBoundingBoxDescent"in x))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const d=this._ctx.measureText("W");return this._validateAndSet(d.width,d.fontBoundingBoxAscent+d.fontBoundingBoxDescent),this._result}}},4269:function(C,r,u){var _=this&&this.__decorate||function(p,m,d,x){var I,E=arguments.length,M=E<3?m:x===null?x=Object.getOwnPropertyDescriptor(m,d):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(p,m,d,x);else for(var b=p.length-1;b>=0;b--)(I=p[b])&&(M=(E<3?I(M):E>3?I(m,d,M):I(m,d))||M);return E>3&&M&&Object.defineProperty(m,d,M),M},v=this&&this.__param||function(p,m){return function(d,x){m(d,x,p)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const h=u(3734),w=u(643),k=u(511),L=u(2585);class f extends h.AttributeData{constructor(m,d,x){super(),this.content=0,this.combinedData="",this.fg=m.fg,this.bg=m.bg,this.combinedData=d,this._width=x}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(m){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=f;let a=r.CharacterJoinerService=class Ym{constructor(m){this._bufferService=m,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new k.CellData}register(m){const d={id:this._nextCharacterJoinerId++,handler:m};return this._characterJoiners.push(d),d.id}deregister(m){for(let d=0;d<this._characterJoiners.length;d++)if(this._characterJoiners[d].id===m)return this._characterJoiners.splice(d,1),!0;return!1}getJoinedCharacters(m){if(this._characterJoiners.length===0)return[];const d=this._bufferService.buffer.lines.get(m);if(!d||d.length===0)return[];const x=[],I=d.translateToString(!0);let E=0,M=0,b=0,R=d.getFg(0),D=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!==R||this._workCell.bg!==D){if(B-E>1){const O=this._getJoinedRanges(I,b,M,d,E);for(let F=0;F<O.length;F++)x.push(O[F])}E=B,b=M,R=this._workCell.fg,D=this._workCell.bg}M+=this._workCell.getChars().length||w.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-E>1){const B=this._getJoinedRanges(I,b,M,d,E);for(let O=0;O<B.length;O++)x.push(B[O])}return x}_getJoinedRanges(m,d,x,I,E){const M=m.substring(d,x);let b=[];try{b=this._characterJoiners[0].handler(M)}catch(R){console.error(R)}for(let R=1;R<this._characterJoiners.length;R++)try{const D=this._characterJoiners[R].handler(M);for(let B=0;B<D.length;B++)Ym._mergeRanges(b,D[B])}catch(D){console.error(D)}return this._stringRangesToCellRanges(b,I,E),b}_stringRangesToCellRanges(m,d,x){let I=0,E=!1,M=0,b=m[I];if(b){for(let R=x;R<this._bufferService.cols;R++){const D=d.getWidth(R),B=d.getString(R).length||w.WHITESPACE_CELL_CHAR.length;if(D!==0){if(!E&&b[0]<=M&&(b[0]=R,E=!0),b[1]<=M){if(b[1]=R,b=m[++I],!b)break;b[0]<=M?(b[0]=R,E=!0):E=!1}M+=B}}b&&(b[1]=this._bufferService.cols)}}static _mergeRanges(m,d){let x=!1;for(let I=0;I<m.length;I++){const E=m[I];if(x){if(d[1]<=E[0])return m[I-1][1]=d[1],m;if(d[1]<=E[1])return m[I-1][1]=Math.max(d[1],E[1]),m.splice(I,1),m;m.splice(I,1),I--}else{if(d[1]<=E[0])return m.splice(I,0,d),m;if(d[1]<=E[1])return E[0]=Math.min(d[0],E[0]),m;d[0]<E[1]&&(E[0]=Math.min(d[0],E[0]),x=!0)}}return x?m[m.length-1][1]=d[1]:m.push(d),m}};r.CharacterJoinerService=a=_([v(0,L.IBufferService)],a)},5114:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0;const _=u(844),v=u(8460),h=u(3656);class w extends _.Disposable{constructor(f,a,p){super(),this._textarea=f,this._window=a,this.mainDocument=p,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new k(this._window),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new v.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((m=>this._screenDprMonitor.setWindow(m)))),this.register((0,v.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(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=w;class k extends _.Disposable{constructor(f){super(),this._parentWindow=f,this._windowResizeListener=this.register(new _.MutableDisposable),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,_.toDisposable)((()=>this.clearListener())))}setWindow(f){this._parentWindow=f,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var 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:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkProviderService=void 0;const _=u(844);class v extends _.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,_.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(w){return this.linkProviders.push(w),{dispose:()=>{const k=this.linkProviders.indexOf(w);k!==-1&&this.linkProviders.splice(k,1)}}}}r.LinkProviderService=v},8934:function(C,r,u){var _=this&&this.__decorate||function(L,f,a,p){var m,d=arguments.length,x=d<3?f:p===null?p=Object.getOwnPropertyDescriptor(f,a):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(L,f,a,p);else for(var I=L.length-1;I>=0;I--)(m=L[I])&&(x=(d<3?m(x):d>3?m(f,a,x):m(f,a))||x);return d>3&&x&&Object.defineProperty(f,a,x),x},v=this&&this.__param||function(L,f){return function(a,p){f(a,p,L)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const h=u(4725),w=u(9806);let k=r.MouseService=class{constructor(L,f){this._renderService=L,this._charSizeService=f}getCoords(L,f,a,p,m){return(0,w.getCoords)(window,L,f,a,p,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,m)}getMouseReportCoords(L,f){const a=(0,w.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=k=_([v(0,h.IRenderService),v(1,h.ICharSizeService)],k)},3230:function(C,r,u){var _=this&&this.__decorate||function(m,d,x,I){var E,M=arguments.length,b=M<3?d:I===null?I=Object.getOwnPropertyDescriptor(d,x):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(m,d,x,I);else for(var R=m.length-1;R>=0;R--)(E=m[R])&&(b=(M<3?E(b):M>3?E(d,x,b):E(d,x))||b);return M>3&&b&&Object.defineProperty(d,x,b),b},v=this&&this.__param||function(m,d){return function(x,I){d(x,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const h=u(6193),w=u(4725),k=u(8460),L=u(844),f=u(7226),a=u(2585);let p=r.RenderService=class extends L.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(m,d,x,I,E,M,b,R){super(),this._rowCount=m,this._charSizeService=I,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 k.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new k.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new k.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new k.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((D,B)=>this._renderRows(D,B)),b),this.register(this._renderDebouncer),this.register(b.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(M.onResize((()=>this._fullRefresh()))),this.register(M.buffers.onBufferActivate((()=>{var D;return(D=this._renderer.value)==null?void 0:D.clear()}))),this.register(x.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(E.onDecorationRegistered((()=>this._fullRefresh()))),this.register(E.onDecorationRemoved((()=>this._fullRefresh()))),this.register(x.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(M.cols,M.rows),this._fullRefresh()}))),this.register(x.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(M.buffer.y,M.buffer.y,!0)))),this.register(R.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(b.window,d),this.register(b.onWindowChange((D=>this._registerIntersectionObserver(D,d))))}_registerIntersectionObserver(m,d){if("IntersectionObserver"in m){const x=new m.IntersectionObserver((I=>this._handleIntersectionChange(I[I.length-1])),{threshold:0});x.observe(d),this._observerDisposable.value=(0,L.toDisposable)((()=>x.disconnect()))}}_handleIntersectionChange(m){this._isPaused=m.isIntersecting===void 0?m.intersectionRatio===0:!m.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(m,d,x=!1){this._isPaused?this._needsFullRefresh=!0:(x||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(m,d,this._rowCount))}_renderRows(m,d){this._renderer.value&&(m=Math.min(m,this._rowCount-1),d=Math.min(d,this._rowCount-1),this._renderer.value.renderRows(m,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:m,end:d}),this._onRender.fire({start:m,end:d}),this._isNextRenderRedrawOnly=!0)}resize(m,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(m){this._renderer.value=m,this._renderer.value&&(this._renderer.value.onRequestRedraw((d=>this.refreshRows(d.start,d.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(m){return this._renderDebouncer.addRefreshCallback(m)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var m,d;this._renderer.value&&((d=(m=this._renderer.value).clearTextureAtlas)==null||d.call(m),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(m,d){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var x;return(x=this._renderer.value)==null?void 0:x.handleResize(m,d)})):this._renderer.value.handleResize(m,d),this._fullRefresh())}handleCharSizeChanged(){var m;(m=this._renderer.value)==null||m.handleCharSizeChanged()}handleBlur(){var m;(m=this._renderer.value)==null||m.handleBlur()}handleFocus(){var m;(m=this._renderer.value)==null||m.handleFocus()}handleSelectionChanged(m,d,x){var I;this._selectionState.start=m,this._selectionState.end=d,this._selectionState.columnSelectMode=x,(I=this._renderer.value)==null||I.handleSelectionChanged(m,d,x)}handleCursorMove(){var m;(m=this._renderer.value)==null||m.handleCursorMove()}clear(){var m;(m=this._renderer.value)==null||m.clear()}};r.RenderService=p=_([v(2,a.IOptionsService),v(3,w.ICharSizeService),v(4,a.IDecorationService),v(5,a.IBufferService),v(6,w.ICoreBrowserService),v(7,w.IThemeService)],p)},9312:function(C,r,u){var _=this&&this.__decorate||function(b,R,D,B){var O,F=arguments.length,U=F<3?R:B===null?B=Object.getOwnPropertyDescriptor(R,D):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(b,R,D,B);else for(var q=b.length-1;q>=0;q--)(O=b[q])&&(U=(F<3?O(U):F>3?O(R,D,U):O(R,D))||U);return F>3&&U&&Object.defineProperty(R,D,U),U},v=this&&this.__param||function(b,R){return function(D,B){R(D,B,b)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const h=u(9806),w=u(9504),k=u(456),L=u(4725),f=u(8460),a=u(844),p=u(6114),m=u(4841),d=u(511),x=u(2585),I=" ",E=new RegExp(I,"g");let M=r.SelectionService=class extends a.Disposable{constructor(b,R,D,B,O,F,U,q,X){super(),this._element=b,this._screenElement=R,this._linkifier=D,this._bufferService=B,this._coreService=O,this._mouseService=F,this._optionsService=U,this._renderService=q,this._coreBrowserService=X,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=Y=>this._handleMouseMove(Y),this._mouseUpListener=Y=>this._handleMouseUp(Y),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Y=>this._handleTrim(Y))),this.register(this._bufferService.buffers.onBufferActivate((Y=>this._handleBufferActivate(Y)))),this.enable(),this._model=new k.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,R=this._model.finalSelectionEnd;return!(!b||!R||b[0]===R[0]&&b[1]===R[1])}get selectionText(){const b=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;if(!b||!R)return"";const D=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(b[0]===R[0])return"";const O=b[0]<R[0]?b[0]:R[0],F=b[0]<R[0]?R[0]:b[0];for(let U=b[1];U<=R[1];U++){const q=D.translateBufferLineToString(U,!0,O,F);B.push(q)}}else{const O=b[1]===R[1]?R[0]:void 0;B.push(D.translateBufferLineToString(b[1],!0,b[0],O));for(let F=b[1]+1;F<=R[1]-1;F++){const U=D.lines.get(F),q=D.translateBufferLineToString(F,!0);U!=null&&U.isWrapped?B[B.length-1]+=q:B.push(q)}if(b[1]!==R[1]){const F=D.lines.get(R[1]),U=D.translateBufferLineToString(R[1],!0,0,R[0]);F&&F.isWrapped?B[B.length-1]+=U:B.push(U)}}return B.map((O=>O.replace(E," "))).join(p.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()))),p.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 R=this._getMouseBufferCoords(b),D=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(D&&B&&R)&&this._areCoordsInSelection(R,D,B)}isCellInSelection(b,R){const D=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!D||!B)&&this._areCoordsInSelection([b,R],D,B)}_areCoordsInSelection(b,R,D){return b[1]>R[1]&&b[1]<D[1]||R[1]===D[1]&&b[1]===R[1]&&b[0]>=R[0]&&b[0]<D[0]||R[1]<D[1]&&b[1]===D[1]&&b[0]<D[0]||R[1]<D[1]&&b[1]===R[1]&&b[0]>=R[0]}_selectWordAtCursor(b,R){var O,F;const D=(F=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:F.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,m.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(b);return!!B&&(this._selectWordAt(B,R),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(b,R){this._model.clearSelection(),b=Math.max(b,0),R=Math.min(R,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,b],this._model.selectionEnd=[this._bufferService.cols,R],this.refresh(),this._onSelectionChange.fire()}_handleTrim(b){this._model.handleTrim(b)&&this.refresh()}_getMouseBufferCoords(b){const R=this._mouseService.getCoords(b,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(R)return R[0]--,R[1]--,R[1]+=this._bufferService.buffer.ydisp,R}_getMouseEventScrollAmount(b){let R=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,b,this._screenElement)[1];const D=this._renderService.dimensions.css.canvas.height;return R>=0&&R<=D?0:(R>D&&(R-=D),R=Math.min(Math.max(R,-50),50),R/=50,R/Math.abs(R)+Math.round(14*R))}shouldForceSelection(b){return p.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 R=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);R&&R.length!==this._model.selectionStart[0]&&R.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(b){this._selectWordAtCursor(b,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(b){const R=this._getMouseBufferCoords(b);R&&(this._activeSelectionMode=2,this._selectLineAt(R[1]))}shouldColumnSelect(b){return b.altKey&&!(p.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(b){if(b.stopImmediatePropagation(),!this._model.selectionStart)return;const R=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(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 D=this._bufferService.buffer;if(this._model.selectionEnd[1]<D.lines.length){const B=D.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]++}R&&R[0]===this._model.selectionEnd[0]&&R[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const 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 R=b.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&R<500&&b.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const D=this._mouseService.getCoords(b,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(D&&D[0]!==void 0&&D[1]!==void 0){const B=(0,w.moveToCellSequence)(D[0]-1,D[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const b=this._model.finalSelectionStart,R=this._model.finalSelectionEnd,D=!(!b||!R||b[0]===R[0]&&b[1]===R[1]);D?b&&R&&(this._oldSelectionStart&&this._oldSelectionEnd&&b[0]===this._oldSelectionStart[0]&&b[1]===this._oldSelectionStart[1]&&R[0]===this._oldSelectionEnd[0]&&R[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(b,R,D)):this._oldHasSelection&&this._fireOnSelectionChange(b,R,D)}_fireOnSelectionChange(b,R,D){this._oldSelectionStart=b,this._oldSelectionEnd=R,this._oldHasSelection=D,this._onSelectionChange.fire()}_handleBufferActivate(b){this.clearSelection(),this._trimListener.dispose(),this._trimListener=b.activeBuffer.lines.onTrim((R=>this._handleTrim(R)))}_convertViewportColToCharacterIndex(b,R){let D=R;for(let B=0;R>=B;B++){const O=b.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?D--:O>1&&R!==B&&(D+=O-1)}return D}setSelection(b,R,D){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[b,R],this._model.selectionStartLength=D,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(b){this._isClickInSelection(b)||(this._selectWordAtCursor(b,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(b,R,D=!0,B=!0){if(b[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,F=O.lines.get(b[1]);if(!F)return;const U=O.translateBufferLineToString(b[1],!1);let q=this._convertViewportColToCharacterIndex(F,b[0]),X=q;const Y=b[0]-q;let V=0,j=0,$=0,H=0;if(U.charAt(q)===" "){for(;q>0&&U.charAt(q-1)===" ";)q--;for(;X<U.length&&U.charAt(X+1)===" ";)X++}else{let re=b[0],le=b[0];F.getWidth(re)===0&&(V++,re--),F.getWidth(le)===2&&(j++,le++);const de=F.getString(le).length;for(de>1&&(H+=de-1,X+=de-1);re>0&&q>0&&!this._isCharWordSeparator(F.loadCell(re-1,this._workCell));){F.loadCell(re-1,this._workCell);const G=this._workCell.getChars().length;this._workCell.getWidth()===0?(V++,re--):G>1&&($+=G-1,q-=G-1),q--,re--}for(;le<F.length&&X+1<U.length&&!this._isCharWordSeparator(F.loadCell(le+1,this._workCell));){F.loadCell(le+1,this._workCell);const G=this._workCell.getChars().length;this._workCell.getWidth()===2?(j++,le++):G>1&&(H+=G-1,X+=G-1),X++,le++}}X++;let K=q+Y-V+$,te=Math.min(this._bufferService.cols,X-q+V+j-$-H);if(R||U.slice(q,X).trim()!==""){if(D&&K===0&&F.getCodePoint(0)!==32){const re=O.lines.get(b[1]-1);if(re&&F.isWrapped&&re.getCodePoint(this._bufferService.cols-1)!==32){const le=this._getWordAt([this._bufferService.cols-1,b[1]-1],!1,!0,!1);if(le){const de=this._bufferService.cols-le.start;K-=de,te+=de}}}if(B&&K+te===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const re=O.lines.get(b[1]+1);if(re!=null&&re.isWrapped&&re.getCodePoint(0)!==32){const le=this._getWordAt([0,b[1]+1],!1,!1,!0);le&&(te+=le.length)}}return{start:K,length:te}}}_selectWordAt(b,R){const D=this._getWordAt(b,R);if(D){for(;D.start<0;)D.start+=this._bufferService.cols,b[1]--;this._model.selectionStart=[D.start,b[1]],this._model.selectionStartLength=D.length}}_selectToWordAt(b){const R=this._getWordAt(b,!0);if(R){let D=b[1];for(;R.start<0;)R.start+=this._bufferService.cols,D--;if(!this._model.areSelectionValuesReversed())for(;R.start+R.length>this._bufferService.cols;)R.length-=this._bufferService.cols,D++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?R.start:R.start+R.length,D]}}_isCharWordSeparator(b){return b.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(b.getChars())>=0}_selectLineAt(b){const R=this._bufferService.buffer.getWrappedRangeForLine(b),D={start:{x:0,y:R.first},end:{x:this._bufferService.cols-1,y:R.last}};this._model.selectionStart=[0,R.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,m.getRangeLength)(D,this._bufferService.cols)}};r.SelectionService=M=_([v(3,x.IBufferService),v(4,x.ICoreService),v(5,L.IMouseService),v(6,x.IOptionsService),v(7,L.IRenderService),v(8,L.ICoreBrowserService)],M)},4725:(C,r,u)=>{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 _=u(8343);r.ICharSizeService=(0,_.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,_.createDecorator)("CoreBrowserService"),r.IMouseService=(0,_.createDecorator)("MouseService"),r.IRenderService=(0,_.createDecorator)("RenderService"),r.ISelectionService=(0,_.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,_.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,_.createDecorator)("ThemeService"),r.ILinkProviderService=(0,_.createDecorator)("LinkProviderService")},6731:function(C,r,u){var _=this&&this.__decorate||function(M,b,R,D){var B,O=arguments.length,F=O<3?b:D===null?D=Object.getOwnPropertyDescriptor(b,R):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(M,b,R,D);else for(var U=M.length-1;U>=0;U--)(B=M[U])&&(F=(O<3?B(F):O>3?B(b,R,F):B(b,R))||F);return O>3&&F&&Object.defineProperty(b,R,F),F},v=this&&this.__param||function(M,b){return function(R,D){b(R,D,M)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const h=u(7239),w=u(8055),k=u(8460),L=u(844),f=u(2585),a=w.css.toColor("#ffffff"),p=w.css.toColor("#000000"),m=w.css.toColor("#ffffff"),d=w.css.toColor("#000000"),x={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const M=[w.css.toColor("#2e3436"),w.css.toColor("#cc0000"),w.css.toColor("#4e9a06"),w.css.toColor("#c4a000"),w.css.toColor("#3465a4"),w.css.toColor("#75507b"),w.css.toColor("#06989a"),w.css.toColor("#d3d7cf"),w.css.toColor("#555753"),w.css.toColor("#ef2929"),w.css.toColor("#8ae234"),w.css.toColor("#fce94f"),w.css.toColor("#729fcf"),w.css.toColor("#ad7fa8"),w.css.toColor("#34e2e2"),w.css.toColor("#eeeeec")],b=[0,95,135,175,215,255];for(let R=0;R<216;R++){const D=b[R/36%6|0],B=b[R/6%6|0],O=b[R%6];M.push({css:w.channels.toCss(D,B,O),rgba:w.channels.toRgba(D,B,O)})}for(let R=0;R<24;R++){const D=8+10*R;M.push({css:w.channels.toCss(D,D,D),rgba:w.channels.toRgba(D,D,D)})}return M})());let I=r.ThemeService=class extends L.Disposable{get colors(){return this._colors}constructor(M){super(),this._optionsService=M,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new k.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:a,background:p,cursor:m,cursorAccent:d,selectionForeground:void 0,selectionBackgroundTransparent:x,selectionBackgroundOpaque:w.color.blend(p,x),selectionInactiveBackgroundTransparent:x,selectionInactiveBackgroundOpaque:w.color.blend(p,x),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,p),b.cursor=E(M.cursor,m),b.cursorAccent=E(M.cursorAccent,d),b.selectionBackgroundTransparent=E(M.selectionBackground,x),b.selectionBackgroundOpaque=w.color.blend(b.background,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundTransparent=E(M.selectionInactiveBackground,b.selectionBackgroundTransparent),b.selectionInactiveBackgroundOpaque=w.color.blend(b.background,b.selectionInactiveBackgroundTransparent),b.selectionForeground=M.selectionForeground?E(M.selectionForeground,w.NULL_COLOR):void 0,b.selectionForeground===w.NULL_COLOR&&(b.selectionForeground=void 0),w.color.isOpaque(b.selectionBackgroundTransparent)&&(b.selectionBackgroundTransparent=w.color.opacity(b.selectionBackgroundTransparent,.3)),w.color.isOpaque(b.selectionInactiveBackgroundTransparent)&&(b.selectionInactiveBackgroundTransparent=w.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 R=Math.min(b.ansi.length-16,M.extendedAnsi.length);for(let D=0;D<R;D++)b.ansi[D+16]=E(M.extendedAnsi[D],r.DEFAULT_ANSI_COLORS[D+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 w.css.toColor(M)}catch{}return b}r.ThemeService=I=_([v(0,f.IOptionsService)],I)},6349:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const _=u(8460),v=u(844);class h extends v.Disposable{constructor(k){super(),this._maxLength=k,this.onDeleteEmitter=this.register(new _.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new _.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new _.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(k){if(this._maxLength===k)return;const L=new Array(k);for(let f=0;f<Math.min(k,this.length);f++)L[f]=this._array[this._getCyclicIndex(f)];this._array=L,this._maxLength=k,this._startIndex=0}get length(){return this._length}set length(k){if(k>this._length)for(let L=this._length;L<k;L++)this._array[L]=void 0;this._length=k}get(k){return this._array[this._getCyclicIndex(k)]}set(k,L){this._array[this._getCyclicIndex(k)]=L}push(k){this._array[this._getCyclicIndex(this._length)]=k,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(k,L,...f){if(L){for(let a=k;a<this._length-L;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+L)];this._length-=L,this.onDeleteEmitter.fire({index:k,amount:L})}for(let a=this._length-1;a>=k;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(k+a)]=f[a];if(f.length&&this.onInsertEmitter.fire({index:k,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(k){k>this._length&&(k=this._length),this._startIndex+=k,this._length-=k,this.onTrimEmitter.fire(k)}shiftElements(k,L,f){if(!(L<=0)){if(k<0||k>=this._length)throw new Error("start argument out of range");if(k+f<0)throw new Error("Cannot shift elements in list beyond index 0");if(f>0){for(let p=L-1;p>=0;p--)this.set(k+p+f,this.get(k+p));const a=k+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(k+a+f,this.get(k+a))}}_getCyclicIndex(k){return(this._startIndex+k)%this._maxLength}}r.CircularList=h},1439:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function u(_,v=5){if(typeof _!="object")return _;const h=Array.isArray(_)?[]:{};for(const w in _)h[w]=v<=1?_[w]:_[w]&&u(_[w],v-1);return h}},8055:(C,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 u=0,_=0,v=0,h=0;var w,k,L,f,a;function p(d){const x=d.toString(16);return x.length<2?"0"+x:x}function m(d,x){return d<x?(x+.05)/(d+.05):(d+.05)/(x+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(d){d.toCss=function(x,I,E,M){return M!==void 0?`#${p(x)}${p(I)}${p(E)}${p(M)}`:`#${p(x)}${p(I)}${p(E)}`},d.toRgba=function(x,I,E,M=255){return(x<<24|I<<16|E<<8|M)>>>0},d.toColor=function(x,I,E,M){return{css:d.toCss(x,I,E,M),rgba:d.toRgba(x,I,E,M)}}})(w||(r.channels=w={})),(function(d){function x(I,E){return h=Math.round(255*E),[u,_,v]=a.toChannels(I.rgba),{css:w.toCss(u,_,v,h),rgba:w.toRgba(u,_,v,h)}}d.blend=function(I,E){if(h=(255&E.rgba)/255,h===1)return{css:E.css,rgba:E.rgba};const M=E.rgba>>24&255,b=E.rgba>>16&255,R=E.rgba>>8&255,D=I.rgba>>24&255,B=I.rgba>>16&255,O=I.rgba>>8&255;return u=D+Math.round((M-D)*h),_=B+Math.round((b-B)*h),v=O+Math.round((R-O)*h),{css:w.toCss(u,_,v),rgba:w.toRgba(u,_,v)}},d.isOpaque=function(I){return(255&I.rgba)==255},d.ensureContrastRatio=function(I,E,M){const b=a.ensureContrastRatio(I.rgba,E.rgba,M);if(b)return w.toColor(b>>24&255,b>>16&255,b>>8&255)},d.opaque=function(I){const E=(255|I.rgba)>>>0;return[u,_,v]=a.toChannels(E),{css:w.toCss(u,_,v),rgba:E}},d.opacity=x,d.multiplyOpacity=function(I,E){return h=255&I.rgba,x(I,h*E/255)},d.toColorRGB=function(I){return[I.rgba>>24&255,I.rgba>>16&255,I.rgba>>8&255]}})(k||(r.color=k={})),(function(d){let x,I;try{const E=document.createElement("canvas");E.width=1,E.height=1;const M=E.getContext("2d",{willReadFrequently:!0});M&&(x=M,x.globalCompositeOperation="copy",I=x.createLinearGradient(0,0,1,1))}catch{}d.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return u=parseInt(E.slice(1,2).repeat(2),16),_=parseInt(E.slice(2,3).repeat(2),16),v=parseInt(E.slice(3,4).repeat(2),16),w.toColor(u,_,v);case 5:return u=parseInt(E.slice(1,2).repeat(2),16),_=parseInt(E.slice(2,3).repeat(2),16),v=parseInt(E.slice(3,4).repeat(2),16),h=parseInt(E.slice(4,5).repeat(2),16),w.toColor(u,_,v,h);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 u=parseInt(M[1]),_=parseInt(M[2]),v=parseInt(M[3]),h=Math.round(255*(M[5]===void 0?1:parseFloat(M[5]))),w.toColor(u,_,v,h);if(!x||!I)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=I,x.fillStyle=E,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[u,_,v,h]=x.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:w.toRgba(u,_,v,h),css:E}}})(L||(r.css=L={})),(function(d){function x(I,E,M){const b=I/255,R=E/255,D=M/255;return .2126*(b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4))+.7152*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}d.relativeLuminance=function(I){return x(I>>16&255,I>>8&255,255&I)},d.relativeLuminance2=x})(f||(r.rgb=f={})),(function(d){function x(E,M,b){const R=E>>24&255,D=E>>16&255,B=E>>8&255;let O=M>>24&255,F=M>>16&255,U=M>>8&255,q=m(f.relativeLuminance2(O,F,U),f.relativeLuminance2(R,D,B));for(;q<b&&(O>0||F>0||U>0);)O-=Math.max(0,Math.ceil(.1*O)),F-=Math.max(0,Math.ceil(.1*F)),U-=Math.max(0,Math.ceil(.1*U)),q=m(f.relativeLuminance2(O,F,U),f.relativeLuminance2(R,D,B));return(O<<24|F<<16|U<<8|255)>>>0}function I(E,M,b){const R=E>>24&255,D=E>>16&255,B=E>>8&255;let O=M>>24&255,F=M>>16&255,U=M>>8&255,q=m(f.relativeLuminance2(O,F,U),f.relativeLuminance2(R,D,B));for(;q<b&&(O<255||F<255||U<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),F=Math.min(255,F+Math.ceil(.1*(255-F))),U=Math.min(255,U+Math.ceil(.1*(255-U))),q=m(f.relativeLuminance2(O,F,U),f.relativeLuminance2(R,D,B));return(O<<24|F<<16|U<<8|255)>>>0}d.blend=function(E,M){if(h=(255&M)/255,h===1)return M;const b=M>>24&255,R=M>>16&255,D=M>>8&255,B=E>>24&255,O=E>>16&255,F=E>>8&255;return u=B+Math.round((b-B)*h),_=O+Math.round((R-O)*h),v=F+Math.round((D-F)*h),w.toRgba(u,_,v)},d.ensureContrastRatio=function(E,M,b){const R=f.relativeLuminance(E>>8),D=f.relativeLuminance(M>>8);if(m(R,D)<b){if(D<R){const F=x(E,M,b),U=m(R,f.relativeLuminance(F>>8));if(U<b){const q=I(E,M,b);return U>m(R,f.relativeLuminance(q>>8))?F:q}return F}const B=I(E,M,b),O=m(R,f.relativeLuminance(B>>8));if(O<b){const F=x(E,M,b);return O>m(R,f.relativeLuminance(F>>8))?B:F}return B}},d.reduceLuminance=x,d.increaseLuminance=I,d.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(a||(r.rgba=a={})),r.toPaddedHex=p,r.contrastRatio=m},8969:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const _=u(844),v=u(2585),h=u(4348),w=u(7866),k=u(744),L=u(7302),f=u(6975),a=u(8460),p=u(1753),m=u(1480),d=u(7994),x=u(9282),I=u(5435),E=u(5981),M=u(2660);let b=!1;class R extends _.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new a.EventEmitter),this._onScroll.event((B=>{var O;(O=this._onScrollApi)==null||O.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 O in B)this.optionsService.options[O]=B[O]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new _.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 h.InstantiationService,this.optionsService=this.register(new L.OptionsService(B)),this._instantiationService.setService(v.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(k.BufferService)),this._instantiationService.setService(v.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(w.LogService)),this._instantiationService.setService(v.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(f.CoreService)),this._instantiationService.setService(v.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(p.CoreMouseService)),this._instantiationService.setService(v.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(m.UnicodeService)),this._instantiationService.setService(v.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(d.CharsetService),this._instantiationService.setService(v.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(M.OscLinkService),this._instantiationService.setService(v.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new I.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((O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((O=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new E.WriteBuffer(((O,F)=>this._inputHandler.parse(O,F)))),this.register((0,a.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,O){this._writeBuffer.write(B,O)}writeSync(B,O){this._logService.logLevel<=v.LogLevelEnum.WARN&&!b&&(this._logService.warn("writeSync is unreliable and will be removed soon."),b=!0),this._writeBuffer.writeSync(B,O)}input(B,O=!0){this.coreService.triggerDataEvent(B,O)}resize(B,O){isNaN(B)||isNaN(O)||(B=Math.max(B,k.MINIMUM_COLS),O=Math.max(O,k.MINIMUM_ROWS),this._bufferService.resize(B,O))}scroll(B,O=!1){this._bufferService.scroll(B,O)}scrollLines(B,O,F){this._bufferService.scrollLines(B,O,F)}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 O=B-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(B,O){return this._inputHandler.registerEscHandler(B,O)}registerDcsHandler(B,O){return this._inputHandler.registerDcsHandler(B,O)}registerCsiHandler(B,O){return this._inputHandler.registerCsiHandler(B,O)}registerOscHandler(B,O){return this._inputHandler.registerOscHandler(B,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?B=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(x.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},(()=>((0,x.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,_.toDisposable)((()=>{for(const O of B)O.dispose()}))}}}r.CoreTerminal=R},8460:(C,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=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let _=0;_<this._listeners.length;_++)if(this._listeners[_]===u)return void this._listeners.splice(_,1)}}})),this._event}fire(u,_){const v=[];for(let h=0;h<this._listeners.length;h++)v.push(this._listeners[h]);for(let h=0;h<v.length;h++)v[h].call(void 0,u,_)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(u,_){return u((v=>_.fire(v)))},r.runAndSubscribe=function(u,_){return _(void 0),u((v=>_(v)))}},5435:function(C,r,u){var _=this&&this.__decorate||function(V,j,$,H){var K,te=arguments.length,re=te<3?j:H===null?H=Object.getOwnPropertyDescriptor(j,$):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")re=Reflect.decorate(V,j,$,H);else for(var le=V.length-1;le>=0;le--)(K=V[le])&&(re=(te<3?K(re):te>3?K(j,$,re):K(j,$))||re);return te>3&&re&&Object.defineProperty(j,$,re),re},v=this&&this.__param||function(V,j){return function($,H){j($,H,V)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const h=u(2584),w=u(7116),k=u(2015),L=u(844),f=u(482),a=u(8437),p=u(8460),m=u(643),d=u(511),x=u(3734),I=u(2585),E=u(1480),M=u(6242),b=u(6351),R=u(5941),D={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function O(V,j){if(V>24)return j.setWinLines||!1;switch(V){case 1:return!!j.restoreWin;case 2:return!!j.minimizeWin;case 3:return!!j.setWinPosition;case 4:return!!j.setWinSizePixels;case 5:return!!j.raiseWin;case 6:return!!j.lowerWin;case 7:return!!j.refreshWin;case 8:return!!j.setWinSizeChars;case 9:return!!j.maximizeWin;case 10:return!!j.fullscreenWin;case 11:return!!j.getWinState;case 13:return!!j.getWinPosition;case 14:return!!j.getWinSizePixels;case 15:return!!j.getScreenSizePixels;case 16:return!!j.getCellSizePixels;case 18:return!!j.getWinSizeChars;case 19:return!!j.getScreenSizeChars;case 20:return!!j.getIconTitle;case 21:return!!j.getWinTitle;case 22:return!!j.pushTitle;case 23:return!!j.popTitle;case 24:return!!j.setWinLines}return!1}var F;(function(V){V[V.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",V[V.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(r.WindowsOptionsReportType=F={}));let U=0;class q extends L.Disposable{getAttrData(){return this._curAttrData}constructor(j,$,H,K,te,re,le,de,G=new k.EscapeSequenceParser){super(),this._bufferService=j,this._charsetService=$,this._coreService=H,this._logService=K,this._optionsService=te,this._oscLinkService=re,this._coreMouseService=le,this._unicodeService=de,this._parser=G,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 p.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new p.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new p.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new p.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new p.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new p.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new p.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new p.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new p.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new p.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new p.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new p.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new p.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new X(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((z=>this._activeBuffer=z.activeBuffer))),this._parser.setCsiHandlerFallback(((z,Q)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(z),params:Q.toArray()})})),this._parser.setEscHandlerFallback((z=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(z)})})),this._parser.setExecuteHandlerFallback((z=>{this._logService.debug("Unknown EXECUTE code: ",{code:z})})),this._parser.setOscHandlerFallback(((z,Q,Z)=>{this._logService.debug("Unknown OSC code: ",{identifier:z,action:Q,data:Z})})),this._parser.setDcsHandlerFallback(((z,Q,Z)=>{Q==="HOOK"&&(Z=Z.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(z),action:Q,payload:Z})})),this._parser.setPrintHandler(((z,Q,Z)=>this.print(z,Q,Z))),this._parser.registerCsiHandler({final:"@"},(z=>this.insertChars(z))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(z=>this.scrollLeft(z))),this._parser.registerCsiHandler({final:"A"},(z=>this.cursorUp(z))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(z=>this.scrollRight(z))),this._parser.registerCsiHandler({final:"B"},(z=>this.cursorDown(z))),this._parser.registerCsiHandler({final:"C"},(z=>this.cursorForward(z))),this._parser.registerCsiHandler({final:"D"},(z=>this.cursorBackward(z))),this._parser.registerCsiHandler({final:"E"},(z=>this.cursorNextLine(z))),this._parser.registerCsiHandler({final:"F"},(z=>this.cursorPrecedingLine(z))),this._parser.registerCsiHandler({final:"G"},(z=>this.cursorCharAbsolute(z))),this._parser.registerCsiHandler({final:"H"},(z=>this.cursorPosition(z))),this._parser.registerCsiHandler({final:"I"},(z=>this.cursorForwardTab(z))),this._parser.registerCsiHandler({final:"J"},(z=>this.eraseInDisplay(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(z=>this.eraseInDisplay(z,!0))),this._parser.registerCsiHandler({final:"K"},(z=>this.eraseInLine(z,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(z=>this.eraseInLine(z,!0))),this._parser.registerCsiHandler({final:"L"},(z=>this.insertLines(z))),this._parser.registerCsiHandler({final:"M"},(z=>this.deleteLines(z))),this._parser.registerCsiHandler({final:"P"},(z=>this.deleteChars(z))),this._parser.registerCsiHandler({final:"S"},(z=>this.scrollUp(z))),this._parser.registerCsiHandler({final:"T"},(z=>this.scrollDown(z))),this._parser.registerCsiHandler({final:"X"},(z=>this.eraseChars(z))),this._parser.registerCsiHandler({final:"Z"},(z=>this.cursorBackwardTab(z))),this._parser.registerCsiHandler({final:"`"},(z=>this.charPosAbsolute(z))),this._parser.registerCsiHandler({final:"a"},(z=>this.hPositionRelative(z))),this._parser.registerCsiHandler({final:"b"},(z=>this.repeatPrecedingCharacter(z))),this._parser.registerCsiHandler({final:"c"},(z=>this.sendDeviceAttributesPrimary(z))),this._parser.registerCsiHandler({prefix:">",final:"c"},(z=>this.sendDeviceAttributesSecondary(z))),this._parser.registerCsiHandler({final:"d"},(z=>this.linePosAbsolute(z))),this._parser.registerCsiHandler({final:"e"},(z=>this.vPositionRelative(z))),this._parser.registerCsiHandler({final:"f"},(z=>this.hVPosition(z))),this._parser.registerCsiHandler({final:"g"},(z=>this.tabClear(z))),this._parser.registerCsiHandler({final:"h"},(z=>this.setMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(z=>this.setModePrivate(z))),this._parser.registerCsiHandler({final:"l"},(z=>this.resetMode(z))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(z=>this.resetModePrivate(z))),this._parser.registerCsiHandler({final:"m"},(z=>this.charAttributes(z))),this._parser.registerCsiHandler({final:"n"},(z=>this.deviceStatus(z))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(z=>this.deviceStatusPrivate(z))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(z=>this.softReset(z))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(z=>this.setCursorStyle(z))),this._parser.registerCsiHandler({final:"r"},(z=>this.setScrollRegion(z))),this._parser.registerCsiHandler({final:"s"},(z=>this.saveCursor(z))),this._parser.registerCsiHandler({final:"t"},(z=>this.windowOptions(z))),this._parser.registerCsiHandler({final:"u"},(z=>this.restoreCursor(z))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(z=>this.insertColumns(z))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(z=>this.deleteColumns(z))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(z=>this.selectProtected(z))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(z=>this.requestMode(z,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(z=>this.requestMode(z,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new M.OscHandler((z=>(this.setTitle(z),this.setIconName(z),!0)))),this._parser.registerOscHandler(1,new M.OscHandler((z=>this.setIconName(z)))),this._parser.registerOscHandler(2,new M.OscHandler((z=>this.setTitle(z)))),this._parser.registerOscHandler(4,new M.OscHandler((z=>this.setOrReportIndexedColor(z)))),this._parser.registerOscHandler(8,new M.OscHandler((z=>this.setHyperlink(z)))),this._parser.registerOscHandler(10,new M.OscHandler((z=>this.setOrReportFgColor(z)))),this._parser.registerOscHandler(11,new M.OscHandler((z=>this.setOrReportBgColor(z)))),this._parser.registerOscHandler(12,new M.OscHandler((z=>this.setOrReportCursorColor(z)))),this._parser.registerOscHandler(104,new M.OscHandler((z=>this.restoreIndexedColor(z)))),this._parser.registerOscHandler(110,new M.OscHandler((z=>this.restoreFgColor(z)))),this._parser.registerOscHandler(111,new M.OscHandler((z=>this.restoreBgColor(z)))),this._parser.registerOscHandler(112,new M.OscHandler((z=>this.restoreCursorColor(z)))),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 z in w.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:z},(()=>this.selectCharset("("+z))),this._parser.registerEscHandler({intermediates:")",final:z},(()=>this.selectCharset(")"+z))),this._parser.registerEscHandler({intermediates:"*",final:z},(()=>this.selectCharset("*"+z))),this._parser.registerEscHandler({intermediates:"+",final:z},(()=>this.selectCharset("+"+z))),this._parser.registerEscHandler({intermediates:"-",final:z},(()=>this.selectCharset("-"+z))),this._parser.registerEscHandler({intermediates:".",final:z},(()=>this.selectCharset("."+z))),this._parser.registerEscHandler({intermediates:"/",final:z},(()=>this.selectCharset("/"+z)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((z=>(this._logService.error("Parsing error: ",z),z))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new b.DcsHandler(((z,Q)=>this.requestStatusString(z,Q))))}_preserveStack(j,$,H,K){this._parseStack.paused=!0,this._parseStack.cursorStartX=j,this._parseStack.cursorStartY=$,this._parseStack.decodedLength=H,this._parseStack.position=K}_logSlowResolvingAsync(j){this._logService.logLevel<=I.LogLevelEnum.WARN&&Promise.race([j,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(j,$){let H,K=this._activeBuffer.x,te=this._activeBuffer.y,re=0;const le=this._parseStack.paused;if(le){if(H=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,$))return this._logSlowResolvingAsync(H),H;K=this._parseStack.cursorStartX,te=this._parseStack.cursorStartY,this._parseStack.paused=!1,j.length>B&&(re=this._parseStack.position+B)}if(this._logService.logLevel<=I.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof j=="string"?` "${j}"`:` "${Array.prototype.map.call(j,(z=>String.fromCharCode(z))).join("")}"`),typeof j=="string"?j.split("").map((z=>z.charCodeAt(0))):j),this._parseBuffer.length<j.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(j.length,B))),le||this._dirtyRowTracker.clearRange(),j.length>B)for(let z=re;z<j.length;z+=B){const Q=z+B<j.length?z+B:j.length,Z=typeof j=="string"?this._stringDecoder.decode(j.substring(z,Q),this._parseBuffer):this._utf8Decoder.decode(j.subarray(z,Q),this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,Z))return this._preserveStack(K,te,Z,z),this._logSlowResolvingAsync(H),H}else if(!le){const z=typeof j=="string"?this._stringDecoder.decode(j,this._parseBuffer):this._utf8Decoder.decode(j,this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,z))return this._preserveStack(K,te,z,0),this._logSlowResolvingAsync(H),H}this._activeBuffer.x===K&&this._activeBuffer.y===te||this._onCursorMove.fire();const de=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),G=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);G<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(G,this._bufferService.rows-1),Math.min(de,this._bufferService.rows-1))}print(j,$,H){let K,te;const re=this._charsetService.charset,le=this._optionsService.rawOptions.screenReaderMode,de=this._bufferService.cols,G=this._coreService.decPrivateModes.wraparound,z=this._coreService.modes.insertMode,Q=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,Q);let ae=this._parser.precedingJoinState;for(let fe=$;fe<H;++fe){if(K=j[fe],K<127&&re){const ue=re[String.fromCharCode(K)];ue&&(K=ue.charCodeAt(0))}const Ee=this._unicodeService.charProperties(K,ae);te=E.UnicodeService.extractWidth(Ee);const Ae=E.UnicodeService.extractShouldJoin(Ee),ze=Ae?E.UnicodeService.extractWidth(ae):0;if(ae=Ee,le&&this._onA11yChar.fire((0,f.stringFromCodePoint)(K)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+te-ze>de){if(G){const ue=Z;let Me=this._activeBuffer.x-ze;for(this._activeBuffer.x=ze,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),Z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ze>0&&Z instanceof a.BufferLine&&Z.copyCellsFrom(ue,Me,0,ze,!1);Me<de;)ue.setCellFromCodepoint(Me++,0,1,Q)}else if(this._activeBuffer.x=de-1,te===2)continue}if(Ae&&this._activeBuffer.x){const ue=Z.getWidth(this._activeBuffer.x-1)?1:2;Z.addCodepointToCell(this._activeBuffer.x-ue,K,te);for(let Me=te-ze;--Me>=0;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,Q)}else if(z&&(Z.insertCells(this._activeBuffer.x,te-ze,this._activeBuffer.getNullCell(Q)),Z.getWidth(de-1)===2&&Z.setCellFromCodepoint(de-1,m.NULL_CELL_CODE,m.NULL_CELL_WIDTH,Q)),Z.setCellFromCodepoint(this._activeBuffer.x++,K,te,Q),te>0)for(;--te;)Z.setCellFromCodepoint(this._activeBuffer.x++,0,0,Q)}this._parser.precedingJoinState=ae,this._activeBuffer.x<de&&H-$>0&&Z.getWidth(this._activeBuffer.x)===0&&!Z.hasContent(this._activeBuffer.x)&&Z.setCellFromCodepoint(this._activeBuffer.x,0,1,Q),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(j,$){return j.final!=="t"||j.prefix||j.intermediates?this._parser.registerCsiHandler(j,$):this._parser.registerCsiHandler(j,(H=>!O(H.params[0],this._optionsService.rawOptions.windowOptions)||$(H)))}registerDcsHandler(j,$){return this._parser.registerDcsHandler(j,new b.DcsHandler($))}registerEscHandler(j,$){return this._parser.registerEscHandler(j,$)}registerOscHandler(j,$){return this._parser.registerOscHandler(j,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 j;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&j.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const $=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 j=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-j),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(j=this._bufferService.cols-1){this._activeBuffer.x=Math.min(j,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(j,$){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=j,this._activeBuffer.y=this._activeBuffer.scrollTop+$):(this._activeBuffer.x=j,this._activeBuffer.y=$),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(j,$){this._restrictCursor(),this._setCursor(this._activeBuffer.x+j,this._activeBuffer.y+$)}cursorUp(j){const $=this._activeBuffer.y-this._activeBuffer.scrollTop;return $>=0?this._moveCursor(0,-Math.min($,j.params[0]||1)):this._moveCursor(0,-(j.params[0]||1)),!0}cursorDown(j){const $=this._activeBuffer.scrollBottom-this._activeBuffer.y;return $>=0?this._moveCursor(0,Math.min($,j.params[0]||1)):this._moveCursor(0,j.params[0]||1),!0}cursorForward(j){return this._moveCursor(j.params[0]||1,0),!0}cursorBackward(j){return this._moveCursor(-(j.params[0]||1),0),!0}cursorNextLine(j){return this.cursorDown(j),this._activeBuffer.x=0,!0}cursorPrecedingLine(j){return this.cursorUp(j),this._activeBuffer.x=0,!0}cursorCharAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(j){return this._setCursor(j.length>=2?(j.params[1]||1)-1:0,(j.params[0]||1)-1),!0}charPosAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(j){return this._moveCursor(j.params[0]||1,0),!0}linePosAbsolute(j){return this._setCursor(this._activeBuffer.x,(j.params[0]||1)-1),!0}vPositionRelative(j){return this._moveCursor(0,j.params[0]||1),!0}hVPosition(j){return this.cursorPosition(j),!0}tabClear(j){const $=j.params[0];return $===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:$===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=j.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let $=j.params[0]||1;for(;$--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(j){const $=j.params[0];return $===1&&(this._curAttrData.bg|=536870912),$!==2&&$!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(j,$,H,K=!1,te=!1){const re=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);re.replaceCells($,H,this._activeBuffer.getNullCell(this._eraseAttrData()),te),K&&(re.isWrapped=!1)}_resetBufferLine(j,$=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);H&&(H.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),$),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+j),H.isWrapped=!1)}eraseInDisplay(j,$=!1){let H;switch(this._restrictCursor(this._bufferService.cols),j.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 K=this._activeBuffer.lines.length-this._bufferService.rows;K>0&&(this._activeBuffer.lines.trimStart(K),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-K,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-K,0),this._onScroll.fire(0))}return!0}eraseInLine(j,$=!1){switch(this._restrictCursor(this._bufferService.cols),j.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,$);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(j){this._restrictCursor();let $=j.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,K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,te=this._bufferService.rows-1+this._activeBuffer.ybase-K+1;for(;$--;)this._activeBuffer.lines.splice(te-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(j){this._restrictCursor();let $=j.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 K;for(K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-K;$--;)this._activeBuffer.lines.splice(H,1),this._activeBuffer.lines.splice(K,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(j){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.insertCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(j){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.deleteCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(j){let $=j.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(j){let $=j.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(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=j.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);K.deleteCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=j.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);K.insertCells(0,$,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=j.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);K.insertCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const $=j.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);K.deleteCells(this._activeBuffer.x,$,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(j){this._restrictCursor();const $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return $&&($.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(j.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(j){const $=this._parser.precedingJoinState;if(!$)return!0;const H=j.params[0]||1,K=E.UnicodeService.extractWidth($),te=this._activeBuffer.x-K,re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(te),le=new Uint32Array(re.length*H);let de=0;for(let z=0;z<re.length;){const Q=re.codePointAt(z)||0;le[de++]=Q,z+=Q>65535?2:1}let G=de;for(let z=1;z<H;++z)le.copyWithin(G,0,de),G+=de;return this.print(le,0,G),!0}sendDeviceAttributesPrimary(j){return j.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(j){return j.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(j.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(j){return(this._optionsService.rawOptions.termName+"").indexOf(j)===0}setMode(j){for(let $=0;$<j.length;$++)switch(j.params[$]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(j){for(let $=0;$<j.length;$++)switch(j.params[$]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,w.DEFAULT_CHARSET),this._charsetService.setgCharset(1,w.DEFAULT_CHARSET),this._charsetService.setgCharset(2,w.DEFAULT_CHARSET),this._charsetService.setgCharset(3,w.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(j){for(let $=0;$<j.length;$++)switch(j.params[$]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(j){for(let $=0;$<j.length;$++)switch(j.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(),j.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(j,$){const H=this._coreService.decPrivateModes,{activeProtocol:K,activeEncoding:te}=this._coreMouseService,re=this._coreService,{buffers:le,cols:de}=this._bufferService,{active:G,alt:z}=le,Q=this._optionsService.rawOptions,Z=Ae=>Ae?1:2,ae=j.params[0];return fe=ae,Ee=$?ae===2?4:ae===4?Z(re.modes.insertMode):ae===12?3:ae===20?Z(Q.convertEol):0:ae===1?Z(H.applicationCursorKeys):ae===3?Q.windowOptions.setWinLines?de===80?2:de===132?1:0:0:ae===6?Z(H.origin):ae===7?Z(H.wraparound):ae===8?3:ae===9?Z(K==="X10"):ae===12?Z(Q.cursorBlink):ae===25?Z(!re.isCursorHidden):ae===45?Z(H.reverseWraparound):ae===66?Z(H.applicationKeypad):ae===67?4:ae===1e3?Z(K==="VT200"):ae===1002?Z(K==="DRAG"):ae===1003?Z(K==="ANY"):ae===1004?Z(H.sendFocus):ae===1005?4:ae===1006?Z(te==="SGR"):ae===1015?4:ae===1016?Z(te==="SGR_PIXELS"):ae===1048?1:ae===47||ae===1047||ae===1049?Z(G===z):ae===2004?Z(H.bracketedPasteMode):0,re.triggerDataEvent(`${h.C0.ESC}[${$?"":"?"}${fe};${Ee}$y`),!0;var fe,Ee}_updateAttrColor(j,$,H,K,te){return $===2?(j|=50331648,j&=-16777216,j|=x.AttributeData.fromColorRGB([H,K,te])):$===5&&(j&=-50331904,j|=33554432|255&H),j}_extractColor(j,$,H){const K=[0,0,-1,0,0,0];let te=0,re=0;do{if(K[re+te]=j.params[$+re],j.hasSubParams($+re)){const le=j.getSubParams($+re);let de=0;do K[1]===5&&(te=1),K[re+de+1+te]=le[de];while(++de<le.length&&de+re+1+te<K.length);break}if(K[1]===5&&re+te>=2||K[1]===2&&re+te>=5)break;K[1]&&(te=1)}while(++re+$<j.length&&re+te<K.length);for(let le=2;le<K.length;++le)K[le]===-1&&(K[le]=0);switch(K[0]){case 38:H.fg=this._updateAttrColor(H.fg,K[1],K[3],K[4],K[5]);break;case 48:H.bg=this._updateAttrColor(H.bg,K[1],K[3],K[4],K[5]);break;case 58:H.extended=H.extended.clone(),H.extended.underlineColor=this._updateAttrColor(H.extended.underlineColor,K[1],K[3],K[4],K[5])}return re}_processUnderline(j,$){$.extended=$.extended.clone(),(!~j||j>5)&&(j=1),$.extended.underlineStyle=j,$.fg|=268435456,j===0&&($.fg&=-268435457),$.updateExtended()}_processSGR0(j){j.fg=a.DEFAULT_ATTR_DATA.fg,j.bg=a.DEFAULT_ATTR_DATA.bg,j.extended=j.extended.clone(),j.extended.underlineStyle=0,j.extended.underlineColor&=-67108864,j.updateExtended()}charAttributes(j){if(j.length===1&&j.params[0]===0)return this._processSGR0(this._curAttrData),!0;const $=j.length;let H;const K=this._curAttrData;for(let te=0;te<$;te++)H=j.params[te],H>=30&&H<=37?(K.fg&=-50331904,K.fg|=16777216|H-30):H>=40&&H<=47?(K.bg&=-50331904,K.bg|=16777216|H-40):H>=90&&H<=97?(K.fg&=-50331904,K.fg|=16777224|H-90):H>=100&&H<=107?(K.bg&=-50331904,K.bg|=16777224|H-100):H===0?this._processSGR0(K):H===1?K.fg|=134217728:H===3?K.bg|=67108864:H===4?(K.fg|=268435456,this._processUnderline(j.hasSubParams(te)?j.getSubParams(te)[0]:1,K)):H===5?K.fg|=536870912:H===7?K.fg|=67108864:H===8?K.fg|=1073741824:H===9?K.fg|=2147483648:H===2?K.bg|=134217728:H===21?this._processUnderline(2,K):H===22?(K.fg&=-134217729,K.bg&=-134217729):H===23?K.bg&=-67108865:H===24?(K.fg&=-268435457,this._processUnderline(0,K)):H===25?K.fg&=-536870913:H===27?K.fg&=-67108865:H===28?K.fg&=-1073741825:H===29?K.fg&=2147483647:H===39?(K.fg&=-67108864,K.fg|=16777215&a.DEFAULT_ATTR_DATA.fg):H===49?(K.bg&=-67108864,K.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):H===38||H===48||H===58?te+=this._extractColor(j,te,K):H===53?K.bg|=1073741824:H===55?K.bg&=-1073741825:H===59?(K.extended=K.extended.clone(),K.extended.underlineColor=-1,K.updateExtended()):H===100?(K.fg&=-67108864,K.fg|=16777215&a.DEFAULT_ATTR_DATA.fg,K.bg&=-67108864,K.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",H);return!0}deviceStatus(j){switch(j.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const $=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${$};${H}R`)}return!0}deviceStatusPrivate(j){if(j.params[0]===6){const $=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${$};${H}R`)}return!0}softReset(j){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(j){const $=j.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(j){const $=j.params[0]||1;let H;return(j.length<2||(H=j.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(j){if(!O(j.params[0],this._optionsService.rawOptions.windowOptions))return!0;const $=j.length>1?j.params[1]:0;switch(j.params[0]){case 14:$!==2&&this._onRequestWindowsOptionsReport.fire(F.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(F.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.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(j){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(j){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(j){return this._windowTitle=j,this._onTitleChange.fire(j),!0}setIconName(j){return this._iconName=j,!0}setOrReportIndexedColor(j){const $=[],H=j.split(";");for(;H.length>1;){const K=H.shift(),te=H.shift();if(/^\d+$/.exec(K)){const re=parseInt(K);if(Y(re))if(te==="?")$.push({type:0,index:re});else{const le=(0,R.parseColor)(te);le&&$.push({type:1,index:re,color:le})}}}return $.length&&this._onColor.fire($),!0}setHyperlink(j){const $=j.split(";");return!($.length<2)&&($[1]?this._createHyperlink($[0],$[1]):!$[0]&&this._finishHyperlink())}_createHyperlink(j,$){this._getCurrentLinkId()&&this._finishHyperlink();const H=j.split(":");let K;const te=H.findIndex((re=>re.startsWith("id=")));return te!==-1&&(K=H[te].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:K,uri:$}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(j,$){const H=j.split(";");for(let K=0;K<H.length&&!($>=this._specialColors.length);++K,++$)if(H[K]==="?")this._onColor.fire([{type:0,index:this._specialColors[$]}]);else{const te=(0,R.parseColor)(H[K]);te&&this._onColor.fire([{type:1,index:this._specialColors[$],color:te}])}return!0}setOrReportFgColor(j){return this._setOrReportSpecialColor(j,0)}setOrReportBgColor(j){return this._setOrReportSpecialColor(j,1)}setOrReportCursorColor(j){return this._setOrReportSpecialColor(j,2)}restoreIndexedColor(j){if(!j)return this._onColor.fire([{type:2}]),!0;const $=[],H=j.split(";");for(let K=0;K<H.length;++K)if(/^\d+$/.exec(H[K])){const te=parseInt(H[K]);Y(te)&&$.push({type:2,index:te})}return $.length&&this._onColor.fire($),!0}restoreFgColor(j){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(j){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(j){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,w.DEFAULT_CHARSET),!0}selectCharset(j){return j.length!==2?(this.selectDefaultCharset(),!0):(j[0]==="/"||this._charsetService.setgCharset(D[j[0]],w.CHARSETS[j[1]]||w.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const j=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,j,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(j){return this._charsetService.setgLevel(j),!0}screenAlignmentPattern(){const j=new d.CellData;j.content=4194373,j.fg=this._curAttrData.fg,j.bg=this._curAttrData.bg,this._setCursor(0,0);for(let $=0;$<this._bufferService.rows;++$){const H=this._activeBuffer.ybase+this._activeBuffer.y+$,K=this._activeBuffer.lines.get(H);K&&(K.fill(j),K.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(j,$){const H=this._bufferService.buffer,K=this._optionsService.rawOptions;return(te=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${te}${h.C0.ESC}\\`),!0))(j==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:j==='"p'?'P1$r61;1"p':j==="r"?`P1$r${H.scrollTop+1};${H.scrollBottom+1}r`:j==="m"?"P1$r0m":j===" q"?`P1$r${{block:2,underline:4,bar:6}[K.cursorStyle]-(K.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(j,$){this._dirtyRowTracker.markRangeDirty(j,$)}}r.InputHandler=q;let X=class{constructor(V){this._bufferService=V,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(V){V<this.start?this.start=V:V>this.end&&(this.end=V)}markRangeDirty(V,j){V>j&&(U=V,V=j,j=U),V<this.start&&(this.start=V),j>this.end&&(this.end=j)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Y(V){return 0<=V&&V<256}X=_([v(0,I.IBufferService)],X)},844:(C,r)=>{function u(_){for(const v of _)v.dispose();_.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 _ of this._disposables)_.dispose();this._disposables.length=0}register(_){return this._disposables.push(_),_}unregister(_){const v=this._disposables.indexOf(_);v!==-1&&this._disposables.splice(v,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(_){var v;this._isDisposed||_===this._value||((v=this._value)==null||v.dispose(),this._value=_)}clear(){this.value=void 0}dispose(){var _;this._isDisposed=!0,(_=this._value)==null||_.dispose(),this._value=void 0}},r.toDisposable=function(_){return{dispose:_}},r.disposeArray=u,r.getDisposeArrayDisposable=function(_){return{dispose:()=>u(_)}}},1505:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(v,h,w){this._data[v]||(this._data[v]={}),this._data[v][h]=w}get(v,h){return this._data[v]?this._data[v][h]:void 0}clear(){this._data={}}}r.TwoKeyMap=u,r.FourKeyMap=class{constructor(){this._data=new u}set(_,v,h,w,k){this._data.get(_,v)||this._data.set(_,v,new u),this._data.get(_,v).set(h,w,k)}get(_,v,h,w){var k;return(k=this._data.get(_,v))==null?void 0:k.get(h,w)}clear(){this._data.clear()}}},6114:(C,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 u=r.isNode?"node":navigator.userAgent,_=r.isNode?"node":navigator.platform;r.isFirefox=u.includes("Firefox"),r.isLegacyEdge=u.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(u),r.getSafariVersion=function(){if(!r.isSafari)return 0;const v=u.match(/Version\/(\d+)/);return v===null||v.length<2?0:parseInt(v[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_),r.isIpad=_==="iPad",r.isIphone=_==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(_),r.isLinux=_.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(u)},6106:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let u=0;r.SortedList=class{constructor(_){this._getKey=_,this._array=[]}clear(){this._array.length=0}insert(_){this._array.length!==0?(u=this._search(this._getKey(_)),this._array.splice(u,0,_)):this._array.push(_)}delete(_){if(this._array.length===0)return!1;const v=this._getKey(_);if(v===void 0||(u=this._search(v),u===-1)||this._getKey(this._array[u])!==v)return!1;do if(this._array[u]===_)return this._array.splice(u,1),!0;while(++u<this._array.length&&this._getKey(this._array[u])===v);return!1}*getKeyIterator(_){if(this._array.length!==0&&(u=this._search(_),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===_))do yield this._array[u];while(++u<this._array.length&&this._getKey(this._array[u])===_)}forEachByKey(_,v){if(this._array.length!==0&&(u=this._search(_),!(u<0||u>=this._array.length)&&this._getKey(this._array[u])===_))do v(this._array[u]);while(++u<this._array.length&&this._getKey(this._array[u])===_)}values(){return[...this._array].values()}_search(_){let v=0,h=this._array.length-1;for(;h>=v;){let w=v+h>>1;const k=this._getKey(this._array[w]);if(k>_)h=w-1;else{if(!(k<_)){for(;w>0&&this._getKey(this._array[w-1])===_;)w--;return w}v=w+1}}return v}}},7226:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const _=u(6114);class v{constructor(){this._tasks=[],this._i=0}enqueue(k){this._tasks.push(k),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(k){this._idleCallback=void 0;let L=0,f=0,a=k.timeRemaining(),p=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),p=k.timeRemaining(),1.5*f>p)return a-L<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-L))}ms`),void this._start();a=p}this.clear()}}class h extends v{_requestCallback(k){return setTimeout((()=>k(this._createDeadline(16))))}_cancelCallback(k){clearTimeout(k)}_createDeadline(k){const L=Date.now()+k;return{timeRemaining:()=>Math.max(0,L-Date.now())}}}r.PriorityTaskQueue=h,r.IdleTaskQueue=!_.isNode&&"requestIdleCallback"in window?class extends v{_requestCallback(w){return requestIdleCallback(w)}_cancelCallback(w){cancelIdleCallback(w)}}:h,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(w){this._queue.clear(),this._queue.enqueue(w)}flush(){this._queue.flush()}}},9282:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const _=u(643);r.updateWindowsModeWrappedState=function(v){const h=v.buffer.lines.get(v.buffer.ybase+v.buffer.y-1),w=h==null?void 0:h.get(v.cols-1),k=v.buffer.lines.get(v.buffer.ybase+v.buffer.y);k&&w&&(k.isWrapped=w[_.CHAR_DATA_CODE_INDEX]!==_.NULL_CELL_CODE&&w[_.CHAR_DATA_CODE_INDEX]!==_.WHITESPACE_CELL_CODE)}},3734:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new _}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new u;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}r.AttributeData=u;class _{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,w=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=w}clone(){return new _(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=_},9092:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const _=u(6349),v=u(7226),h=u(3734),w=u(8437),k=u(4634),L=u(511),f=u(643),a=u(4863),p=u(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(m,d,x){this._hasScrollback=m,this._optionsService=d,this._bufferService=x,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=w.DEFAULT_ATTR_DATA.clone(),this.savedCharset=p.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 v.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(m){return m?(this._nullCell.fg=m.fg,this._nullCell.bg=m.bg,this._nullCell.extended=m.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(m){return m?(this._whitespaceCell.fg=m.fg,this._whitespaceCell.bg=m.bg,this._whitespaceCell.extended=m.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(m,d){return new w.BufferLine(this._bufferService.cols,this.getNullCell(m),d)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const m=this.ybase+this.y-this.ydisp;return m>=0&&m<this._rows}_getCorrectBufferLength(m){if(!this._hasScrollback)return m;const d=m+this._optionsService.rawOptions.scrollback;return d>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:d}fillViewportRows(m){if(this.lines.length===0){m===void 0&&(m=w.DEFAULT_ATTR_DATA);let d=this._rows;for(;d--;)this.lines.push(this.getBlankLine(m))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new _.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(m,d){const x=this.getNullCell(w.DEFAULT_ATTR_DATA);let I=0;const E=this._getCorrectBufferLength(d);if(E>this.lines.maxLength&&(this.lines.maxLength=E),this.lines.length>0){if(this._cols<m)for(let b=0;b<this.lines.length;b++)I+=+this.lines.get(b).resize(m,x);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 w.BufferLine(m,x)):this.ybase>0&&this.lines.length<=this.ybase+this.y+M+1?(this.ybase--,M++,this.ydisp>0&&this.ydisp--):this.lines.push(new w.BufferLine(m,x)));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,m-1),this.y=Math.min(this.y,d-1),M&&(this.y+=M),this.savedX=Math.min(this.savedX,m-1),this.scrollTop=0}if(this.scrollBottom=d-1,this._isReflowEnabled&&(this._reflow(m,d),this._cols>m))for(let M=0;M<this.lines.length;M++)I+=+this.lines.get(M).resize(m,x);this._cols=m,this._rows=d,this._memoryCleanupQueue.clear(),I>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let m=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,m=!1);let d=0;for(;this._memoryCleanupPosition<this.lines.length;)if(d+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),d>100)return!0;return m}get _isReflowEnabled(){const m=this._optionsService.rawOptions.windowsPty;return m&&m.buildNumber?this._hasScrollback&&m.backend==="conpty"&&m.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(m,d){this._cols!==m&&(m>this._cols?this._reflowLarger(m,d):this._reflowSmaller(m,d))}_reflowLarger(m,d){const x=(0,k.reflowLargerGetLinesToRemove)(this.lines,this._cols,m,this.ybase+this.y,this.getNullCell(w.DEFAULT_ATTR_DATA));if(x.length>0){const I=(0,k.reflowLargerCreateNewLayout)(this.lines,x);(0,k.reflowLargerApplyNewLayout)(this.lines,I.layout),this._reflowLargerAdjustViewport(m,d,I.countRemoved)}}_reflowLargerAdjustViewport(m,d,x){const I=this.getNullCell(w.DEFAULT_ATTR_DATA);let E=x;for(;E-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<d&&this.lines.push(new w.BufferLine(m,I))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-x,0)}_reflowSmaller(m,d){const x=this.getNullCell(w.DEFAULT_ATTR_DATA),I=[];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()<=m)continue;const R=[b];for(;b.isWrapped&&M>0;)b=this.lines.get(--M),R.unshift(b);const D=this.ybase+this.y;if(D>=M&&D<M+R.length)continue;const B=R[R.length-1].getTrimmedLength(),O=(0,k.reflowSmallerGetNewLineLengths)(R,this._cols,m),F=O.length-R.length;let U;U=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+F):Math.max(0,this.lines.length-this.lines.maxLength+F);const q=[];for(let H=0;H<F;H++){const K=this.getBlankLine(w.DEFAULT_ATTR_DATA,!0);q.push(K)}q.length>0&&(I.push({start:M+R.length+E,newLines:q}),E+=q.length),R.push(...q);let X=O.length-1,Y=O[X];Y===0&&(X--,Y=O[X]);let V=R.length-F-1,j=B;for(;V>=0;){const H=Math.min(j,Y);if(R[X]===void 0)break;if(R[X].copyCellsFrom(R[V],j-H,Y-H,H,!0),Y-=H,Y===0&&(X--,Y=O[X]),j-=H,j===0){V--;const K=Math.max(V,0);j=(0,k.getWrappedLineTrimmedLength)(R,K,this._cols)}}for(let H=0;H<R.length;H++)O[H]<m&&R[H].setCell(O[H],x);let $=F-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+F,this.ybase+d-1)}if(I.length>0){const M=[],b=[];for(let X=0;X<this.lines.length;X++)b.push(this.lines.get(X));const R=this.lines.length;let D=R-1,B=0,O=I[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+E);let F=0;for(let X=Math.min(this.lines.maxLength-1,R+E-1);X>=0;X--)if(O&&O.start>D+F){for(let Y=O.newLines.length-1;Y>=0;Y--)this.lines.set(X--,O.newLines[Y]);X++,M.push({index:D+1,amount:O.newLines.length}),F+=O.newLines.length,O=I[++B]}else this.lines.set(X,b[D--]);let U=0;for(let X=M.length-1;X>=0;X--)M[X].index+=U,this.lines.onInsertEmitter.fire(M[X]),U+=M[X].amount;const q=Math.max(0,R+E-this.lines.maxLength);q>0&&this.lines.onTrimEmitter.fire(q)}}translateBufferLineToString(m,d,x=0,I){const E=this.lines.get(m);return E?E.translateToString(d,x,I):""}getWrappedRangeForLine(m){let d=m,x=m;for(;d>0&&this.lines.get(d).isWrapped;)d--;for(;x+1<this.lines.length&&this.lines.get(x+1).isWrapped;)x++;return{first:d,last:x}}setupTabStops(m){for(m!=null?this.tabs[m]||(m=this.prevStop(m)):(this.tabs={},m=0);m<this._cols;m+=this._optionsService.rawOptions.tabStopWidth)this.tabs[m]=!0}prevStop(m){for(m==null&&(m=this.x);!this.tabs[--m]&&m>0;);return m>=this._cols?this._cols-1:m<0?0:m}nextStop(m){for(m==null&&(m=this.x);!this.tabs[++m]&&m<this._cols;);return m>=this._cols?this._cols-1:m<0?0:m}clearMarkers(m){this._isClearing=!0;for(let d=0;d<this.markers.length;d++)this.markers[d].line===m&&(this.markers[d].dispose(),this.markers.splice(d--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].dispose(),this.markers.splice(m--,1);this._isClearing=!1}addMarker(m){const d=new a.Marker(m);return this.markers.push(d),d.register(this.lines.onTrim((x=>{d.line-=x,d.line<0&&d.dispose()}))),d.register(this.lines.onInsert((x=>{d.line>=x.index&&(d.line+=x.amount)}))),d.register(this.lines.onDelete((x=>{d.line>=x.index&&d.line<x.index+x.amount&&d.dispose(),d.line>x.index&&(d.line-=x.amount)}))),d.register(d.onDispose((()=>this._removeMarker(d)))),d}_removeMarker(m){this._isClearing||this.markers.splice(this.markers.indexOf(m),1)}}},8437:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const _=u(3734),v=u(511),h=u(643),w=u(482);r.DEFAULT_ATTR_DATA=Object.freeze(new _.AttributeData);let k=0;class L{constructor(a,p,m=!1){this.isWrapped=m,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*a);const d=p||v.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let x=0;x<a;++x)this.setCell(x,d);this.length=a}get(a){const p=this._data[3*a+0],m=2097151&p;return[this._data[3*a+1],2097152&p?this._combined[a]:m?(0,w.stringFromCodePoint)(m):"",p>>22,2097152&p?this._combined[a].charCodeAt(this._combined[a].length-1):m]}set(a,p){this._data[3*a+1]=p[h.CHAR_DATA_ATTR_INDEX],p[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[a]=p[1],this._data[3*a+0]=2097152|a|p[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*a+0]=p[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|p[h.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 p=this._data[3*a+0];return 2097152&p?this._combined[a].charCodeAt(this._combined[a].length-1):2097151&p}isCombined(a){return 2097152&this._data[3*a+0]}getString(a){const p=this._data[3*a+0];return 2097152&p?this._combined[a]:2097151&p?(0,w.stringFromCodePoint)(2097151&p):""}isProtected(a){return 536870912&this._data[3*a+2]}loadCell(a,p){return k=3*a,p.content=this._data[k+0],p.fg=this._data[k+1],p.bg=this._data[k+2],2097152&p.content&&(p.combinedData=this._combined[a]),268435456&p.bg&&(p.extended=this._extendedAttrs[a]),p}setCell(a,p){2097152&p.content&&(this._combined[a]=p.combinedData),268435456&p.bg&&(this._extendedAttrs[a]=p.extended),this._data[3*a+0]=p.content,this._data[3*a+1]=p.fg,this._data[3*a+2]=p.bg}setCellFromCodepoint(a,p,m,d){268435456&d.bg&&(this._extendedAttrs[a]=d.extended),this._data[3*a+0]=p|m<<22,this._data[3*a+1]=d.fg,this._data[3*a+2]=d.bg}addCodepointToCell(a,p,m){let d=this._data[3*a+0];2097152&d?this._combined[a]+=(0,w.stringFromCodePoint)(p):2097151&d?(this._combined[a]=(0,w.stringFromCodePoint)(2097151&d)+(0,w.stringFromCodePoint)(p),d&=-2097152,d|=2097152):d=p|4194304,m&&(d&=-12582913,d|=m<<22),this._data[3*a+0]=d}insertCells(a,p,m){if((a%=this.length)&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,m),p<this.length-a){const d=new v.CellData;for(let x=this.length-a-p-1;x>=0;--x)this.setCell(a+p+x,this.loadCell(a+x,d));for(let x=0;x<p;++x)this.setCell(a+x,m)}else for(let d=a;d<this.length;++d)this.setCell(d,m);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,m)}deleteCells(a,p,m){if(a%=this.length,p<this.length-a){const d=new v.CellData;for(let x=0;x<this.length-a-p;++x)this.setCell(a+x,this.loadCell(a+p+x,d));for(let x=this.length-p;x<this.length;++x)this.setCell(x,m)}else for(let d=a;d<this.length;++d)this.setCell(d,m);a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,m),this.getWidth(a)!==0||this.hasContent(a)||this.setCellFromCodepoint(a,0,1,m)}replaceCells(a,p,m,d=!1){if(d)for(a&&this.getWidth(a-1)===2&&!this.isProtected(a-1)&&this.setCellFromCodepoint(a-1,0,1,m),p<this.length&&this.getWidth(p-1)===2&&!this.isProtected(p)&&this.setCellFromCodepoint(p,0,1,m);a<p&&a<this.length;)this.isProtected(a)||this.setCell(a,m),a++;else for(a&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a-1,0,1,m),p<this.length&&this.getWidth(p-1)===2&&this.setCellFromCodepoint(p,0,1,m);a<p&&a<this.length;)this.setCell(a++,m)}resize(a,p){if(a===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const m=3*a;if(a>this.length){if(this._data.buffer.byteLength>=4*m)this._data=new Uint32Array(this._data.buffer,0,m);else{const d=new Uint32Array(m);d.set(this._data),this._data=d}for(let d=this.length;d<a;++d)this.setCell(d,p)}else{this._data=this._data.subarray(0,m);const d=Object.keys(this._combined);for(let I=0;I<d.length;I++){const E=parseInt(d[I],10);E>=a&&delete this._combined[E]}const x=Object.keys(this._extendedAttrs);for(let I=0;I<x.length;I++){const E=parseInt(x[I],10);E>=a&&delete this._extendedAttrs[E]}}return this.length=a,4*m*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,p=!1){if(p)for(let m=0;m<this.length;++m)this.isProtected(m)||this.setCell(m,a);else{this._combined={},this._extendedAttrs={};for(let m=0;m<this.length;++m)this.setCell(m,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 p in a._combined)this._combined[p]=a._combined[p];this._extendedAttrs={};for(const p in a._extendedAttrs)this._extendedAttrs[p]=a._extendedAttrs[p];this.isWrapped=a.isWrapped}clone(){const a=new L(0);a._data=new Uint32Array(this._data),a.length=this.length;for(const p in this._combined)a._combined[p]=this._combined[p];for(const p in this._extendedAttrs)a._extendedAttrs[p]=this._extendedAttrs[p];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,p,m,d,x){const I=a._data;if(x)for(let M=d-1;M>=0;M--){for(let b=0;b<3;b++)this._data[3*(m+M)+b]=I[3*(p+M)+b];268435456&I[3*(p+M)+2]&&(this._extendedAttrs[m+M]=a._extendedAttrs[p+M])}else for(let M=0;M<d;M++){for(let b=0;b<3;b++)this._data[3*(m+M)+b]=I[3*(p+M)+b];268435456&I[3*(p+M)+2]&&(this._extendedAttrs[m+M]=a._extendedAttrs[p+M])}const E=Object.keys(a._combined);for(let M=0;M<E.length;M++){const b=parseInt(E[M],10);b>=p&&(this._combined[b-p+m]=a._combined[b])}}translateToString(a,p,m,d){p=p??0,m=m??this.length,a&&(m=Math.min(m,this.getTrimmedLength())),d&&(d.length=0);let x="";for(;p<m;){const I=this._data[3*p+0],E=2097151&I,M=2097152&I?this._combined[p]:E?(0,w.stringFromCodePoint)(E):h.WHITESPACE_CELL_CHAR;if(x+=M,d)for(let b=0;b<M.length;++b)d.push(p);p+=I>>22||1}return d&&d.push(p),x}}r.BufferLine=L},4841:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(u,_){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return _*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(C,r)=>{function u(_,v,h){if(v===_.length-1)return _[v].getTrimmedLength();const w=!_[v].hasContent(h-1)&&_[v].getWidth(h-1)===1,k=_[v+1].getWidth(0)===2;return w&&k?h-1:h}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(_,v,h,w,k){const L=[];for(let f=0;f<_.length-1;f++){let a=f,p=_.get(++a);if(!p.isWrapped)continue;const m=[_.get(f)];for(;a<_.length&&p.isWrapped;)m.push(p),p=_.get(++a);if(w>=f&&w<a){f+=m.length-1;continue}let d=0,x=u(m,d,v),I=1,E=0;for(;I<m.length;){const b=u(m,I,v),R=b-E,D=h-x,B=Math.min(R,D);m[d].copyCellsFrom(m[I],E,x,B,!1),x+=B,x===h&&(d++,x=0),E+=B,E===b&&(I++,E=0),x===0&&d!==0&&m[d-1].getWidth(h-1)===2&&(m[d].copyCellsFrom(m[d-1],h-1,x++,1,!1),m[d-1].setCell(h-1,k))}m[d].replaceCells(x,h,k);let M=0;for(let b=m.length-1;b>0&&(b>d||m[b].getTrimmedLength()===0);b--)M++;M>0&&(L.push(f+m.length-M),L.push(M)),f+=m.length-1}return L},r.reflowLargerCreateNewLayout=function(_,v){const h=[];let w=0,k=v[w],L=0;for(let f=0;f<_.length;f++)if(k===f){const a=v[++w];_.onDeleteEmitter.fire({index:f-L,amount:a}),f+=a-1,L+=a,k=v[++w]}else h.push(f);return{layout:h,countRemoved:L}},r.reflowLargerApplyNewLayout=function(_,v){const h=[];for(let w=0;w<v.length;w++)h.push(_.get(v[w]));for(let w=0;w<h.length;w++)_.set(w,h[w]);_.length=v.length},r.reflowSmallerGetNewLineLengths=function(_,v,h){const w=[],k=_.map(((p,m)=>u(_,m,v))).reduce(((p,m)=>p+m));let L=0,f=0,a=0;for(;a<k;){if(k-a<h){w.push(k-a);break}L+=h;const p=u(_,f,v);L>p&&(L-=p,f++);const m=_[f].getWidth(L-1)===2;m&&L--;const d=m?h-1:h;w.push(d),a+=d}return w},r.getWrappedLineTrimmedLength=u},5295:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const _=u(8460),v=u(844),h=u(9092);class w extends v.Disposable{constructor(L,f){super(),this._optionsService=L,this._bufferService=f,this._onBufferActivate=this.register(new _.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(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=w},511:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const _=u(482),v=u(643),h=u(3734);class w extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(L){const f=new w;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,_.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(L){this.fg=L[v.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(L[v.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(L[v.CHAR_DATA_CHAR_INDEX].length===2){const a=L[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=a&&a<=56319){const p=L[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=p&&p<=57343?this.content=1024*(a-55296)+p-56320+65536|L[v.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=L[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|L[v.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=L[v.CHAR_DATA_CHAR_INDEX],this.content=2097152|L[v.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=w},643:(C,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:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const _=u(8460),v=u(844);class h{get id(){return this._id}constructor(k){this.line=k,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,v.disposeArray)(this._disposables),this._disposables.length=0)}register(k){return this._disposables.push(k),k}}r.Marker=h,h._nextId=1},7116:(C,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:(C,r)=>{var u,_,v;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
115
- `,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(u||(r.C0=u={})),(function(h){h.PAD="€",h.HOP="",h.BPH="‚",h.NBH="ƒ",h.IND="„",h.NEL="…",h.SSA="†",h.ESA="‡",h.HTS="ˆ",h.HTJ="‰",h.VTS="Š",h.PLD="‹",h.PLU="Œ",h.RI="",h.SS2="Ž",h.SS3="",h.DCS="",h.PU1="‘",h.PU2="’",h.STS="“",h.CCH="”",h.MW="•",h.SPA="–",h.EPA="—",h.SOS="˜",h.SGCI="™",h.SCI="š",h.CSI="›",h.ST="œ",h.OSC="",h.PM="ž",h.APC="Ÿ"})(_||(r.C1=_={})),(function(h){h.ST=`${u.ESC}\\`})(v||(r.C1_ESCAPED=v={}))},7399:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const _=u(2584),v={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(h,w,k,L){const f={type:0,cancel:!1,key:void 0},a=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?f.key=w?_.C0.ESC+"OA":_.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?f.key=w?_.C0.ESC+"OD":_.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?f.key=w?_.C0.ESC+"OC":_.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(f.key=w?_.C0.ESC+"OB":_.C0.ESC+"[B");break;case 8:f.key=h.ctrlKey?"\b":_.C0.DEL,h.altKey&&(f.key=_.C0.ESC+f.key);break;case 9:if(h.shiftKey){f.key=_.C0.ESC+"[Z";break}f.key=_.C0.HT,f.cancel=!0;break;case 13:f.key=h.altKey?_.C0.ESC+_.C0.CR:_.C0.CR,f.cancel=!0;break;case 27:f.key=_.C0.ESC,h.altKey&&(f.key=_.C0.ESC+_.C0.ESC),f.cancel=!0;break;case 37:if(h.metaKey)break;a?(f.key=_.C0.ESC+"[1;"+(a+1)+"D",f.key===_.C0.ESC+"[1;3D"&&(f.key=_.C0.ESC+(k?"b":"[1;5D"))):f.key=w?_.C0.ESC+"OD":_.C0.ESC+"[D";break;case 39:if(h.metaKey)break;a?(f.key=_.C0.ESC+"[1;"+(a+1)+"C",f.key===_.C0.ESC+"[1;3C"&&(f.key=_.C0.ESC+(k?"f":"[1;5C"))):f.key=w?_.C0.ESC+"OC":_.C0.ESC+"[C";break;case 38:if(h.metaKey)break;a?(f.key=_.C0.ESC+"[1;"+(a+1)+"A",k||f.key!==_.C0.ESC+"[1;3A"||(f.key=_.C0.ESC+"[1;5A")):f.key=w?_.C0.ESC+"OA":_.C0.ESC+"[A";break;case 40:if(h.metaKey)break;a?(f.key=_.C0.ESC+"[1;"+(a+1)+"B",k||f.key!==_.C0.ESC+"[1;3B"||(f.key=_.C0.ESC+"[1;5B")):f.key=w?_.C0.ESC+"OB":_.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(f.key=_.C0.ESC+"[2~");break;case 46:f.key=a?_.C0.ESC+"[3;"+(a+1)+"~":_.C0.ESC+"[3~";break;case 36:f.key=a?_.C0.ESC+"[1;"+(a+1)+"H":w?_.C0.ESC+"OH":_.C0.ESC+"[H";break;case 35:f.key=a?_.C0.ESC+"[1;"+(a+1)+"F":w?_.C0.ESC+"OF":_.C0.ESC+"[F";break;case 33:h.shiftKey?f.type=2:h.ctrlKey?f.key=_.C0.ESC+"[5;"+(a+1)+"~":f.key=_.C0.ESC+"[5~";break;case 34:h.shiftKey?f.type=3:h.ctrlKey?f.key=_.C0.ESC+"[6;"+(a+1)+"~":f.key=_.C0.ESC+"[6~";break;case 112:f.key=a?_.C0.ESC+"[1;"+(a+1)+"P":_.C0.ESC+"OP";break;case 113:f.key=a?_.C0.ESC+"[1;"+(a+1)+"Q":_.C0.ESC+"OQ";break;case 114:f.key=a?_.C0.ESC+"[1;"+(a+1)+"R":_.C0.ESC+"OR";break;case 115:f.key=a?_.C0.ESC+"[1;"+(a+1)+"S":_.C0.ESC+"OS";break;case 116:f.key=a?_.C0.ESC+"[15;"+(a+1)+"~":_.C0.ESC+"[15~";break;case 117:f.key=a?_.C0.ESC+"[17;"+(a+1)+"~":_.C0.ESC+"[17~";break;case 118:f.key=a?_.C0.ESC+"[18;"+(a+1)+"~":_.C0.ESC+"[18~";break;case 119:f.key=a?_.C0.ESC+"[19;"+(a+1)+"~":_.C0.ESC+"[19~";break;case 120:f.key=a?_.C0.ESC+"[20;"+(a+1)+"~":_.C0.ESC+"[20~";break;case 121:f.key=a?_.C0.ESC+"[21;"+(a+1)+"~":_.C0.ESC+"[21~";break;case 122:f.key=a?_.C0.ESC+"[23;"+(a+1)+"~":_.C0.ESC+"[23~";break;case 123:f.key=a?_.C0.ESC+"[24;"+(a+1)+"~":_.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(k&&!L||!h.altKey||h.metaKey)!k||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?f.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(f.key=_.C0.US),h.key==="@"&&(f.key=_.C0.NUL)):h.keyCode===65&&(f.type=1);else{const p=v[h.keyCode],m=p==null?void 0:p[h.shiftKey?1:0];if(m)f.key=_.C0.ESC+m;else if(h.keyCode>=65&&h.keyCode<=90){const d=h.ctrlKey?h.keyCode-64:h.keyCode+32;let x=String.fromCharCode(d);h.shiftKey&&(x=x.toUpperCase()),f.key=_.C0.ESC+x}else if(h.keyCode===32)f.key=_.C0.ESC+(h.ctrlKey?_.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let d=h.code.slice(3,4);h.shiftKey||(d=d.toLowerCase()),f.key=_.C0.ESC+d,f.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?f.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?f.key=_.C0.NUL:h.keyCode>=51&&h.keyCode<=55?f.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?f.key=_.C0.DEL:h.keyCode===219?f.key=_.C0.ESC:h.keyCode===220?f.key=_.C0.FS:h.keyCode===221&&(f.key=_.C0.GS)}return f}},482:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},r.utf32ToString=function(u,_=0,v=u.length){let h="";for(let w=_;w<v;++w){let k=u[w];k>65535?(k-=65536,h+=String.fromCharCode(55296+(k>>10))+String.fromCharCode(k%1024+56320)):h+=String.fromCharCode(k)}return h},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,_){const v=u.length;if(!v)return 0;let h=0,w=0;if(this._interim){const k=u.charCodeAt(w++);56320<=k&&k<=57343?_[h++]=1024*(this._interim-55296)+k-56320+65536:(_[h++]=this._interim,_[h++]=k),this._interim=0}for(let k=w;k<v;++k){const L=u.charCodeAt(k);if(55296<=L&&L<=56319){if(++k>=v)return this._interim=L,h;const f=u.charCodeAt(k);56320<=f&&f<=57343?_[h++]=1024*(L-55296)+f-56320+65536:(_[h++]=L,_[h++]=f)}else L!==65279&&(_[h++]=L)}return h}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,_){const v=u.length;if(!v)return 0;let h,w,k,L,f=0,a=0,p=0;if(this.interim[0]){let x=!1,I=this.interim[0];I&=(224&I)==192?31:(240&I)==224?15:7;let E,M=0;for(;(E=63&this.interim[++M])&&M<4;)I<<=6,I|=E;const b=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=b-M;for(;p<R;){if(p>=v)return 0;if(E=u[p++],(192&E)!=128){p--,x=!0;break}this.interim[M++]=E,I<<=6,I|=63&E}x||(b===2?I<128?p--:_[f++]=I:b===3?I<2048||I>=55296&&I<=57343||I===65279||(_[f++]=I):I<65536||I>1114111||(_[f++]=I)),this.interim.fill(0)}const m=v-4;let d=p;for(;d<v;){for(;!(!(d<m)||128&(h=u[d])||128&(w=u[d+1])||128&(k=u[d+2])||128&(L=u[d+3]));)_[f++]=h,_[f++]=w,_[f++]=k,_[f++]=L,d+=4;if(h=u[d++],h<128)_[f++]=h;else if((224&h)==192){if(d>=v)return this.interim[0]=h,f;if(w=u[d++],(192&w)!=128){d--;continue}if(a=(31&h)<<6|63&w,a<128){d--;continue}_[f++]=a}else if((240&h)==224){if(d>=v)return this.interim[0]=h,f;if(w=u[d++],(192&w)!=128){d--;continue}if(d>=v)return this.interim[0]=h,this.interim[1]=w,f;if(k=u[d++],(192&k)!=128){d--;continue}if(a=(15&h)<<12|(63&w)<<6|63&k,a<2048||a>=55296&&a<=57343||a===65279)continue;_[f++]=a}else if((248&h)==240){if(d>=v)return this.interim[0]=h,f;if(w=u[d++],(192&w)!=128){d--;continue}if(d>=v)return this.interim[0]=h,this.interim[1]=w,f;if(k=u[d++],(192&k)!=128){d--;continue}if(d>=v)return this.interim[0]=h,this.interim[1]=w,this.interim[2]=k,f;if(L=u[d++],(192&L)!=128){d--;continue}if(a=(7&h)<<18|(63&w)<<12|(63&k)<<6|63&L,a<65536||a>1114111)continue;_[f++]=a}}return f}}},225:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const _=u(1480),v=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let w;r.UnicodeV6=class{constructor(){if(this.version="6",!w){w=new Uint8Array(65536),w.fill(1),w[0]=0,w.fill(0,1,32),w.fill(0,127,160),w.fill(2,4352,4448),w[9001]=2,w[9002]=2,w.fill(2,11904,42192),w[12351]=1,w.fill(2,44032,55204),w.fill(2,63744,64256),w.fill(2,65040,65050),w.fill(2,65072,65136),w.fill(2,65280,65377),w.fill(2,65504,65511);for(let k=0;k<v.length;++k)w.fill(0,v[k][0],v[k][1]+1)}}wcwidth(k){return k<32?0:k<127?1:k<65536?w[k]:(function(L,f){let a,p=0,m=f.length-1;if(L<f[0][0]||L>f[m][1])return!1;for(;m>=p;)if(a=p+m>>1,L>f[a][1])p=a+1;else{if(!(L<f[a][0]))return!0;m=a-1}return!1})(k,h)?0:k>=131072&&k<=196605||k>=196608&&k<=262141?2:1}charProperties(k,L){let f=this.wcwidth(k),a=f===0&&L!==0;if(a){const p=_.UnicodeService.extractWidth(L);p===0?a=!1:p>f&&(f=p)}return _.UnicodeService.createPropertyValue(0,f,a)}}},5981:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const _=u(8460),v=u(844);class h extends v.Disposable{constructor(k){super(),this._action=k,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new _.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(k,L){if(L!==void 0&&this._syncCalls>L)return void(this._syncCalls=0);if(this._pendingData+=k.length,this._writeBuffer.push(k),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(k,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+=k.length,this._writeBuffer.push(k),this._callbacks.push(L),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=k.length,this._writeBuffer.push(k),this._callbacks.push(L)}_innerWrite(k=0,L=!0){const f=k||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const a=this._writeBuffer[this._bufferOffset],p=this._action(a,L);if(p){const d=x=>Date.now()-f>=12?setTimeout((()=>this._innerWrite(0,x))):this._innerWrite(f,x);return void p.catch((x=>(queueMicrotask((()=>{throw x})),Promise.resolve(!1)))).then(d)}const m=this._callbacks[this._bufferOffset];if(m&&m(),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=h},5941:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const u=/^([\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})$/,_=/^[\da-f]+$/;function v(h,w){const k=h.toString(16),L=k.length<2?"0"+k:k;switch(w){case 4:return k[0];case 8:return L;case 12:return(L+L).slice(0,3);default:return L+L}}r.parseColor=function(h){if(!h)return;let w=h.toLowerCase();if(w.indexOf("rgb:")===0){w=w.slice(4);const k=u.exec(w);if(k){const L=k[1]?15:k[4]?255:k[7]?4095:65535;return[Math.round(parseInt(k[1]||k[4]||k[7]||k[10],16)/L*255),Math.round(parseInt(k[2]||k[5]||k[8]||k[11],16)/L*255),Math.round(parseInt(k[3]||k[6]||k[9]||k[12],16)/L*255)]}}else if(w.indexOf("#")===0&&(w=w.slice(1),_.exec(w)&&[3,6,9,12].includes(w.length))){const k=w.length/3,L=[0,0,0];for(let f=0;f<3;++f){const a=parseInt(w.slice(k*f,k*f+k),16);L[f]=k===1?a<<4:k===2?a:k===3?a>>4:a>>8}return L}},r.toRgbString=function(h,w=16){const[k,L,f]=h;return`rgb:${v(k,w)}/${v(L,w)}/${v(f,w)}`}},5770:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const _=u(482),v=u(8742),h=u(5770),w=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=w,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=w}registerHandler(L,f){this._handlers[L]===void 0&&(this._handlers[L]=[]);const a=this._handlers[L];return a.push(f),{dispose:()=>{const p=a.indexOf(f);p!==-1&&a.splice(p,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=w,this._ident=0}hook(L,f){if(this.reset(),this._ident=L,this._active=this._handlers[L]||w,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 p=this._active.length-1;p>=0;p--)this._active[p].put(L,f,a);else this._handlerFb(this._ident,"PUT",(0,_.utf32ToString)(L,f,a))}unhook(L,f=!0){if(this._active.length){let a=!1,p=this._active.length-1,m=!1;if(this._stack.paused&&(p=this._stack.loopPosition-1,a=f,m=this._stack.fallThrough,this._stack.paused=!1),!m&&a===!1){for(;p>=0&&(a=this._active[p].unhook(L),a!==!0);p--)if(a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!1,a;p--}for(;p>=0;p--)if(a=this._active[p].unhook(!1),a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=p,this._stack.fallThrough=!0,a}else this._handlerFb(this._ident,"UNHOOK",L);this._active=w,this._ident=0}};const k=new v.Params;k.addParam(0),r.DcsHandler=class{constructor(L){this._handler=L,this._data="",this._params=k,this._hitLimit=!1}hook(L){this._params=L.length>1||L.params[0]?L.clone():k,this._data="",this._hitLimit=!1}put(L,f,a){this._hitLimit||(this._data+=(0,_.utf32ToString)(L,f,a),this._data.length>h.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=k,this._data="",this._hitLimit=!1,a)));return this._params=k,this._data="",this._hitLimit=!1,f}}},2015:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const _=u(844),v=u(8742),h=u(6242),w=u(6351);class k{constructor(p){this.table=new Uint8Array(p)}setDefault(p,m){this.table.fill(p<<4|m)}add(p,m,d,x){this.table[m<<8|p]=d<<4|x}addMany(p,m,d,x){for(let I=0;I<p.length;I++)this.table[m<<8|p[I]]=d<<4|x}}r.TransitionTable=k;const L=160;r.VT500_TRANSITION_TABLE=(function(){const a=new k(4095),p=Array.apply(null,Array(256)).map(((M,b)=>b)),m=(M,b)=>p.slice(M,b),d=m(32,127),x=m(0,24);x.push(25),x.push.apply(x,m(28,32));const I=m(0,14);let E;for(E in a.setDefault(1,0),a.addMany(d,0,2,0),I)a.addMany([24,26,153,154],E,3,0),a.addMany(m(128,144),E,3,0),a.addMany(m(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(x,0,3,0),a.addMany(x,1,3,1),a.add(127,1,0,1),a.addMany(x,8,0,8),a.addMany(x,3,3,3),a.add(127,3,0,3),a.addMany(x,4,3,4),a.add(127,4,0,4),a.addMany(x,6,3,6),a.addMany(x,5,3,5),a.add(127,5,0,5),a.addMany(x,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(m(28,32),8,0,8),a.addMany([88,94,95],1,0,7),a.addMany(d,7,0,7),a.addMany(x,7,0,7),a.add(156,7,0,0),a.add(127,7,0,7),a.add(91,1,11,3),a.addMany(m(64,127),3,7,0),a.addMany(m(48,60),3,8,4),a.addMany([60,61,62,63],3,9,4),a.addMany(m(48,60),4,8,4),a.addMany(m(64,127),4,7,0),a.addMany([60,61,62,63],4,0,6),a.addMany(m(32,64),6,0,6),a.add(127,6,0,6),a.addMany(m(64,127),6,0,0),a.addMany(m(32,48),3,9,5),a.addMany(m(32,48),5,9,5),a.addMany(m(48,64),5,0,6),a.addMany(m(64,127),5,7,0),a.addMany(m(32,48),4,9,5),a.addMany(m(32,48),1,9,2),a.addMany(m(32,48),2,9,2),a.addMany(m(48,127),2,10,0),a.addMany(m(48,80),1,10,0),a.addMany(m(81,88),1,10,0),a.addMany([89,90,92],1,10,0),a.addMany(m(96,127),1,10,0),a.add(80,1,11,9),a.addMany(x,9,0,9),a.add(127,9,0,9),a.addMany(m(28,32),9,0,9),a.addMany(m(32,48),9,9,12),a.addMany(m(48,60),9,8,10),a.addMany([60,61,62,63],9,9,10),a.addMany(x,11,0,11),a.addMany(m(32,128),11,0,11),a.addMany(m(28,32),11,0,11),a.addMany(x,10,0,10),a.add(127,10,0,10),a.addMany(m(28,32),10,0,10),a.addMany(m(48,60),10,8,10),a.addMany([60,61,62,63],10,0,11),a.addMany(m(32,48),10,9,12),a.addMany(x,12,0,12),a.add(127,12,0,12),a.addMany(m(28,32),12,0,12),a.addMany(m(32,48),12,9,12),a.addMany(m(48,64),12,0,11),a.addMany(m(64,127),12,12,13),a.addMany(m(64,127),10,12,13),a.addMany(m(64,127),9,12,13),a.addMany(x,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 _.Disposable{constructor(p=r.VT500_TRANSITION_TABLE){super(),this._transitions=p,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new v.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(m,d,x)=>{},this._executeHandlerFb=m=>{},this._csiHandlerFb=(m,d)=>{},this._escHandlerFb=m=>{},this._errorHandlerFb=m=>m,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,_.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new w.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(p,m=[64,126]){let d=0;if(p.prefix){if(p.prefix.length>1)throw new Error("only one byte as prefix supported");if(d=p.prefix.charCodeAt(0),d&&60>d||d>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(p.intermediates){if(p.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let I=0;I<p.intermediates.length;++I){const E=p.intermediates.charCodeAt(I);if(32>E||E>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");d<<=8,d|=E}}if(p.final.length!==1)throw new Error("final must be a single byte");const x=p.final.charCodeAt(0);if(m[0]>x||x>m[1])throw new Error(`final must be in range ${m[0]} .. ${m[1]}`);return d<<=8,d|=x,d}identToString(p){const m=[];for(;p;)m.push(String.fromCharCode(255&p)),p>>=8;return m.reverse().join("")}setPrintHandler(p){this._printHandler=p}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(p,m){const d=this._identifier(p,[48,126]);this._escHandlers[d]===void 0&&(this._escHandlers[d]=[]);const x=this._escHandlers[d];return x.push(m),{dispose:()=>{const I=x.indexOf(m);I!==-1&&x.splice(I,1)}}}clearEscHandler(p){this._escHandlers[this._identifier(p,[48,126])]&&delete this._escHandlers[this._identifier(p,[48,126])]}setEscHandlerFallback(p){this._escHandlerFb=p}setExecuteHandler(p,m){this._executeHandlers[p.charCodeAt(0)]=m}clearExecuteHandler(p){this._executeHandlers[p.charCodeAt(0)]&&delete this._executeHandlers[p.charCodeAt(0)]}setExecuteHandlerFallback(p){this._executeHandlerFb=p}registerCsiHandler(p,m){const d=this._identifier(p);this._csiHandlers[d]===void 0&&(this._csiHandlers[d]=[]);const x=this._csiHandlers[d];return x.push(m),{dispose:()=>{const I=x.indexOf(m);I!==-1&&x.splice(I,1)}}}clearCsiHandler(p){this._csiHandlers[this._identifier(p)]&&delete this._csiHandlers[this._identifier(p)]}setCsiHandlerFallback(p){this._csiHandlerFb=p}registerDcsHandler(p,m){return this._dcsParser.registerHandler(this._identifier(p),m)}clearDcsHandler(p){this._dcsParser.clearHandler(this._identifier(p))}setDcsHandlerFallback(p){this._dcsParser.setHandlerFallback(p)}registerOscHandler(p,m){return this._oscParser.registerHandler(p,m)}clearOscHandler(p){this._oscParser.clearHandler(p)}setOscHandlerFallback(p){this._oscParser.setHandlerFallback(p)}setErrorHandler(p){this._errorHandler=p}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(p,m,d,x,I){this._parseStack.state=p,this._parseStack.handlers=m,this._parseStack.handlerPos=d,this._parseStack.transition=x,this._parseStack.chunkPos=I}parse(p,m,d){let x,I=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 R=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(d===!1&&R>-1){for(;R>=0&&(x=b[R](this._params),x!==!0);R--)if(x instanceof Promise)return this._parseStack.handlerPos=R,x}this._parseStack.handlers=[];break;case 4:if(d===!1&&R>-1){for(;R>=0&&(x=b[R](),x!==!0);R--)if(x instanceof Promise)return this._parseStack.handlerPos=R,x}this._parseStack.handlers=[];break;case 6:if(I=p[this._parseStack.chunkPos],x=this._dcsParser.unhook(I!==24&&I!==26,d),x)return x;I===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(I=p[this._parseStack.chunkPos],x=this._oscParser.end(I!==24&&I!==26,d),x)return x;I===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<m;++b){switch(I=p[b],E=this._transitions.table[this.currentState<<8|(I<160?I:L)],E>>4){case 2:for(let F=b+1;;++F){if(F>=m||(I=p[F])<32||I>126&&I<L){this._printHandler(p,b,F),b=F-1;break}if(++F>=m||(I=p[F])<32||I>126&&I<L){this._printHandler(p,b,F),b=F-1;break}if(++F>=m||(I=p[F])<32||I>126&&I<L){this._printHandler(p,b,F),b=F-1;break}if(++F>=m||(I=p[F])<32||I>126&&I<L){this._printHandler(p,b,F),b=F-1;break}}break;case 3:this._executeHandlers[I]?this._executeHandlers[I]():this._executeHandlerFb(I),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:b,code:I,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const R=this._csiHandlers[this._collect<<8|I];let D=R?R.length-1:-1;for(;D>=0&&(x=R[D](this._params),x!==!0);D--)if(x instanceof Promise)return this._preserveStack(3,R,D,E,b),x;D<0&&this._csiHandlerFb(this._collect<<8|I,this._params),this.precedingJoinState=0;break;case 8:do switch(I){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(I-48)}while(++b<m&&(I=p[b])>47&&I<60);b--;break;case 9:this._collect<<=8,this._collect|=I;break;case 10:const B=this._escHandlers[this._collect<<8|I];let O=B?B.length-1:-1;for(;O>=0&&(x=B[O](),x!==!0);O--)if(x instanceof Promise)return this._preserveStack(4,B,O,E,b),x;O<0&&this._escHandlerFb(this._collect<<8|I),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|I,this._params);break;case 13:for(let F=b+1;;++F)if(F>=m||(I=p[F])===24||I===26||I===27||I>127&&I<L){this._dcsParser.put(p,b,F),b=F-1;break}break;case 14:if(x=this._dcsParser.unhook(I!==24&&I!==26),x)return this._preserveStack(6,[],0,E,b),x;I===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let F=b+1;;F++)if(F>=m||(I=p[F])<32||I>127&&I<L){this._oscParser.put(p,b,F),b=F-1;break}break;case 6:if(x=this._oscParser.end(I!==24&&I!==26),x)return this._preserveStack(5,[],0,E,b),x;I===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&E}}}r.EscapeSequenceParser=f},6242:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const _=u(5770),v=u(482),h=[];r.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(w,k){this._handlers[w]===void 0&&(this._handlers[w]=[]);const L=this._handlers[w];return L.push(k),{dispose:()=>{const f=L.indexOf(k);f!==-1&&L.splice(f,1)}}}clearHandler(w){this._handlers[w]&&delete this._handlers[w]}setHandlerFallback(w){this._handlerFb=w}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let w=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;w>=0;--w)this._active[w].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].start();else this._handlerFb(this._id,"START")}_put(w,k,L){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(w,k,L);else this._handlerFb(this._id,"PUT",(0,v.utf32ToString)(w,k,L))}start(){this.reset(),this._state=1}put(w,k,L){if(this._state!==3){if(this._state===1)for(;k<L;){const f=w[k++];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-k>0&&this._put(w,k,L)}}end(w,k=!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=k,a=this._stack.fallThrough,this._stack.paused=!1),!a&&L===!1){for(;f>=0&&(L=this._active[f].end(w),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",w);this._active=h,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(w){this._handler=w,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(w,k,L){this._hitLimit||(this._data+=(0,v.utf32ToString)(w,k,L),this._data.length>_.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(w){let k=!1;if(this._hitLimit)k=!1;else if(w&&(k=this._handler(this._data),k instanceof Promise))return k.then((L=>(this._data="",this._hitLimit=!1,L)));return this._data="",this._hitLimit=!1,k}}},8742:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const u=2147483647;class _{static fromArray(h){const w=new _;if(!h.length)return w;for(let k=Array.isArray(h[0])?1:0;k<h.length;++k){const L=h[k];if(Array.isArray(L))for(let f=0;f<L.length;++f)w.addSubParam(L[f]);else w.addParam(L)}return w}constructor(h=32,w=32){if(this.maxLength=h,this.maxSubParamsLength=w,w>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(w),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new _(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let w=0;w<this.length;++w){h.push(this.params[w]);const k=this._subParamsIdx[w]>>8,L=255&this._subParamsIdx[w];L-k>0&&h.push(Array.prototype.slice.call(this._subParams,k,L))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>u?u:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>u?u:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const w=this._subParamsIdx[h]>>8,k=255&this._subParamsIdx[h];return k-w>0?this._subParams.subarray(w,k):null}getSubParamsAll(){const h={};for(let w=0;w<this.length;++w){const k=this._subParamsIdx[w]>>8,L=255&this._subParamsIdx[w];L-k>0&&(h[w]=this._subParams.slice(k,L))}return h}addDigit(h){let w;if(this._rejectDigits||!(w=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const k=this._digitIsSub?this._subParams:this.params,L=k[w-1];k[w-1]=~L?Math.min(10*L+h,u):h}}r.Params=_},5741:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,_){const v={instance:_,dispose:_.dispose,isDisposed:!1};this._addons.push(v),_.dispose=()=>this._wrappedAddonDispose(v),_.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let _=-1;for(let v=0;v<this._addons.length;v++)if(this._addons[v]===u){_=v;break}if(_===-1)throw new Error("Could not dispose an addon that has not been loaded");u.isDisposed=!0,u.dispose.apply(u.instance),this._addons.splice(_,1)}}},8771:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const _=u(3785),v=u(511);r.BufferApiView=class{constructor(h,w){this._buffer=h,this.type=w}init(h){return this._buffer=h,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(h){const w=this._buffer.lines.get(h);if(w)return new _.BufferLineApiView(w)}getNullCell(){return new v.CellData}}},3785:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const _=u(511);r.BufferLineApiView=class{constructor(v){this._line=v}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(v,h){if(!(v<0||v>=this._line.length))return h?(this._line.loadCell(v,h),h):this._line.loadCell(v,new _.CellData)}translateToString(v,h,w){return this._line.translateToString(v,h,w)}}},8285:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const _=u(8771),v=u(8460),h=u(844);class w extends h.Disposable{constructor(L){super(),this._core=L,this._onBufferChange=this.register(new v.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new _.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new _.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=w},7975:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,_){return this._core.registerCsiHandler(u,(v=>_(v.toArray())))}addCsiHandler(u,_){return this.registerCsiHandler(u,_)}registerDcsHandler(u,_){return this._core.registerDcsHandler(u,((v,h)=>_(v,h.toArray())))}addDcsHandler(u,_){return this.registerDcsHandler(u,_)}registerEscHandler(u,_){return this._core.registerEscHandler(u,_)}addEscHandler(u,_){return this.registerEscHandler(u,_)}registerOscHandler(u,_){return this._core.registerOscHandler(u,_)}addOscHandler(u,_){return this.registerOscHandler(u,_)}}},7090:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(C,r,u){var _=this&&this.__decorate||function(a,p,m,d){var x,I=arguments.length,E=I<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(a,p,m,d);else for(var M=a.length-1;M>=0;M--)(x=a[M])&&(E=(I<3?x(E):I>3?x(p,m,E):x(p,m))||E);return I>3&&E&&Object.defineProperty(p,m,E),E},v=this&&this.__param||function(a,p){return function(m,d){p(m,d,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const h=u(8460),w=u(844),k=u(5295),L=u(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let f=r.BufferService=class extends w.Disposable{get buffer(){return this.buffers.active}constructor(a){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(a.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(a.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new k.BufferSet(a,this))}resize(a,p){this.cols=a,this.rows=p,this.buffers.resize(a,p),this._onResize.fire({cols:a,rows:p})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(a,p=!1){const m=this.buffer;let d;d=this._cachedBlankLine,d&&d.length===this.cols&&d.getFg(0)===a.fg&&d.getBg(0)===a.bg||(d=m.getBlankLine(a,p),this._cachedBlankLine=d),d.isWrapped=p;const x=m.ybase+m.scrollTop,I=m.ybase+m.scrollBottom;if(m.scrollTop===0){const E=m.lines.isFull;I===m.lines.length-1?E?m.lines.recycle().copyFrom(d):m.lines.push(d.clone()):m.lines.splice(I+1,0,d.clone()),E?this.isUserScrolling&&(m.ydisp=Math.max(m.ydisp-1,0)):(m.ybase++,this.isUserScrolling||m.ydisp++)}else{const E=I-x+1;m.lines.shiftElements(x+1,E-1,-1),m.lines.set(I,d.clone())}this.isUserScrolling||(m.ydisp=m.ybase),this._onScroll.fire(m.ydisp)}scrollLines(a,p,m){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 x=d.ydisp;d.ydisp=Math.max(Math.min(d.ydisp+a,d.ybase),0),x!==d.ydisp&&(p||this._onScroll.fire(d.ydisp))}};r.BufferService=f=_([v(0,L.IOptionsService)],f)},7994:(C,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(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,_){this._charsets[u]=_,this.glevel===u&&(this.charset=_)}}},1753:function(C,r,u){var _=this&&this.__decorate||function(d,x,I,E){var M,b=arguments.length,R=b<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,I):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(d,x,I,E);else for(var D=d.length-1;D>=0;D--)(M=d[D])&&(R=(b<3?M(R):b>3?M(x,I,R):M(x,I))||R);return b>3&&R&&Object.defineProperty(x,I,R),R},v=this&&this.__param||function(d,x){return function(I,E){x(I,E,d)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const h=u(2585),w=u(8460),k=u(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,x){let I=(d.ctrl?16:0)|(d.shift?4:0)|(d.alt?8:0);return d.button===4?(I|=64,I|=d.action):(I|=3&d.button,4&d.button&&(I|=64),8&d.button&&(I|=128),d.action===32?I|=32:d.action!==0||x||(I|=3)),I}const a=String.fromCharCode,p={DEFAULT:d=>{const x=[f(d,!1)+32,d.col+32,d.row+32];return x[0]>255||x[1]>255||x[2]>255?"":`\x1B[M${a(x[0])}${a(x[1])}${a(x[2])}`},SGR:d=>{const x=d.action===0&&d.button!==4?"m":"M";return`\x1B[<${f(d,!0)};${d.col};${d.row}${x}`},SGR_PIXELS:d=>{const x=d.action===0&&d.button!==4?"m":"M";return`\x1B[<${f(d,!0)};${d.x};${d.y}${x}`}};let m=r.CoreMouseService=class extends k.Disposable{constructor(d,x){super(),this._bufferService=d,this._coreService=x,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new w.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const I of Object.keys(L))this.addProtocol(I,L[I]);for(const I of Object.keys(p))this.addEncoding(I,p[I]);this.reset()}addProtocol(d,x){this._protocols[d]=x}addEncoding(d,x){this._encodings[d]=x}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 x=this._encodings[this._activeEncoding](d);return x&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(x):this._coreService.triggerDataEvent(x,!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,x,I){if(I){if(d.x!==x.x||d.y!==x.y)return!1}else if(d.col!==x.col||d.row!==x.row)return!1;return d.button===x.button&&d.action===x.action&&d.ctrl===x.ctrl&&d.alt===x.alt&&d.shift===x.shift}};r.CoreMouseService=m=_([v(0,h.IBufferService),v(1,h.ICoreService)],m)},6975:function(C,r,u){var _=this&&this.__decorate||function(m,d,x,I){var E,M=arguments.length,b=M<3?d:I===null?I=Object.getOwnPropertyDescriptor(d,x):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(m,d,x,I);else for(var R=m.length-1;R>=0;R--)(E=m[R])&&(b=(M<3?E(b):M>3?E(d,x,b):E(d,x))||b);return M>3&&b&&Object.defineProperty(d,x,b),b},v=this&&this.__param||function(m,d){return function(x,I){d(x,I,m)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const h=u(1439),w=u(8460),k=u(844),L=u(2585),f=Object.freeze({insertMode:!1}),a=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let p=r.CoreService=class extends k.Disposable{constructor(m,d,x){super(),this._bufferService=m,this._logService=d,this._optionsService=x,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new w.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new w.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new w.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new w.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(f),this.decPrivateModes=(0,h.clone)(a)}reset(){this.modes=(0,h.clone)(f),this.decPrivateModes=(0,h.clone)(a)}triggerDataEvent(m,d=!1){if(this._optionsService.rawOptions.disableStdin)return;const x=this._bufferService.buffer;d&&this._optionsService.rawOptions.scrollOnUserInput&&x.ybase!==x.ydisp&&this._onRequestScrollToBottom.fire(),d&&this._onUserInput.fire(),this._logService.debug(`sending data "${m}"`,(()=>m.split("").map((I=>I.charCodeAt(0))))),this._onData.fire(m)}triggerBinaryEvent(m){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${m}"`,(()=>m.split("").map((d=>d.charCodeAt(0))))),this._onBinary.fire(m))}};r.CoreService=p=_([v(0,L.IBufferService),v(1,L.ILogService),v(2,L.IOptionsService)],p)},9074:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const _=u(8055),v=u(8460),h=u(844),w=u(6106);let k=0,L=0;class f extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new w.SortedList((m=>m==null?void 0:m.marker.line)),this._onDecorationRegistered=this.register(new v.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new v.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(m){if(m.marker.isDisposed)return;const d=new a(m);if(d){const x=d.marker.onDispose((()=>d.dispose()));d.onDispose((()=>{d&&(this._decorations.delete(d)&&this._onDecorationRemoved.fire(d),x.dispose())})),this._decorations.insert(d),this._onDecorationRegistered.fire(d)}return d}reset(){for(const m of this._decorations.values())m.dispose();this._decorations.clear()}*getDecorationsAtCell(m,d,x){let I=0,E=0;for(const M of this._decorations.getKeyIterator(d))I=M.options.x??0,E=I+(M.options.width??1),m>=I&&m<E&&(!x||(M.options.layer??"bottom")===x)&&(yield M)}forEachDecorationAtCell(m,d,x,I){this._decorations.forEachByKey(d,(E=>{k=E.options.x??0,L=k+(E.options.width??1),m>=k&&m<L&&(!x||(E.options.layer??"bottom")===x)&&I(E)}))}}r.DecorationService=f;class a extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=_.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=_.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(m){super(),this.options=m,this.onRenderEmitter=this.register(new v.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new v.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=m.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const _=u(2585),v=u(8343);class h{constructor(...k){this._entries=new Map;for(const[L,f]of k)this.set(L,f)}set(k,L){const f=this._entries.get(k);return this._entries.set(k,L),f}forEach(k){for(const[L,f]of this._entries.entries())k(L,f)}has(k){return this._entries.has(k)}get(k){return this._entries.get(k)}}r.ServiceCollection=h,r.InstantiationService=class{constructor(){this._services=new h,this._services.set(_.IInstantiationService,this)}setService(w,k){this._services.set(w,k)}getService(w){return this._services.get(w)}createInstance(w,...k){const L=(0,v.getServiceDependencies)(w).sort(((p,m)=>p.index-m.index)),f=[];for(const p of L){const m=this._services.get(p.id);if(!m)throw new Error(`[createInstance] ${w.name} depends on UNKNOWN service ${p.id}.`);f.push(m)}const a=L.length>0?L[0].index:k.length;if(k.length!==a)throw new Error(`[createInstance] First service dependency of ${w.name} at position ${a+1} conflicts with ${k.length} static arguments`);return new w(...k,...f)}}},7866:function(C,r,u){var _=this&&this.__decorate||function(a,p,m,d){var x,I=arguments.length,E=I<3?p:d===null?d=Object.getOwnPropertyDescriptor(p,m):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(a,p,m,d);else for(var M=a.length-1;M>=0;M--)(x=a[M])&&(E=(I<3?x(E):I>3?x(p,m,E):x(p,m))||E);return I>3&&E&&Object.defineProperty(p,m,E),E},v=this&&this.__param||function(a,p){return function(m,d){p(m,d,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const h=u(844),w=u(2585),k={trace:w.LogLevelEnum.TRACE,debug:w.LogLevelEnum.DEBUG,info:w.LogLevelEnum.INFO,warn:w.LogLevelEnum.WARN,error:w.LogLevelEnum.ERROR,off:w.LogLevelEnum.OFF};let L,f=r.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(a){super(),this._optionsService=a,this._logLevel=w.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),L=this}_updateLogLevel(){this._logLevel=k[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let p=0;p<a.length;p++)typeof a[p]=="function"&&(a[p]=a[p]())}_log(a,p,m){this._evalLazyOptionalParams(m),a.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+p,...m)}trace(a,...p){var m;this._logLevel<=w.LogLevelEnum.TRACE&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.trace.bind(this._optionsService.options.logger))??console.log,a,p)}debug(a,...p){var m;this._logLevel<=w.LogLevelEnum.DEBUG&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.debug.bind(this._optionsService.options.logger))??console.log,a,p)}info(a,...p){var m;this._logLevel<=w.LogLevelEnum.INFO&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.info.bind(this._optionsService.options.logger))??console.info,a,p)}warn(a,...p){var m;this._logLevel<=w.LogLevelEnum.WARN&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.warn.bind(this._optionsService.options.logger))??console.warn,a,p)}error(a,...p){var m;this._logLevel<=w.LogLevelEnum.ERROR&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.error.bind(this._optionsService.options.logger))??console.error,a,p)}};r.LogService=f=_([v(0,w.IOptionsService)],f),r.setTraceLogger=function(a){L=a},r.traceCall=function(a,p,m){if(typeof m.value!="function")throw new Error("not supported");const d=m.value;m.value=function(...x){if(L.logLevel!==w.LogLevelEnum.TRACE)return d.apply(this,x);L.trace(`GlyphRenderer#${d.name}(${x.map((E=>JSON.stringify(E))).join(", ")})`);const I=d.apply(this,x);return L.trace(`GlyphRenderer#${d.name} return`,I),I}}},7302:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const _=u(8460),v=u(844),h=u(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:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const w=["normal","bold","100","200","300","400","500","600","700","800","900"];class k extends v.Disposable{constructor(f){super(),this._onOptionChange=this.register(new _.EventEmitter),this.onOptionChange=this._onOptionChange.event;const a={...r.DEFAULT_OPTIONS};for(const p in f)if(p in a)try{const m=f[p];a[p]=this._sanitizeAndValidateOption(p,m)}catch(m){console.error(m)}this.rawOptions=a,this.options={...a},this._setupOptions(),this.register((0,v.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(f,a){return this.onOptionChange((p=>{p===f&&a(this.rawOptions[f])}))}onMultipleOptionChange(f,a){return this.onOptionChange((p=>{f.indexOf(p)!==-1&&a()}))}_setupOptions(){const f=p=>{if(!(p in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${p}"`);return this.rawOptions[p]},a=(p,m)=>{if(!(p in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${p}"`);m=this._sanitizeAndValidateOption(p,m),this.rawOptions[p]!==m&&(this.rawOptions[p]=m,this._onOptionChange.fire(p))};for(const p in this.rawOptions){const m={get:f.bind(this,p),set:a.bind(this,p)};Object.defineProperty(this.options,p,m)}}_sanitizeAndValidateOption(f,a){switch(f){case"cursorStyle":if(a||(a=r.DEFAULT_OPTIONS[f]),!(function(p){return p==="block"||p==="underline"||p==="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=w.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=k},2660:function(C,r,u){var _=this&&this.__decorate||function(k,L,f,a){var p,m=arguments.length,d=m<3?L:a===null?a=Object.getOwnPropertyDescriptor(L,f):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(k,L,f,a);else for(var x=k.length-1;x>=0;x--)(p=k[x])&&(d=(m<3?p(d):m>3?p(L,f,d):p(L,f))||d);return m>3&&d&&Object.defineProperty(L,f,d),d},v=this&&this.__param||function(k,L){return function(f,a){L(f,a,k)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const h=u(2585);let w=r.OscLinkService=class{constructor(k){this._bufferService=k,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(k){const L=this._bufferService.buffer;if(k.id===void 0){const x=L.addMarker(L.ybase+L.y),I={data:k,id:this._nextId++,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(I,x))),this._dataByLinkId.set(I.id,I),I.id}const f=k,a=this._getEntryIdKey(f),p=this._entriesWithId.get(a);if(p)return this.addLineToLink(p.id,L.ybase+L.y),p.id;const m=L.addMarker(L.ybase+L.y),d={id:this._nextId++,key:this._getEntryIdKey(f),data:f,lines:[m]};return m.onDispose((()=>this._removeMarkerFromLink(d,m))),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(k,L){const f=this._dataByLinkId.get(k);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(k){var L;return(L=this._dataByLinkId.get(k))==null?void 0:L.data}_getEntryIdKey(k){return`${k.id};;${k.uri}`}_removeMarkerFromLink(k,L){const f=k.lines.indexOf(L);f!==-1&&(k.lines.splice(f,1),k.lines.length===0&&(k.data.id!==void 0&&this._entriesWithId.delete(k.key),this._dataByLinkId.delete(k.id)))}};r.OscLinkService=w=_([v(0,h.IBufferService)],w)},8343:(C,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const u="di$target",_="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(v){return v[_]||[]},r.createDecorator=function(v){if(r.serviceRegistry.has(v))return r.serviceRegistry.get(v);const h=function(w,k,L){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,a,p){a[u]===a?a[_].push({id:f,index:p}):(a[_]=[{id:f,index:p}],a[u]=a)})(h,w,L)};return h.toString=()=>v,r.serviceRegistry.set(v,h),h}},2585:(C,r,u)=>{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 _=u(8343);var v;r.IBufferService=(0,_.createDecorator)("BufferService"),r.ICoreMouseService=(0,_.createDecorator)("CoreMouseService"),r.ICoreService=(0,_.createDecorator)("CoreService"),r.ICharsetService=(0,_.createDecorator)("CharsetService"),r.IInstantiationService=(0,_.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(v||(r.LogLevelEnum=v={})),r.ILogService=(0,_.createDecorator)("LogService"),r.IOptionsService=(0,_.createDecorator)("OptionsService"),r.IOscLinkService=(0,_.createDecorator)("OscLinkService"),r.IUnicodeService=(0,_.createDecorator)("UnicodeService"),r.IDecorationService=(0,_.createDecorator)("DecorationService")},1480:(C,r,u)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const _=u(8460),v=u(225);class h{static extractShouldJoin(k){return(1&k)!=0}static extractWidth(k){return k>>1&3}static extractCharKind(k){return k>>3}static createPropertyValue(k,L,f=!1){return(16777215&k)<<3|(3&L)<<1|(f?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _.EventEmitter,this.onChange=this._onChange.event;const k=new v.UnicodeV6;this.register(k),this._active=k.version,this._activeProvider=k}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(k){if(!this._providers[k])throw new Error(`unknown Unicode version "${k}"`);this._active=k,this._activeProvider=this._providers[k],this._onChange.fire(k)}register(k){this._providers[k.version]=k}wcwidth(k){return this._activeProvider.wcwidth(k)}getStringCellWidth(k){let L=0,f=0;const a=k.length;for(let p=0;p<a;++p){let m=k.charCodeAt(p);if(55296<=m&&m<=56319){if(++p>=a)return L+this.wcwidth(m);const I=k.charCodeAt(p);56320<=I&&I<=57343?m=1024*(m-55296)+I-56320+65536:L+=this.wcwidth(I)}const d=this.charProperties(m,f);let x=h.extractWidth(d);h.extractShouldJoin(d)&&(x-=h.extractWidth(f)),L+=x,f=d}return L}charProperties(k,L){return this._activeProvider.charProperties(k,L)}}r.UnicodeService=h}},c={};function g(C){var r=c[C];if(r!==void 0)return r.exports;var u=c[C]={exports:{}};return i[C].call(u.exports,u,u.exports,g),u.exports}var T={};return(()=>{var C=T;Object.defineProperty(C,"__esModule",{value:!0}),C.Terminal=void 0;const r=g(9042),u=g(3236),_=g(844),v=g(5741),h=g(8285),w=g(7975),k=g(7090),L=["cols","rows"];class f extends _.Disposable{constructor(p){super(),this._core=this.register(new u.Terminal(p)),this._addonManager=this.register(new v.AddonManager),this._publicOptions={...this._core.options};const m=x=>this._core.options[x],d=(x,I)=>{this._checkReadonlyOptions(x),this._core.options[x]=I};for(const x in this._core.options){const I={get:m.bind(this,x),set:d.bind(this,x)};Object.defineProperty(this._publicOptions,x,I)}}_checkReadonlyOptions(p){if(L.includes(p))throw new Error(`Option "${p}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new w.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new k.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const p=this._core.coreService.decPrivateModes;let m="none";switch(this._core.coreMouseService.activeProtocol){case"X10":m="x10";break;case"VT200":m="vt200";break;case"DRAG":m="drag";break;case"ANY":m="any"}return{applicationCursorKeysMode:p.applicationCursorKeys,applicationKeypadMode:p.applicationKeypad,bracketedPasteMode:p.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:m,originMode:p.origin,reverseWraparoundMode:p.reverseWraparound,sendFocusMode:p.sendFocus,wraparoundMode:p.wraparound}}get options(){return this._publicOptions}set options(p){for(const m in p)this._publicOptions[m]=p[m]}blur(){this._core.blur()}focus(){this._core.focus()}input(p,m=!0){this._core.input(p,m)}resize(p,m){this._verifyIntegers(p,m),this._core.resize(p,m)}open(p){this._core.open(p)}attachCustomKeyEventHandler(p){this._core.attachCustomKeyEventHandler(p)}attachCustomWheelEventHandler(p){this._core.attachCustomWheelEventHandler(p)}registerLinkProvider(p){return this._core.registerLinkProvider(p)}registerCharacterJoiner(p){return this._checkProposedApi(),this._core.registerCharacterJoiner(p)}deregisterCharacterJoiner(p){this._checkProposedApi(),this._core.deregisterCharacterJoiner(p)}registerMarker(p=0){return this._verifyIntegers(p),this._core.registerMarker(p)}registerDecoration(p){return this._checkProposedApi(),this._verifyPositiveIntegers(p.x??0,p.width??0,p.height??0),this._core.registerDecoration(p)}hasSelection(){return this._core.hasSelection()}select(p,m,d){this._verifyIntegers(p,m,d),this._core.select(p,m,d)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(p,m){this._verifyIntegers(p,m),this._core.selectLines(p,m)}dispose(){super.dispose()}scrollLines(p){this._verifyIntegers(p),this._core.scrollLines(p)}scrollPages(p){this._verifyIntegers(p),this._core.scrollPages(p)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(p){this._verifyIntegers(p),this._core.scrollToLine(p)}clear(){this._core.clear()}write(p,m){this._core.write(p,m)}writeln(p,m){this._core.write(p),this._core.write(`\r
116
- `,m)}paste(p){this._core.paste(p)}refresh(p,m){this._verifyIntegers(p,m),this._core.refresh(p,m)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(p){this._addonManager.loadAddon(this,p)}static get strings(){return r}_verifyIntegers(...p){for(const m of p)if(m===1/0||isNaN(m)||m%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...p){for(const m of p)if(m&&(m===1/0||isNaN(m)||m%1!=0||m<0))throw new Error("This API only accepts positive integers")}}C.Terminal=f})(),T})()))})(Uc)),Uc.exports}var Y1=G1();function X1(t){return t.toLowerCase().startsWith("win")}function Q1(t){return t.keyCode===86&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey}const J1=8,Z1=100,eb=80,$f=6,Uf=.02,tb=.95,nb=50;function sb(t,n){return Math.hypot(t,n)>J1}function rb(t,n){const i=t[t.length-1];if(i===void 0||n-i.t>eb)return 0;const c=t.filter(C=>i.t-C.t<=Z1),g=c[0];if(g===void 0||c.length<2||i.t===g.t)return 0;const T=(g.y-i.y)/(i.t-g.t);return Math.max(-$f,Math.min($f,T))}function ib(t,n){if(Math.abs(t)<Uf)return{delta:0,velocity:0};const i=Math.max(0,Math.min(nb,n)),c=t*tb**(i/16);return{delta:t*i,velocity:Math.abs(c)<Uf?0:c}}function ob(t){const n=Math.trunc(t);return{pixels:n,rest:t-n}}const lb=60;function ab(){return new URLSearchParams(window.location.search).get("renderer")==="webgl"?"webgl":"canvas"}const Wf={dark:{background:"#12141a",foreground:"#d8dee9",cursor:"#d8dee9",selectionBackground:"#2f3542"},light:{background:"#fbfbfd",foreground:"#22262e",cursor:"#22262e",selectionBackground:"#cfd8e3"}},zf={dark:1,light:4.5};function Xm({terminalId:t,connection:n,active:i,theme:c,autoFocus:g=!0,pasteOnCtrlV:T=!1}){const C=N.useRef(null),r=N.useRef(null),u=N.useRef(null),_=N.useRef(c);return _.current=c,N.useEffect(()=>{const v=C.current;if(v===null)return;const h=new Y1.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:'"Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace',fontSize:14,lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:Wf[_.current],minimumContrastRatio:zf[_.current]});r.current=h;const w=new W1.FitAddon;u.current=w,h.loadAddon(w),h.loadAddon(new V1.WebLinksAddon),h.open(v);let k=!1;const L=()=>{if(!(k||ab()!=="webgl")){k=!0;try{const Q=new K1.WebglAddon;Q.onContextLoss(()=>Q.dispose()),h.loadAddon(Q)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let f={cols:0,rows:0},a;const p=()=>v.clientWidth>0&&v.clientHeight>0,m=Q=>{const{cols:Z,rows:ae}=h;Z<=0||ae<=0||!Q&&Z===f.cols&&ae===f.rows||(f={cols:Z,rows:ae},n.send({type:"resize",terminalId:t,cols:Z,rows:ae}))};let d={atBottom:!0,line:0},x=!1;const I=()=>{if(x||!p())return;const Q=h.buffer.active;d={atBottom:Q.viewportY>=Q.baseY,line:Q.viewportY}},E=()=>{const Q=h.buffer.active;if(Q.baseY===0)return;const Z=d.atBottom?Q.baseY:Math.min(d.line,Q.baseY);h.scrollToLine(Z>0?Z-1:Z+1),h.scrollToLine(Z)},M=h.onRender(I),b=h.onScroll(I);let R=p();const D=()=>{if(p()){try{w.fit()}catch{return}x&&(E(),x=!1),h.cols>0&&h.rows>0&&L(),m(!1)}},B=()=>{window.clearTimeout(a),a=window.setTimeout(D,lb)},O=new ResizeObserver(()=>{const Q=p();x=!0,Q&&!R&&E(),R=Q,B()});O.observe(v),window.addEventListener("resize",B);let F=null,U=0,q=0;const X=(Q,Z,ae)=>{const fe=h.element;if(fe===void 0)return;const Ee=ob(q+Q);q=Ee.rest,Ee.pixels!==0&&fe.dispatchEvent(new WheelEvent("wheel",{deltaY:Ee.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:Z,clientY:ae,bubbles:!0,cancelable:!0}))},Y=()=>{window.cancelAnimationFrame(U),U=0},V=(Q,Z,ae)=>{let fe=Q,Ee=performance.now();const Ae=ze=>{if(!p()){U=0;return}const ue=ib(fe,ze-Ee);Ee=ze,X(ue.delta,Z,ae),fe=ue.velocity,U=fe===0?0:window.requestAnimationFrame(Ae)};U=window.requestAnimationFrame(Ae)},j=(Q,Z)=>{for(let ae=0;ae<Q.length;ae++){const fe=Q.item(ae);if(fe!==null&&fe.identifier===Z)return fe}return null},$=Q=>{Y(),q=0;const Z=Q.touches.length===1?Q.touches.item(0):null;F=Z===null?null:{id:Z.identifier,startX:Z.clientX,startY:Z.clientY,lastX:Z.clientX,lastY:Z.clientY,moving:!1,samples:[{t:Q.timeStamp,y:Z.clientY}]}},H=Q=>{if(Q.stopPropagation(),F===null)return;const Z=j(Q.touches,F.id);if(Z===null)return;if(!F.moving){if(!sb(Z.clientX-F.startX,Z.clientY-F.startY))return;F.moving=!0}Q.cancelable&&Q.preventDefault();const ae=F.lastY-Z.clientY;F.lastX=Z.clientX,F.lastY=Z.clientY,F.samples.push({t:Q.timeStamp,y:Z.clientY}),F.samples.length>32&&F.samples.shift(),X(ae,Z.clientX,Z.clientY)},K=Q=>{if(F===null||j(Q.changedTouches,F.id)===null)return;const Z=F;if(F=null,!Z.moving)return;const ae=rb(Z.samples,Q.timeStamp);ae!==0&&V(ae,Z.lastX,Z.lastY)},te=()=>{F=null};v.addEventListener("touchstart",$,{capture:!0,passive:!0}),v.addEventListener("touchmove",H,{capture:!0,passive:!1}),v.addEventListener("touchend",K,{capture:!0,passive:!0}),v.addEventListener("touchcancel",te,{capture:!0,passive:!0});const re=()=>{if(!(document.visibilityState!=="visible"||!p())){try{w.fit()}catch{return}m(!0)}};window.addEventListener("focus",re),document.addEventListener("visibilitychange",re),T&&h.attachCustomKeyEventHandler(Q=>!Q1(Q));const le=h.onData(Q=>{n.send({type:"input",terminalId:t,data:Q})}),de=n.onMessage(Q=>{switch(Q.type){case"terminal.output":Q.terminalId===t&&h.write(Q.data);break;case"terminal.replay":if(Q.terminalId!==t)break;h.reset(),Q.truncated&&h.write(`\x1B[90m-- ${S("terminal.replayTruncated")} --\x1B[0m\r
117
- `),h.write(Q.data);break;case"terminal.exit":if(Q.terminalId!==t)break;h.write(`\r
118
- \x1B[90m-- ${S("terminal.exited",{code:Q.exitCode})} --\x1B[0m\r
119
- `);break}}),G=()=>{if(p())try{w.fit()}catch{}const Q=h.cols>0?h.cols:80,Z=h.rows>0?h.rows:24;f={cols:Q,rows:Z},n.send({type:"terminal.attach",terminalId:t,cols:Q,rows:Z})};G();const z=n.onReopen(G);return()=>{window.clearTimeout(a),window.removeEventListener("resize",B),window.removeEventListener("focus",re),document.removeEventListener("visibilitychange",re),O.disconnect(),Y(),v.removeEventListener("touchstart",$,{capture:!0}),v.removeEventListener("touchmove",H,{capture:!0}),v.removeEventListener("touchend",K,{capture:!0}),v.removeEventListener("touchcancel",te,{capture:!0}),M.dispose(),b.dispose(),le.dispose(),de(),z(),n.send({type:"terminal.detach",terminalId:t}),h.dispose(),r.current=null,u.current=null}},[t,n,T]),N.useEffect(()=>{const v=r.current;v!==null&&(v.options.theme=Wf[c],v.options.minimumContrastRatio=zf[c])},[c]),N.useEffect(()=>{if(!i)return;const v=r.current,h=u.current;if(v===null||h===null)return;const w=window.setTimeout(()=>{const k=C.current;if(!(k===null||k.clientWidth===0||k.clientHeight===0)){try{h.fit()}catch{return}g&&v.focus(),v.cols>0&&v.rows>0&&n.send({type:"resize",terminalId:t,cols:v.cols,rows:v.rows})}},0);return()=>window.clearTimeout(w)},[i,g,t,n]),l.jsx("div",{className:`terminal-surface${i?"":" terminal-surface-hidden"}`,ref:C})}function cb(){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 $l({title:t,onHide:n,confirmText:i}){const[c,g]=N.useState(!1);return l.jsxs("span",{className:"section-hide",children:[l.jsx("button",{className:"icon-button",onClick:T=>{T.stopPropagation(),i===null?n():g(!0)},title:t,"aria-label":t,children:l.jsx(cb,{})}),c&&i!==null&&l.jsxs("span",{className:"section-hide-confirm",role:"alert",children:[l.jsx("span",{children:i}),l.jsx("button",{className:"link-button",onClick:()=>{g(!1),n()},children:S("settings.panels.consoleConfirmYes")}),l.jsx("button",{className:"link-button",onClick:()=>g(!1),children:S("common.cancel")})]})]})}const ub=typeof navigator<"u"&&X1(navigator.platform);function hb({connection:t,shells:n,activeShellId:i,cwd:c,shellName:g,theme:T,onSelect:C,onOpen:r,onCloseShell:u,onCollapse:_,onHide:v,hideCount:h=0}){const w=g??S("console.name"),k=n.find(L=>L.terminalId===i)??n[0]??null;return l.jsxs("section",{className:"console-pane",children:[l.jsxs("header",{className:"console-header",children:[l.jsxs("div",{className:"strip-tabs",children:[n.map((L,f)=>l.jsxs("div",{className:`strip-tab${L.terminalId===(k==null?void 0:k.terminalId)?" is-active":""}${L.alive?"":" is-dead"}`,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>C(L.terminalId),title:L.alive?S("console.tab.title",{shell:L.label.length>0?L.label:w,number:f+1,cwd:c}):S("console.tab.exited",{code:L.exitCode??"?"}),children:S("console.tab.label",{number:f+1})}),l.jsx("button",{className:"strip-tab-close",onClick:()=>u(L.terminalId),title:S("console.tab.close"),children:"×"})]},L.terminalId)),g!==null&&l.jsx("button",{className:"strip-tab-new",onClick:r,title:S("console.openAnother",{shell:w,cwd:c}),children:"+"})]}),l.jsx("span",{className:"strip-spacer"}),l.jsx("button",{className:"icon-button",onClick:_,title:S("console.collapse"),children:"▾"}),v!==void 0&&l.jsx($l,{title:S("settings.hide.console"),onHide:v,confirmText:h===0?null:S("settings.panels.consoleConfirm",{count:h})})]}),l.jsx("div",{className:"console-body",children:n.length===0?l.jsx("div",{className:"console-empty",children:g===null?l.jsx("p",{className:"panel-note",children:S("console.noShell")}):l.jsx("button",{className:"link-button",onClick:r,children:S("console.openIn",{shell:w,cwd:c})})}):l.jsx("div",{className:"terminal-stack",children:n.map(L=>l.jsx(Xm,{terminalId:L.terminalId,connection:t,active:L.terminalId===(k==null?void 0:k.terminalId),theme:T,pasteOnCtrlV:ub},L.terminalId))})})]})}function db(t,n){if(!n.consoleShown)return{requested:t.size===0?t:new Set,open:null};const{cwd:i}=n;if(i===null)return{requested:t,open:null};if(n.shellCwds.includes(i)){if(!t.has(i))return{requested:t,open:null};const c=new Set(t);return c.delete(i),{requested:c,open:null}}return t.has(i)?{requested:t,open:null}:{requested:new Set(t).add(i),open:i}}function Vf(t,n){return t.has(n)?t:new Set(t).add(n)}const fb=.75,pb=.9;function Hn(t){if(t<1e3)return String(t);if(t<1e6){const n=t/1e3;return`${n<100?Qr(n,1):Math.round(n)}k`}return`${Qr(t/1e6,2)}M`}function mb({usage:t,source:n,instructionsFile:i,fallbackWindow:c=null,compact:g=!1,statusLineState:T=null,onConfigure:C}){const{lastRequestTokens:r,contextWindow:u}=t;if(C!==void 0&&T!==null&&qw(n,{state:T}))return l.jsxs("div",{className:`meter meter-idle${g?" meter-compact":""}`,title:Kw(T),children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),l.jsx("span",{className:`meter-bar${g?" meter-bar-inline":""}`}),l.jsx("span",{className:"meter-value",children:S("meter.unmeasured")}),l.jsx("button",{className:"link-button",onClick:C,children:S("meter.configure")})]});if(n===null)return l.jsxs("div",{className:`meter meter-idle${g?" meter-compact":""}`,title:S("meter.noTokensTitle"),children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),l.jsx("span",{className:`meter-bar${g?" meter-bar-inline":""}`}),l.jsx("span",{className:"meter-value",children:S("meter.noTokens")})]});if(!Vw(n,t)){const k=Yw(i,n),L=zw(n,t,c);return l.jsxs("div",{className:`meter meter-idle${g?" meter-compact":""}`,title:k,children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),l.jsx("span",{className:`meter-bar${g?" meter-bar-inline":""}`}),l.jsxs("span",{className:"meter-value",children:[S("meter.unmeasured"),L!==null&&l.jsxs("span",{className:"meter-dim",children:[" / ",Hn(L)]})]})]})}const _=u!==null&&u>0?Math.min(r/u,1):null,v=_===null?"unknown":_>=pb?"danger":_>=fb?"warn":"ok",h=u===null?"":` / ${Hn(u)}${t.contextWindowEstimated?"+":""}`,w=Gw(n,t);if(g){const k=[t.lastModel===null?null:t.lastModel,w,_===null?S("meter.unknownModelShort"):S("meter.windowPercent",{percent:Math.round(_*100)}),S("meter.output",{tokens:Hn(t.lastOutputTokens)}),n==="status-line"?S("meter.responses",{count:t.assistantMessages}):S("meter.sessionTotals",{output:Hn(t.totalOutputTokens),cache:Hn(t.totalCacheReadTokens),count:t.assistantMessages})].filter(L=>L!==null).join(" · ");return l.jsxs("div",{className:"meter meter-compact",title:k,children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),_!==null&&l.jsx("span",{className:"meter-bar meter-bar-inline",children:l.jsx("span",{className:`meter-fill meter-fill-${v}`,style:{width:`${_*100}%`}})}),l.jsxs("span",{className:"meter-value",children:[Hn(r),h.length>0&&l.jsx("span",{className:"meter-dim",children:h})]})]})}return l.jsxs("div",{className:"meter",children:[l.jsxs("div",{className:"meter-row",children:[l.jsx("span",{className:"meter-label",children:S("meter.label")}),l.jsxs("span",{className:"meter-value",children:[Hn(r),u!==null&&l.jsxs("span",{className:"meter-dim",title:t.lastModel===null?void 0:w!==null?S("meter.modelWithOrigin",{model:t.lastModel,origin:w}):t.lastModel,children:[" ","/ ",Hn(u),t.contextWindowEstimated&&"+"]})]})]}),_!==null?l.jsx("div",{className:"meter-bar",title:S("meter.windowPercent",{percent:Math.round(_*100)}),children:l.jsx("div",{className:`meter-fill meter-fill-${v}`,style:{width:`${_*100}%`}})}):l.jsx("div",{className:"meter-note",title:t.lastModel??void 0,children:S("meter.unknownModel")}),l.jsxs("div",{className:"meter-row meter-row-dim",children:[l.jsx("span",{title:S("meter.lastResponseTitle"),children:S("meter.output",{tokens:Hn(t.lastOutputTokens)})}),l.jsx("span",{title:S("meter.sessionTitle"),children:S("meter.sessionTotals",{output:Hn(t.totalOutputTokens),cache:Hn(t.totalCacheReadTokens),count:t.assistantMessages})})]})]})}const Wc=["s","m","l"],Qm="m",gb="agent-workbench.thread-font",_b="agent-workbench.notes-font",vb="s",wb={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function qf(t){return S(wb[t])}function Jm(t){const n=Wc.indexOf(t);return Wc[(n+1)%Wc.length]??Qm}function yb(t){return t==="s"||t==="m"||t==="l"?t:null}function Ul(t){return S("threadFont.title",{current:qf(t),next:qf(Jm(t))})}const bb=300,Sb=200,Cb=2,xb=bb+Sb,Zm=Cb*xb,kb=200;function eg(t){return Math.max(kb,t)}function Eb(t){return t.hasMore&&!t.loading&&t.searching!==!0&&t.scrollTop<t.previousScrollTop&&t.scrollTop<=eg(t.clientHeight)}function Lb(t,n,i){return t<0&&n<=eg(i)}function Tb(t,n){return Math.max(0,n-t)}function Rb(t,n){return t===null||n.length===0||n[0]===t?!1:n.includes(t)}const Mb=52,Ab=10;function Nb(t){return t.filter(n=>n.role==="user"&&n.parts.some(i=>i.kind==="text"||i.kind==="image")).map(n=>n.eventId)}function Db(t,n){for(let i=t-1;i>=0;i-=1){const c=n(i);if(c!==null&&c<-8)return i}return null}function Ib(t){return t.awayFromEnd&&(t.ownAbove||t.hasMore)}function Kf(t,n){return Math.max(0,t+n-Mb)}function jb(t){return t.found?"jump":t.loading?"wait":!t.hasMore||t.pagesRequested>=Ab?"give-up":"load"}const Pb=1;function Ob(t,n){for(const i of t){const c=n(i);if(!(c===null||c.bottom<=Pb))return{eventId:i,offset:c.top,lastId:t[t.length-1]??null}}return null}function Bb(t,n,i,c){const g=n.indexOf(t.eventId);if(g===-1)return null;for(let T=g;T<n.length;T+=1){const C=n[T],r=C===void 0?null:i(C);if(r!==null)return Math.max(0,c+r.top-(T===g?t.offset:0))}return null}function Fb(t,n){if(n===null)return 0;const i=t.lastIndexOf(n);return i===-1?0:t.length-1-i}const Gf=2,Hb=4;function $b(t,n,i,c=Hb){const g=n.right-n.left,T=n.bottom-n.top;if(g<=0||T<=0)return 0;const C=t.right-Gf,r=C-g,u=t.top+Gf,_=u+T;return C<=i.left-c||r>=i.right+c||_<=i.top-c||u>=i.bottom+c?0:Math.ceil(C-(i.left-c))}function tg({agents:t,preselected:n,anchor:i,label:c=S("agentMenu.openWith"),onPick:g,onClose:T}){const C=N.useMemo(()=>Tm(t),[t]),[r,u]=N.useState(()=>ty(C,n)),[_,v]=N.useState(null),h=N.useRef(null),w=N.useRef([]);return N.useLayoutEffect(()=>{const k=h.current;if(k===null)return;const L=i.getBoundingClientRect(),f=k.getBoundingClientRect();v(sy({left:L.left,top:L.top,bottom:L.bottom},{width:f.width,height:f.height},{width:window.innerWidth,height:window.innerHeight}))},[i]),N.useEffect(()=>{var k;(k=w.current[r])==null||k.focus()},[r,_]),N.useEffect(()=>{const k=a=>{if(!(a.altKey||a.ctrlKey||a.metaKey)){if(a.key==="Escape"){a.preventDefault(),a.stopPropagation(),T(),i.focus();return}if(a.key==="ArrowDown"||a.key==="ArrowUp"){a.preventDefault(),a.stopPropagation(),u(p=>ny(p,a.key==="ArrowDown"?1:-1,C.length));return}if(a.key==="Enter"){a.preventDefault(),a.stopPropagation();const p=C[r];p!==void 0&&g(p.id);return}a.key==="Tab"&&T()}},L=a=>{var m;const p=a.target;p instanceof Node&&((m=h.current)!=null&&m.contains(p)||i.contains(p))||T()},f=a=>{ry(a.target,i,h.current)&&T()};return window.addEventListener("keydown",k,!0),document.addEventListener("pointerdown",L,!0),window.addEventListener("scroll",f,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("keydown",k,!0),document.removeEventListener("pointerdown",L,!0),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",T)}},[r,i,C,T,g]),Om.createPortal(l.jsx("div",{ref:h,className:"agent-menu",role:"menu","aria-label":c,style:_===null?{left:0,top:0,visibility:"hidden"}:{left:`${_.left}px`,top:`${_.top}px`},children:C.map((k,L)=>l.jsxs("button",{ref:f=>{w.current[L]=f},className:`agent-menu-item${L===r?" agent-menu-item-active":""}`,role:"menuitem",tabIndex:L===r?0:-1,onMouseEnter:()=>u(L),onClick:()=>g(k.id),children:[l.jsx("span",{className:"agent-menu-label",children:k.label}),k.version!==null&&l.jsx("span",{className:"agent-menu-version",children:k.version})]},k.id))}),document.body)}function ng({targets:t,className:n,text:i,blockedReason:c=null,onPick:g}){const[T,C]=N.useState(!1),r=N.useRef(null),u=N.useCallback(()=>C(!1),[]),_=N.useCallback(v=>{C(!1),g(v)},[g]);return t.length===0?null:l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:r,className:n,onClick:()=>C(v=>!v),disabled:c!==null,"aria-haspopup":"menu","aria-expanded":T,title:c??iy(),children:i}),T&&r.current!==null&&l.jsx(tg,{agents:t,preselected:null,anchor:r.current,label:S("continue.menuLabel"),onPick:_,onClose:u})]})}function sg(t){switch(t.notice){case"compacted":return t.detail==="auto"?S("thread.notice.compactedAuto"):S("thread.notice.compacted");case"interrupted":return S("thread.notice.interrupted");case"error":return t.detail.length>0?S("thread.notice.error",{detail:t.detail}):S("thread.notice.errorNoDetail")}}const rg="agent-workbench.locale",ig="auto";function Ub(t){return t==="auto"||wm(t)?t:null}function og(t){const n=t.trim().replace(/_/g,"-").toLowerCase();if(n.length===0)return null;const i=Mu.find(T=>T.toLowerCase()===n);if(i!==void 0)return i;const[c="",...g]=n.split("-");return c==="zh"?g.includes("hant")||g.some(C=>C==="tw"||C==="hk"||C==="mo")?null:zc("zh-CN"):zc(c==="pt"?"pt-BR":c)}function zc(t){return wm(t)?t:null}function lg(t,n){if(t!=="auto")return t;for(const i of n){const c=og(i);if(c!==null)return c}return"en"}function ag(t,n){for(const i of n)if(og(i)===t)try{if(Intl.DateTimeFormat.supportedLocalesOf([i]).length>0)return i}catch{}return fw(t)}let Wl=ig;const mu=new Set;function Du(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function Wb(){return lg("auto",Du())}async function cg(t){const n=Du(),i=lg(t,n);await bm(i,ag(i,n))}async function zb(){Wl=xt(rg,ig,Ub);try{await cg(Wl)}catch{await bm("en",ag("en",Du()))}document.documentElement.lang=uu(),ym(()=>{document.documentElement.lang=uu()})}async function Vb(t){await cg(t),Wl=t,vt(rg,t);for(const n of mu)n()}function qb(t){return mu.add(t),()=>mu.delete(t)}function Kb(){return Wl}function ao(){return N.useSyncExternalStore(ym,uu)}function Gb(){return N.useSyncExternalStore(qb,Kb)}const ug=String.raw`https?:\/\/[^\s<>"'\`]+`,Yb=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${ug})`].join("|")),Xb=/^(https?:|mailto:)/i,Qb=new RegExp(ug);function Jb(t){const n=Qb.exec(t);if(n===null||n.index===void 0)return null;const i=hg(n[0]);return{index:n.index,length:i.length,href:i}}function Ml(t,n){let i=0;for(const c of t)c===n&&(i+=1);return i}function hg(t){let n=t;for(;;){const i=n.slice(-1);if(i.length===0)return n;if(".,;:!?".includes(i)){n=n.slice(0,-1);continue}if(i===")"&&Ml(n,"(")<Ml(n,")")){n=n.slice(0,-1);continue}if(i==="]"&&Ml(n,"[")<Ml(n,"]")){n=n.slice(0,-1);continue}return n}}function Zb(t){const n=Yb.exec(t);if(n===null||n.index===void 0)return null;const i=n[0],c=n.index,g=(C,r=i.length)=>({index:c,length:r,token:C});if(i.startsWith("`"))return g({kind:"code",text:i.slice(1,-1)});if(i.startsWith("**")||i.startsWith("__"))return g({kind:"strong",text:i.slice(2,-2)});if(i.startsWith("~~"))return g({kind:"del",text:i.slice(2,-2)});if(i.startsWith("*"))return g({kind:"em",text:i.slice(1,-1)});if(i.startsWith("[")){const C=i.indexOf("]("),r=i.slice(1,C),u=i.slice(C+2,-1);return Xb.test(u)?g({kind:"link",label:r,href:u}):g({kind:"plain",text:i})}const T=hg(i);return g({kind:"link",label:T,href:T},T.length)}function Yi(t,n,i){if(n.length===0)return[t];const c=t.toLowerCase(),g=n.toLowerCase(),T=[];let C=0,r=c.indexOf(g),u=0;for(;r!==-1;)r>C&&T.push(t.slice(C,r)),T.push(l.jsx("mark",{children:t.slice(r,r+n.length)},`${i}-m${u++}`)),C=r+n.length,r=c.indexOf(g,C);return C<t.length&&T.push(t.slice(C)),T}const eS=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/;function tS(t,n){const i=eS.exec(t);if(i===null)return null;const c=i[2]??"",g=n(c);return g===null?null:{label:i[1]??"",href:c,open:g}}function _s(t,n,i,c){const g=[];let T=t,C=0;for(;T.length>0;){const r=Zb(T);if(r===null){g.push(...Yi(T,n,`${i}-${C++}`));break}r.index>0&&g.push(...Yi(T.slice(0,r.index),n,`${i}-${C++}`));const u=`${i}-i${C++}`,{token:_}=r;switch(_.kind){case"code":{const v=c.code===void 0?null:c.code(_.text);g.push(v===null?l.jsx("code",{children:_.text},u):l.jsx("code",{className:"md-file-link",role:"link",tabIndex:0,title:S("thread.openInFiles",{path:_.text}),onClick:v,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),v())},children:_.text},u));break}case"strong":g.push(l.jsx("strong",{children:_s(_.text,n,u,c)},u));break;case"del":g.push(l.jsx("del",{children:_s(_.text,n,u,c)},u));break;case"em":g.push(l.jsx("em",{children:_s(_.text,n,u,c)},u));break;case"link":g.push(l.jsx("a",{href:_.href,target:"_blank",rel:"noreferrer noopener",children:Yi(_.label,n,u)},u));break;default:{const v=c.local===void 0?null:tS(_.text,c.local);if(v!==null){g.push(l.jsx("button",{className:"md-local-link",onClick:v.open,title:v.href,children:Yi(v.label,n,u)},u));break}g.push(l.jsx("span",{children:Yi(_.text,n,u)},u));break}}T=T.slice(r.index+r.length)}return g}function nS({code:t,language:n}){const[i,c]=N.useState(null),[g,T]=N.useState(!1),C=N.useRef(null);N.useEffect(()=>()=>{C.current!==null&&window.clearTimeout(C.current)},[]);const r=()=>{navigator.clipboard.writeText(t).then(()=>{T(!0),C.current!==null&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>T(!1),1200)}).catch(()=>T(!1))};return N.useEffect(()=>{let u=!0;return Jn(async()=>{const{highlightCode:_}=await import("./highlight-BXBl9DQv.js");return{highlightCode:_}},[]).then(({highlightCode:_})=>{u&&c(_(t,n))}).catch(()=>{u&&c(null)}),()=>{u=!1}},[t,n]),l.jsxs("div",{className:"md-code-wrap",children:[l.jsx("pre",{className:"md-code hljs",children:i===null?l.jsx("code",{children:t}):l.jsx("code",{dangerouslySetInnerHTML:{__html:i}})}),l.jsxs("div",{className:"md-code-tools","data-search-skip":"",children:[n!==null&&l.jsx("span",{className:"md-code-lang",children:n}),l.jsx("button",{className:"md-code-copy",onClick:r,title:S(g?"common.copied":"common.copyCode"),"aria-label":S("common.copyCode"),children:g?"✓":"⧉"})]})]})}const Yf=/^(#{1,6})\s+(.*)$/,Vc=/^\s{0,3}[-*+]\s+(.*)$/,Xi=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,Al=/^>\s?(.*)$/,qc=/^\s*```(\S*)\s*$/,Xf=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,Kc=/^\s*\|.*\|\s*$/,sS=/^\s*\|[\s:|-]+\|\s*$/;function Qf(t){return t.trim().replace(/^\||\|$/g,"").split("|").map(n=>n.trim())}function Iu({text:t,needle:n="",localLink:i,codeLink:c}){var u,_;const g={local:i,code:c},T=t.split(`
120
- `),C=[];let r=0;for(;r<T.length;){const v=T[r]??"",h=`b${r}`,w=qc.exec(v);if(w!==null){const f=(w[1]??"").length>0?w[1]:null,a=[];for(r+=1;r<T.length&&!qc.test(T[r]??"");)a.push(T[r]??""),r+=1;r+=1,C.push({key:h,node:l.jsx(nS,{code:a.join(`
121
- `),language:f},h)});continue}if(v.trim().length===0){r+=1;continue}if(Xf.test(v)){C.push({key:h,node:l.jsx("hr",{className:"md-rule"},h)}),r+=1;continue}const k=Yf.exec(v);if(k!==null){const f=Math.min((k[1]??"#").length,6);C.push({key:h,node:l.jsx("p",{className:`md-heading md-h${f}`,children:_s(k[2]??"",n,h,g)},h)}),r+=1;continue}if(Kc.test(v)&&sS.test(T[r+1]??"")){const f=Qf(v);r+=2;const a=[];for(;r<T.length&&Kc.test(T[r]??"");)a.push(Qf(T[r]??"")),r+=1;C.push({key:h,node:l.jsx("div",{className:"md-table-wrap",children:l.jsxs("table",{className:"md-table",children:[l.jsx("thead",{children:l.jsx("tr",{children:f.map((p,m)=>l.jsx("th",{children:_s(p,n,`${h}-h${m}`,g)},m))})}),l.jsx("tbody",{children:a.map((p,m)=>l.jsx("tr",{children:p.map((d,x)=>l.jsx("td",{children:_s(d,n,`${h}-${m}-${x}`,g)},x))},m))})]})},h)});continue}if(Al.test(v)){const f=[];for(;r<T.length&&Al.test(T[r]??"");)f.push(((u=Al.exec(T[r]??""))==null?void 0:u[1])??""),r+=1;C.push({key:h,node:l.jsx("blockquote",{className:"md-quote",children:_s(f.join(`
122
- `),n,h,g)},h)});continue}if(Vc.test(v)||Xi.test(v)){const f=Xi.test(v),a=f?Number(((_=Xi.exec(v))==null?void 0:_[1])??"1"):1,p=[];for(;r<T.length;){const d=T[r]??"",x=Vc.exec(d),I=Xi.exec(d);if(f&&I!==null)p.push(I[2]??"");else if(!f&&x!==null)p.push(x[1]??"");else if(p.length>0&&/^\s{2,}\S/.test(d)&&x===null&&I===null)p[p.length-1]=`${p[p.length-1]??""} ${d.trim()}`;else break;r+=1}const m=p.map((d,x)=>l.jsx("li",{children:_s(d,n,`${h}-l${x}`,g)},x));C.push({key:h,node:f?l.jsx("ol",{className:"md-list",start:a===1?void 0:a,children:m},h):l.jsx("ul",{className:"md-list",children:m},h)});continue}const L=[];for(;r<T.length;){const f=T[r]??"";if(f.trim().length===0||qc.test(f)||Yf.test(f)||Vc.test(f)||Xi.test(f)||Al.test(f)||Xf.test(f)||Kc.test(f))break;L.push(f),r+=1}C.push({key:h,node:l.jsx("p",{className:"md-paragraph",children:_s(L.join(`
123
- `),n,h,g)},h)})}return l.jsx("div",{className:"md",children:C.map(v=>v.node)})}const dg=[{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 Gc(t){const n=dg.find(i=>i.names.includes(t));return n===void 0?{key:`name:${t}`,known:!1}:{key:n.key,known:!0}}function rS(t,n,i){const c=dg.find(g=>g.key===t);return c===void 0?S("tools.run.callsTo",{count:n,name:i}):S(c.run,{count:n})}function Pt(t){if(!lv(t.key))return t.key;let n;if(t.params!==void 0){const i={};for(const[c,g]of Object.entries(t.params))i[c]=typeof g=="object"?Pt(g):g;n=i}return S(`server.${t.key}`,n)}const Yc={model:null,effort:null,contextWindow:null},iS=200,oS=2e4,lS={},aS={},Jf=[];function gu(t,n,i){return`${t}:${i}:${n}`}function cS(t,n){const[i,c]=N.useState([]),[g,T]=N.useState(Nc),[C,r]=N.useState(Yc),[u,_]=N.useState("waiting"),[v,h]=N.useState(!1),[w,k]=N.useState(!1),[L,f]=N.useState({}),[a,p]=N.useState(null),[m,d]=N.useState(null),[x,I]=N.useState(!1),[E,M]=N.useState(Jf),[b,R]=N.useState({}),[D,B]=N.useState({}),O=(n===null?void 0:b[n])??lS,F=(n===null?void 0:D[n])??aS,U=N.useRef(new Set),q=N.useRef(new Map),X=N.useRef(new Set),Y=N.useCallback((le,de,G)=>{B(z=>({...z,[le]:{...z[le]??{},[de]:G}}))},[]),V=N.useCallback(le=>{B(de=>{let G=!1;const z={};for(const[Q,Z]of Object.entries(de))if(le in Z){const ae={...Z};delete ae[le],z[Q]=ae,G=!0}else z[Q]=Z;return G?z:de})},[]),j=N.useCallback((le,de)=>{B(G=>{const z=G[le];if(z===void 0||!(de in z))return G;const Q={...z};return delete Q[de],{...G,[le]:Q}})},[]);N.useEffect(()=>{for(const le of i)for(const de of le.parts){if(de.kind!=="tool-result")continue;X.current.add(de.toolUseId);const G=q.current.get(de.toolUseId);G!==void 0&&(window.clearTimeout(G),q.current.delete(de.toolUseId)),V(de.toolUseId)}},[i,V]),N.useEffect(()=>{const le=q.current;return()=>{for(const de of le.values())window.clearTimeout(de);le.clear()}},[]);const $=N.useRef(null);N.useEffect(()=>{if(n===null){c([]),T(Nc),r(Yc),_("waiting"),h(!1),$.current=null;return}c([]),T(Nc),r(Yc),_("waiting"),h(!1),k(!1),f({}),p(null),d(null),I(!1),M(Jf),U.current.clear(),$.current=null;const le=t.onMessage(G=>{var z;switch(G.type){case"conversation.reset":if(G.terminalId!==n)break;c(G.events),T(G.usage),r(G.defaults),p(G.permissionMode),d(G.waitingFor),I(G.openToolCall),M(G.subagents),_(G.state),h(G.hasMore),k(!1),$.current=((z=G.events[0])==null?void 0:z.eventId)??null;break;case"conversation.append":{if(G.terminalId!==n)break;c(Q=>{var fe;const Z=new Set(Q.map(Ee=>Ee.eventId)),ae=G.events.filter(Ee=>!Z.has(Ee.eventId));return ae.length===0?Q:($.current===null&&($.current=((fe=ae[0])==null?void 0:fe.eventId)??null),[...Q,...ae])}),T(G.usage),G.permissionMode!==null&&p(G.permissionMode),_("live");break}case"conversation.page":{if(G.terminalId!==n)break;c(Q=>{var fe;const Z=new Set(Q.map(Ee=>Ee.eventId)),ae=G.events.filter(Ee=>!Z.has(Ee.eventId));return ae.length===0?Q:($.current=((fe=ae[0])==null?void 0:fe.eventId)??$.current,[...ae,...Q])}),h(G.hasMore),k(!1);break}case"conversation.turns":{if(G.terminalId!==n)break;const Q=new Map(G.turns.map(Z=>[Z.eventId,Z.durationMs]));c(Z=>Z.map(ae=>{const fe=Q.get(ae.eventId);return fe===void 0?ae:{...ae,durationMs:fe}}));break}case"conversation.parts":{if(G.terminalId!==n)break;const Q=new Map(G.updates.map(Z=>[Z.eventId,Z.parts]));c(Z=>Z.map(ae=>{const fe=Q.get(ae.eventId);return fe===void 0?ae:{...ae,parts:fe}}));break}case"conversation.imageData":{if(G.terminalId!==n)break;const Q=gu(G.eventId,G.index,G.source);f(Z=>({...Z,[Q]:G.data===null?null:`data:${G.mediaType};base64,${G.data}`}));break}case"conversation.state":if(G.terminalId!==n)break;_(G.state);break;case"conversation.mode":if(G.terminalId!==n)break;p(G.mode);break;case"conversation.waiting":if(G.terminalId!==n)break;d(G.waitingFor);break;case"conversation.toolCall":if(G.terminalId!==n)break;I(G.open);break;case"conversation.subagents":if(G.terminalId!==n)break;M(G.subagents);break;case"error":{if(G.code!=="answer-failed"||n===null)break;for(const[Q,Z]of q.current)window.clearTimeout(Z),q.current.delete(Q),R(ae=>{const fe=ae[n];if(fe===void 0||!(Q in fe))return ae;const Ee={...fe};return delete Ee[Q],{...ae,[n]:Ee}}),Y(n,Q,Pt(G.text));break}}});t.send({type:"conversation.subscribe",terminalId:n});const de=t.onReopen(()=>{t.send({type:"conversation.subscribe",terminalId:n})});return()=>{le(),de(),t.send({type:"conversation.unsubscribe",terminalId:n})}},[t,n,Y]);const H=N.useCallback(()=>{const le=$.current;n===null||le===null||w||(k(!0),t.send({type:"conversation.loadMore",terminalId:n,beforeEventId:le,limit:iS}))},[t,n,w]),K=N.useCallback((le,de,G)=>{if(n===null)return;const z=gu(le,de,G);U.current.has(z)||(U.current.add(z),t.send({type:"conversation.image",terminalId:n,eventId:le,index:de,source:G}))},[t,n]),te=N.useCallback((le,de)=>{if(n===null)return;R(z=>{const Q=z[n]??{};return le in Q?z:{...z,[n]:{...Q,[le]:de}}}),j(n,le),t.send({type:"agent.answer",terminalId:n,toolUseId:le,selections:de});const G=window.setTimeout(()=>{X.current.has(le)||(R(z=>{const Q=z[n];if(Q===void 0||!(le in Q))return z;const Z={...Q};return delete Z[le],{...z,[n]:Z}}),Y(n,le,S("conversation.answerUnconfirmed")))},oS);q.current.set(le,G)},[t,n,Y,j]),re=N.useCallback(le=>{n!==null&&t.send({type:"agent.mode",terminalId:n,mode:le})},[t,n]);return{events:i,usage:g,defaults:C,state:u,permissionMode:a,waitingFor:m,openToolCall:x,subagents:E,hasMore:v,loadingMore:w,loadMore:H,images:L,requestImage:K,answer:te,answered:O,answerFailed:F,setPermissionMode:re}}const fg=80;function Xc(t){return t.scrollHeight-t.scrollTop-t.clientHeight>fg}const Zf=5;function Nl(t){return!Array.isArray(t)}function ep(t){const n=[];for(const i of t.parts){if(i.kind!=="tool-call")return null;n.push(i.name)}return n.length>0?n:null}function uS(t){const n=[];let i=0;for(;i<t.length;){const c=t[i];if(c===void 0)break;const g=ep(c),T=g===null?null:Gc(g[0]??"");if(!(g!==null&&T!==null&&g.every(v=>Gc(v).key===T.key))||g===null||T===null){n.push({kind:"card",card:c}),i+=1;continue}const r=[c];let u=g.length,_=i+1;for(;_<t.length;){const v=t[_];if(v===void 0)break;const h=ep(v);if(h===null||!h.every(w=>Gc(w).key===T.key))break;r.push(v),u+=h.length,_+=1}if(u<2){n.push({kind:"card",card:c}),i+=1;continue}n.push({kind:"tools",id:`tools-${c.event.eventId}`,summary:rS(T.key,u,g[0]??""),at:c.event.at,cards:r}),i=_}return n}function hS(t){switch(t.kind){case"text":return t.text;case"tool-call":return`${t.name} ${t.input}`;case"tool-result":return t.text;case"question":return t.questions.map(n=>`${n.question} ${n.options.map(i=>i.label).join(" ")}`).join(`
124
- `);case"notice":return sg(t);case"thinking":case"image":return""}}function tp(t,n){const i=[];for(const c of t.parts)if(i.push(hS(c)),c.kind==="tool-call"){const g=n.get(c.toolUseId);g!==void 0&&i.push(g.text)}return i.join(`
125
- `)}function qs(t,n){if(n.length===0)return l.jsx(l.Fragment,{children:t});const i=t.toLowerCase(),c=n.toLowerCase(),g=[];let T=0,C=i.indexOf(c),r=0;for(;C!==-1;)C>T&&g.push(l.jsx("span",{children:t.slice(T,C)},r++)),g.push(l.jsx("mark",{children:t.slice(C,C+n.length)},r++)),T=C+n.length,C=i.indexOf(c,T);return T<t.length&&g.push(l.jsx("span",{children:t.slice(T)},r++)),l.jsx(l.Fragment,{children:g})}function pg(t,n){const i=[];let c=t,g=0;for(;c.length>0;){const T=Jb(c);if(T===null){i.push(l.jsx("span",{children:qs(c,n)},g++));break}T.index>0&&i.push(l.jsx("span",{children:qs(c.slice(0,T.index),n)},g++)),i.push(l.jsx("a",{href:T.href,target:"_blank",rel:"noreferrer noopener",children:qs(T.href,n)},g++)),c=c.slice(T.index+T.length)}return l.jsx(l.Fragment,{children:i})}const mg=N.createContext(null);function dS({view:t,terminalId:n,onRewind:i,questionsAnswerable:c,contextWindowSource:g,instructionsFile:T,onGoToCli:C,cliPresence:r,exitCode:u,onWakeCli:_,waking:v,discovering:h=!1,toolCallNotice:w=null,serverClosed:k=null,statusLineState:L=null,onConfigureStatusLine:f,threadFont:a,continueTargets:p=[],continueBlockedReason:m=null,onContinue:d,searchRequest:x=null,onSearchRequestApplied:I,activity:E=null,receipt:M=null,clock:b=null,fileLinks:R=null}){const{events:D,usage:B,defaults:O,state:F,waitingFor:U,subagents:q,hasMore:X,loadingMore:Y,loadMore:V,images:j,requestImage:$,answer:H,answered:K,answerFailed:te}=t,re=ao(),[le,de]=N.useState(""),[G,z]=N.useState(0),[Q,Z]=N.useState(null);N.useEffect(()=>{x!==null&&(de(x.query),I==null||I(x.seq))},[x,I]);const ae=N.useRef(null),fe=N.useRef(new Map),Ee=N.useRef(!0),[Ae,ze]=N.useState(!1),[ue,Me]=N.useState(0),he=N.useRef(n),Te=N.useRef(new Map),ge=N.useRef(null),[Re,Ue]=N.useState(!1),ke=N.useRef(null),[Ne,st]=N.useState(!1),[ot,wt]=N.useState(!1),ct=N.useRef(null),bt=N.useMemo(()=>Nb(D),[D]),{cards:Pe,results:Ze}=N.useMemo(()=>{const me=new Map,je=new Set;for(const _t of D)for(const ut of _t.parts)ut.kind==="tool-result"?me.set(ut.toolUseId,ut):(ut.kind==="tool-call"||ut.kind==="question")&&je.add(ut.toolUseId);const Ve=[];for(const _t of D){const ut=_t.parts.filter(mn=>mn.kind!=="thinking"&&!(mn.kind==="tool-result"&&je.has(mn.toolUseId)));ut.length!==0&&Ve.push({event:_t,parts:ut})}return{cards:Ve,results:me}},[D]),qe=N.useRef([]);qe.current=N.useMemo(()=>Pe.map(me=>me.event.eventId),[Pe]);const et=N.useCallback(me=>{const je=me.getBoundingClientRect().top;return Ve=>{const _t=fe.current.get(Ve);if(_t===void 0)return null;const ut=_t.getBoundingClientRect();return ut.height<=0?null:{top:ut.top-je,bottom:ut.bottom-je}}},[]),Gt=N.useMemo(()=>uS(Pe),[Pe,re]),pt=le.trim(),it=N.useMemo(()=>{if(pt.length===0)return[];const me=pt.toLowerCase();return Pe.filter(je=>tp(je,Ze).toLowerCase().includes(me)).map(je=>je.event.eventId)},[Pe,Ze,pt,re]);N.useEffect(()=>{z(0)},[pt]);const pe=N.useMemo(()=>new Set(it),[it]),Ke=it[G]??null;N.useEffect(()=>{var me;Ke!==null&&((me=fe.current.get(Ke))==null||me.scrollIntoView({block:"center"}))},[Ke]),N.useLayoutEffect(()=>{const me=he.current;he.current=n;const je=ae.current;if(me!==null&&me!==n&&ge.current===null){const Ve=je===null||Ee.current?null:Ob(qe.current,et(je));Ve===null?Te.current.delete(me):Te.current.set(me,Ve)}ge.current=n===null?null:Te.current.get(n)??null,Ee.current=!0,ze(!1),Me(0),ct.current=null,wt(!1),st(!1),Ue(!1)},[n,et]),N.useEffect(()=>()=>{ke.current!==null&&window.clearTimeout(ke.current)},[]);const Xe=N.useCallback(()=>{const me=ae.current;if(me===null)return;const je=Xc(me);ze(je),je||Me(0)},[]),xe=N.useCallback(me=>{const je=me.getBoundingClientRect().top,Ve=ut=>{const mn=bt[ut],Rn=mn===void 0?void 0:fe.current.get(mn);return Rn===void 0?null:Rn.getBoundingClientRect().top-je},_t=Db(bt.length,Ve);return _t===null?null:Ve(_t)},[bt]),be=N.useCallback(()=>{const me=ae.current;me!==null&&st(Ib({awayFromEnd:Xc(me),ownAbove:xe(me)!==null,hasMore:X}))},[xe,X]),tt=N.useRef(null),Ce=N.useRef(0),rt=N.useRef(0);N.useLayoutEffect(()=>{const me=tt.current,je=D.map(_t=>_t.eventId);tt.current=je[0]??null;const Ve=ae.current;Ve===null||!Rb(me,je)||(Ve.scrollTop=Tb(Ce.current,Ve.scrollHeight))},[D]),N.useLayoutEffect(()=>{const me=ae.current,je=ge.current;if(me!==null&&je!==null&&Pe.length>0){ge.current=null;const Ve=qe.current,_t=pt.length>0?null:Bb(je,Ve,et(me),me.scrollTop);_t!==null&&(me.scrollTop=_t,Ee.current=!Xc(me),Ee.current||(Me(Fb(Ve,je.lastId)),Ue(!0),ke.current!==null&&window.clearTimeout(ke.current),ke.current=window.setTimeout(()=>{ke.current=null,Ue(!1)},Zm)))}me!==null&&Ee.current&&pt.length===0&&(me.scrollTop=me.scrollHeight),Xe()},[Pe.length,pt,Xe,et]),N.useLayoutEffect(()=>{const me=ct.current,je=ae.current;if(me===null||je===null)return;const Ve=xe(je),_t=jb({found:Ve!==null,hasMore:X,loading:Y,pagesRequested:me.pages});if(_t!=="wait"){if(_t==="load"){me.pages+=1,V();return}ct.current=null,wt(!1),Ve!==null&&(Ee.current=!1,je.scrollTop=Kf(je.scrollTop,Ve))}},[Pe,X,Y,ot,xe,V]),N.useLayoutEffect(()=>{be()},[Pe,be]);const St=N.useRef(null),gt=N.useRef(null),Qe=N.useRef(new Map),ht=N.useCallback(()=>{const me=new Map;for(const je of[St.current,gt.current]){if(je===null)continue;const Ve=je.getBoundingClientRect();for(const _t of[Ve.top+1,(Ve.top+Ve.bottom)/2,Ve.bottom-1]){const ut=document.elementsFromPoint(Ve.left+1,_t).map(ws=>ws.closest(".turn")).find(ws=>ws!==null),mn=(ut==null?void 0:ut.querySelector(":scope > .turn-actions"))??null;if(ut==null||mn===null)continue;const Rn=$b(ut.getBoundingClientRect(),mn.getBoundingClientRect(),Ve);Rn>0&&me.set(ut,Math.max(me.get(ut)??0,Rn))}}for(const je of Qe.current.keys())me.has(je)||je.style.removeProperty("--turn-actions-shift");for(const[je,Ve]of me)Qe.current.get(je)!==Ve&&je.style.setProperty("--turn-actions-shift",`${Ve}px`);Qe.current=me},[]);N.useLayoutEffect(()=>{const me=ae.current;me!==null&&(Ce.current=me.scrollHeight-me.scrollTop,rt.current=me.scrollTop,ht())});const Ot=N.useRef(null),Nt=N.useCallback(()=>{var je;const me=((je=D[0])==null?void 0:je.eventId)??null;me===null||Ot.current===me||(Ot.current=me,V())},[D,V]),Tn=N.useRef(null);N.useEffect(()=>{var _t;const me=((_t=Pe[Pe.length-1])==null?void 0:_t.event.eventId)??null,je=Tn.current;if(Tn.current=me,je===null||me===je||Ee.current&&pt.length===0)return;const Ve=Pe.findIndex(ut=>ut.event.eventId===je);Ve!==-1&&Me(ut=>ut+(Pe.length-1-Ve))},[Pe,pt]);const ns=N.useCallback(()=>{const me=ae.current;if(me===null)return;const je=me.scrollHeight-me.scrollTop-me.clientHeight;Ee.current=je<=fg,Xe(),be(),ht();const Ve=Eb({scrollTop:me.scrollTop,previousScrollTop:rt.current,clientHeight:me.clientHeight,hasMore:X,loading:Y,searching:pt.length>0});rt.current=me.scrollTop,Ce.current=me.scrollHeight-me.scrollTop,Ve&&Nt()},[Xe,be,ht,X,Y,Nt,pt]),ii=N.useCallback(me=>{const je=ae.current;je===null||!X||Y||pt.length>0||Lb(me.deltaY,je.scrollTop,je.clientHeight)&&Nt()},[X,Y,Nt,pt]),ss=N.useCallback(()=>{const me=ae.current;me!==null&&(me.scrollTop=me.scrollHeight,Ee.current=!0,ze(!1),Me(0),ct.current=null,wt(!1),st(!1))},[]),pn=N.useCallback(()=>{const me=ae.current;if(me===null)return;const je=xe(me);if(je!==null){Ee.current=!1,me.scrollTop=Kf(me.scrollTop,je);return}ct.current===null&&(ct.current={pages:0},wt(!0))},[xe]),rs=N.useCallback((me,je)=>{je===null?fe.current.delete(me):fe.current.set(me,je)},[]),vs=N.useCallback(me=>{const je=tp(me,Ze);navigator.clipboard.writeText(je).then(()=>{Z(me.event.eventId),window.setTimeout(()=>Z(null),1200)}).catch(()=>Z(null))},[Ze,re]),Ks=me=>{it.length!==0&&z(je=>(je+me+it.length)%it.length)};return l.jsx(mg.Provider,{value:R,children:l.jsxs("div",{className:"conversation-pane",children:[l.jsxs("div",{className:"conversation-search",children:[l.jsx("input",{className:"conversation-search-input",type:"search",placeholder:S("thread.search.placeholder"),value:le,onChange:me=>de(me.target.value),onKeyDown:me=>{me.key==="Enter"&&Ks(me.shiftKey?-1:1),me.stopPropagation()},spellCheck:!1}),pt.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-matches",children:it.length===0?S("thread.search.none"):`${G+1}/${it.length}`}),l.jsx("button",{className:"icon-button",onClick:()=>Ks(-1),disabled:it.length===0,title:S("thread.search.previous"),children:"↑"}),l.jsx("button",{className:"icon-button",onClick:()=>Ks(1),disabled:it.length===0,title:S("thread.search.next"),children:"↓"})]}),l.jsx("span",{className:"conversation-spacer"}),d!==void 0&&l.jsx(ng,{targets:p,className:"icon-button conversation-continue",text:S("thread.continueWith"),blockedReason:m,onPick:d}),a!==void 0&&l.jsx("button",{className:"icon-button thread-font-button",onClick:a.cycle,title:Ul(a.size),"aria-label":Ul(a.size),children:l.jsxs("span",{"aria-hidden":"true",children:["a",l.jsx("span",{className:"thread-font-big",children:"A"})]})}),l.jsx(mb,{usage:B,source:g,instructionsFile:T,fallbackWindow:O.contextWindow,compact:!0,statusLineState:L,onConfigure:f})]}),l.jsxs("div",{className:"conversation-scroll-frame",children:[l.jsxs("div",{className:"conversation-scroll",ref:ae,onScroll:ns,onWheel:ii,children:[X&&l.jsxs("button",{className:`conversation-more${Y?" conversation-more-loading":""}`,onClick:V,disabled:Y,"aria-busy":Y,children:[Y&&l.jsx("span",{className:"conversation-more-spinner","aria-hidden":"true"}),S(Y?"thread.loadingMore":"thread.loadEarlier")]}),Pe.length===0&&l.jsxs("p",{className:"conversation-empty",children:[F==="unavailable"?S("thread.empty.unavailable"):F==="no-transcript"?py():S(F==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),F==="waiting"&&h&&l.jsxs(l.Fragment,{children:[l.jsx("br",{}),my()]})]}),Gt.map(me=>{if(me.kind==="card")return l.jsx(np,{card:me.card,results:Ze,needle:pt,isMatch:me.card.event.eventId===Ke,copied:Q===me.card.event.eventId,images:j,onRequestImage:$,onCopy:()=>vs(me.card),onRewind:i,register:rs,answered:K,answerFailed:te,answerable:c,onAnswer:H},me.card.event.eventId);const je=me.cards.some(Ve=>pe.has(Ve.event.eventId));return l.jsx(yS,{summary:me.summary,at:me.at,open:je,children:me.cards.map(Ve=>l.jsx(np,{card:Ve,results:Ze,needle:pt,isMatch:Ve.event.eventId===Ke,copied:Q===Ve.event.eventId,images:j,onRequestImage:$,onCopy:()=>vs(Ve),onRewind:i,register:rs,answered:K,answerFailed:te,answerable:c,onAnswer:H},Ve.event.eventId))},me.id)})]}),Ae&&(Ne||ot)&&l.jsx("button",{ref:St,className:`conversation-jump conversation-jump-own${ot?" is-seeking":""}`,onClick:pn,disabled:ot,"aria-busy":ot,title:S("thread.jumpToOwn"),"aria-label":S("thread.jumpToOwn"),children:l.jsx("span",{"aria-hidden":"true",children:"↑"})}),Ae&&l.jsxs("button",{ref:gt,className:`conversation-jump${ue>0?" has-unseen":""}${Re?" is-hinting":""}`,onClick:ss,title:ue>0?S("thread.jumpToEndNew",{count:ue}):S("thread.jumpToEnd"),"aria-label":ue>0?S("thread.jumpToEndNew",{count:ue}):S("thread.jumpToEnd"),children:[l.jsx("span",{"aria-hidden":"true",children:"↓"}),ue>0&&l.jsx("span",{className:"conversation-jump-count",children:ue>99?"99+":ue}),Re&&l.jsx("span",{className:"conversation-jump-tip","aria-hidden":"true",children:ue>0?S("thread.jumpToEndNew",{count:ue}):S("thread.jumpToEnd")})]})]}),l.jsx(pS,{live:r==="live"&&k===null,activity:E,waitingFor:U,receipt:M,events:D,clock:b,subagents:q}),k!==null&&(k.state==="relaunching"||r==="live")?l.jsx(_S,{text:k.text,relaunching:k.state==="relaunching",onRelaunch:_}):r==="live"?U===null&&w!==null?l.jsx(wS,{notice:w,onGoToCli:C}):l.jsx(vS,{waitingFor:U,questionsAnswerable:c,onGoToCli:C}):l.jsx(gS,{presence:r,exitCode:u,waking:v,onWake:_})]})})}const fS=1e3;function pS({live:t,activity:n,waitingFor:i,receipt:c,events:g,clock:T,subagents:C}){const[,r]=N.useState(0),u=Date.now(),_=k1({live:t,activity:n,waitingFor:i,receipt:c,events:g,clock:T,now:u}),v=t?C:[],h=_!==null||v.length>0;return N.useEffect(()=>{if(!h)return;const w=window.setInterval(()=>r(k=>k+1),fS);return()=>window.clearInterval(w)},[h]),h?l.jsxs("div",{className:"thread-status",children:[_!==null&&l.jsxs("div",{className:`thread-status-row thread-status-${_.kind}`,children:[l.jsx(mS,{kind:_.kind}),l.jsx("span",{className:"thread-status-text",children:E1(_,u)})]}),v.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:L1(v,u)})]})]}):null}function mS({kind:t}){return t==="working"?l.jsxs("span",{className:"tab-working","aria-hidden":"true",children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}):t==="sending"?l.jsx("span",{className:"thread-status-sending-dot","aria-hidden":"true"}):l.jsx("span",{className:"thread-status-check","aria-hidden":"true",children:"✓"})}function gS({presence:t,exitCode:n,waking:i,onWake:c}){const g=t==="sleeping"?S("thread.wake.sleeping"):n===null?S("thread.wake.exited"):S("thread.wake.exitedWithCode",{code:n});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:g}),l.jsx("button",{className:"primary-button primary-button-small",onClick:c,disabled:i,children:S(i?"thread.wake.opening":"thread.wake.open")})]})}function _S({text:t,relaunching:n,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:t}),l.jsx("button",{className:"primary-button primary-button-small",onClick:i,disabled:n,children:n?yy():wy()})]})}function vS({waitingFor:t,questionsAnswerable:n,onGoToCli:i}){if(t===null)return null;const c=Mm(t,n);return l.jsxs("div",{className:"conversation-waiting",role:"status",children:[l.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),l.jsx("span",{children:c}),l.jsx("button",{className:"link-button",onClick:i,children:S("thread.goToCli")})]})}function wS({notice:t,onGoToCli:n}){return l.jsxs("div",{className:"conversation-waiting",role:"status",children:[l.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),l.jsx("span",{children:t}),l.jsx("button",{className:"link-button",onClick:n,children:S("thread.goToCli")})]})}function np({card:t,results:n,needle:i,isMatch:c,copied:g,images:T,onRequestImage:C,onCopy:r,onRewind:u,register:_,answered:v,answerFailed:h,answerable:w,onAnswer:k}){const{event:L}=t,f=L.role==="user",a=p=>{const m=v[p.toolUseId];return m!==void 0?m:n.has(p.toolUseId)?[]:null};return l.jsxs("article",{ref:p=>_(L.eventId,p),className:`turn turn-${L.role}${c?" turn-match":""}`,children:[l.jsxs("div",{className:"turn-actions",children:[l.jsx("button",{className:"icon-button",onClick:r,title:S("thread.copyMessage"),children:g?"✓":"⧉"}),f&&u!==void 0&&l.jsx("button",{className:"icon-button",onClick:u,title:S("thread.rewind"),children:"↩"})]}),t.parts.map((p,m)=>l.jsx(SS,{part:p,eventId:L.eventId,mine:f,result:p.kind==="tool-call"?n.get(p.toolUseId)??null:null,needle:i,images:T,onRequestImage:C,answeredAt:p.kind==="question"?a(p):null,failure:p.kind==="question"?h[p.toolUseId]??null:null,answerable:w,onAnswer:k},m)),l.jsx(bS,{event:L,mine:f})]})}function yS({summary:t,at:n,open:i,children:c}){const g=n>0?Pm(n):"";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:t}),g.length>0&&l.jsx("span",{className:"tool-group-time",children:g})]}),l.jsx("div",{className:"tool-group-body",children:c})]})}function bS({event:t,mine:n}){const i=t.at>0?Pm(t.at):"",c=[];return t.durationMs!==null&&c.push(Gy(t.durationMs)),t.effort!==null&&c.push(S("thread.turn.effort",{effort:t.effort})),l.jsxs("div",{className:"turn-meta",children:[n&&l.jsx("span",{className:"turn-who",children:S("thread.turn.you")}),i.length>0&&l.jsx("span",{children:i}),t.queued&&l.jsx("span",{className:"turn-queued",title:S("thread.turn.queuedTitle"),children:S("thread.turn.queued")}),c.map(g=>l.jsx("span",{className:"turn-meta-bit",children:g},g))]})}function SS({part:t,eventId:n,mine:i,result:c,needle:g,images:T,onRequestImage:C,answeredAt:r,failure:u,answerable:_,onAnswer:v}){const h=N.useContext(mg);switch(t.kind){case"text":return i?l.jsx(xS,{text:t.text,truncated:t.truncated,needle:g}):l.jsxs("div",{className:"part-text",children:[l.jsx(Iu,{text:t.text,needle:g,codeLink:h==null?void 0:h.code,localLink:h==null?void 0:h.link}),t.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]})]});case"image":return l.jsx(ES,{eventId:n,index:t.index,source:t.source,src:T[gu(n,t.index,t.source)],onRequest:C});case"thinking":return null;case"notice":return l.jsx("div",{className:`turn-notice turn-notice-${t.notice}`,children:qs(sg(t),g)});case"question":return l.jsx(CS,{part:t,answeredAt:r,failure:u,answerable:_,onAnswer:v,needle:g});case"tool-call":{const w=g.length>0&&`${t.name} ${t.input} ${(c==null?void 0:c.text)??""}`.toLowerCase().includes(g.toLowerCase());return l.jsxs("details",{className:"tool",open:w,children:[l.jsxs("summary",{className:"tool-summary",children:[l.jsx("span",{className:"tool-name",children:t.name}),c!==null&&c.isError&&l.jsx("span",{className:"tool-error",children:S("thread.tool.error")}),c!==null&&c.imageCount>0&&l.jsx("span",{className:"tool-images",children:S("thread.tool.images",{count:c.imageCount})})]}),l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:S("thread.tool.input")}),l.jsxs("pre",{className:"tool-pre",children:[qs(t.input,g),t.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]})]})]}),c!==null&&l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:S("thread.tool.result")}),l.jsxs("pre",{className:`tool-pre${c.isError?" tool-pre-error":""}`,children:[c.text.length>0?qs(c.text,g):c.imageCount>0?S("thread.tool.imagesNotSent",{count:c.imageCount}):S("thread.tool.noOutput"),c.truncated&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]})]})]})]})}case"tool-result":return l.jsxs("div",{className:"tool-block",children:[l.jsx("span",{className:"tool-label",children:S("thread.tool.orphanResult")}),l.jsx("pre",{className:`tool-pre${t.isError?" tool-pre-error":""}`,children:qs(t.text,g)})]})}}function CS({part:t,answeredAt:n,failure:i,answerable:c,onAnswer:g,needle:T}){var I;const[C,r]=N.useState(()=>t.questions.map(()=>[])),[u,_]=N.useState(null),[v,h]=N.useState(""),w=n!==null,k=w||!c,L=n??C,f=t.questions.length===1&&((I=t.questions[0])==null?void 0:I.multiSelect)===!1,a=L.every(E=>Nl(E)?E.text.trim().length>0:E.length>0),p=E=>E===void 0||Nl(E)?[]:E,m=(E,M)=>{if(k)return;const b=t.questions[E];if(b!==void 0){if(f){g(t.toolUseId,[[M]]);return}_(R=>R===E?null:R),r(R=>R.map((D,B)=>{if(B!==E)return D;const O=p(D);return b.multiSelect?O.includes(M)?O.filter(F=>F!==M):[...O,M]:[M]}))}},d=E=>{const M=v.trim();if(M.length===0||k)return;const b={kind:"free",text:M};if(f){g(t.toolUseId,[b]);return}r(R=>R.map((D,B)=>B===E?b:D)),_(null),h("")},x=E=>{if(k)return;const M=L[E];h(M!==void 0&&Nl(M)?M.text:""),_(E)};return l.jsxs("div",{className:`question${w?" question-done":""}`,children:[t.questions.map((E,M)=>{const b=L[M],R=b!==void 0&&Nl(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:qs(E.question,T)}),E.multiSelect&&l.jsx("span",{className:"question-hint",children:S("thread.question.multi")})]}),l.jsxs("div",{className:"question-options",children:[E.options.map((D,B)=>{const O=p(b).includes(B);return l.jsxs("button",{type:"button",className:`question-option${O?" question-option-picked":""}`,disabled:k,onClick:()=>m(M,B),children:[l.jsx("span",{className:"question-option-label",children:D.label}),D.description.length>0&&l.jsx("span",{className:"question-option-desc",children:D.description})]},B)}),u===M&&!k?l.jsxs("div",{className:"question-write",children:[l.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:v,placeholder:S("thread.question.placeholder"),onChange:D=>h(D.target.value),onKeyDown:D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),d(M)),D.key==="Escape"&&_(null),D.stopPropagation()}}),l.jsxs("div",{className:"question-write-actions",children:[l.jsx("button",{type:"button",className:"question-send",disabled:v.trim().length===0,onClick:()=>d(M),children:S(f?"thread.question.send":"thread.question.useText")}),l.jsx("button",{type:"button",className:"question-write-cancel",onClick:()=>_(null),children:S("common.cancel")})]})]}):l.jsxs("button",{type:"button",className:`question-option question-option-write${R!==null?" question-option-picked":""}`,disabled:k,onClick:()=>x(M),children:[l.jsx("span",{className:"question-option-label",children:R!==null?R:S("thread.question.writeOther")}),R===null&&l.jsx("span",{className:"question-option-desc",children:S("thread.question.writeOtherHint")})]})]})]},M)}),l.jsxs("div",{className:"question-foot",children:[i!==null&&l.jsx("span",{className:"question-failed",children:i}),w?l.jsx("span",{className:"question-sent",children:S("thread.question.answered")}):c?l.jsxs(l.Fragment,{children:[!f&&l.jsx("button",{type:"button",className:"question-send",disabled:!a,onClick:()=>g(t.toolUseId,C),children:S("thread.question.sendAnswers")}),l.jsx("span",{className:"question-note",children:S(f?"thread.question.pickOne":"thread.question.pickEach")})]}):l.jsx("span",{className:"question-note",children:S("thread.question.answerInCli")})]})]})}function xS({text:t,truncated:n,needle:i}){const c=Hy(t,n),g=c.length===1?c[0]:void 0;if(g!==void 0&&g.kind==="text")return l.jsx(sp,{text:t,truncated:n,needle:i});const T=c.length-1;return l.jsx("div",{className:"part-own",children:c.map((C,r)=>C.kind==="text"?l.jsx(sp,{text:C.text,truncated:n&&r===T,needle:i},r):l.jsx(kS,{number:C.number,text:C.text,complete:C.complete,needle:i},r))})}function kS({number:t,text:n,complete:i,needle:c}){const[g,T]=N.useState(!1),C=c.length>0&&n.toLowerCase().includes(c.toLowerCase()),r=g||C;return l.jsxs("div",{className:`thread-pasted${r?" thread-pasted-open":""}`,children:[l.jsxs("button",{className:"thread-pasted-toggle",onClick:()=>T(u=>!u),"aria-expanded":r,children:[l.jsx("span",{className:"chip-icon",children:"¶"}),S("thread.pasted",{number:t,count:Hl(n)}),!i&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]}),l.jsx("span",{className:"chip-chevron",children:r?"▾":"▸"})]}),r&&l.jsx("div",{className:"thread-pasted-text part-mine",children:pg(n,c)})]})}function sp({text:t,truncated:n,needle:i}){const[c,g]=N.useState(!1),T=t.split(`
126
- `),C=i.length>0&&t.toLowerCase().includes(i.toLowerCase()),r=T.length>=Zf&&!C,u=r&&!c?T.slice(0,Zf-1).join(`
127
- `):t;return l.jsxs("div",{className:"part-text part-mine",children:[pg(u,i),n&&l.jsxs("span",{className:"part-truncated",children:[" ",S("thread.truncated")]}),r&&l.jsx("button",{className:"fold-toggle",onClick:()=>g(_=>!_),children:c?S("thread.fold.less"):S("thread.fold.more",{count:T.length})})]})}function ES({eventId:t,index:n,source:i,src:c,onRequest:g}){const[T,C]=N.useState(!1);return N.useEffect(()=>{c===void 0&&g(t,n,i)},[c,t,n,i,g]),c===void 0?l.jsx("div",{className:"conversation-image-placeholder",children:S("thread.image.loading")}):c===null?l.jsx("div",{className:"conversation-image-placeholder",children:S("thread.image.gone")}):l.jsxs(l.Fragment,{children:[l.jsx("img",{className:"conversation-image",src:c,alt:S("thread.image.alt"),onClick:()=>C(!0),title:S("thread.image.openTitle")}),T&&l.jsx(Bm,{src:c,caption:S("thread.image.alt"),onClose:()=>C(!1)})]})}function rp({connection:t,title:n,confirmLabel:i,confirmTitle:c,onChoose:g,onClose:T}){const[C,r]=N.useState(null),[u,_]=N.useState(null),[v,h]=N.useState(!1),[w,k]=N.useState(""),L=N.useRef(null),f=N.useRef(null);N.useEffect(()=>{const d=t.onMessage(x=>{if(x.type==="picker.listing"){L.current=x.listing.pickerId,r(x.listing),_(null),h(!1),k("");return}x.type==="error"&&x.code==="picker-failed"&&_(Pt(x.text))});return t.send({type:"picker.open"}),()=>{d();const x=L.current;x!==null&&t.send({type:"picker.close",pickerId:x})}},[t]),N.useEffect(()=>{const d=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),T())};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[T]),N.useEffect(()=>{var d;v&&((d=f.current)==null||d.focus())},[v]);const a=N.useCallback(d=>{const x=L.current;x!==null&&t.send({type:"picker.enter",pickerId:x,name:d})},[t]),p=N.useCallback(d=>{const x=L.current;x!==null&&t.send({type:"picker.root",pickerId:x,rootIndex:d})},[t]),m=N.useCallback(()=>{const d=L.current,x=w.trim();d===null||x.length===0||t.send({type:"picker.create",pickerId:d,name:x})},[t,w]);return l.jsx("div",{className:"modal-backdrop",onClick:T,children:l.jsxs("div",{className:"modal picker-modal",role:"dialog","aria-label":n,onClick:d=>d.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:n}),l.jsx("button",{className:"icon-button",onClick:T,title:S("common.close"),children:"×"})]}),C===null?l.jsx("p",{className:"panel-note",children:S("picker.loading")}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"picker-roots",children:C.roots.map((d,x)=>l.jsx("button",{className:"picker-root",onClick:()=>p(x),title:S("picker.goTo",{root:d}),children:d},d))}),l.jsx("p",{className:"picker-path",title:C.path,children:C.path}),l.jsxs("div",{className:"picker-list",children:[C.canGoUp&&l.jsxs("button",{className:"picker-entry picker-up",onClick:()=>a(".."),children:["‹ ",S("picker.up")]}),C.entries.length===0&&!C.canGoUp&&l.jsx("p",{className:"panel-note",children:S("picker.empty")}),C.entries.map(d=>l.jsx("button",{className:"picker-entry",onClick:()=>a(d),children:d},d)),C.truncated&&l.jsx("p",{className:"panel-note",children:S("picker.truncated")})]}),u!==null&&l.jsx("p",{className:"picker-problem",children:u}),l.jsxs("footer",{className:"picker-footer",children:[v?l.jsxs("div",{className:"picker-create",children:[l.jsx("input",{ref:f,className:"picker-create-input",value:w,placeholder:S("picker.newFolderName"),onChange:d=>k(d.target.value),onKeyDown:d=>{d.key==="Enter"&&m(),d.key==="Escape"&&(d.stopPropagation(),h(!1)),d.stopPropagation()},spellCheck:!1}),l.jsx("button",{className:"primary-button primary-button-small",onClick:m,children:S("picker.create")}),l.jsx("button",{className:"link-button",onClick:()=>h(!1),children:S("common.cancel")})]}):l.jsx("button",{className:"primary-button primary-button-small",onClick:()=>h(!0),children:S("picker.createHere")}),l.jsx("span",{className:"composer-spacer"}),l.jsx("button",{className:"picker-open",onClick:()=>g(C.pickerId,C.path),title:c(C.path),children:i})]})]})]})})}function LS(t,n){return Lu(t)&&n!==null&&n.sessions>0}function TS(){return S("search.mode.titles")}function RS(){return S("search.mode.conversations")}function MS(){return S("search.mode.conversationsTitle")}function AS(t){return S(t==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function NS(){return S("search.tooShort",{min:cm})}function DS(t){return[...t.trim()].length<cm}function IS(){return S("search.off")}function jS(t){const n=new Map;for(const i of t){const c=`${i.agent}:${i.sessionId}`;let g=n.get(c);g===void 0&&(g={key:c,agent:i.agent,sessionId:i.sessionId,title:i.title,titleHit:null,hits:[],lastAt:null},n.set(c,g)),i.eventId===null?g.titleHit=i:g.hits.push(i),i.at!==null&&(g.lastAt=Math.max(g.lastAt??0,i.at))}return[...n.values()]}const PS=40;function gg(t,n=PS){const i=t.matchStart+t.matchLength;let c=t.snippet.slice(0,t.matchStart);if(c.length>n){let g=c.length-n;const T=c.charCodeAt(g);T>=56320&&T<=57343&&(g+=1),c=`…${c.slice(g)}`}return{before:c,match:t.snippet.slice(t.matchStart,i),after:t.snippet.slice(i)}}function OS(t){return t.role==="user"?S("search.role.user"):t.role==="assistant"?S("search.role.assistant"):S("search.role.title")}function _g(t){return gg(t).match.trim()}function BS(t){const n=t.hits[0]??t.titleHit;return n===null?"":_g(n)}const _u=t=>S("search.sessions",{count:t});function FS(t,n){return{query:n.query,hits:t===null?[...n.hits]:[...t.hits,...n.hits],sessionsScanned:n.sessionsScanned,sessionsTotal:n.sessionsTotal,truncated:null}}function HS(t){const{result:n}=t;if(t.searching&&t.error===null){if(n===null)return S("search.status.searching");const c={count:n.sessionsTotal,scanned:n.sessionsScanned};return n.hits.length===0?S("search.status.progress",c):S("search.status.progressFound",{...c,found:ip(n)})}if(t.error!==null)return t.error;if(n===null)return null;const i=n.hits.length===0?S("search.status.none"):ip(n);if(n.truncated===null&&n.hits.length===0&&n.sessionsScanned>0)return S("search.status.noneIn",{sessions:_u(n.sessionsScanned)});if(n.truncated==="results")return S("search.status.truncatedResults",{found:i});if(n.truncated==="time"){const c=Math.max(0,n.sessionsTotal-n.sessionsScanned);return S("search.status.truncatedTime",{found:i,seconds:Math.round(x0/1e3),left:_u(c)})}return S("search.status.done",{found:i})}function ip(t){const n=new Set(t.hits.map(i=>`${i.agent}:${i.sessionId}`)).size;return S("search.found",{hits:S("search.hits",{count:t.hits.length}),sessions:_u(n)})}function $S(t,n){const i=n.terminals.find(c=>c.kind==="agent"&&c.agent===t.agent&&c.sessionId===t.sessionId);if(i!==void 0)return{kind:"activate",terminalId:i.terminalId};for(const c of n.projects){const g=c.sessions.find(T=>T.agent===t.agent&&T.sessionId===t.sessionId);if(g!==void 0)return hu(g)&&c.cwdExists&&n.canResume(g.agent)?{kind:"resume",cwd:pm(g.cwd,c.cwd,n.platform),session:g}:{kind:"copy"}}return{kind:"copy"}}const US=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function Kt(t,n,i){const c=Sm(t,n),g=[];let T=0;for(const C of c.matchAll(US)){const r=C.index??0;r>T&&g.push(Il(c.slice(T,r),n));const u=C[1];if(u===void 0)g.push(N.createElement("br",{key:g.length}));else{const _=Il(C[2]??"",n);g.push(N.createElement(u,{key:g.length},_))}T=r+C[0].length}return T<c.length&&g.push(Il(c.slice(T),n)),g.length===1?g[0]:g}const op="0.6.0",lp="agent-workbench.support-notice",WS=3e4;function zS(t){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(t)?t:null}function VS(t,n){return t!==n}function qS(){return[{keys:"Alt + T",description:S("shortcuts.app.newTab")},{keys:"Alt + W",description:S("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:S("shortcuts.app.switchTab")},{keys:"Alt + P",description:S("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:S("shortcuts.app.previousTab")}]}function KS({agent:t,onClose:n}){return N.useEffect(()=>{const i=c=>{c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),n())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[n]),l.jsx("div",{className:"modal-backdrop",onClick:n,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":S("shortcuts.ariaLabel"),onClick:i=>i.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:S("shortcuts.title")}),l.jsx("button",{className:"icon-button",onClick:n,title:S("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("h3",{className:"modal-section",children:S("shortcuts.section.app")}),l.jsx(Qc,{shortcuts:qS()}),l.jsx("h3",{className:"modal-section",children:S("shortcuts.section.composer")}),l.jsx(Qc,{shortcuts:Uw(t!==null&&t.capabilities.imagesByPath!==null)}),t!==null&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("shortcuts.section.cli")}),l.jsx("p",{className:"modal-hint",children:Kt("shortcuts.cliHint")}),l.jsx(Qc,{shortcuts:vr[t.id].shortcuts}),vr[t.id].shortcutsNote!==null&&l.jsx("p",{className:"modal-hint",children:vr[t.id].shortcutsNote})]}),l.jsx("p",{className:"modal-hint",children:Kt("shortcuts.browserReserved")}),l.jsx("p",{className:"modal-hint",children:Kt("shortcuts.altNumber")}),l.jsxs("p",{className:"modal-hint support-hint",children:[l.jsx("span",{"aria-hidden":"true",children:"☕"})," ",S("support.notice")," ",l.jsx("a",{href:gm,target:"_blank",rel:"noreferrer noopener",children:S("support.link")})]})]})]})})}function Qc({shortcuts:t}){return l.jsx("dl",{className:"shortcut-list",children:t.map(n=>l.jsxs("div",{className:"shortcut-row",children:[l.jsx("dt",{children:l.jsx("kbd",{children:n.keys})}),l.jsx("dd",{children:n.description})]},n.keys))})}const GS=1e3,YS=5e3;function XS({info:t,agentLabel:n,onRefresh:i,onClose:c}){const[g,T]=N.useState(!1),[C,r]=N.useState(!1),u=N.useRef(null),_=N.useRef(null);N.useEffect(()=>{const L=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),c())};return window.addEventListener("keydown",L,!0),()=>window.removeEventListener("keydown",L,!0)},[c]),N.useEffect(()=>{r(!1)},[t]),N.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current),_.current!==null&&window.clearTimeout(_.current)},[]);const v=L=>{navigator.clipboard.writeText(L).then(()=>{T(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>T(!1),GS)}).catch(()=>T(!1))},h=()=>{r(!0),i(),_.current!==null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>r(!1),YS)},w=t.state==="active",k=S("statusLine.title",{agent:n});return l.jsx("div",{className:"modal-backdrop",onClick:c,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":k,onClick:L=>L.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:k}),l.jsx("button",{className:"icon-button",onClick:c,title:S("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:`status-line-state${w?" status-line-state-active":""}`,children:Ow(t.state)}),l.jsx("p",{className:"modal-hint",children:S("statusLine.benefit")}),l.jsx("h3",{className:"modal-section",children:S("statusLine.lineSection")}),t.fragment===null?l.jsx("p",{className:"modal-hint",children:Bw()}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:Kt("statusLine.mergeHint")}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:t.fragment}),l.jsx("button",{className:"link-button",onClick:()=>v(t.fragment??""),title:S("statusLine.copyTitle"),children:g?l.jsxs(l.Fragment,{children:["✓ ",S("statusLine.copied")]}):S("statusLine.copy")})]})]}),l.jsx("h3",{className:"modal-section",children:S("statusLine.whereSection")}),l.jsx("p",{className:"status-line-path",children:t.settingsPath}),l.jsx("p",{className:"modal-hint",children:S("statusLine.whereHint")}),l.jsx("h3",{className:"modal-section",children:S("statusLine.scriptSection")}),l.jsx("p",{className:"modal-hint",children:S("statusLine.scriptHint")}),l.jsx("p",{className:"status-line-path",children:t.scriptPath}),l.jsx("p",{className:"modal-hint",children:Kt("statusLine.runsEverywhere")}),l.jsxs("div",{className:"status-line-actions",children:[l.jsx("button",{className:"primary-button",onClick:h,disabled:C,children:S(C?"statusLine.checking":"statusLine.check")}),l.jsx("span",{className:"modal-hint",children:S("statusLine.checkHint")})]})]})]})})}function QS(){const[t,n]=N.useState(()=>VS(xt(lp,null,zS),op));return N.useEffect(()=>{if(!t)return;vt(lp,op);const i=window.setTimeout(()=>n(!1),WS);return()=>window.clearTimeout(i)},[t]),t?l.jsxs("div",{className:"banner banner-support",role:"status",children:[l.jsx("span",{children:S("support.notice")}),l.jsx("a",{className:"banner-support-link",href:gm,target:"_blank",rel:"noreferrer noopener",onClick:()=>n(!1),children:S("support.link")}),l.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>n(!1),children:S("support.dismiss")})]}):null}function vu({agent:t,agents:n}){return l.jsx("span",{className:"agent-badge",title:lo(t,n),children:Cw(t)})}const JS=500,ap=10;function ZS(t){const n=N.useRef(null),i=N.useRef(null),c=N.useRef(!1),g=N.useRef(t);g.current=t;const T=N.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,i.current=null},[]),C=N.useCallback(v=>{v.pointerType==="mouse"||v.button!==0||(T(),c.current=!1,i.current={x:v.clientX,y:v.clientY},n.current=window.setTimeout(()=>{n.current=null,c.current=!0,g.current()},JS))},[T]),r=N.useCallback(v=>{const h=i.current;h!==null&&(Math.abs(v.clientX-h.x)>ap||Math.abs(v.clientY-h.y)>ap)&&T()},[T]),u=N.useCallback(v=>{(c.current||n.current!==null)&&v.preventDefault()},[]),_=N.useCallback(v=>{c.current&&(c.current=!1,v.preventDefault(),v.stopPropagation())},[]);return{onPointerDown:C,onPointerMove:r,onPointerUp:T,onPointerCancel:T,onContextMenu:u,onClickCapture:_}}function eC({onLongPress:t,...n}){const i=ZS(t);return l.jsx("button",{...n,...i})}function ju({className:t,text:n,title:i,disabled:c,offerAgentChoice:g,agents:T,agent:C,onOpen:r}){var L;const[u,_]=N.useState(!1),v=N.useRef(null),h=N.useCallback(()=>_(!1),[]),w=N.useCallback(f=>{_(!1),r(f)},[r]);if(!g)return l.jsx("button",{className:t,onClick:()=>r(),disabled:c,title:i,children:n});const k=((L=T.find(f=>f.id===C))==null?void 0:L.label)??null;return l.jsxs("span",{className:"split-button",children:[l.jsx("button",{className:`${t} split-button-main`,onClick:()=>r(C??void 0),disabled:c,title:k===null?i:S("agentMenu.titleWithAgent",{title:i,label:k}),children:n}),l.jsx("button",{ref:v,className:`${t} split-button-arrow`,onClick:()=>_(f=>!f),disabled:c,"aria-haspopup":"menu","aria-expanded":u,title:S("agentMenu.chooseTitle"),children:"▾"}),u&&v.current!==null&&l.jsx(tg,{agents:T,preselected:C,anchor:v.current,onPick:w,onClose:h})]})}function tC(t){const n=new Date(t);return n.setHours(0,0,0,0),n.getTime()}function vg(t,n,i,c){const g=new Set;for(const T of t)for(const C of T.sessions)C.agent===n&&(C.archived||C.updatedAt<i&&(c.has(C.sessionId)||g.add(C.sessionId)));return[...g]}function nC(t,n,i,c){const g=[];for(const r of t)for(const u of r.sessions)g.includes(u.agent)||g.push(u.agent);const T=c,C=r=>{const u=T.indexOf(r);return u===-1?c.length:u};return g.sort((r,u)=>C(r)-C(u)).map(r=>({agent:r,count:vg(t,r,n,i).length})).filter(r=>r.count>0)}function wg(t,n){const i=new Set;let c=0;for(const g of t.sessions)if(!g.archived){if(n.has(g.sessionId)){c+=1;continue}i.add(g.sessionId)}return{sessionIds:[...i],blocked:c}}function sC(t){const{sessionIds:n,blocked:i}=t;if(n.length===0)return S("archive.allBlocked",{count:i});const c=S("archive.confirm",{count:n.length});return i===0?c:S("archive.withBlocked",{confirm:c,blocked:S("archive.blockedStays",{count:i})})}const cp=12;function rC(t){let n=2166136261;for(let i=0;i<t.length;i+=1)n^=t.charCodeAt(i),n=Math.imul(n,16777619);return n>>>0}function wr(t){const n=t.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${rC(n)%cp*(360/cp)} var(--project-color-s) var(--project-color-l))`}function ni(){return S("vault.name")}function iC(){return S("vault.privacy")}function oC(){return S("vault.archived")}function lC(){return S("vault.mark.copy")}function up(){return S("vault.mark.copyTitle")}function aC(){return S("vault.mark.partial")}function cC(){return S("vault.mark.partialTitle")}function yg(t){return S("vault.sessions",{count:t})}function Pu(t){return t==="measuring"||t==="writing"||t==="moving"}function uC(t){const n=t.progress;switch(t.state){case"measuring":return n===null?S("vault.state.measuring"):S("vault.state.measuringProgress",{done:n.done,total:n.total});case"writing":return n===null?S("vault.state.writing"):S("vault.state.writingProgress",{done:n.done,total:n.total});case"moving":return S("vault.state.moving");default:return t.enabled?S("vault.state.on"):S("vault.state.off")}}function hC(t){if(t===null||!t.enabled)return null;const n=[ni(),yg(t.sessions)];return t.state==="writing"?n.push(t.progress===null?S("vault.line.copying"):S("vault.line.copyingProgress",{done:t.progress.done,total:t.progress.total})):t.state==="moving"?n.push(S("vault.line.moving")):t.state==="measuring"?n.push(S("vault.line.measuring")):n.push(t.lastPassAt===null?S("vault.line.neverCopied"):es(t.lastPassAt)),t.pending>0&&n.push(S("vault.line.pending",{count:t.pending})),n.join(" · ")}function dC(t){return t===null?ni():t.enabled?S("vault.button.on"):S("vault.button.off")}function fC(t){return t.enabled?"enabled":Pu(t.state)?"busy":t.measurement!==null?"measured":t.passSessions>0?"existing":"needs-measure"}function pC(t,n){return Pu(t.state)?S("vault.busy"):n?null:S("vault.indexNotReady")}function mC(t){return Pu(t.state)?S("vault.busy"):null}function gC(t){return S("vault.previousDir",{dir:t})}function _C(t){const n=[];return t.skippedEmpty>0&&n.push(S("vault.note.empty",{count:t.skippedEmpty})),t.unsupported>0&&n.push(S("vault.note.unsupported",{count:t.unsupported})),t.failed>0&&n.push(t.failureReasons.length>0?S("vault.note.failedWithReasons",{count:t.failed,reasons:t.failureReasons.map(Pt).join("; ")}):S("vault.note.failed",{count:t.failed})),n.length===0?null:S("vault.note.notCopied",{parts:n.join(" · ")})}function vC(t,n){const i=t.byAgent.map(T=>({agent:T.agent,label:lo(T.agent,n),sessions:T.sessions,bytes:T.eventBytes+T.imageBytes,images:T.images,imageBytes:T.imageBytes,skippedArchived:T.skippedArchived,note:_C(T)})),c=i.reduce((T,C)=>({sessions:T.sessions+C.sessions,bytes:T.bytes+C.bytes,images:T.images+C.images,skippedArchived:T.skippedArchived+C.skippedArchived}),{sessions:0,bytes:t.memoryBytes,images:0,skippedArchived:0}),g=es(t.measuredAt);return{rows:i,memoryProjects:t.memoryProjects,memoryBytes:t.memoryBytes,total:c,summary:g.length>0?S("vault.measure.summary",{when:g,duration:so(t.durationMs)}):S("vault.measure.summaryNoWhen",{duration:so(t.durationMs)})}}function wC(t){const n=t.storage==="vault";return{copy:n,partial:n&&t.partial}}function yC(t){switch(t){case"exporting":return S("vault.export.exporting");case"done":return S("vault.export.done");default:return S("vault.export.idle")}}const bC=1e3;function hp({hit:t}){const{before:n,match:i,after:c}=gg(t);return l.jsxs(l.Fragment,{children:[n,l.jsx("mark",{children:i}),c]})}function SC({project:t,openSessionIds:n,onConfirm:i,onCancel:c}){const g=wg(t,n);return l.jsxs("div",{className:"project-archive-confirm",role:"group",children:[l.jsx("span",{className:"archive-history-text",children:sC(g)}),g.sessionIds.length>0&&l.jsx("button",{className:"link-button",onClick:i,children:S("sidebar.action.archive")}),l.jsx("button",{className:"link-button",onClick:c,children:g.sessionIds.length>0?S("common.cancel"):S("common.close")})]})}function Jc(t){if(t.cwd.length===0)return t.fallbackName;const n=t.cwd.split(/[\\/]/).filter(i=>i.length>0);return n[n.length-1]??t.cwd}function dp({out:t}){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"}),t?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 CC(){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 xC({done:t}){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:t?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 kC({candidates:t,agents:n,onArchiveAgent:i,onClose:c,anchorRef:g}){const[T,C]=N.useState(null),r=N.useRef(null);return N.useEffect(()=>{const u=h=>{var w,k;return h instanceof Node&&(((w=r.current)==null?void 0:w.contains(h))===!0||((k=g.current)==null?void 0:k.contains(h))===!0)},_=h=>{h.key!=="Escape"||!u(document.activeElement)||(h.preventDefault(),h.stopPropagation(),c())},v=h=>{u(h.target)||c()};return window.addEventListener("keydown",_,!0),document.addEventListener("pointerdown",v,!0),()=>{window.removeEventListener("keydown",_,!0),document.removeEventListener("pointerdown",v,!0)}},[g,c]),l.jsxs("div",{ref:r,className:"archive-history",role:"region","aria-label":S("sidebar.history.region"),children:[l.jsxs("div",{className:"archive-history-header",children:[l.jsx("span",{children:S("sidebar.history.heading")}),l.jsx("button",{className:"icon-button",onClick:c,title:S("common.closeEsc"),children:"×"})]}),t.map(({agent:u,count:_})=>{const v=lo(u,n);return T===u?l.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[l.jsx("span",{className:"archive-history-text",children:S("sidebar.history.confirm",{count:_,label:v})}),l.jsx("button",{className:"link-button",onClick:()=>i(u),children:S("sidebar.action.archive")}),l.jsx("button",{className:"link-button",onClick:()=>C(null),children:S("common.cancel")})]},u):l.jsxs("div",{className:"archive-history-row",children:[l.jsxs("span",{className:"archive-history-text",children:[l.jsx("span",{className:"archive-history-agent",children:v}),l.jsx("span",{className:"archive-history-count",children:S("sidebar.history.count",{count:_})})]}),l.jsx("button",{className:"link-button",onClick:()=>C(u),children:S("sidebar.action.archive")})]},u)})]})}function EC({projects:t,indexStatus:n,disabled:i,openSessionIds:c,openBlocked:g,onOpenProject:T,agents:C,offerAgentChoice:r,agentForProject:u,onOpenSession:_,canResume:v,platform:h,onRefresh:w,onArchive:k,onHide:L,width:f,onNewProject:a,vault:p,onOpenVault:m,onOpenVaultSession:d,onExportProject:x,exporting:I,lastExported:E,onContinueSession:M,globalSearch:b,onOpenSearchHit:R}){const[D,B]=N.useState(new Set),[O,F]=N.useState(null);N.useEffect(()=>{const pe=E===null?0:E.at+bC-Date.now();if(E===null||pe<=0)return;F(E.projectKey);const Ke=window.setTimeout(()=>F(null),pe);return()=>window.clearTimeout(Ke)},[E]);const U=pe=>I.has(pe)?"exporting":O===pe?"done":"idle",q=hC(p),[X,Y]=N.useState(""),[V,j]=N.useState(!1),[$,H]=N.useState(new Set),[K,te]=N.useState("titles"),re=b===null?"titles":K,[le,de]=N.useState(!1),G=b!==null&&re==="conversations"&&X.trim().length>0&&(le||b.submitted!==null),z=(b==null?void 0:b.result)??null,Q=N.useMemo(()=>G&&z!==null?jS(z.hits):[],[G,z]),Z=pe=>{te(pe),de(!1),b==null||b.clear()},ae=()=>{if(b!==null){if(DS(X)){de(!0),b.clear();return}de(!1),b.search(X.trim(),V)}},fe=(b==null?void 0:b.submitted)??null,Ee=b==null?void 0:b.search;N.useEffect(()=>{re!=="conversations"||fe===null||Ee===void 0||fe.includeArchived!==V&&Ee(fe.query,V)},[re,fe,Ee,V]);const Ae=N.useMemo(()=>t.reduce((pe,Ke)=>pe+Ke.sessions.filter(Xe=>Xe.archived).length,0),[t]),ze=N.useMemo(()=>{const pe=re==="titles"?X.trim().toLowerCase():"";return t.map(Ke=>{const Xe=V?Ke.sessions:Ke.sessions.filter(tt=>!tt.archived);if(Xe.length===0)return null;if(pe.length===0)return{...Ke,sessions:Xe};if(Jc(Ke).toLowerCase().includes(pe)||Ke.cwd.toLowerCase().includes(pe))return{...Ke,sessions:Xe};const be=Xe.filter(tt=>Zn(tt.title,tt.titleSource).toLowerCase().includes(pe));return be.length>0?{...Ke,sessions:be}:null}).filter(Ke=>Ke!==null)},[t,X,V,re]),ue=re==="titles"&&X.trim().length>0,Me=pe=>pe.archived||!c.has(pe.sessionId),[he,Te]=N.useState(!1),ge=N.useRef(null),Re=tC(Date.now()),Ue=N.useMemo(()=>C.map(pe=>pe.id),[C]),ke=N.useMemo(()=>nC(t,Re,c,Ue),[t,Re,c,Ue]),[Ne,st]=N.useState(null);N.useEffect(()=>{ke.length===0&&Te(!1)},[ke.length]);const ot=N.useCallback(()=>Te(!1),[]),wt=pe=>{const Ke=vg(t,pe,Re,c);Ke.length>0&&(k(Ke,!0),st({what:lo(pe,C),sessionIds:Ke})),Te(!1)},[ct,bt]=N.useState(null),Pe=pe=>{const Ke=wg(pe,c);Ke.sessionIds.length>0&&(k(Ke.sessionIds,!0),st({what:Jc(pe),sessionIds:Ke.sessionIds})),bt(null)},Ze=()=>{Ne!==null&&k(Ne.sessionIds,!1),st(null)},qe=pe=>{H(Ke=>{const Xe=new Set(Ke);return Xe.has(pe)?Xe.delete(pe):Xe.add(pe),Xe})},et=N.useMemo(()=>{const pe=[];for(const Ke of ze)for(const Xe of Ke.sessions)$.has(Xe.sessionId)&&pe.push(Xe);return pe},[ze,$]),Gt=pe=>{const Ke=et.filter(Xe=>pe?Me(Xe):!0).map(Xe=>Xe.sessionId);Ke.length>0&&k(Ke,pe),H(new Set)},pt=pe=>{B(Ke=>{const Xe=new Set(Ke);return Xe.has(pe)?Xe.delete(pe):Xe.add(pe),Xe})},it=n.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:AS(re),value:X,onChange:pe=>{Y(pe.target.value),re==="conversations"&&(de(!1),pe.target.value.trim().length===0&&(b==null||b.clear()))},onKeyDown:pe=>{re!=="conversations"||pe.key!=="Enter"||(pe.preventDefault(),ae())},spellCheck:!1}),l.jsx("button",{className:"icon-button",onClick:a,title:S("sidebar.newProject"),disabled:i,children:"+"}),l.jsx("button",{className:"icon-button",onClick:w,title:S("sidebar.reindex"),disabled:it,children:"⟳"}),l.jsx("button",{className:`icon-button${(p==null?void 0:p.enabled)===!0?" icon-button-on":""}`,onClick:m,title:dC(p),"aria-label":ni(),children:l.jsx(CC,{})}),l.jsx("button",{className:"icon-button",onClick:L,title:S("sidebar.hide"),children:"«"})]}),b!==null&&l.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":S("sidebar.searchMode.label"),children:[l.jsx("button",{className:`sidebar-search-mode-option${re==="titles"?" is-on":""}`,"aria-pressed":re==="titles",onClick:()=>Z("titles"),title:S("sidebar.searchMode.titlesTitle"),children:TS()}),l.jsx("button",{className:`sidebar-search-mode-option${re==="conversations"?" is-on":""}`,"aria-pressed":re==="conversations",onClick:()=>Z("conversations"),title:MS(),children:RS()})]}),it&&l.jsx("div",{className:"sidebar-progress",children:S("sidebar.indexing",{scanned:n.scannedFiles,total:n.totalFiles})}),(Ae>0||ke.length>0)&&l.jsxs("div",{className:"sidebar-archive-bar",children:[Ae>0&&l.jsx("button",{className:`sidebar-archived-toggle${V?" is-on":""}`,onClick:()=>j(pe=>!pe),title:S("sidebar.archived.toggleTitle"),children:V?S("sidebar.archived.hide",{count:Ae}):S("sidebar.archived.show",{count:Ae})}),ke.length>0&&l.jsx("button",{ref:ge,className:`link-button sidebar-archive-history${he?" is-on":""}`,onClick:()=>Te(pe=>!pe),"aria-expanded":he,title:S("sidebar.history.buttonTitle"),children:S("sidebar.history.button")})]}),he&&ke.length>0&&l.jsx(kC,{candidates:ke,agents:C,onArchiveAgent:wt,onClose:ot,anchorRef:ge}),Ne!==null&&!he&&l.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[l.jsx("span",{className:"archive-history-text",children:S("sidebar.undo.text",{count:Ne.sessionIds.length,what:Ne.what})}),l.jsx("button",{className:"link-button",onClick:Ze,children:S("sidebar.action.undo")}),l.jsx("button",{className:"icon-button",onClick:()=>st(null),title:S("sidebar.undo.dismissTitle"),children:"×"})]}),q!==null&&l.jsx("button",{className:`sidebar-vault-line${(p==null?void 0:p.lastError)!=null?" is-problem":""}`,onClick:m,title:(p==null?void 0:p.lastError)!=null?S("sidebar.vaultLine.lastError",{error:Pt(p.lastError)}):S("sidebar.vaultLine.title"),children:q}),l.jsxs("div",{className:"sidebar-scroll",children:[G&&b!==null&&l.jsxs("div",{className:"search-results",children:[!b.vaultEnabled&&l.jsx("p",{className:"search-note",children:IS()}),l.jsx("p",{className:`search-status${b.error!==null?" is-problem":""}`,role:"status",children:le?NS():HS(b)}),!le&&Q.map(pe=>{const Ke=pe.hits[0]??pe.titleHit;return Ke===null?null:l.jsxs("div",{className:"search-group",children:[l.jsxs("button",{className:"search-group-title",onClick:()=>R(Ke,BS(pe)),title:Zn(pe.title),children:[l.jsx(vu,{agent:pe.agent,agents:C}),pe.titleHit!==null?l.jsx(hp,{hit:pe.titleHit}):Zn(pe.title)]}),pe.hits.map(Xe=>l.jsxs("button",{className:"search-hit",onClick:()=>R(Xe,_g(Xe)),children:[l.jsx("span",{className:"search-hit-snippet",children:l.jsx(hp,{hit:Xe})}),l.jsxs("span",{className:"search-hit-meta",children:[OS(Xe),Xe.at!==null?` · ${es(Xe.at)}`:""]})]},Xe.eventId??"titulo"))]},pe.key)})]}),!G&&ze.length===0&&!it&&l.jsx("p",{className:"sidebar-empty",children:t.length===0?S("sidebar.empty.noProjects"):S("sidebar.empty.noMatch")}),!G&&ze.map(pe=>{const Ke=D.has(pe.key)||ue,Xe=!i&&pe.cwdExists,xe=g(pe.cwd);return l.jsxs("div",{className:"project",children:[l.jsxs("div",{className:"project-row",children:[l.jsxs("button",{className:"project-toggle",onClick:()=>pt(pe.key),title:pe.cwd.length>0?pe.cwd:pe.fallbackName,children:[l.jsx("span",{className:`chevron${Ke?" chevron-open":""}`,children:"›"}),l.jsx("span",{className:"project-swatch",style:{background:wr(pe.cwd)},"aria-hidden":"true"}),l.jsx("span",{className:"project-name",children:Jc(pe)}),l.jsx("span",{className:"project-count",children:pe.sessions.length})]}),l.jsxs("span",{className:"project-actions",children:[x!==null&&l.jsx("button",{className:`icon-button project-action${U(pe.key)!=="idle"?" project-action-busy":""}`,onClick:()=>x(pe.key),disabled:U(pe.key)==="exporting",title:yC(U(pe.key)),"aria-label":S("sidebar.project.export"),children:l.jsx(xC,{done:U(pe.key)==="done"})}),l.jsx("button",{className:`icon-button project-action${ct===pe.key?" project-action-busy":""}`,onClick:()=>bt(be=>be===pe.key?null:pe.key),title:S("sidebar.project.archiveTitle"),"aria-label":S("sidebar.project.archive"),"aria-expanded":ct===pe.key,children:l.jsx(dp,{out:!1})})]}),l.jsx(ju,{className:"icon-button",text:"+",title:xe?Am():pe.cwdExists?S("sidebar.project.newSession"):S("sidebar.project.folderGone"),disabled:!Xe||xe,offerAgentChoice:r,agents:C,agent:r?u(pe):null,onOpen:be=>T(pe.cwd,be)})]}),!pe.cwdExists&&l.jsx("div",{className:"project-missing",title:pe.cwd,children:S("sidebar.project.missing")}),ct===pe.key&&l.jsx(SC,{project:pe,openSessionIds:c,onConfirm:()=>Pe(pe),onCancel:()=>bt(null)}),Ke&&l.jsx("ul",{className:"session-list",children:pe.sessions.map(be=>{const tt=$.has(be.sessionId),Ce=!Me(be),rt=dy(be.agent,C,r),St=wC(be),gt=hu(be)&&v(be.agent),Qe=St.copy?d!==null:Xe&&gt;return l.jsxs("li",{className:`session-row${be.archived?" session-archived":""}${tt?" session-selected":""}`,children:[l.jsxs(eC,{className:"session-item",onLongPress:()=>qe(be.sessionId),onClick:ht=>{if(ht.ctrlKey||ht.metaKey){qe(be.sessionId);return}if(St.copy){d==null||d(be);return}hu(be)&&(be.archived&&k([be.sessionId],!1),_(pm(be.cwd,pe.cwd,h),be))},disabled:!Qe,title:St.copy?`${Zn(be.title,be.titleSource)}
128
- ${d===null?S("remote.onlyOnHost"):up()}`:rt.unavailableTitle??Zn(be.title,be.titleSource),children:[l.jsxs("span",{className:"session-title",children:[rt.badge&&l.jsx(vu,{agent:be.agent,agents:C}),St.copy&&l.jsx("span",{className:"session-vault-mark",title:up(),children:lC()}),St.partial&&l.jsx("span",{className:"session-partial-mark",title:cC(),children:aC()}),Zn(be.title,be.titleSource)]}),l.jsx("span",{className:"session-meta",children:es(be.updatedAt)})]}),l.jsx(ng,{targets:Rm(C,be.agent,be.partial),className:"icon-button session-continue",text:"↪",onPick:ht=>M(be,ht)}),l.jsx("button",{className:"icon-button session-action",onClick:()=>k([be.sessionId],!be.archived),disabled:Ce,title:be.archived?S("sidebar.session.restore"):S(Ce?"sidebar.session.blocked":"sidebar.session.archive"),children:l.jsx(dp,{out:be.archived})})]},`${be.agent}:${be.sessionId}`)})})]},pe.key)})]}),et.length>0&&l.jsxs("div",{className:"sidebar-selection",children:[l.jsx("span",{children:S("sidebar.selection.count",{count:et.length})}),et.some(pe=>!pe.archived)&&l.jsx("button",{className:"link-button",onClick:()=>Gt(!0),children:S("sidebar.action.archive")}),et.some(pe=>pe.archived)&&l.jsx("button",{className:"link-button",onClick:()=>Gt(!1),children:S("sidebar.action.restore")}),l.jsx("button",{className:"link-button",onClick:()=>H(new Set),children:S("common.cancel")})]})]})}function wu({x:t,y:n,items:i,onClose:c,anchor:g=null}){const T=N.useRef(null),[C,r]=N.useState({left:t,top:n});return N.useLayoutEffect(()=>{const u=T.current;if(u===null)return;const{width:_,height:v}=u.getBoundingClientRect();r({left:Math.max(4,Math.min(t,window.innerWidth-_-4)),top:Math.max(4,Math.min(n,window.innerHeight-v-4))})},[t,n]),N.useEffect(()=>{const u=v=>{v.key==="Escape"&&(v.stopPropagation(),c())},_=v=>{var w;const h=v.target;h instanceof Node&&((w=T.current)!=null&&w.contains(h)||g!=null&&g.contains(h))||c()};return window.addEventListener("keydown",u,!0),window.addEventListener("pointerdown",_,!0),window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{window.removeEventListener("keydown",u,!0),window.removeEventListener("pointerdown",_,!0),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}},[g,c]),l.jsx("div",{ref:T,className:"context-menu",style:{left:`${C.left}px`,top:`${C.top}px`},onPointerDown:u=>u.stopPropagation(),children:i.map(u=>l.jsxs("button",{className:"context-menu-item",lang:u.lang,role:u.checked===void 0?void 0:"menuitemradio","aria-checked":u.checked,onClick:()=>{u.onSelect(),c()},children:[u.checked!==void 0&&l.jsx("span",{className:"context-menu-check","aria-hidden":"true",children:u.checked?"✓":""}),u.label]},u.label))})}function bg({listLabel:t,docs:n,active:i,tooltipOf:c,labelOf:g=u=>u.title,onShowList:T,onSelect:C,onClose:r}){return l.jsxs("div",{className:"panel-subhead doc-strip",children:[l.jsx("button",{className:`doc-strip-list${i===null?" is-active":""}`,onClick:T,title:S("docs.backToList"),children:i===null?t:`← ${t}`}),l.jsx("div",{className:"strip-tabs doc-tabs",children:n.map(u=>l.jsxs("div",{className:`strip-tab${u.key===i?" is-active":""}`,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>C(u.key),title:c(u),children:g(u)}),l.jsx("button",{className:"strip-tab-close",onClick:()=>r(u.key),title:S("docs.tab.close"),children:"×"})]},u.key))})]})}function fp(t){let n="";for(let i=0;i<t.length;i++){const c=t[i]??"",g=c.toLowerCase();n+=g.length===c.length?g:c}return n}function LC(t,n){if(n.length===0)return[];const i=fp(t),c=fp(n),g=[];let T=i.indexOf(c);for(;T!==-1;)g.push(T),T=i.indexOf(c,T+c.length);return g}function pp(t,n,i){for(let T=0;T<t.length;T++){const C=t[T]??0;if(i==="start"?n<C:n<=C){const r=T===0?0:t[T-1]??0;return{node:T,offset:n-r}}}const c=Math.max(0,t.length-1),g=c===0?0:t[c-1]??0;return{node:c,offset:(t[c]??0)-g}}function TC(t,n,i){return n===0?0:(t+i+n)%n}function RC(t){return/\.(md|markdown)$/i.test(t)}function MC(t,n){var T;const i=((T=n.split("#")[0])==null?void 0:T.split("?")[0])??"";if(i.length===0)return null;let c;try{c=decodeURIComponent(i)}catch{return null}if(/^[a-z][a-z0-9+.-]*:/i.test(c)||c.startsWith("/")||c.startsWith("\\"))return null;const g=t.split("/").slice(0,-1);for(const C of c.replace(/\\/g,"/").split("/")){if(C.includes(":"))return null;if(!(C===""||C===".")){if(C===".."){if(g.length===0)return null;g.pop();continue}g.push(C)}}return g.length===0?null:g.join("/")}function AC({text:t,language:n}){const[i,c]=N.useState(null);N.useEffect(()=>{if(n===null){c(null);return}let T=!1;return Jn(async()=>{const{highlightCode:C}=await import("./highlight-BXBl9DQv.js");return{highlightCode:C}},[]).then(({highlightCode:C})=>{T||c(C(t,n))}).catch(()=>{T||c(null)}),()=>{T=!0,c(null)}},[t,n]);const g=N.useMemo(()=>t.split(`
129
- `).length,[t]);return l.jsxs("div",{className:"preview",children:[l.jsx("div",{className:"preview-gutter","aria-hidden":"true","data-search-skip":"",children:Array.from({length:g},(T,C)=>l.jsx("span",{children:C+1},C))}),i!==null?l.jsx("pre",{className:"preview-code hljs",dangerouslySetInnerHTML:{__html:i}}):l.jsx("pre",{className:"preview-code",children:t})]})}function mp({onInsert:t,onOpenWithSystem:n}){const[i,c]=N.useState(!1),g=N.useRef(null);N.useEffect(()=>()=>{g.current!==null&&window.clearTimeout(g.current)},[]);const T=()=>{t==null||t(),c(!0),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>c(!1),1200)};return l.jsxs("div",{className:"preview-actions",children:[t!==void 0&&l.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:T,children:S(i?"files.pathInserted":"files.preview.insertPath")}),n!==null&&l.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:n,children:S("files.menu.openWithSystem")})]})}const yu="doc-search",bu="doc-search-current";function Su(){const t=CSS.highlights,n=window.Highlight;return t===void 0||typeof n!="function"?null:t}function gp(t){const n=window.Highlight;return new n(...t)}function _p(){const t=Su();t==null||t.delete(yu),t==null||t.delete(bu)}function NC(t,n){if(n===null)return;const i=t.getBoundingClientRect(),c=n.getBoundingClientRect();(i.top<c.top+16||i.bottom>c.bottom-16)&&(n.scrollTop+=i.top-c.top-c.height/3),(i.left<c.left||i.right>c.right)&&(n.scrollLeft+=i.left-c.left-48)}function DC(t,n,i,c){const[g,T]=N.useState(0),[C,r]=N.useState(0),[u,_]=N.useState(0),v=N.useRef([]);N.useEffect(()=>{const w=t.current;if(w===null||i.length===0)return;let k=0;const L=new MutationObserver(()=>{k===0&&(k=window.requestAnimationFrame(()=>{k=0,_(f=>f+1)}))});return L.observe(w,{childList:!0,subtree:!0,characterData:!0}),()=>{L.disconnect(),k!==0&&window.cancelAnimationFrame(k)}},[t,i,c]),N.useEffect(()=>{const w=t.current;if(v.current=[],w===null||i.length===0){_p(),T(0),r(0);return}const k=[],L=[];let f="";const a=document.createTreeWalker(w,NodeFilter.SHOW_TEXT,{acceptNode:m=>{var d;return(d=m.parentElement)!=null&&d.closest("[data-search-skip]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let m=a.nextNode();m!==null;m=a.nextNode()){const d=m;k.push(d),f+=d.data,L.push(f.length)}v.current=LC(f,i).map(m=>{const d=pp(L,m,"start"),x=pp(L,m+i.length,"end"),I=document.createRange();return I.setStart(k[d.node],d.offset),I.setEnd(k[x.node],x.offset),I}),T(v.current.length),r(m=>m<v.current.length?m:0);const p=Su();return p!==null&&v.current.length>0?p.set(yu,gp(v.current)):p==null||p.delete(yu),_p},[t,i,u,c]),N.useEffect(()=>{r(0)},[i]),N.useEffect(()=>{const w=v.current[C],k=Su();if(w===void 0){k==null||k.delete(bu);return}k==null||k.set(bu,gp([w])),NC(w,n.current)},[C,g,u,c,i,n]);const h=N.useCallback(w=>r(k=>TC(k,g,w)),[g]);return{count:g,index:C,step:h}}function Sg({doc:t,content:n,readingText:i,truncatedText:c,onReload:g,onModeChange:T,onOpenWithSystem:C,onInsert:r,onOpenLink:u,initialScroll:_,onScrollChange:v}){const[h,w]=N.useState(""),k=N.useRef(null),L=N.useRef(null),f=(n==null?void 0:n.loaded)??null,a=f===null?"":f.kind==="file"?f.preview.text:f.plan.text,p=f!==null&&f.kind==="file"&&f.preview.binary,m=f!==null&&(f.kind==="file"?f.preview.truncated:f.plan.truncated),d=f!==null&&(f.kind==="plan"||f.preview.language==="markdown"||RC(f.preview.path)),x=d&&(t.mode??"formatted")==="formatted",I=f!==null&&f.kind==="file"?f.preview.language:"markdown",E=h.trim(),M=DC(L,k,E,`${x?"f":"s"}:${a.length}:${a.slice(0,64)}`),b=N.useRef(!1);N.useLayoutEffect(()=>{b.current||f===null||(b.current=!0,_!==void 0&&k.current!==null&&(k.current.scrollTop=_))},[f,_]);const R=u===void 0||f===null||f.kind!=="file"?void 0:B=>{const O=MC(t.key,B);return O===null?null:()=>u(O)},D=f!==null&&!p;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:S("docs.search.placeholder"),value:h,disabled:!D,onChange:B=>w(B.target.value),onKeyDown:B=>{B.key==="Enter"&&M.step(B.shiftKey?-1:1),B.key==="Escape"&&w(""),B.stopPropagation()},spellCheck:!1}),E.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"conversation-matches",children:M.count===0?S("thread.search.none"):`${M.index+1}/${M.count}`}),l.jsx("button",{className:"icon-button",onClick:()=>M.step(-1),disabled:M.count===0,title:S("thread.search.previous"),children:"↑"}),l.jsx("button",{className:"icon-button",onClick:()=>M.step(1),disabled:M.count===0,title:S("thread.search.next"),children:"↓"})]}),d&&l.jsxs("div",{className:"doc-mode",role:"group","aria-label":S("docs.mode.label"),children:[l.jsx("button",{className:x?"is-active":"","aria-pressed":x,onClick:()=>T("formatted"),children:S("docs.mode.formatted")}),l.jsx("button",{className:x?"":"is-active","aria-pressed":!x,onClick:()=>T("source"),children:S("docs.mode.source")})]}),l.jsx("button",{className:"icon-button",onClick:g,disabled:(n==null?void 0:n.loading)===!0,title:S("docs.reload"),children:"⟳"})]}),(n==null?void 0:n.failed)===!0&&f!==null&&l.jsx("p",{className:"panel-note doc-note",children:S("docs.reloadFailed")}),f===null?l.jsx("p",{className:"panel-note",children:(n==null?void 0:n.failed)===!0?S("docs.failed"):i}):p?l.jsxs("div",{className:"preview-fallback",children:[l.jsx("p",{className:"panel-note",children:S("files.preview.binary")}),l.jsx(mp,{onInsert:r,onOpenWithSystem:C})]}):l.jsxs("div",{className:"panel-scroll",ref:k,onScroll:B=>v(B.currentTarget.scrollTop),children:[l.jsx("div",{ref:L,className:x?"plan-body":"doc-source",children:x?l.jsx(Iu,{text:a,localLink:R}):l.jsx(AC,{text:a,language:I})}),m&&l.jsxs("div",{className:"preview-fallback",children:[l.jsx("p",{className:"panel-note",children:c}),f.kind==="file"&&l.jsx(mp,{onInsert:r,onOpenWithSystem:C})]})]})]})}function Ou(){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 IC(){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 jC({open:t}){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"}),!t&&l.jsx("path",{d:"M2.6 13.4L13.4 2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function PC(){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 OC(){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 Cg({className:t,title:n,doneTitle:i,icon:c,onAction:g}){const[T,C]=N.useState(!1),r=N.useRef(null);N.useEffect(()=>()=>{r.current!==null&&window.clearTimeout(r.current)},[]);const u=_=>{_.stopPropagation(),g(),C(!0),r.current!==null&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>C(!1),1200)};return l.jsx("button",{className:T?`${t} tree-action-done`:t,onClick:u,title:T?i:n,children:T?l.jsx(OC,{}):c})}function BC({className:t,title:n,onCopy:i}){return l.jsx(Cg,{className:t,title:n,doneTitle:S("common.copied"),icon:l.jsx(IC,{}),onAction:i})}function Yl({className:t,title:n,onInsert:i}){return l.jsx(Cg,{className:t,title:n,doneTitle:S("files.pathInserted"),icon:l.jsx(PC,{}),onAction:i})}function FC({view:t,cwd:n,platform:i,onInsert:c,onInsertPath:g,onReveal:T,docs:C}){const{listings:r,loading:u,refresh:_,query:v,setQuery:h,showHidden:w,toggleHidden:k}=t,L=ao(),[f,a]=N.useState(null),p=i==="win32"?"\\":"/",m=N.useCallback(q=>{const X=q.split("/").join(p);return n.length===0?X:n.endsWith(p)?`${n}${X}`:`${n}${p}${X}`},[n,p]),d=N.useCallback(q=>{navigator.clipboard.writeText(q).catch(()=>{})},[]),x=N.useCallback(q=>g(`"${m(q)}"`),[m,g]),I=N.useCallback((q,X)=>{q.preventDefault(),q.stopPropagation(),a({x:q.clientX,y:q.clientY,items:[{label:S("files.menu.copyAbsolute"),onSelect:()=>d(m(X))},{label:S("files.menu.copyRelative"),onSelect:()=>d(X)},...c===void 0?[]:[{label:S("files.menu.insertMention"),onSelect:()=>c(`@${X}`)}],...T===null?[]:[{label:S("files.menu.openWithSystem"),onSelect:()=>T(X)}]]})},[m,d,c,T,L]),E=C.active===null?null:C.docs.find(q=>q.key===C.active)??null,M=E===null?void 0:C.content(E.key),b=E!==null&&M===void 0;N.useEffect(()=>{b&&E!==null&&C.reload(E.key)},[b,E==null?void 0:E.key]);const R=N.useCallback(q=>C.open({key:q,title:q.split("/").pop()??q}),[C]),D=N.useMemo(()=>({...t,openFile:R}),[t,R]),B=q=>{var Y;const X=(Y=C.content(q.key))==null?void 0:Y.loaded;return(X==null?void 0:X.kind)==="file"?`${q.key} · ${fn(X.preview.sizeBytes)}`:q.key},O=C.docs.length>0?l.jsx(bg,{listLabel:S("panel.tab.files"),docs:C.docs,active:C.active,tooltipOf:B,onShowList:C.showList,onSelect:C.select,onClose:C.close}):null;if(E!==null)return l.jsxs("div",{className:"panel-body",children:[O,l.jsx(Sg,{doc:E,content:M,readingText:S("files.readingFile"),truncatedText:S("files.preview.truncated"),onReload:()=>C.reload(E.key),onModeChange:q=>C.setMode(E.key,q),onOpenWithSystem:T===null?null:()=>T(E.key),onInsert:()=>x(E.key),onOpenLink:R,initialScroll:C.scrollOf(E.key),onScrollChange:q=>C.rememberScroll(E.key,q)},E.key),f!==null&&l.jsx(wu,{x:f.x,y:f.y,items:f.items,onClose:()=>a(null)})]});const F=r.get(""),U=v.trim();return l.jsxs("div",{className:"panel-body",children:[O,l.jsxs("div",{className:"panel-subhead",children:[l.jsx("span",{className:"panel-subhead-title",title:n,children:n.split(/[\\/]/).filter(q=>q.length>0).pop()??n}),l.jsx(Yl,{className:"icon-button",title:S("files.insertFolderPath"),onInsert:()=>x("")}),l.jsx("button",{className:w?"icon-button icon-button-on":"icon-button",onClick:k,title:S(w?"files.hidden.hide":"files.hidden.show"),children:l.jsx(jC,{open:w})}),T!==null&&l.jsx("button",{className:"icon-button",onClick:()=>T(""),title:S("files.revealFolder"),children:l.jsx(Ou,{})}),l.jsx("button",{className:"icon-button",onClick:_,title:S("files.refresh"),children:"⟳"})]}),l.jsxs("div",{className:"tree-search",children:[l.jsx("input",{className:"tree-search-input",value:v,placeholder:S("files.search.placeholder"),onChange:q=>h(q.target.value),onKeyDown:q=>{q.key==="Escape"&&v.length>0&&(q.stopPropagation(),h(""))}}),v.length>0&&l.jsx("button",{className:"tree-search-clear",onClick:()=>h(""),title:S("files.search.clear"),children:"×"})]}),l.jsx("div",{className:"panel-scroll",children:U.length>0?l.jsx(HC,{view:D,onContextMenu:I,onReveal:T,onInsertPath:x}):F===void 0?l.jsx("p",{className:"panel-note",children:u.has("")?S("files.readingDir"):S("files.readDirFailed")}):l.jsx(xg,{path:"",depth:0,view:D,onContextMenu:I,onReveal:T,onInsertPath:x})}),f!==null&&l.jsx(wu,{x:f.x,y:f.y,items:f.items,onClose:()=>a(null)})]})}function HC({view:t,onContextMenu:n,onReveal:i,onInsertPath:c}){const{results:g,searching:T,openFile:C,toggleDirectory:r}=t;return g===null?l.jsx("p",{className:"panel-note",children:S(T?"files.search.searching":"files.search.prompt")}):g.entries.length===0?l.jsx("p",{className:"panel-note",children:S("files.search.none")}):l.jsxs("ul",{className:"tree tree-results",children:[g.entries.map(u=>l.jsx("li",{children:l.jsxs("div",{className:"tree-item",children:[l.jsxs("button",{className:`tree-row tree-row-${u.kind}${u.hidden===void 0?"":" tree-row-hidden"}`,onClick:()=>u.kind==="dir"?r(u.path):C(u.path),onContextMenu:_=>n(_,u.path,u.kind),title:u.path,children:[l.jsx("span",{className:"tree-chevron",children:u.kind==="dir"?"›":""}),l.jsxs("span",{className:"tree-result",children:[l.jsx("span",{className:"tree-name",children:u.name}),l.jsx("span",{className:"tree-result-path",children:u.path})]}),u.kind==="file"&&l.jsx("span",{className:"tree-size",children:fn(u.sizeBytes)})]}),l.jsx(Yl,{className:"tree-action",title:S("files.insertPath",{name:u.name}),onInsert:()=>c(u.path)}),u.kind==="dir"&&i!==null&&l.jsx("button",{className:"tree-action",onClick:()=>i(u.path),title:S("files.reveal",{name:u.name}),children:l.jsx(Ou,{})})]})},u.path)),g.truncated&&l.jsx("li",{className:"tree-hidden",title:S("files.search.moreTitle"),children:S("files.search.more")})]})}function xg({path:t,depth:n,view:i,onContextMenu:c,onReveal:g,onInsertPath:T}){const{listings:C,loading:r}=i,u=C.get(t);return u===void 0?r.has(t)?l.jsx("div",{className:"tree-loading",children:S("files.loading")}):null:l.jsxs("ul",{className:"tree",children:[u.entries.map(_=>l.jsx($C,{entry:_,depth:n,view:i,onContextMenu:c,onReveal:g,onInsertPath:T},_.path)),u.entries.length===0&&l.jsx("li",{className:"tree-empty",style:{paddingLeft:`${n*12+8}px`},children:u.hiddenCount>0?S("files.allHidden"):S("files.empty")}),(u.truncated||u.hiddenCount>0)&&u.entries.length>0&&l.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${n*12+8}px`},title:S("files.hiddenTitle"),children:u.truncated?S("files.moreEntries"):S("files.hiddenCount",{count:u.hiddenCount})})]})}function $C({entry:t,depth:n,view:i,onContextMenu:c,onReveal:g,onInsertPath:T}){const{expanded:C,toggleDirectory:r,openFile:u}=i,_=t.kind==="dir"&&C.has(t.path);return l.jsxs("li",{children:[l.jsxs("div",{className:"tree-item",children:[l.jsxs("button",{className:`tree-row tree-row-${t.kind}${t.hidden===void 0?"":" tree-row-hidden"}`,style:{paddingLeft:`${n*12+6}px`},onClick:()=>t.kind==="dir"?r(t.path):u(t.path),onContextMenu:v=>c(v,t.path,t.kind),title:t.hidden===void 0?t.path:`${t.path}
130
- ${t.hidden==="ignored"?S("files.row.ignored"):S("files.row.alwaysHidden")}`,children:[l.jsx("span",{className:`tree-chevron${_?" tree-chevron-open":""}`,children:t.kind==="dir"?"›":""}),l.jsx("span",{className:"tree-name",children:t.name}),t.kind==="file"&&l.jsx("span",{className:"tree-size",children:fn(t.sizeBytes)})]}),l.jsx(Yl,{className:"tree-action",title:S("files.insertPath",{name:t.name}),onInsert:()=>T(t.path)}),t.kind==="dir"&&g!==null&&l.jsx("button",{className:"tree-action",onClick:()=>g(t.path),title:S("files.reveal",{name:t.name}),children:l.jsx(Ou,{})})]}),_&&l.jsx(xg,{path:t.path,depth:n+1,view:i,onContextMenu:c,onReveal:g,onInsertPath:T})]})}const UC={added:"+",removed:"-",context:" ",hunk:"",meta:""};function WC({diff:t}){return t.binary?l.jsx("p",{className:"panel-note",children:S("diff.binary")}):t.lines.length===0?l.jsx("p",{className:"panel-note",children:t.message===null?S("diff.noChanges"):Pt(t.message)}):l.jsxs("div",{className:"panel-scroll",children:[l.jsx("div",{className:"diff",children:t.lines.map((n,i)=>l.jsxs("div",{className:`diff-line diff-line-${n.kind}`,children:[l.jsx("span",{className:"diff-num","aria-hidden":"true",children:n.oldLine??""}),l.jsx("span",{className:"diff-num","aria-hidden":"true",children:n.newLine??""}),l.jsx("span",{className:"diff-marker","aria-hidden":"true",children:UC[n.kind]}),l.jsx("span",{className:"diff-text",children:n.text})]},i))}),t.truncated&&l.jsx("p",{className:"panel-note",children:S("diff.truncated")})]})}const zC={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},VC={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"},qC=[{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 vp(t){const n=t.endsWith("/"),i=n?t.slice(0,-1):t,c=i.lastIndexOf("/"),g=c===-1?i:i.slice(c+1);return{dir:c===-1?"":i.slice(0,c+1),name:n?`${g}/`:g,isDirectory:n}}function KC({status:t}){return l.jsxs("div",{className:"git-headline",children:[l.jsx("span",{className:"git-branch",title:t.repoRoot,children:t.branch??(t.head!==null?S("git.detachedAt",{head:t.head}):S("git.detached"))}),t.upstream!==null&&l.jsx("span",{className:"git-upstream",title:S("git.upstreamTitle",{upstream:t.upstream}),children:t.upstream}),(t.ahead>0||t.behind>0)&&l.jsxs("span",{className:"git-ab",title:S("git.aheadBehindTitle"),children:[t.ahead>0&&l.jsxs("span",{className:"git-ahead",children:["↑",t.ahead]}),t.behind>0&&l.jsxs("span",{className:"git-behind",children:["↓",t.behind]})]})]})}function GC({view:t}){const{status:n,diff:i,loadingDiff:c,openDiff:g,closeDiff:T,refresh:C}=t;if(i!==null||c)return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsxs("button",{className:"link-button",onClick:T,children:["← ",S("git.backToChanges")]}),i!==null&&l.jsxs("span",{className:"panel-subhead-title",title:i.path,children:[vp(i.path).name,i.staged&&l.jsxs("span",{className:"panel-tagline",children:[" ",S("git.stagedTag")]})]})]}),c?l.jsx("p",{className:"panel-note",children:S("git.readingDiff")}):i!==null&&l.jsx(WC,{diff:i})]});if(n.state!=="ready")return l.jsx("div",{className:"panel-body",children:l.jsx("p",{className:"panel-note",children:n.message===null?S("git.unknownState"):Pt(n.message)})});const r=n.worktrees.filter(u=>!u.isCurrent);return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx(KC,{status:n}),l.jsx("button",{className:"icon-button",onClick:C,title:S("git.refresh"),children:"⟳"})]}),l.jsxs("div",{className:"panel-scroll",children:[n.changes.length===0&&l.jsx("p",{className:"panel-note",children:S("git.clean")}),qC.map(u=>{const _=n.changes.filter(v=>v.stage===u.stage);return _.length===0?null:l.jsxs("section",{className:"git-group",children:[l.jsxs("h3",{className:"git-group-title",title:S(u.hint),children:[S(u.title),l.jsx("span",{className:"git-group-count",children:_.length})]}),l.jsx("ul",{className:"git-list",children:_.map(v=>{const{dir:h,name:w,isDirectory:k}=vp(v.path),L=v.oldPath!==null?`${v.oldPath} → ${v.path}`:k?S("git.newFolderTitle",{path:v.path}):v.path,f=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`git-badge git-badge-${v.kind}`,title:S(VC[v.kind]),children:zC[v.kind]}),l.jsxs("span",{className:"git-path",children:[l.jsx("span",{className:"git-path-name",children:w}),h.length>0&&l.jsx("span",{className:"git-path-dir",children:h})]})]});return l.jsx("li",{children:k?l.jsx("div",{className:"git-item git-item-static",title:L,children:f}):l.jsx("button",{className:"git-item",onClick:()=>g(v.path,v.stage==="staged"),title:L,children:f})},`${u.stage}:${v.path}`)})})]},u.stage)}),n.truncated&&l.jsx("p",{className:"panel-note",children:Kt("git.truncated")}),r.length>0&&l.jsxs("section",{className:"git-group",children:[l.jsxs("h3",{className:"git-group-title",title:S("git.worktrees.headingTitle"),children:[S("git.worktrees.heading"),l.jsx("span",{className:"git-group-count",children:r.length})]}),l.jsx("ul",{className:"git-list",children:r.map(u=>l.jsx("li",{children:l.jsxs("div",{className:"git-worktree",title:u.path,children:[l.jsx("span",{className:"git-worktree-branch",children:u.branch??S("git.worktrees.detached")}),l.jsx("span",{className:"git-worktree-path",children:u.path})]})},u.path))})]})]})]})}const YC={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},XC={"AGENTS.md":["Codex","Antigravity","OpenCode","Pi"],"CLAUDE.md":["Claude Code"]};function Xl(t){return t.brokenBlock||t.problem!==null}function QC(t){return t.problem==="outside"?S("memory.problem.outside"):t.problem==="encoding"?S("memory.problem.encoding"):t.brokenBlock?S("memory.problem.brokenBlock"):null}function JC(t){const n=t.files.filter(i=>!Xl(i));return t.installed?{instructionFiles:n.filter(i=>i.hasBlock||i.exists).map(i=>i.name),gitMode:t.git.kind==="error"||t.git.kind==="repo"&&!t.git.ignored?"version":"ignore",importNative:!1,copyFromMainWorktree:!1}:{...d0(t),instructionFiles:n.map(i=>i.name)}}function ZC(t){const n=t.files.filter(g=>g.hasBlock&&!g.blockCurrent),i=t.files.filter(g=>g.exists&&!g.hasBlock&&!Xl(g)),c=g=>Nu(g.map(T=>T.name));return n.length===0?i.length===0?null:S("memory.update.missing",{files:c(i)}):i.length===0?S("memory.update.outdated",{count:n.length,files:c(n)}):S("memory.update.outdatedAndMissing",{count:n.length,outdated:c(n),missing:c(i)})}function ex(t){const n=t.replace(/^\uFEFF/,"").replace(/\r\n/g,`
131
- `),i=/^---\n[\s\S]*?\n---(?:\n|$)/.exec(n);return i===null?n:n.slice(i[0].length)}function tx(t){return t.split(/`([^`]+)`/).map((n,i)=>i%2===1?l.jsx("code",{children:n},i):n)}function nx({view:t}){var a;const{status:n,open:i,loading:c,error:g,closeNote:T,openNote:C}=t,[r,u]=N.useState(null),[_,v]=N.useState(!1),h=(n==null?void 0:n.cwd)??null;N.useEffect(()=>{u(null),v(!1)},[h]),N.useEffect(()=>{t.lastResult!==null&&(u(null),v(!1))},[t.lastResult]);const w=N.useCallback(p=>{if(n===null)return null;let m=p.replace(/^\.\//,"");try{m=decodeURIComponent(m)}catch{return null}return m===Bl||n.notes.some(x=>x.name===m)?()=>C(m):null},[n,C]);if(n===null)return l.jsx("div",{className:"panel-body",children:l.jsx("p",{className:"panel-note",children:g??S("memory.loading")})});if(i!==null||c!==null){const p=(i==null?void 0:i.name)??c??"",m=p===Bl?S("memory.index"):((a=n.notes.find(d=>d.name===p))==null?void 0:a.title)??p;return l.jsxs("div",{className:"panel-body",children:[l.jsxs("div",{className:"panel-subhead",children:[l.jsx("button",{className:"link-button",onClick:T,children:S("memory.back")}),l.jsx("span",{className:"panel-subhead-title",title:p,children:m})]}),i===null?l.jsx("p",{className:"panel-note",children:S("memory.note.loading")}):l.jsxs("div",{className:"panel-scroll",children:[l.jsx("div",{className:"plan-body",children:l.jsx(Iu,{text:ex(i.text),localLink:w})}),i.truncated&&l.jsx("p",{className:"panel-note",children:S("memory.note.truncated")})]})]})}const k=r??JC(n),L=n.installed?ZC(n):null,f=!n.installed||_||t.planned!==null;return l.jsxs("div",{className:"panel-body",children:[l.jsx(sx,{reach:n.reach,onAdjust:n.installed&&!f&&L===null&&n.reach.some(p=>!p.reaches)?()=>v(!0):null}),l.jsxs("div",{className:"panel-scroll",children:[(g??t.lastResult)!==null&&l.jsxs("div",{className:`memory-message${g!==null?" memory-message-error":""}`,children:[l.jsx("span",{children:g??t.lastResult}),l.jsx("button",{className:"link-button",onClick:t.dismissMessage,title:S("common.dismissNotice"),children:"×"})]}),n.git.kind==="error"&&l.jsxs("div",{className:"memory-warning",children:[l.jsx("p",{className:"memory-warning-line",children:Kt("memory.git.errorWarning")}),l.jsx("pre",{className:"memory-git-message",children:Pt(n.git.message)})]}),n.files.filter(Xl).map(p=>l.jsx("p",{className:"memory-warning",children:p.problem==="outside"?Kt("memory.problem.outsideWarning",{file:p.name}):p.problem==="encoding"?Kt("memory.problem.encodingWarning",{file:p.name}):Kt("memory.problem.brokenBlockWarning",{file:p.name})},p.name)),!n.installed&&l.jsxs("div",{className:"memory-intro",children:[l.jsx("p",{children:S("memory.intro.what")}),l.jsx("p",{children:Kt("memory.intro.where")})]}),n.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:()=>v(!0),children:S("memory.update.button")})]}),f&&(t.planned===null?l.jsx(rx,{status:n,options:k,busy:t.busy,onChange:u,onPlan:()=>{u(k),t.requestPlan(k)},onCancel:n.installed?()=>{v(!1),u(null)}:null}):l.jsx(ix,{changes:t.planned,busy:t.busy,confirmLabel:n.installed?S("memory.plan.update"):S("memory.plan.install"),onConfirm:t.install,onCancel:t.cancelPlan})),n.installed&&n.native.pending>0&&!f&&l.jsxs("div",{className:"memory-callout",children:[l.jsx("span",{children:S("memory.native.pending",{count:n.native.pending})}),l.jsx("button",{className:"primary-button primary-button-small",disabled:t.busy!==null,onClick:t.importNative,children:t.busy==="import"?S("memory.native.importing"):S("memory.native.import",{count:n.native.pending})})]}),n.installed&&l.jsx(ox,{notes:n.notes,indexExists:n.indexExists,onOpen:C}),n.globalFragments.length>0&&l.jsx(lx,{fragments:n.globalFragments})]})]})}function sx({reach:t,onAdjust:n}){return l.jsxs("div",{className:"memory-reach",children:[t.map(i=>l.jsxs("span",{className:`memory-reach-item${i.reaches?" memory-reach-on":""}`,title:S("memory.reach.title",{label:i.label,via:Pt(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?S("memory.reach.reaches",{via:Pt(i.via)}):S("memory.reach.doesNotReach",{via:Pt(i.via)})})]},i.agent)),n!==null&&l.jsx("button",{className:"link-button memory-reach-adjust",onClick:n,title:S("memory.reach.adjustTitle"),children:S("memory.reach.adjust")})]})}function rx({status:t,options:n,busy:i,onChange:c,onPlan:g,onCancel:T}){const{git:C}=t,r=C.kind==="repo"?C.worktree:null,u=C.kind==="error"&&n.gitMode==="ignore",_=(v,h)=>{const w=new Set(n.instructionFiles);h?w.add(v):w.delete(v),c({...n,instructionFiles:Ru.filter(k=>w.has(k))})};return l.jsxs("div",{className:"memory-form",children:[l.jsx("p",{className:"memory-section-label",children:S("memory.form.files")}),t.files.map(v=>l.jsxs("label",{className:"memory-option",title:QC(v)??void 0,children:[l.jsx("input",{type:"checkbox",checked:n.instructionFiles.includes(v.name),disabled:Xl(v),onChange:h=>_(v.name,h.target.checked)}),l.jsx("code",{children:v.name}),l.jsx("span",{className:"memory-option-hint",children:Nu(XC[v.name])})]},v.name)),C.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:n.gitMode==="ignore",onChange:()=>c({...n,gitMode:"ignore"})}),S("memory.git.ignore"),l.jsx("span",{className:"memory-option-hint",children:S("memory.git.ignoreHint")})]}),l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"radio",name:"memory-git-mode",checked:n.gitMode==="version",onChange:()=>c({...n,gitMode:"version"})}),S("memory.git.version"),l.jsx("span",{className:"memory-option-hint",children:S("memory.git.versionHint")})]}),C.ignored&&n.gitMode==="version"&&l.jsx("p",{className:"memory-warning",children:Kt("memory.git.alreadyIgnored")})]}),C.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:n.gitMode==="version",onChange:()=>c({...n,gitMode:"version"})}),Kt("memory.git.dontTouch"),l.jsx("span",{className:"memory-option-hint",children:S("memory.git.errorHint")})]})]}),(t.native.pending>0||(r==null?void 0:r.mainHasMemory)===!0)&&l.jsx("p",{className:"memory-section-label",children:S("memory.form.existingNotes")}),t.native.pending>0&&l.jsxs("label",{className:"memory-option",children:[l.jsx("input",{type:"checkbox",checked:n.importNative,onChange:v=>c({...n,importNative:v.target.checked})}),S("memory.form.importNative",{count:t.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:n.copyFromMainWorktree,onChange:v=>c({...n,copyFromMainWorktree:v.target.checked})}),S("memory.form.copyFromMain")]}),l.jsxs("div",{className:"memory-actions",children:[l.jsx("button",{className:"primary-button primary-button-small",disabled:i!==null||n.instructionFiles.length===0||u,onClick:g,title:n.instructionFiles.length===0?S("memory.form.noFiles"):u?S("memory.git.blocked"):void 0,children:S(i==="plan"?"memory.form.planning":"memory.form.preview")}),T!==null&&l.jsx("button",{className:"link-button",onClick:T,disabled:i!==null,children:S("common.cancel")})]})]})}function ix({changes:t,busy:n,confirmLabel:i,onConfirm:c,onCancel:g}){const T=n==="install";return l.jsxs("div",{className:"memory-form",children:[l.jsx("p",{className:"memory-section-label",children:S("memory.plan.changes")}),t.length===0?l.jsx("p",{className:"memory-empty",children:S("memory.plan.nothing")}):l.jsx("ul",{className:"memory-change-list",children:t.map((C,r)=>l.jsxs("li",{className:"memory-change",children:[l.jsxs("div",{className:"memory-change-head",children:[l.jsx("code",{className:"memory-change-file",children:C.file}),l.jsx("span",{className:"memory-option-hint",children:S(YC[C.action])})]}),C.copiedFrom!==null&&l.jsx("p",{className:"memory-option-hint",children:S("memory.plan.copiedFrom",{path:C.copiedFrom})}),C.preview.length>0&&l.jsx("pre",{className:"memory-preview",children:C.preview})]},`${C.file}-${r}`))}),l.jsxs("div",{className:"memory-actions",children:[t.length>0&&l.jsx("button",{className:"primary-button primary-button-small",disabled:n!==null,onClick:c,children:T?S("memory.plan.writing"):i}),l.jsx("button",{className:"link-button",onClick:g,disabled:T,children:t.length===0?S("memory.plan.back"):S("common.cancel")})]})]})}function ox({notes:t,indexExists:n,onOpen:i}){return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"memory-section-label",children:S("memory.list.notes")}),l.jsxs("ul",{className:"plan-list",children:[n&&l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:()=>i(Bl),children:[l.jsx("span",{className:"plan-name",children:S("memory.index")}),l.jsx("span",{className:"plan-meta",children:Bl})]})}),t.map(c=>l.jsx("li",{children:l.jsxs("button",{className:"plan-row",onClick:()=>i(c.name),title:c.name,children:[l.jsx("span",{className:"plan-name",children:c.title}),c.description.length>0&&l.jsx("span",{className:"memory-note-description",children:c.description}),l.jsxs("span",{className:"plan-meta",children:[es(c.modifiedAt)," · ",fn(c.sizeBytes)]})]})},c.name))]}),t.length===0&&l.jsx("p",{className:"memory-empty",children:S("memory.list.empty")})]})}function lx({fragments:t}){const n=N.useCallback(i=>{navigator.clipboard.writeText(i).catch(()=>{})},[]);return l.jsxs("details",{className:"memory-global",children:[l.jsx("summary",{className:"memory-global-summary",children:S("memory.global.title")}),l.jsx("p",{className:"memory-empty",children:Kt("memory.global.intro")}),t.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(BC,{className:"icon-button",title:S("memory.global.copy"),onCopy:()=>n(i.text)})]}),l.jsx("p",{className:"memory-fragment-note",children:tx(Pt(i.note))})]},i.agent))]})}function ax(t){for(const n of t.split(`
132
- `,40)){const i=/^#{1,3}\s+(.+)$/.exec(n.trim());if(i!==null)return(i[1]??"").trim()}return null}function cx({view:t,docs:n,onInsertPath:i}){const{plans:c}=t,g=n.active===null?null:n.docs.find(_=>_.key===n.active)??null,T=g===null?void 0:n.content(g.key),C=g!==null&&T===void 0&&t.listFor!==null&&t.listFor===n.terminalId;N.useEffect(()=>{C&&g!==null&&n.reload(g.key)},[C,g==null?void 0:g.key]);const r=_=>{var h;const v=(h=n.content(_.key))==null?void 0:h.loaded;return(v==null?void 0:v.kind)==="plan"?ax(v.plan.text)??_.title:_.title},u=_=>{var h;const v=((h=c.find(w=>w.fileName===_.key))==null?void 0:h.path)??"";return v.length>0?v:r(_)};return l.jsxs("div",{className:"panel-body",children:[n.docs.length>0&&l.jsx(bg,{listLabel:S("panel.tab.plans"),docs:n.docs,active:n.active,tooltipOf:u,labelOf:r,onShowList:n.showList,onSelect:n.select,onClose:n.close}),g!==null?l.jsx(Sg,{doc:g,content:T,readingText:S("plans.loading"),truncatedText:S("plans.truncated"),onReload:()=>n.reload(g.key),onModeChange:_=>n.setMode(g.key,_),onOpenWithSystem:null,initialScroll:n.scrollOf(g.key),onScrollChange:_=>n.rememberScroll(g.key,_)},g.key):l.jsx("div",{className:"panel-scroll",children:c.length===0?l.jsx("p",{className:"panel-note",children:Kt("plans.empty")}):l.jsx("ul",{className:"plan-list",children:[...c].reverse().map(_=>l.jsx(ux,{plan:_,onOpen:()=>n.open({key:_.fileName,title:_.title}),onInsertPath:i},_.fileName))})})]})}function ux({plan:t,onOpen:n,onInsertPath:i}){const c=t.path.length>0?t.path:null;return t.exists?l.jsxs("li",{className:"plan-item",children:[l.jsxs("button",{className:"plan-row",onClick:n,title:c??void 0,children:[l.jsx("span",{className:"plan-name",children:t.title}),c!==null&&l.jsx("span",{className:"plan-path",children:c}),l.jsxs("span",{className:"plan-meta",children:[es(t.modifiedAt)," · ",fn(t.sizeBytes)]})]}),t.absolutePath.length>0&&l.jsx(Yl,{className:"tree-action plan-action",title:S("files.insertPath",{name:t.absolutePath.split(/[\\/]/).pop()??t.title}),onInsert:()=>i(`"${t.absolutePath}"`)})]}):l.jsxs("li",{className:"plan-row plan-row-missing",title:c??S("plans.missingTitle"),children:[l.jsx("span",{className:"plan-name",children:t.title}),c!==null&&l.jsx("span",{className:"plan-path",children:c}),l.jsx("span",{className:"plan-meta",children:S("plans.missing")})]})}const hx=[{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 kg(t){return t.state!=="ready"?0:new Set(t.changes.map(n=>n.path)).size}function dx({tab:t,plansAvailable:n,hiddenTabs:i,hidden:c,onTabChange:g,title:T,cwd:C,platform:r,cli:u,cliUnseen:_,expanded:v,onToggleExpanded:h,git:w,files:k,plans:L,documents:f,memory:a,onInsert:p,onInsertPath:m,onReveal:d,onHide:x}){var M;const I=kg(w.status),E=((M=a.status)==null?void 0:M.installed)===!0?a.status.notes.length:0;return l.jsxs("section",{className:`side-panel${c?" side-panel-hidden":""}`,"aria-hidden":c,children:[l.jsxs("header",{className:"side-panel-header",children:[l.jsx("button",{className:"icon-button",onClick:x,title:S("panel.hide"),children:"»"}),C.length>0&&l.jsx("span",{className:"project-swatch",style:{background:wr(C)}}),l.jsx("span",{className:"side-panel-title",title:C,children:T}),l.jsx("button",{className:"icon-button",onClick:h,title:S(v?"panel.restoreWidth":"panel.widen"),children:v?"⇥":"⇤"})]}),l.jsx("nav",{className:"side-panel-tabs",children:Fw(hx,n,i).map(b=>l.jsxs("button",{className:`side-panel-tab${b.id===t?" side-panel-tab-active":""}`,onClick:()=>g(b.id),title:S(b.labelKey),children:[l.jsx("span",{className:"side-panel-tab-label",children:S(b.labelKey)}),b.id==="git"&&I>0&&l.jsx("span",{className:"side-panel-badge",children:I}),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"&&_&&t!=="cli"&&l.jsx("span",{className:"side-panel-dot",title:S("panel.cliUnseen")})]},b.id))}),l.jsxs("div",{className:"side-panel-body",children:[l.jsx("div",{className:`cli-slot${t==="cli"?"":" cli-slot-hidden"}`,children:u}),t==="git"&&l.jsx(GC,{view:w}),t==="plans"&&l.jsx(cx,{view:L,docs:f.plans,onInsertPath:m}),t==="memory"&&l.jsx(nx,{view:a}),t==="files"&&l.jsx(FC,{view:k,cwd:C,platform:r,onInsert:p,onInsertPath:m,onReveal:d,docs:f.files})]})]})}function fx(t,n,i){return`${n===void 0||n.length===0?t:`${t} — ${n}`}
133
- ${i}`}function px({placement:t}){return l.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${t.pending.cwd}
134
- ${S("tabs.state.opening")}`,style:{"--tab-project-color":wr(t.pending.cwd)},children:[l.jsx("span",{className:"tab-opening","aria-label":S("tabs.aria.opening"),children:l.jsx("i",{})}),l.jsx("span",{className:"tab-label",children:t.label})]})}function Bu({terminal:t,activity:n,statusLine:i}){if(!t.alive){const c=t.sleeping;return l.jsx("span",{className:`tab-dot${c?" tab-dot-sleeping":" tab-dot-dead"}`,title:S(c?"tabs.dot.sleeping":"tabs.dot.exited")})}return n==="waiting"?l.jsx("span",{className:"tab-bang",title:S("tabs.dot.waiting"),children:"!"}):n==="busy"?l.jsxs("span",{className:"tab-working",title:S("tabs.dot.busy"),"aria-label":S("tabs.aria.working"),children:[l.jsx("i",{}),l.jsx("i",{}),l.jsx("i",{})]}):l.jsx("span",{className:"tab-dot",title:Xw(n,i)})}function ro(t){if(t.label.length>0)return t.label;const n=t.cwd.split(/[\\/]/).filter(c=>c.length>0),i=n[n.length-1]??t.cwd;return t.resumed?`${i} ↩`:i}function mx(t){return t.alive?S("tabs.state.alive"):t.sleeping?S("tabs.state.sleeping"):S("tabs.state.exited",{code:t.exitCode??"?"})}function gx({terminals:t,activeTerminalId:n,activity:i,attention:c,canOpen:g,onSelect:T,onClose:C,onRename:r,onReorder:u,onNew:_,agents:v,offerAgentChoice:h,newTabAgent:w,pendingOpens:k,platform:L,newTabBlockedTitle:f,sessionTitles:a}){const[p,m]=N.useState(null),[d,x]=N.useState(""),[I,E]=N.useState(null),M=N.useRef(null);N.useEffect(()=>{var U;p!==null&&((U=M.current)==null||U.select())},[p]);const b=U=>{m(U.terminalId),x(U.label.length>0?U.label:ro(U))},R=()=>{p!==null&&r(p,d.trim()),m(null)},D=U=>{if(I===null||I===U)return;const q=t.map(V=>V.terminalId),X=q.indexOf(I),Y=q.indexOf(U);X===-1||Y===-1||(q.splice(Y,0,...q.splice(X,1)),u(q),E(null))},B=ky(t,k,L),O=new Map;for(const U of B){const q=O.get(U.index);q===void 0?O.set(U.index,[U]):q.push(U)}const F=U=>(O.get(U)??[]).map(q=>l.jsx(px,{placement:q},`pending:${q.pending.requestId}`));return l.jsxs("div",{className:"tab-bar",children:[t.map((U,q)=>{var V;const X=U.terminalId===n,Y=U.terminalId===p;return l.jsxs(sv.Fragment,{children:[F(q),l.jsx("div",{className:`tab${X?" tab-active":""}${U.alive||U.sleeping?"":" tab-dead"}${(c==null?void 0:c.has(U.terminalId))===!0?" tab-attention":""}`,draggable:!Y,onDragStart:()=>E(U.terminalId),onDragOver:j=>j.preventDefault(),onDrop:()=>D(U.terminalId),onDragEnd:()=>E(null),onClick:()=>T(U.terminalId),onDoubleClick:()=>b(U),title:fx(U.cwd,a.get(U.terminalId),mx(U)),style:{"--tab-project-color":wr(U.cwd)},children:Y?l.jsx("input",{ref:M,className:"tab-input",value:d,onChange:j=>x(j.target.value),onBlur:R,onKeyDown:j=>{j.key==="Enter"&&R(),j.key==="Escape"&&m(null),j.stopPropagation()},onClick:j=>j.stopPropagation()}):l.jsxs(l.Fragment,{children:[l.jsx(Bu,{terminal:U,activity:i.get(U.terminalId),statusLine:((V=v.find(j=>j.id===U.agent))==null?void 0:V.statusLine)??null}),l.jsxs("span",{className:"tab-label",children:[U.agent!==null&&hy(h,U.agent)&&l.jsx(vu,{agent:U.agent,agents:v}),ro(U)]}),l.jsx("button",{className:"tab-close",onClick:j=>{j.stopPropagation(),C(U.terminalId)},title:S("tabs.close"),children:"×"})]})})]},U.terminalId)}),F(t.length),l.jsx(ju,{className:"tab-new",text:"+",title:f??S("tabs.new"),disabled:!g||f!==null,offerAgentChoice:h,agents:v,agent:w,onOpen:_})]})}function _x(t,n,i){const[c,g]=N.useState(!1);return N.useEffect(()=>{if(g(!1),!(n===null||i))return t.onMessage(T=>{T.type==="terminal.output"&&T.terminalId===n&&g(!0)})},[t,n,i]),c&&!i}const vx=200,wp="agent-workbench.files.hidden";function wx(t,n){const[i,c]=N.useState(new Map),[g,T]=N.useState(new Set),[C,r]=N.useState(new Set),[u,_]=N.useState(""),[v,h]=N.useState(null),[w,k]=N.useState(!1),[L,f]=N.useState(()=>xt(wp,!1,E=>E==="true"?!0:E==="false"?!1:null)),a=N.useRef(new Set),p=N.useRef(L);p.current=L;const m=N.useCallback(E=>{n===null||a.current.has(E)||(a.current.add(E),r(M=>new Set(M).add(E)),t.send({type:"files.list",terminalId:n,path:E,includeHidden:p.current}))},[t,n]);N.useEffect(()=>{if(c(new Map),T(new Set),r(new Set),_(""),h(null),k(!1),a.current=new Set,n===null)return;const E=t.onMessage(b=>{switch(b.type){case"files.listing":{if(b.terminalId!==n)break;const{listing:R}=b;a.current.delete(R.path),c(D=>new Map(D).set(R.path,R)),r(D=>{const B=new Set(D);return B.delete(R.path),B});break}case"files.results":if(b.terminalId!==n)break;h(b.result),k(!1);break;case"error":a.current=new Set,r(new Set),k(!1);break}});t.send({type:"files.list",terminalId:n,path:"",includeHidden:p.current}),a.current.add(""),r(new Set([""]));const M=t.onReopen(()=>{a.current=new Set,t.send({type:"files.list",terminalId:n,path:"",includeHidden:p.current})});return()=>{E(),M()}},[t,n]),N.useEffect(()=>{const E=u.trim();if(n===null||E.length===0){h(null),k(!1);return}k(!0);const M=window.setTimeout(()=>{t.send({type:"files.search",terminalId:n,query:E,includeHidden:p.current})},vx);return()=>window.clearTimeout(M)},[t,n,u,L]);const d=N.useCallback(E=>{T(M=>{const b=new Set(M);return b.has(E)?b.delete(E):(b.add(E),m(E)),b})},[m]),x=N.useCallback(()=>{if(n===null)return;a.current=new Set;const E=["",...g];for(const M of E)a.current.add(M),t.send({type:"files.list",terminalId:n,path:M,includeHidden:p.current});r(new Set(E))},[t,n,g]),I=N.useCallback(()=>{f(E=>{const M=!E;if(p.current=M,vt(wp,String(M)),n!==null){a.current=new Set;const b=["",...g];for(const R of b)a.current.add(R),t.send({type:"files.list",terminalId:n,path:R,includeHidden:M});r(new Set(b))}return M})},[t,n,g]);return{listings:i,expanded:g,loading:C,query:u,setQuery:_,results:v,searching:w,showHidden:L,toggleHidden:I,toggleDirectory:d,refresh:x}}function yx(t){const[n,i]=N.useState(!1),[c,g]=N.useState(null),[T,C]=N.useState(null),[r,u]=N.useState(null),_=N.useRef(null);N.useEffect(()=>{const w=t.onMessage(L=>{switch(L.type){case"search.progress":if(_.current===null||L.searchId!==_.current)break;g(f=>FS(f,L.progress));break;case"search.results":if(_.current===null||L.searchId!==_.current)break;_.current=null,g(L.result),C(null),i(!1);break;case"error":if(L.code!=="search-failed"||_.current===null||L.requestId!==_.current)break;_.current=null,L.detail!==void 0&&console.error("[servidor]",L.detail),g(null),C(Pt(L.text)),i(!1);break}}),k=t.onReopen(()=>{_.current!==null&&(_.current=null,i(!1),C(S("searchHook.connectionLost")))});return()=>{w(),k()}},[t]);const v=N.useCallback((w,k)=>{const L=crypto.randomUUID();_.current=L,u({query:w,includeArchived:k}),i(!0),C(null),g(null),t.send({type:"search.global",searchId:L,query:w,includeArchived:k})},[t]),h=N.useCallback(()=>{const w=_.current;_.current=null,w!==null&&t.send({type:"search.cancel",searchId:w}),u(null),i(!1),g(null),C(null)},[t]);return{searching:n,result:c,error:T,submitted:r,search:v,clear:h}}function bx(t,n){const[i,c]=N.useState([]),[g,T]=N.useState(null);return N.useEffect(()=>{if(c([]),T(null),n!==null)return t.onMessage(C=>{switch(C.type){case"conversation.plans":if(C.terminalId!==n)break;c(C.plans),T(n);break}})},[t,n]),{plans:i,listFor:g}}const Eg=8,Lg=1024,Sx=300,Cx=["file","plan"],zl={docs:[],active:null,recent:[]},io={};function Vl(t,n){return[...t.filter(i=>i!==n),n]}function xx(t,n){const i=t.docs.find(T=>T.key===n.key);if(i!==void 0)return{docs:i.title===n.title?t.docs:t.docs.map(C=>C.key===n.key?{...C,title:n.title}:C),active:n.key,recent:Vl(t.recent,n.key)};let c=[...t.docs,{key:n.key,title:n.title}],g=Vl(t.recent,n.key);for(;c.length>Eg;){const T=g.find(C=>C!==n.key);if(T===void 0)break;c=c.filter(C=>C.key!==T),g=g.filter(C=>C!==T)}return{docs:c,active:n.key,recent:g}}function kx(t,n){return t.docs.some(i=>i.key===n)?{...t,active:n,recent:Vl(t.recent,n)}:t}function Ex(t){return t.active===null?t:{...t,active:null}}function Lx(t,n){const i=t.docs.findIndex(C=>C.key===n);if(i===-1)return t;const c=t.docs.filter(C=>C.key!==n),g=t.recent.filter(C=>C!==n);if(t.active!==n)return{docs:c,active:t.active,recent:g};const T=c[i]??c[i-1]??null;return{docs:c,active:T===null?null:T.key,recent:T===null?g:Vl(g,T.key)}}function Tx(t,n,i){return{...t,docs:t.docs.map(c=>c.key===n?{...c,mode:i}:c)}}function Zc(t,n,i){var c;return((c=t[n])==null?void 0:c[i])??zl}function Rx(t,n,i,c){const g=t[n]??{file:zl,plan:zl};return{...t,[n]:{...g,[i]:c}}}function Mx(t,n){if(n.length===0)return t;const i=new Set(n),c=Object.keys(t).filter(T=>!i.has(T));if(c.length===0)return t;const g={...t};for(const T of c)delete g[T];return g}function _r(t,n,i){return`${t}\0${n}\0${i}`}function Ax(t){const n=new Set;for(const[i,c]of Object.entries(t))for(const g of Cx)for(const T of c[g].docs)n.add(_r(i,g,T.key));return n}function Nx(t){return JSON.stringify(t)}function ql(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function Dx(t){const n=ql(t);if(n===null)return null;const{key:i,title:c,mode:g}=n;if(typeof i!="string"||i.length===0||i.length>Lg||typeof c!="string"||c.length>Sx)return null;const T={key:i,title:c};return g==="formatted"||g==="source"?{...T,mode:g}:T}function yp(t){const n=ql(t);if(n===null||!Array.isArray(n.docs))return zl;const i=[];for(const r of n.docs){const u=Dx(r);if(u!==null&&!i.some(_=>_.key===u.key)&&i.push(u),i.length===Eg)break}const c=i.map(r=>r.key),g=typeof n.active=="string"&&c.includes(n.active)?n.active:null,T=Array.isArray(n.recent)?n.recent.filter(r=>typeof r=="string"&&c.includes(r)):[],C=[...c.filter(r=>!T.includes(r)),...new Set(T)];return{docs:i,active:g,recent:C}}function Ix(t){let n;try{n=JSON.parse(t)}catch{return io}const i=ql(n);if(i===null)return io;const c={};for(const[g,T]of Object.entries(i)){const C=ql(T);if(C===null||g.length===0||g.length>Lg)continue;const r=yp(C.file),u=yp(C.plan);r.docs.length===0&&u.docs.length===0||(c[g]={file:r,plan:u})}return c}const Tg="agent-workbench.docTabs";function jx(){try{const t=window.sessionStorage.getItem(Tg);return t===null?io:Ix(t)}catch{return io}}function Px(t,n,i){const[c,g]=N.useState(jx),[T,C]=N.useState(new Map),r=N.useRef(T);r.current=T;const u=N.useRef(new Map);N.useEffect(()=>{g(h=>Mx(h,n.map(w=>w.terminalId)))},[n]),N.useEffect(()=>{const h=Ax(c);for(const w of[...u.current.keys()])h.has(w)||u.current.delete(w);C(w=>{const k=[...w.keys()].filter(f=>!h.has(f));if(k.length===0)return w;const L=new Map(w);for(const f of k)L.delete(f);return L})},[c]),N.useEffect(()=>{try{window.sessionStorage.setItem(Tg,Nx(c))}catch{}},[c]);const _=N.useCallback((h,w,k)=>{const L=_r(h,w,k);C(f=>{var a;return new Map(f).set(L,{loaded:((a=f.get(L))==null?void 0:a.loaded)??null,loading:!0,failed:!1})}),w==="file"?t.send({type:"files.read",terminalId:h,path:k}):t.send({type:"plans.read",terminalId:h,fileName:k})},[t]);N.useEffect(()=>{const h=(L,f)=>C(a=>a.has(L)?new Map(a).set(L,{loaded:f,loading:!1,failed:!1}):a),w=t.onMessage(L=>{switch(L.type){case"files.preview":h(_r(L.terminalId,"file",L.preview.path),{kind:"file",preview:L.preview});break;case"plans.content":h(_r(L.terminalId,"plan",L.plan.fileName),{kind:"plan",plan:L.plan});break;case"error":C(f=>{if(![...f.values()].some(p=>p.loading))return f;const a=new Map;for(const[p,m]of f)a.set(p,m.loading?{...m,loading:!1,failed:!0}:m);return a});break}}),k=t.onReopen(()=>{for(const[L,f]of r.current){if(!f.loading)continue;const[a,p,m]=L.split("\0");a===void 0||m===void 0||(p==="file"&&t.send({type:"files.read",terminalId:a,path:m}),p==="plan"&&t.send({type:"plans.read",terminalId:a,fileName:m}))}});return()=>{w(),k()}},[t]);const v=N.useCallback(h=>{const w=i,k=w===null?Zc(io,"",h):Zc(c,w,h),L=f=>{w!==null&&g(a=>Rx(a,w,h,f(Zc(a,w,h))))};return{terminalId:w,docs:k.docs,active:k.active,open:f=>{w!==null&&(L(a=>xx(a,f)),_(w,h,f.key))},select:f=>L(a=>kx(a,f)),showList:()=>L(Ex),close:f=>L(a=>Lx(a,f)),setMode:(f,a)=>L(p=>Tx(p,f,a)),content:f=>w===null?void 0:T.get(_r(w,h,f)),reload:f=>{w!==null&&_(w,h,f)},rememberScroll:(f,a)=>{w!==null&&u.current.set(_r(w,h,f),a)},scrollOf:f=>w===null?void 0:u.current.get(_r(w,h,f))}},[i,c,T,_]);return N.useMemo(()=>({files:v("file"),plans:v("plan")}),[v])}const Ox=/(?::\d+(?:[:-]\d+)?|#L\d+(?:-L?\d+)?)$/,Bx=/[\n\r\t*?<>|"`]/,Fx=/\.[A-Za-z0-9_-]{1,12}$/,Rg=t=>t.replace(/\\/g,"/"),Hx=t=>t.replace(/\/+$/,"");function bp(t,n){const i=Hx(Rg(n.cwd));return i.length===0?null:(n.platform==="win32"?t.toLowerCase().startsWith(`${i.toLowerCase()}/`):t.startsWith(`${i}/`))?t.slice(i.length+1):null}function Fu(t,n){let i=t.trim();const c=/^(["'])(.*)\1$/.exec(i);if(c!==null&&(i=(c[2]??"").trim()),i.startsWith("@")&&(i=i.slice(1)),i.length===0||i.length>q0||Bx.test(i)||i.includes("://")||i.startsWith("~")||i.startsWith("-")||(i=Rg(i.replace(Ox,"")).replace(/[.,;:]+$/,""),i.length===0))return null;const g=n.platform==="win32";if(/^[A-Za-z]:\//.test(i)||i.startsWith("//")){const r=g?bp(i,n):null;if(r===null)return null;i=r}else if(i.startsWith("/")){const r=g?null:bp(i,n);if(r===null)return null;i=r}const T=[];for(const r of i.split("/"))if(!(r===""||r===".")){if(r===".."){if(T.length===0)return null;T.pop();continue}if(r.includes(":")||r!==r.trim())return null;T.push(r)}const C=T[T.length-1];return C===void 0||T.length===1&&!Fx.test(C)?null:T.join("/")}function Mg(t,n){var g;const i=((g=t.split("#")[0])==null?void 0:g.split("?")[0])??"";if(i.length===0)return null;let c;try{c=decodeURIComponent(i)}catch{return null}return/^[a-z][a-z0-9+.-]+:/i.test(c)?null:Fu(c,n)}const $x=/`([^`\n]+)`/g,Ux=/\]\(([^)\s]+)\)/g;function Wx(t,n){const i=new Set;for(const c of t.matchAll($x)){const g=Fu(c[1]??"",n);g!==null&&i.add(g)}for(const c of t.matchAll(Ux)){const g=Mg(c[1]??"",n);g!==null&&i.add(g)}return[...i]}function zx(t,n,i){return t.filter(c=>n.get(c)!==!0&&!i.has(c))}function Vx(t,n,i){const c=new Set(i),g=new Map(t);for(const T of n)g.set(T,c.has(T));return g}const qx=1e3;function Kx(t){const{connection:n,enabled:i,terminalId:c,cwd:g,platform:T,events:C,liveTerminalIds:r,onOpen:u}=t,_=N.useRef(new Map),v=N.useRef(new Map),h=N.useRef(0),[w,k]=N.useState(0),[L,f]=N.useState(0),a=N.useMemo(()=>({cwd:g,platform:T}),[g,T]);return N.useEffect(()=>{const p=n.onMessage(d=>{if(d.type!=="files.checked")return;const x=v.current.get(d.requestId);if(x===void 0)return;v.current.delete(d.requestId);const I=_.current.get(x.terminalId);if(I!==void 0){for(const E of x.paths)I.pending.delete(E);I.known=Vx(I.known,x.paths,d.existing),k(E=>E+1)}}),m=n.onReopen(()=>{v.current.clear();for(const d of _.current.values())d.pending.clear(),d.scanned=new WeakSet;f(d=>d+1)});return()=>{p(),m()}},[n]),N.useEffect(()=>{const p=new Set(r);for(const m of[..._.current.keys()])p.has(m)||_.current.delete(m)},[r]),N.useEffect(()=>{if(!i||c===null||g.length===0)return;let p=_.current.get(c);p===void 0&&(p={known:new Map,pending:new Set,scanned:new WeakSet},_.current.set(c,p));const m=new Set;for(const x of C)if(!p.scanned.has(x)&&(p.scanned.add(x),x.role==="assistant")){for(const I of x.parts)if(I.kind==="text")for(const E of Wx(I.text,a))m.add(E)}const d=zx([...m],p.known,p.pending).slice(0,qx);for(let x=0;x<d.length;x+=pf){const I=d.slice(x,x+pf);h.current+=1;const E=`files-${h.current}`;v.current.set(E,{terminalId:c,paths:I});for(const M of I)p.pending.add(M);n.send({type:"files.check",terminalId:c,requestId:E,paths:I})}},[n,i,c,g,a,C,L]),N.useMemo(()=>{var d;if(!i||c===null)return null;const p=(d=_.current.get(c))==null?void 0:d.known,m=x=>x!==null&&(p==null?void 0:p.get(x))===!0?()=>u(x):null;return{code:x=>m(Fu(x,a)),link:x=>m(Mg(x,a))}},[i,c,a,u,w])}function Gx(t,n){const[i,c]=N.useState(Ic),[g,T]=N.useState(null),[C,r]=N.useState(!1);N.useEffect(()=>{if(n===null){c(Ic),T(null);return}c(Ic),T(null),r(!1);const h=t.onMessage(k=>{switch(k.type){case"git.status":k.terminalId===n&&c(k.status);break;case"git.diff":if(k.terminalId!==n)break;T(k.diff),r(!1);break;case"error":r(!1);break}});t.send({type:"git.subscribe",terminalId:n});const w=t.onReopen(()=>{t.send({type:"git.subscribe",terminalId:n})});return()=>{h(),w(),t.send({type:"git.unsubscribe",terminalId:n})}},[t,n]);const u=N.useCallback((h,w)=>{n!==null&&(r(!0),T(null),t.send({type:"git.diff",terminalId:n,path:h,staged:w}))},[t,n]),_=N.useCallback(()=>{T(null),r(!1)},[]),v=N.useCallback(()=>{n!==null&&t.send({type:"git.refresh",terminalId:n})},[t,n]);return{status:i,diff:g,loadingDiff:C,openDiff:u,closeDiff:_,refresh:v}}const Cu=new Set;function Yx(t){return t!==void 0&&Cu.has(t)}function Xx(t){return t.length===0?S("memory.result.nothingChanged"):S("memory.result.installed",{count:t.length})}function Qx(t,n){const i=t.length===0?S("memory.result.nothingImported"):S("memory.result.imported",{count:t.length});return n.length===0?i:S("memory.result.withSkipped",{result:i,skipped:S("memory.result.skipped",{count:n.length,files:n.join(", ")})})}function Jx(t,n){const[i,c]=N.useState(null),[g,T]=N.useState(null),[C,r]=N.useState(null),[u,_]=N.useState(null),[v,h]=N.useState(null),[w,k]=N.useState(null),[L,f]=N.useState(null),a=N.useRef(new Map),p=N.useRef(new Set),m=N.useRef(null),d=N.useRef(!1),x=N.useCallback(U=>{const q=`memory-${crypto.randomUUID()}`;return a.current.set(q,U),p.current.add(q),Cu.add(q),q},[]),I=N.useCallback(U=>{for(const[q,X]of a.current)X===U&&a.current.delete(q)},[]);N.useEffect(()=>{c(null),T(null),r(null),_(null),h(null),k(null),f(null),a.current.clear();for(const j of p.current)Cu.delete(j);if(p.current.clear(),m.current=null,d.current=!1,n===null)return;const U=(j,$)=>j===void 0||a.current.get(j)!==$?!1:(a.current.delete(j),!0),q=t.onMessage(j=>{switch(j.type){case"memory.status":if(j.terminalId!==n)break;c(j.status),d.current&&(d.current=!1,f(null));break;case"memory.planned":if(j.terminalId!==n||!U(j.requestId,"plan"))break;_(j.changes),h(null);break;case"memory.installed":if(j.terminalId!==n||!U(j.requestId,"install"))break;m.current=null,_(null),h(null),k(Xx(j.applied));break;case"memory.imported":if(j.terminalId!==n||!U(j.requestId,"import"))break;h(null),k(Qx(j.copied,j.skipped));break;case"memory.content":if(j.terminalId!==n||!U(j.requestId,"read"))break;T(j.note),r(null);break;case"error":{const $=j.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"&&h(null),f(Pt(j.text)),d.current=H==="subscribe";break}}}),X=t.onStatus(j=>{if(j!=="reconnecting"&&j!=="failed")return;const $=new Set(a.current.values());a.current.clear(),h(null),r(null),($.has("install")||$.has("import"))&&(m.current=null,_(null),f(S("memory.error.connectionLost")))}),Y=()=>{t.send({type:"memory.subscribe",terminalId:n,requestId:x("subscribe")})};Y();const V=t.onReopen(Y);return()=>{q(),X(),V(),t.send({type:"memory.unsubscribe",terminalId:n})}},[t,n,x]);const E=N.useCallback(()=>{d.current=!1,f(null),k(null)},[]),M=N.useCallback(U=>{n!==null&&(I("read"),E(),r(U),T(null),t.send({type:"memory.read",terminalId:n,name:U,requestId:x("read")}))},[t,n,E,I,x]),b=N.useCallback(()=>{I("read"),T(null),r(null)},[I]),R=N.useCallback(U=>{n!==null&&(E(),m.current=U,_(null),h("plan"),t.send({type:"memory.plan",terminalId:n,options:U,requestId:x("plan")}))},[t,n,E,x]),D=N.useCallback(()=>{const U=m.current;n===null||U===null||(E(),h("install"),t.send({type:"memory.install",terminalId:n,options:U,requestId:x("install")}))},[t,n,E,x]),B=N.useCallback(()=>{n!==null&&(E(),h("import"),t.send({type:"memory.import",terminalId:n,requestId:x("import")}))},[t,n,E,x]),O=N.useCallback(()=>{I("plan"),m.current=null,_(null)},[I]),F=N.useCallback(()=>{d.current=!1,f(null),k(null)},[]);return{status:i,open:g,loading:C,planned:u,busy:v,lastResult:w,error:L,openNote:M,closeNote:b,requestPlan:R,install:D,importNative:B,cancelPlan:O,dismissMessage:F}}function Zx(t){const[n,i]=N.useState([]),[c,g]=N.useState({}),[T,C]=N.useState(null),r=N.useRef(new Set);N.useEffect(()=>{const a=t.onMessage(m=>{switch(m.type){case"notes.list":i(m.notes);break;case"notes.imageData":r.current.add(m.imageId),g(d=>({...d,[m.imageId]:m.data===null?null:`data:${m.mediaType};base64,${m.data}`}));break;case"error":m.code==="notes-failed"&&C(Pt(m.text));break}}),p=t.onReopen(()=>{r.current.clear()});return()=>{a(),p()}},[t]);const u=N.useCallback(a=>{r.current.has(a)||(r.current.add(a),t.send({type:"notes.image",imageId:a}))},[t]),_=N.useCallback(()=>{const a=crypto.randomUUID(),p=Date.now();return i(m=>[...m,{noteId:a,text:"",images:[],createdAt:p,updatedAt:p}]),t.send({type:"notes.create",noteId:a}),a},[t]),v=N.useCallback((a,p)=>{i(m=>m.map(d=>d.noteId===a?{...d,text:p,updatedAt:Date.now()}:d)),t.send({type:"notes.update",noteId:a,text:p})},[t]),h=N.useCallback(a=>{i(p=>p.filter(m=>m.noteId!==a)),t.send({type:"notes.delete",noteId:a})},[t]),w=N.useCallback((a,p)=>{const m=n.find(x=>x.noteId===a);if(m!==void 0&&m.images.length>=hf){C(S("notes.tooManyImages",{count:hf}));return}if(p.size>Fl){C(S("notes.imageTooBig",{name:p.name||S("notes.imageFallbackName"),size:Math.round(p.size/1024/1024),max:Fl/1024/1024}));return}const d=new FileReader;d.onload=()=>{const x=d.result;if(typeof x!="string")return;const I=x.indexOf(",");I!==-1&&t.send({type:"notes.addImage",noteId:a,image:{mediaType:p.type,data:x.slice(I+1)}})},d.onerror=()=>C(S("notes.readFailed")),d.readAsDataURL(p)},[t,n]),k=N.useCallback((a,p)=>{i(m=>m.map(d=>d.noteId===a?{...d,images:d.images.filter(x=>x.imageId!==p)}:d)),t.send({type:"notes.removeImage",noteId:a,imageId:p})},[t]),L=N.useCallback((a,p)=>{t.send({type:"notes.send",noteId:a,terminalId:p})},[t]),f=N.useCallback(()=>C(null),[]);return{notes:n,images:c,problem:T,requestImage:u,create:_,updateText:v,remove:h,addImage:w,removeImage:k,sendToAgent:L,dismissProblem:f}}const Ag="agent-workbench.theme",eu=["system","light","dark"],ek={system:"theme.system",light:"theme.light",dark:"theme.dark"};function Sp(t){return S("theme.title",{theme:S(ek[t])})}const Cp={system:"◐",light:"☀",dark:"☾"};function tk(){return xt(Ag,"system",t=>t==="light"||t==="dark"||t==="system"?t:null)}function nk(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function sk(){const[t,n]=N.useState(tk),[i,c]=N.useState(nk);N.useEffect(()=>{const C=window.matchMedia("(prefers-color-scheme: dark)"),r=u=>c(u.matches);return C.addEventListener("change",r),()=>C.removeEventListener("change",r)},[]);const g=t==="system"?i?"dark":"light":t;N.useEffect(()=>{document.documentElement.dataset.theme=g,document.documentElement.style.colorScheme=g},[g]);const T=N.useCallback(()=>{n(C=>{const r=eu[(eu.indexOf(C)+1)%eu.length]??"system";return vt(Ag,r),r})},[]);return{preference:t,resolved:g,cycle:T}}const xp="agent-workbench.terminalTheme";function rk(t){return t==="dark"||t==="follow"?t:null}function ik(t,n){return t==="follow"?n:"dark"}function ok(t){const[n,i]=N.useState(()=>xt(xp,"dark",rk)),c=ik(n,t);N.useEffect(()=>{document.documentElement.dataset.terminalTheme=c},[c]);const g=N.useCallback(T=>{vt(xp,T),i(T)},[]);return{preference:n,resolved:c,setPreference:g}}const lk=1500;function ak(t,n){return t===void 0||t===n?null:n==="waiting"?"attention":n==="idle"&&t==="busy"?"done":null}function ck(t,n){const i={now:[],later:[],cancel:[]};for(const[c,g]of n){const T=t.get(c);if(T===g)continue;i.cancel.push(c);const C=ak(T,g);C==="attention"?i.now.push(c):C==="done"&&i.later.push(c)}for(const c of t.keys())n.has(c)||i.cancel.push(c);return i}const kp="agent-workbench.phone-chime";function uk(t){return t==="system"||t==="page"?t:null}function hk(t){return`agentworkbench://chime?source=${t}`}function dk(t,n,i,c){return t?n==="page"?Ql:null:i?co(c):null}const Ep="agent-workbench.sound";function fk(t){return t==="on"?!0:t==="off"?!1:null}function pk(t){return S(t?"sound.on":"sound.off")}function mk(t,n){return t&&n>0}const gk={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}]},Ng=.02,Ql=.8,Dg=.2,Lp="agent-workbench.sound-volume";function co(t){return Math.min(Ql,Math.max(Ng,t))}function _k(t){if(t.trim().length===0)return null;const n=Number(t);return Number.isFinite(n)?co(n):null}function vk(t){return Math.round(co(t)/Ql*100)}class wk{constructor(){It(this,"context",null);It(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 n;return((n=this.context)==null?void 0:n.state)==="running"}play(n){const i=this.context;if(i===null||i.state!=="running")return;const c=i.currentTime+.01;for(const g of gk[n]){const T=i.createOscillator(),C=i.createGain();T.type="sine",T.frequency.value=g.frequency;const r=c+g.at;C.gain.setValueAtTime(1e-4,r),C.gain.exponentialRampToValueAtTime(co(this.volume),r+.012),C.gain.exponentialRampToValueAtTime(1e-4,r+g.duration),T.connect(C),C.connect(i.destination),T.start(r),T.stop(r+g.duration+.02)}}}const tu="agent-workbench.notify";function yk(t){return t==="on"?!0:t==="off"?!1:null}function bk(t,n,i){return t&&n==="granted"&&!i}function Sk(t,n){return S(n==="denied"?"sound.notify.blocked":t?"sound.notify.on":"sound.notify.off")}function Ck(t,n){return t==="attention"?S("notify.attention",{tab:n}):S("notify.done",{tab:n})}function xk(t){return t===void 0?"":t.label.length>0?t.label:t.cwd.split(/[\\/]/).filter(n=>n.length>0).pop()??t.cwd}function to(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function kk(){if(to()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return to()}}function Ek(){return document.visibilityState==="visible"&&document.hasFocus()}function Lk(t){try{const n=new Notification("Agent Workbench",{body:Ck(t.chime,t.tabName),tag:`agent-workbench:${t.terminalId}`});n.onclick=()=>{window.focus(),t.onClick(),n.close()}}catch{}}function Tk(t,n){const[i,c]=N.useState(()=>xt(Ep,!0,fk)),g=N.useRef(i);g.current=i;const[T,C]=N.useState(()=>xt(Lp,Dg,_k)),r=N.useRef(T);r.current=T;const[u]=N.useState(()=>typeof navigator<"u"&&$m(navigator.userAgent)),[_,v]=N.useState(()=>xt(kp,"system",uk)),h=N.useRef(_);h.current=_;const[w,k]=N.useState(()=>to()),[L,f]=N.useState(()=>xt(tu,!1,yk)),a=N.useRef(L);a.current=L;const p=N.useRef(n);p.current=n;const m=N.useCallback((V,j)=>{bk(a.current,to(),Ek())&&Lk({chime:V,terminalId:j,tabName:p.current.nameOf(j),onClick:()=>p.current.activate(j)})},[]),d=N.useRef(null),x=N.useRef(new Map),I=N.useRef(new Map),[E,M]=N.useState(()=>new Set),b=N.useRef(new Map),R=N.useCallback(V=>{const j=b.current,$=j.get(V);$!==void 0&&window.clearTimeout($),M(H=>H.has(V)?H:new Set(H).add(V)),j.set(V,window.setTimeout(()=>{j.delete(V),M(H=>{if(!H.has(V))return H;const K=new Set(H);return K.delete(V),K})},Zm))},[]),D=N.useCallback(V=>{const j=d.current,$=dk(u,h.current,g.current,r.current);j===null||$===null||(j.volume=$,j.play(V))},[u]);N.useEffect(()=>{const V=new wk;V.volume=r.current,d.current=V;const j=()=>{V.unlock(),V.ready&&(window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",j))};return window.addEventListener("pointerdown",j),window.addEventListener("keydown",j),()=>{window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",j),d.current=null}},[]),N.useEffect(()=>{const V=ck(x.current,t);x.current=new Map(t);const j=I.current;for(const $ of V.cancel){const H=j.get($);H!==void 0&&(window.clearTimeout(H),j.delete($))}V.now.length>0&&D("attention");for(const $ of V.now)m("attention",$),R($);for(const $ of V.later)j.set($,window.setTimeout(()=>{j.delete($),D("done"),m("done",$),R($)},lk))},[t,m,D,R]),N.useEffect(()=>{const V=I.current,j=b.current;return()=>{for(const $ of V.values())window.clearTimeout($);V.clear();for(const $ of j.values())window.clearTimeout($);j.clear()}},[]);const B=N.useCallback(()=>{var V,j;c($=>{const H=!$;return vt(Ep,H?"on":"off"),H}),g.current||((V=d.current)==null||V.unlock(),(j=d.current)==null||j.play("done"))},[]),O=N.useCallback(V=>{const j=co(V);C(j),vt(Lp,String(j)),d.current!==null&&(d.current.volume=j)},[]),F=N.useCallback(()=>{var V,j;g.current&&((V=d.current)==null||V.unlock(),(j=d.current)==null||j.play("done"))},[]),U=N.useCallback(()=>{if(a.current&&to()==="granted"){f(!1),vt(tu,"off");return}kk().then(V=>{k(V),V==="granted"&&(f(!0),vt(tu,"on"))})},[]),q={supported:w!=="unsupported",enabled:L&&w==="granted",permission:w,toggle:U},X=N.useCallback(V=>{var j;v(V),h.current=V,vt(kp,V),window.location.href=hk(V),V==="page"&&((j=d.current)==null||j.unlock(),D("done"))},[D]);return{enabled:i,toggle:B,volume:T,setVolume:O,previewVolume:F,notify:q,phoneChime:u?{source:_,setSource:X}:null,attention:E}}function Ig(t,n,i){const[c,g]=N.useState(()=>xt(t,n,yb));N.useLayoutEffect(()=>{document.documentElement.dataset[i]=c},[i,c]);const T=N.useCallback(()=>{g(C=>{const r=Jm(C);return vt(t,r),r})},[t]);return{size:c,cycle:T}}function Rk(){return Ig(gb,Qm,"threadFont")}function Mk(){return Ig(_b,vb,"notesFont")}function Ak(t,n){const[i,c]=N.useState(()=>new Map),[g,T]=N.useState(()=>new Map),C=N.useCallback((u,_,v,h)=>{c(w=>new Map(w).set(u,{requestId:_,terminalId:u,afterEventId:v,phase:"sending",queued:h,sentAt:Date.now(),deliveredAt:null}))},[]);N.useEffect(()=>{const u=t.onMessage(v=>{v.type==="agent.submitted"&&c(h=>x1(h,v,Date.now()))}),_=t.onReopen(()=>c(v=>C1(v,Date.now())));return()=>{u(),_()}},[t]);const r=N.useRef(new Map);return N.useLayoutEffect(()=>{const u=r.current;if(u===n)return;r.current=n;const _=Date.now();T(v=>S1(u,n,v,_))},[n]),{track:C,receipts:i,clocks:g}}const Nk=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function jg({sound:t}){return l.jsxs("span",{className:"sound-control",children:[l.jsx("button",{className:`icon-button${mk(t.enabled,t.volume)?" icon-button-on":""}`,onClick:t.toggle,title:pk(t.enabled),"aria-pressed":t.enabled,children:"♪"}),t.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:Ng,max:Ql,step:.01,value:t.volume,onChange:n=>t.setVolume(Number(n.target.value)),onPointerUp:t.previewVolume,onKeyUp:n=>{Nk.has(n.key)&&t.previewVolume()},title:S("sound.volume"),"aria-label":S("sound.volume")}),l.jsxs("span",{className:"sound-volume-value",children:[vk(t.volume),"%"]})]})})]})}function Pg({notify:t}){return t.supported?l.jsx("button",{className:`icon-button${t.enabled?" icon-button-on":""}`,onClick:t.toggle,title:Sk(t.enabled,t.permission),"aria-pressed":t.enabled,children:l.jsx(Dk,{})}):null}function Dk(){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 Ik(t){const[n,i]=N.useState(null),[c,g]=N.useState(null),[T,C]=N.useState(null),[r,u]=N.useState(!1),[_,v]=N.useState(null);N.useEffect(()=>{const x=t.onMessage(E=>{switch(E.type){case"remote.status":i(E.status),E.status.pairingActive||(g(null),C(null));break;case"remote.pairing.code":g(E.pairing),C(null);break;case"remote.phone.pairing":C(E.pairing),g(null);break;case"error":if(E.code!=="remote-failed")break;v(Pt(E.text)),E.detail!==void 0&&console.error("[servidor]",E.detail);break}}),I=t.onReopen(()=>{g(null),C(null),u(!1)});return()=>{x(),I()}},[t]);const h=N.useCallback(x=>{v(null),t.send({type:"remote.configure",enabled:x})},[t]),w=N.useCallback(x=>{v(null),t.send({type:"remote.configure",port:x})},[t]),k=N.useCallback(()=>{v(null),t.send({type:"remote.pairing.start"})},[t]),L=N.useCallback(()=>{g(null),t.send({type:"remote.pairing.cancel"})},[t]),f=N.useCallback(()=>{v(null),u(!0),t.send({type:"remote.phone.start"})},[t]),a=N.useCallback(()=>{C(null),u(!1),t.send({type:"remote.phone.cancel"})},[t]),p=N.useCallback((x,I)=>{v(null),t.send({type:"remote.device.rename",deviceId:x,label:I})},[t]),m=N.useCallback(x=>{v(null),t.send({type:"remote.device.revoke",deviceId:x})},[t]),d=N.useCallback(()=>v(null),[]);return{status:n,pairing:c,phonePairing:T,phoneStarted:r,problem:_,setEnabled:h,setPort:w,startPairing:k,cancelPairing:L,startPhonePairing:f,cancelPhonePairing:a,renameDevice:p,revokeDevice:m,dismissProblem:d}}const jk="USER";function Pk(t,n){const i=t.sshUser.length>0?t.sshUser:jk,c=/\s/.test(i)?`"${i}@${n}"`:`${i}@${n}`;return`ssh -N -L ${t.port}:127.0.0.1:${t.port} ${c}`}function Og(t){return`http://localhost:${t}`}function Ok(t,n){return`${Og(t)}/?${D0}=${n}`}function Tp(t){return t[0]??"localhost"}function xu(t,n){switch(t){case"off":return S("remote.state.off");case"active":return S("remote.state.active",{port:n});case"restart-needed":return S("remote.state.restartNeeded");case"port-busy":return S("remote.state.portBusy",{port:n})}}function Bk(t){const n=t.trim();if(!/^\d{1,5}$/.test(n))return null;const i=Number(n);return j0(i)?i:null}function Fk(){return S("remote.portInvalid",{min:hm,max:dm})}function Rp(t,n){return Math.max(0,Math.ceil((t-n)/1e3))}function Mp(t){return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function Hk(t,n=Date.now()){return t.connected?S("remote.device.connected"):t.lastSeenAt===null?S("remote.device.never"):S("remote.device.lastSeen",{when:es(t.lastSeenAt,n)})}function $k(t,n=Date.now()){return S("remote.device.paired",{when:es(t.createdAt,n)})}function Uk(t){switch(t){case"powershell-admin":return S("remote.phone.authorize.admin");case"powershell":return S("remote.phone.authorize.powershell");case"terminal":return S("remote.phone.authorize.terminal")}}function Wk(){return[{platform:"win32",label:"Windows",hint:S("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:S("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:S("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
136
- `)}]}function zk(t){return t==="win32"||t==="darwin"?t:"linux"}function Dl(t){return t!==null&&t.state==="active"}function Ap(t){return t!==null&&t.state==="active"&&t.devices.length>0}const ri=function(t,n){let g=t;const T=eo[n];let C=null,r=0,u=null;const _=[],v={},h=function(M,b){r=g*4+17,C=(function(R){const D=new Array(R);for(let B=0;B<R;B+=1){D[B]=new Array(R);for(let O=0;O<R;O+=1)D[B][O]=null}return D})(r),w(0,0),w(r-7,0),w(0,r-7),f(),L(),p(M,b),g>=7&&a(M),u==null&&(u=x(g,T,_)),m(u,b)},w=function(M,b){for(let R=-1;R<=7;R+=1)if(!(M+R<=-1||r<=M+R))for(let D=-1;D<=7;D+=1)b+D<=-1||r<=b+D||(0<=R&&R<=6&&(D==0||D==6)||0<=D&&D<=6&&(R==0||R==6)||2<=R&&R<=4&&2<=D&&D<=4?C[M+R][b+D]=!0:C[M+R][b+D]=!1)},k=function(){let M=0,b=0;for(let R=0;R<8;R+=1){h(!0,R);const D=zs.getLostPoint(v);(R==0||M>D)&&(M=D,b=R)}return b},L=function(){for(let M=8;M<r-8;M+=1)C[M][6]==null&&(C[M][6]=M%2==0);for(let M=8;M<r-8;M+=1)C[6][M]==null&&(C[6][M]=M%2==0)},f=function(){const M=zs.getPatternPosition(g);for(let b=0;b<M.length;b+=1)for(let R=0;R<M.length;R+=1){const D=M[b],B=M[R];if(C[D][B]==null)for(let O=-2;O<=2;O+=1)for(let F=-2;F<=2;F+=1)O==-2||O==2||F==-2||F==2||O==0&&F==0?C[D+O][B+F]=!0:C[D+O][B+F]=!1}},a=function(M){const b=zs.getBCHTypeNumber(g);for(let R=0;R<18;R+=1){const D=!M&&(b>>R&1)==1;C[Math.floor(R/3)][R%3+r-8-3]=D}for(let R=0;R<18;R+=1){const D=!M&&(b>>R&1)==1;C[R%3+r-8-3][Math.floor(R/3)]=D}},p=function(M,b){const R=T<<3|b,D=zs.getBCHTypeInfo(R);for(let B=0;B<15;B+=1){const O=!M&&(D>>B&1)==1;B<6?C[B][8]=O:B<8?C[B+1][8]=O:C[r-15+B][8]=O}for(let B=0;B<15;B+=1){const O=!M&&(D>>B&1)==1;B<8?C[8][r-B-1]=O:B<9?C[8][15-B-1+1]=O:C[8][15-B-1]=O}C[r-8][8]=!M},m=function(M,b){let R=-1,D=r-1,B=7,O=0;const F=zs.getMaskFunction(b);for(let U=r-1;U>0;U-=2)for(U==6&&(U-=1);;){for(let q=0;q<2;q+=1)if(C[D][U-q]==null){let X=!1;O<M.length&&(X=(M[O]>>>B&1)==1),F(D,U-q)&&(X=!X),C[D][U-q]=X,B-=1,B==-1&&(O+=1,B=7)}if(D+=R,D<0||r<=D){D-=R,R=-R;break}}},d=function(M,b){let R=0,D=0,B=0;const O=new Array(b.length),F=new Array(b.length);for(let Y=0;Y<b.length;Y+=1){const V=b[Y].dataCount,j=b[Y].totalCount-V;D=Math.max(D,V),B=Math.max(B,j),O[Y]=new Array(V);for(let te=0;te<O[Y].length;te+=1)O[Y][te]=255&M.getBuffer()[te+R];R+=V;const $=zs.getErrorCorrectPolynomial(j),K=oo(O[Y],$.getLength()-1).mod($);F[Y]=new Array($.getLength()-1);for(let te=0;te<F[Y].length;te+=1){const re=te+K.getLength()-F[Y].length;F[Y][te]=re>=0?K.getAt(re):0}}let U=0;for(let Y=0;Y<b.length;Y+=1)U+=b[Y].totalCount;const q=new Array(U);let X=0;for(let Y=0;Y<D;Y+=1)for(let V=0;V<b.length;V+=1)Y<O[V].length&&(q[X]=O[V][Y],X+=1);for(let Y=0;Y<B;Y+=1)for(let V=0;V<b.length;V+=1)Y<F[V].length&&(q[X]=F[V][Y],X+=1);return q},x=function(M,b,R){const D=Np.getRSBlocks(M,b),B=Dp();for(let F=0;F<R.length;F+=1){const U=R[F];B.put(U.getMode(),4),B.put(U.getLength(),zs.getLengthInBits(U.getMode(),M)),U.write(B)}let O=0;for(let F=0;F<D.length;F+=1)O+=D[F].dataCount;if(B.getLengthInBits()>O*8)throw"code length overflow. ("+B.getLengthInBits()+">"+O*8+")";for(B.getLengthInBits()+4<=O*8&&B.put(0,4);B.getLengthInBits()%8!=0;)B.putBit(!1);for(;!(B.getLengthInBits()>=O*8||(B.put(236,8),B.getLengthInBits()>=O*8));)B.put(17,8);return d(B,D)};v.addData=function(M,b){b=b||"Byte";let R=null;switch(b){case"Numeric":R=Vk(M);break;case"Alphanumeric":R=qk(M);break;case"Byte":R=Kk(M);break;case"Kanji":R=Gk(M);break;default:throw"mode:"+b}_.push(R),u=null},v.isDark=function(M,b){if(M<0||r<=M||b<0||r<=b)throw M+","+b;return C[M][b]},v.getModuleCount=function(){return r},v.make=function(){if(g<1){let M=1;for(;M<40;M++){const b=Np.getRSBlocks(M,T),R=Dp();for(let B=0;B<_.length;B++){const O=_[B];R.put(O.getMode(),4),R.put(O.getLength(),zs.getLengthInBits(O.getMode(),M)),O.write(R)}let D=0;for(let B=0;B<b.length;B++)D+=b[B].dataCount;if(R.getLengthInBits()<=D*8)break}g=M}h(!1,k())},v.createTableTag=function(M,b){M=M||2,b=typeof b>"u"?M*4:b;let R="";R+='<table style="',R+=" border-width: 0px; border-style: none;",R+=" border-collapse: collapse;",R+=" padding: 0px; margin: "+b+"px;",R+='">',R+="<tbody>";for(let D=0;D<v.getModuleCount();D+=1){R+="<tr>";for(let B=0;B<v.getModuleCount();B+=1)R+='<td style="',R+=" border-width: 0px; border-style: none;",R+=" border-collapse: collapse;",R+=" padding: 0px; margin: 0px;",R+=" width: "+M+"px;",R+=" height: "+M+"px;",R+=" background-color: ",R+=v.isDark(D,B)?"#000000":"#ffffff",R+=";",R+='"/>';R+="</tr>"}return R+="</tbody>",R+="</table>",R},v.createSvgTag=function(M,b,R,D){let B={};typeof arguments[0]=="object"&&(B=arguments[0],M=B.cellSize,b=B.margin,R=B.alt,D=B.title),M=M||2,b=typeof b>"u"?M*4:b,R=typeof R=="string"?{text:R}:R||{},R.text=R.text||null,R.id=R.text?R.id||"qrcode-description":null,D=typeof D=="string"?{text:D}:D||{},D.text=D.text||null,D.id=D.text?D.id||"qrcode-title":null;const O=v.getModuleCount()*M+b*2;let F,U,q,X,Y="",V;for(V="l"+M+",0 0,"+M+" -"+M+",0 0,-"+M+"z ",Y+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',Y+=B.scalable?"":' width="'+O+'px" height="'+O+'px"',Y+=' viewBox="0 0 '+O+" "+O+'" ',Y+=' preserveAspectRatio="xMinYMin meet"',Y+=D.text||R.text?' role="img" aria-labelledby="'+I([D.id,R.id].join(" ").trim())+'"':"",Y+=">",Y+=D.text?'<title id="'+I(D.id)+'">'+I(D.text)+"</title>":"",Y+=R.text?'<description id="'+I(R.id)+'">'+I(R.text)+"</description>":"",Y+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',Y+='<path d="',q=0;q<v.getModuleCount();q+=1)for(X=q*M+b,F=0;F<v.getModuleCount();F+=1)v.isDark(q,F)&&(U=F*M+b,Y+="M"+U+","+X+V);return Y+='" stroke="transparent" fill="black"/>',Y+="</svg>",Y},v.createDataURL=function(M,b){M=M||2,b=typeof b>"u"?M*4:b;const R=v.getModuleCount()*M+b*2,D=b,B=R-b;return Jk(R,R,function(O,F){if(D<=O&&O<B&&D<=F&&F<B){const U=Math.floor((O-D)/M),q=Math.floor((F-D)/M);return v.isDark(q,U)?0:1}else return 1})},v.createImgTag=function(M,b,R){M=M||2,b=typeof b>"u"?M*4:b;const D=v.getModuleCount()*M+b*2;let B="";return B+="<img",B+=' src="',B+=v.createDataURL(M,b),B+='"',B+=' width="',B+=D,B+='"',B+=' height="',B+=D,B+='"',R&&(B+=' alt="',B+=I(R),B+='"'),B+="/>",B};const I=function(M){let b="";for(let R=0;R<M.length;R+=1){const D=M.charAt(R);switch(D){case"<":b+="&lt;";break;case">":b+="&gt;";break;case"&":b+="&amp;";break;case'"':b+="&quot;";break;default:b+=D;break}}return b},E=function(M){M=typeof M>"u"?2:M;const R=v.getModuleCount()*1+M*2,D=M,B=R-M;let O,F,U,q,X;const Y={"██":"█","█ ":"▀"," █":"▄"," ":" "},V={"██":"▀","█ ":"▀"," █":" "," ":" "};let j="";for(O=0;O<R;O+=2){for(U=Math.floor((O-D)/1),q=Math.floor((O+1-D)/1),F=0;F<R;F+=1)X="█",D<=F&&F<B&&D<=O&&O<B&&v.isDark(U,Math.floor((F-D)/1))&&(X=" "),D<=F&&F<B&&D<=O+1&&O+1<B&&v.isDark(q,Math.floor((F-D)/1))?X+=" ":X+="█",j+=M<1&&O+1>=B?V[X]:Y[X];j+=`
137
- `}return R%2&&M>0?j.substring(0,j.length-R-1)+Array(R+1).join("▀"):j.substring(0,j.length-1)};return v.createASCII=function(M,b){if(M=M||1,M<2)return E(b);M-=1,b=typeof b>"u"?M*2:b;const R=v.getModuleCount()*M+b*2,D=b,B=R-b;let O,F,U,q;const X=Array(M+1).join("██"),Y=Array(M+1).join(" ");let V="",j="";for(O=0;O<R;O+=1){for(U=Math.floor((O-D)/M),j="",F=0;F<R;F+=1)q=1,D<=F&&F<B&&D<=O&&O<B&&v.isDark(U,Math.floor((F-D)/M))&&(q=0),j+=q?X:Y;for(U=0;U<M;U+=1)V+=j+`
138
- `}return V.substring(0,V.length-1)},v.renderTo2dContext=function(M,b){b=b||2;const R=v.getModuleCount();for(let D=0;D<R;D++)for(let B=0;B<R;B++)M.fillStyle=v.isDark(D,B)?"black":"white",M.fillRect(B*b,D*b,b,b)},v};ri.stringToBytes=function(t){const n=[];for(let i=0;i<t.length;i+=1){const c=t.charCodeAt(i);n.push(c&255)}return n};ri.createStringToBytes=function(t,n){const i=(function(){const g=Xk(t),T=function(){const u=g.read();if(u==-1)throw"eof";return u};let C=0;const r={};for(;;){const u=g.read();if(u==-1)break;const _=T(),v=T(),h=T(),w=String.fromCharCode(u<<8|_),k=v<<8|h;r[w]=k,C+=1}if(C!=n)throw C+" != "+n;return r})(),c=63;return function(g){const T=[];for(let C=0;C<g.length;C+=1){const r=g.charCodeAt(C);if(r<128)T.push(r);else{const u=i[g.charAt(C)];typeof u=="number"?(u&255)==u?T.push(u):(T.push(u>>>8),T.push(u&255)):T.push(c)}}return T}};const Zt={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},eo={L:1,M:0,Q:3,H:2},Ws={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},zs=(function(){const t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],n=1335,i=7973,c=21522,g={},T=function(C){let r=0;for(;C!=0;)r+=1,C>>>=1;return r};return g.getBCHTypeInfo=function(C){let r=C<<10;for(;T(r)-T(n)>=0;)r^=n<<T(r)-T(n);return(C<<10|r)^c},g.getBCHTypeNumber=function(C){let r=C<<12;for(;T(r)-T(i)>=0;)r^=i<<T(r)-T(i);return C<<12|r},g.getPatternPosition=function(C){return t[C-1]},g.getMaskFunction=function(C){switch(C){case Ws.PATTERN000:return function(r,u){return(r+u)%2==0};case Ws.PATTERN001:return function(r,u){return r%2==0};case Ws.PATTERN010:return function(r,u){return u%3==0};case Ws.PATTERN011:return function(r,u){return(r+u)%3==0};case Ws.PATTERN100:return function(r,u){return(Math.floor(r/2)+Math.floor(u/3))%2==0};case Ws.PATTERN101:return function(r,u){return r*u%2+r*u%3==0};case Ws.PATTERN110:return function(r,u){return(r*u%2+r*u%3)%2==0};case Ws.PATTERN111:return function(r,u){return(r*u%3+(r+u)%2)%2==0};default:throw"bad maskPattern:"+C}},g.getErrorCorrectPolynomial=function(C){let r=oo([1],0);for(let u=0;u<C;u+=1)r=r.multiply(oo([1,Vs.gexp(u)],0));return r},g.getLengthInBits=function(C,r){if(1<=r&&r<10)switch(C){case Zt.MODE_NUMBER:return 10;case Zt.MODE_ALPHA_NUM:return 9;case Zt.MODE_8BIT_BYTE:return 8;case Zt.MODE_KANJI:return 8;default:throw"mode:"+C}else if(r<27)switch(C){case Zt.MODE_NUMBER:return 12;case Zt.MODE_ALPHA_NUM:return 11;case Zt.MODE_8BIT_BYTE:return 16;case Zt.MODE_KANJI:return 10;default:throw"mode:"+C}else if(r<41)switch(C){case Zt.MODE_NUMBER:return 14;case Zt.MODE_ALPHA_NUM:return 13;case Zt.MODE_8BIT_BYTE:return 16;case Zt.MODE_KANJI:return 12;default:throw"mode:"+C}else throw"type:"+r},g.getLostPoint=function(C){const r=C.getModuleCount();let u=0;for(let h=0;h<r;h+=1)for(let w=0;w<r;w+=1){let k=0;const L=C.isDark(h,w);for(let f=-1;f<=1;f+=1)if(!(h+f<0||r<=h+f))for(let a=-1;a<=1;a+=1)w+a<0||r<=w+a||f==0&&a==0||L==C.isDark(h+f,w+a)&&(k+=1);k>5&&(u+=3+k-5)}for(let h=0;h<r-1;h+=1)for(let w=0;w<r-1;w+=1){let k=0;C.isDark(h,w)&&(k+=1),C.isDark(h+1,w)&&(k+=1),C.isDark(h,w+1)&&(k+=1),C.isDark(h+1,w+1)&&(k+=1),(k==0||k==4)&&(u+=3)}for(let h=0;h<r;h+=1)for(let w=0;w<r-6;w+=1)C.isDark(h,w)&&!C.isDark(h,w+1)&&C.isDark(h,w+2)&&C.isDark(h,w+3)&&C.isDark(h,w+4)&&!C.isDark(h,w+5)&&C.isDark(h,w+6)&&(u+=40);for(let h=0;h<r;h+=1)for(let w=0;w<r-6;w+=1)C.isDark(w,h)&&!C.isDark(w+1,h)&&C.isDark(w+2,h)&&C.isDark(w+3,h)&&C.isDark(w+4,h)&&!C.isDark(w+5,h)&&C.isDark(w+6,h)&&(u+=40);let _=0;for(let h=0;h<r;h+=1)for(let w=0;w<r;w+=1)C.isDark(w,h)&&(_+=1);const v=Math.abs(100*_/r/r-50)/5;return u+=v*10,u},g})(),Vs=(function(){const t=new Array(256),n=new Array(256);for(let c=0;c<8;c+=1)t[c]=1<<c;for(let c=8;c<256;c+=1)t[c]=t[c-4]^t[c-5]^t[c-6]^t[c-8];for(let c=0;c<255;c+=1)n[t[c]]=c;const i={};return i.glog=function(c){if(c<1)throw"glog("+c+")";return n[c]},i.gexp=function(c){for(;c<0;)c+=255;for(;c>=256;)c-=255;return t[c]},i})(),oo=function(t,n){if(typeof t.length>"u")throw t.length+"/"+n;const i=(function(){let g=0;for(;g<t.length&&t[g]==0;)g+=1;const T=new Array(t.length-g+n);for(let C=0;C<t.length-g;C+=1)T[C]=t[C+g];return T})(),c={};return c.getAt=function(g){return i[g]},c.getLength=function(){return i.length},c.multiply=function(g){const T=new Array(c.getLength()+g.getLength()-1);for(let C=0;C<c.getLength();C+=1)for(let r=0;r<g.getLength();r+=1)T[C+r]^=Vs.gexp(Vs.glog(c.getAt(C))+Vs.glog(g.getAt(r)));return oo(T,0)},c.mod=function(g){if(c.getLength()-g.getLength()<0)return c;const T=Vs.glog(c.getAt(0))-Vs.glog(g.getAt(0)),C=new Array(c.getLength());for(let r=0;r<c.getLength();r+=1)C[r]=c.getAt(r);for(let r=0;r<g.getLength();r+=1)C[r]^=Vs.gexp(Vs.glog(g.getAt(r))+T);return oo(C,0).mod(g)},c},Np=(function(){const t=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],n=function(g,T){const C={};return C.totalCount=g,C.dataCount=T,C},i={},c=function(g,T){switch(T){case eo.L:return t[(g-1)*4+0];case eo.M:return t[(g-1)*4+1];case eo.Q:return t[(g-1)*4+2];case eo.H:return t[(g-1)*4+3];default:return}};return i.getRSBlocks=function(g,T){const C=c(g,T);if(typeof C>"u")throw"bad rs block @ typeNumber:"+g+"/errorCorrectionLevel:"+T;const r=C.length/3,u=[];for(let _=0;_<r;_+=1){const v=C[_*3+0],h=C[_*3+1],w=C[_*3+2];for(let k=0;k<v;k+=1)u.push(n(h,w))}return u},i})(),Dp=function(){const t=[];let n=0;const i={};return i.getBuffer=function(){return t},i.getAt=function(c){const g=Math.floor(c/8);return(t[g]>>>7-c%8&1)==1},i.put=function(c,g){for(let T=0;T<g;T+=1)i.putBit((c>>>g-T-1&1)==1)},i.getLengthInBits=function(){return n},i.putBit=function(c){const g=Math.floor(n/8);t.length<=g&&t.push(0),c&&(t[g]|=128>>>n%8),n+=1},i},Vk=function(t){const n=Zt.MODE_NUMBER,i=t,c={};c.getMode=function(){return n},c.getLength=function(C){return i.length},c.write=function(C){const r=i;let u=0;for(;u+2<r.length;)C.put(g(r.substring(u,u+3)),10),u+=3;u<r.length&&(r.length-u==1?C.put(g(r.substring(u,u+1)),4):r.length-u==2&&C.put(g(r.substring(u,u+2)),7))};const g=function(C){let r=0;for(let u=0;u<C.length;u+=1)r=r*10+T(C.charAt(u));return r},T=function(C){if("0"<=C&&C<="9")return C.charCodeAt(0)-48;throw"illegal char :"+C};return c},qk=function(t){const n=Zt.MODE_ALPHA_NUM,i=t,c={};c.getMode=function(){return n},c.getLength=function(T){return i.length},c.write=function(T){const C=i;let r=0;for(;r+1<C.length;)T.put(g(C.charAt(r))*45+g(C.charAt(r+1)),11),r+=2;r<C.length&&T.put(g(C.charAt(r)),6)};const g=function(T){if("0"<=T&&T<="9")return T.charCodeAt(0)-48;if("A"<=T&&T<="Z")return T.charCodeAt(0)-65+10;switch(T){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 :"+T}};return c},Kk=function(t){const n=Zt.MODE_8BIT_BYTE,i=ri.stringToBytes(t),c={};return c.getMode=function(){return n},c.getLength=function(g){return i.length},c.write=function(g){for(let T=0;T<i.length;T+=1)g.put(i[T],8)},c},Gk=function(t){const n=Zt.MODE_KANJI,i=ri.stringToBytes;(function(T,C){const r=i(T);if(r.length!=2||(r[0]<<8|r[1])!=C)throw"sjis not supported."})("友",38726);const c=i(t),g={};return g.getMode=function(){return n},g.getLength=function(T){return~~(c.length/2)},g.write=function(T){const C=c;let r=0;for(;r+1<C.length;){let u=(255&C[r])<<8|255&C[r+1];if(33088<=u&&u<=40956)u-=33088;else if(57408<=u&&u<=60351)u-=49472;else throw"illegal char at "+(r+1)+"/"+u;u=(u>>>8&255)*192+(u&255),T.put(u,13),r+=2}if(r<C.length)throw"illegal char at "+(r+1)},g},Bg=function(){const t=[],n={};return n.writeByte=function(i){t.push(i&255)},n.writeShort=function(i){n.writeByte(i),n.writeByte(i>>>8)},n.writeBytes=function(i,c,g){c=c||0,g=g||i.length;for(let T=0;T<g;T+=1)n.writeByte(i[T+c])},n.writeString=function(i){for(let c=0;c<i.length;c+=1)n.writeByte(i.charCodeAt(c))},n.toByteArray=function(){return t},n.toString=function(){let i="";i+="[";for(let c=0;c<t.length;c+=1)c>0&&(i+=","),i+=t[c];return i+="]",i},n},Yk=function(){let t=0,n=0,i=0,c="";const g={},T=function(r){c+=String.fromCharCode(C(r&63))},C=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 g.writeByte=function(r){for(t=t<<8|r&255,n+=8,i+=1;n>=6;)T(t>>>n-6),n-=6},g.flush=function(){if(n>0&&(T(t<<6-n),t=0,n=0),i%3!=0){const r=3-i%3;for(let u=0;u<r;u+=1)c+="="}},g.toString=function(){return c},g},Xk=function(t){const n=t;let i=0,c=0,g=0;const T={};T.read=function(){for(;g<8;){if(i>=n.length){if(g==0)return-1;throw"unexpected end of file./"+g}const u=n.charAt(i);if(i+=1,u=="=")return g=0,-1;if(u.match(/^\s$/))continue;c=c<<6|C(u.charCodeAt(0)),g+=6}const r=c>>>g-8&255;return g-=8,r};const C=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 T},Qk=function(t,n){const i=t,c=n,g=new Array(t*n),T={};T.setPixel=function(_,v,h){g[v*i+_]=h},T.write=function(_){_.writeString("GIF87a"),_.writeShort(i),_.writeShort(c),_.writeByte(128),_.writeByte(0),_.writeByte(0),_.writeByte(0),_.writeByte(0),_.writeByte(0),_.writeByte(255),_.writeByte(255),_.writeByte(255),_.writeString(","),_.writeShort(0),_.writeShort(0),_.writeShort(i),_.writeShort(c),_.writeByte(0);const v=2,h=r(v);_.writeByte(v);let w=0;for(;h.length-w>255;)_.writeByte(255),_.writeBytes(h,w,255),w+=255;_.writeByte(h.length-w),_.writeBytes(h,w,h.length-w),_.writeByte(0),_.writeString(";")};const C=function(_){const v=_;let h=0,w=0;const k={};return k.write=function(L,f){if(L>>>f)throw"length over";for(;h+f>=8;)v.writeByte(255&(L<<h|w)),f-=8-h,L>>>=8-h,w=0,h=0;w=L<<h|w,h=h+f},k.flush=function(){h>0&&v.writeByte(w)},k},r=function(_){const v=1<<_,h=(1<<_)+1;let w=_+1;const k=u();for(let m=0;m<v;m+=1)k.add(String.fromCharCode(m));k.add(String.fromCharCode(v)),k.add(String.fromCharCode(h));const L=Bg(),f=C(L);f.write(v,w);let a=0,p=String.fromCharCode(g[a]);for(a+=1;a<g.length;){const m=String.fromCharCode(g[a]);a+=1,k.contains(p+m)?p=p+m:(f.write(k.indexOf(p),w),k.size()<4095&&(k.size()==1<<w&&(w+=1),k.add(p+m)),p=m)}return f.write(k.indexOf(p),w),f.write(h,w),f.flush(),L.toByteArray()},u=function(){const _={};let v=0;const h={};return h.add=function(w){if(h.contains(w))throw"dup key:"+w;_[w]=v,v+=1},h.size=function(){return v},h.indexOf=function(w){return _[w]},h.contains=function(w){return typeof _[w]<"u"},h};return T},Jk=function(t,n,i){const c=Qk(t,n);for(let r=0;r<n;r+=1)for(let u=0;u<t;u+=1)c.setPixel(u,r,i(u,r));const g=Bg();c.write(g);const T=Yk(),C=g.toByteArray();for(let r=0;r<C.length;r+=1)T.writeByte(C[r]);return T.flush(),"data:image/gif;base64,"+T};ri.stringToBytes;const Qi=4;function Zk(t){const n=ri(0,"M");n.addData(t,"Byte"),n.make();const i=n.getModuleCount();let c="";for(let g=0;g<i;g++){let T=0;for(;T<i;){if(!n.isDark(g,T)){T++;continue}const C=T;for(;T<i&&n.isDark(g,T);)T++;c+=`M${C} ${g}h${T-C}v1h-${T-C}z`}}return{size:i,path:c}}const eE=1e3,tE=4e3;function nE({status:t,pairing:n,phonePairing:i,phoneStarted:c,problem:g,platform:T,onSetEnabled:C,onSetPort:r,onStartPairing:u,onCancelPairing:_,onStartPhonePairing:v,onCancelPhonePairing:h,onRenameDevice:w,onRevokeDevice:k,onDismissProblem:L,onClose:f}){const[a,p]=N.useState(()=>Tp(t.hostNames)),[m,d]=N.useState(String(t.port)),[x,I]=N.useState(null),E=N.useRef(null),[M,b]=N.useState(()=>Date.now()),R=()=>{n!==null&&_(),c&&h(),f()},D=N.useRef(R);D.current=R,N.useEffect(()=>{const j=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),D.current())};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[]),N.useEffect(()=>{if(n===null&&i===null)return;b(Date.now());const j=window.setInterval(()=>b(Date.now()),1e3);return()=>window.clearInterval(j)},[n,i]),N.useEffect(()=>()=>{E.current!==null&&window.clearTimeout(E.current)},[]);const B=N.useRef(null),O=i!==null;N.useEffect(()=>{var $;if(!O)return;const j=window.matchMedia("(prefers-reduced-motion: reduce)").matches;($=B.current)==null||$.scrollIntoView({block:"center",behavior:j?"auto":"smooth"})},[O]),N.useEffect(()=>{d(String(t.port))},[t.port]),N.useEffect(()=>{t.hostNames.includes(a)||p(Tp(t.hostNames))},[t.hostNames,a]);const F=(j,$)=>{navigator.clipboard.writeText($).then(()=>{I(j),E.current!==null&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>I(null),eE)}).catch(()=>I(null))},U=Bk(m),q=U!==null&&U!==t.port,X=Pk(t,a),Y=S("remote.title"),V=n===null?null:Ok(t.port,n.code);return l.jsx("div",{className:"modal-backdrop",onClick:R,children:l.jsxs("div",{className:"modal",role:"dialog","aria-label":Y,onClick:j=>j.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:Y}),l.jsx("button",{className:"icon-button",onClick:R,title:S("common.close"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:`status-line-state${t.state==="active"?" status-line-state-active":""}`,children:xu(t.state,t.port)}),l.jsx("p",{className:"modal-hint",children:S("remote.intro")}),l.jsx("div",{className:"vault-actions",children:t.enabled?l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"link-button",onClick:()=>C(!1),children:S("remote.turnOff")}),l.jsx("span",{className:"modal-hint",children:S("remote.turnOffHint")})]}):l.jsx("button",{className:"primary-button",onClick:()=>C(!0),children:S("remote.turnOn")})}),l.jsxs("div",{className:"remote-port",children:[l.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:S("remote.port")}),l.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:m,onChange:j=>d(j.target.value),onKeyDown:j=>{j.key==="Enter"&&q&&U!==null&&r(U)}}),l.jsx("button",{className:"link-button",onClick:()=>U!==null&&r(U),disabled:!q,children:S("remote.portSave")}),U===null&&l.jsx("span",{className:"modal-hint remote-port-invalid",children:Fk()})]}),l.jsx("p",{className:"modal-hint",children:S("remote.restartHint")}),g!==null&&l.jsxs("div",{className:"vault-problem",role:"alert",children:[l.jsx("span",{children:g}),l.jsx("button",{className:"icon-button",onClick:L,title:S("common.close"),children:"×"})]}),l.jsx("h3",{className:"modal-section",children:S("remote.step.host")}),l.jsx("p",{className:"modal-hint",children:S("remote.step.hostHint")}),Wk().map(j=>l.jsxs("details",{className:"remote-os",open:j.platform===zk(T),children:[l.jsx("summary",{className:"remote-os-summary",children:j.label}),l.jsx("p",{className:"modal-hint",children:j.hint}),j.command!==null&&l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:j.command}),l.jsx("button",{className:"link-button",onClick:()=>F("ssh",j.command??""),children:x==="ssh"?l.jsxs(l.Fragment,{children:["✓ ",S("remote.copied")]}):S("remote.copy")})]})]},j.platform)),l.jsx("h3",{className:"modal-section",children:S("remote.step.tunnel")}),l.jsx("p",{className:"modal-hint",children:S("remote.step.tunnelHint")}),t.hostNames.length>1&&l.jsxs("div",{className:"remote-port",children:[l.jsx("label",{className:"modal-hint",htmlFor:"remote-host-select",children:S("remote.address")}),l.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:a,onChange:j=>p(j.target.value),children:t.hostNames.map(j=>l.jsx("option",{value:j,children:j},j))})]}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:X}),l.jsx("button",{className:"link-button",onClick:()=>F("command",X),children:x==="command"?l.jsxs(l.Fragment,{children:["✓ ",S("remote.copied")]}):S("remote.copy")})]}),l.jsxs("details",{className:"remote-os",children:[l.jsx("summary",{className:"remote-os-summary",children:S("remote.trouble")}),l.jsxs("ul",{className:"remote-trouble",children:[l.jsx("li",{className:"modal-hint",children:S("remote.trouble.network")}),l.jsx("li",{className:"modal-hint",children:S("remote.vpnHint")}),t.sshUser.length>0&&l.jsx("li",{className:"modal-hint",children:S("remote.userHint",{user:t.sshUser})})]})]}),l.jsx("h3",{className:"modal-section",children:S("remote.step.pair")}),n===null||V===null?l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"primary-button",onClick:u,disabled:!Dl(t),children:S("remote.pair.start")}),!Dl(t)&&l.jsx("span",{className:"modal-hint",children:S("remote.pair.needsActive")})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:S("remote.pair.open")}),l.jsxs("div",{className:"status-line-fragment",children:[l.jsx("pre",{className:"tool-pre",children:V}),l.jsx("button",{className:"link-button",onClick:()=>F("pairing",V),children:x==="pairing"?l.jsxs(l.Fragment,{children:["✓ ",S("remote.copied")]}):S("remote.copy")})]}),l.jsxs("p",{className:"modal-hint",children:[S("remote.pair.expires",{time:Mp(Rp(n.expiresAt,M))})," ",S("remote.pair.after",{url:Og(t.port)})]}),l.jsx("div",{className:"vault-actions",children:l.jsx("button",{className:"link-button",onClick:_,children:S("remote.pair.cancel")})})]}),l.jsx("h3",{className:"modal-section",children:S("remote.phone.title")}),i===null?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:S("remote.phone.hint")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"primary-button",onClick:v,disabled:!Dl(t),children:S("remote.phone.start")}),!Dl(t)&&l.jsx("span",{className:"modal-hint",children:S("remote.pair.needsActive")})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"modal-hint",children:Uk(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:()=>F("phone",i.authorizeCommand),children:x==="phone"?l.jsxs(l.Fragment,{children:["✓ ",S("remote.copied")]}):S("remote.copy")})]}),l.jsx("p",{className:"modal-hint",children:S("remote.phone.authorizeOnce")}),l.jsx("p",{className:"modal-hint",children:S("remote.phone.scan")}),l.jsx("div",{ref:B,children:l.jsx(sE,{payload:i.payload})}),l.jsx("p",{className:"modal-hint",children:S("remote.phone.secret")}),l.jsx("p",{className:"modal-hint",children:S("remote.pair.expires",{time:Mp(Rp(i.expiresAt,M))})}),l.jsx("div",{className:"vault-actions",children:l.jsx("button",{className:"link-button",onClick:h,children:S("remote.pair.cancel")})})]}),l.jsx("h3",{className:"modal-section",children:S("remote.devices")}),t.devices.length===0?l.jsx("p",{className:"modal-hint",children:S("remote.devices.empty")}):l.jsx("ul",{className:"remote-devices",children:t.devices.map(j=>l.jsx(rE,{device:j,onRename:$=>w(j.id,$),onRevoke:()=>k(j.id)},j.id))})]})]})})}function sE({payload:t}){const n=Zk(t),i=n.size+Qi*2;return l.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-Qi} ${-Qi} ${i} ${i}`,role:"img","aria-label":S("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[l.jsx("rect",{x:-Qi,y:-Qi,width:i,height:i,fill:"#fff"}),l.jsx("path",{d:n.path,fill:"#000"})]})}function rE({device:t,onRename:n,onRevoke:i}){const[c,g]=N.useState(!1),[T,C]=N.useState(t.label),[r,u]=N.useState(!1),_=N.useRef(null);N.useEffect(()=>()=>{_.current!==null&&window.clearTimeout(_.current)},[]);const v=()=>{g(!1);const w=T.trim();w.length>0&&w!==t.label&&n(w)},h=()=>{if(r){i();return}u(!0),_.current=window.setTimeout(()=>u(!1),tE)};return l.jsxs("li",{className:"remote-device",children:[l.jsxs("div",{className:"remote-device-main",children:[c?l.jsx("input",{className:"remote-device-input",value:T,autoFocus:!0,onChange:w=>C(w.target.value),onBlur:v,onKeyDown:w=>{w.key==="Enter"&&v()}}):l.jsx("button",{className:"remote-device-label",onClick:()=>{C(t.label),g(!0)},title:S("remote.device.rename"),children:t.label}),l.jsx("span",{className:`remote-device-seen${t.connected?" remote-device-connected":""}`,children:Hk(t)}),l.jsx("span",{className:"remote-device-paired",children:$k(t)})]}),l.jsx("button",{className:`link-button${r?" remote-device-confirm":""}`,onClick:h,children:S(r?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const nu="agent-workbench.notes-open",Ip="agent-workbench.notes-active",jp="agent-workbench.notes-height",su=160,iE=300;function oE(t){return t.text.trim().length===0?t.images.length>0?S("notes.imageOnly"):S("notes.untitled"):b0(t)}function lE({notes:t,onSendNote:n,sendTargetCwd:i,fill:c,onHide:g}){const[T,C]=N.useState(()=>xt(nu,!1,q=>q==="true")),r=T||c,[u,_]=N.useState(()=>xt(jp,iE,q=>{const X=Number.parseInt(q,10);return Number.isFinite(X)?Math.max(X,su):null})),[v,h]=N.useState(()=>xt(Ip,null,q=>q)),[w,k]=N.useState(null),[L,f]=N.useState(null),[a,p]=N.useState(0),m=Mk(),d=N.useMemo(()=>t.notes.length===0?null:t.notes.find(q=>q.noteId===v)??t.notes[t.notes.length-1]??null,[t.notes,v]),x=N.useCallback(q=>{h(q),vt(Ip,q),k(null)},[]),I=N.useCallback(()=>{C(q=>{const X=!q;return vt(nu,String(X)),X})},[]),E=N.useCallback(()=>{const q=t.create();x(q),r||(C(!0),vt(nu,"true")),p(X=>X+1)},[t,r,x]),M=N.useCallback(q=>{if(q.text.trim().length===0&&q.images.length===0){t.remove(q.noteId);return}x(q.noteId),k(q.noteId)},[t,x]),b=N.useCallback(()=>{w!==null&&t.remove(w),k(null)},[w,t]),R=N.useRef(null),D=N.useCallback(q=>{const X=q.currentTarget.parentElement,Y=X===null?u:Math.round(X.getBoundingClientRect().height);R.current={startY:q.clientY,startHeight:Y},q.currentTarget.setPointerCapture(q.pointerId),q.preventDefault()},[u]),B=N.useCallback(q=>{const X=R.current;if(X===null)return;const Y=Math.max(su,Math.floor(window.innerHeight*.8));_(Math.min(Y,Math.max(su,X.startHeight+X.startY-q.clientY)))},[]),O=N.useCallback(q=>{R.current!==null&&(R.current=null,q.currentTarget.releasePointerCapture(q.pointerId),vt(jp,String(u)))},[u]);N.useEffect(()=>{if(L===null)return;const q=X=>{X.key==="Escape"&&(X.stopPropagation(),f(null))};return window.addEventListener("keydown",q,!0),()=>window.removeEventListener("keydown",q,!0)},[L]);const F=L===null?void 0:t.images[L],U=t.notes.length;return l.jsxs("section",{className:`notes${r?" notes-open":""}${c?" notes-fill":""}`,style:r&&!c?{height:`${u}px`}:void 0,children:[r&&!c&&l.jsx("div",{className:"notes-resize",onPointerDown:D,onPointerMove:B,onPointerUp:O,onPointerCancel:O,title:S("notes.resize")}),r?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"notes-header",children:[l.jsxs("div",{className:"strip-tabs",role:"tablist",children:[t.notes.map(q=>{const X=q.noteId===(d==null?void 0:d.noteId),Y=oE(q);return l.jsxs("div",{className:`strip-tab${X?" is-active":""}`,role:"tab","aria-selected":X,children:[l.jsx("button",{className:"strip-tab-label",onClick:()=>x(q.noteId),title:Y,children:Y}),l.jsx("button",{className:"strip-tab-close",onClick:()=>M(q),title:S("notes.closeNote"),children:"×"})]},q.noteId)}),l.jsx("button",{className:"strip-tab-new",onClick:E,title:S("notes.new"),children:"+"})]}),l.jsx("span",{className:"strip-spacer"}),l.jsx("button",{className:"icon-button thread-font-button",onClick:m.cycle,title:Ul(m.size),"aria-label":Ul(m.size),children:l.jsxs("span",{"aria-hidden":"true",children:["a",l.jsx("span",{className:"thread-font-big",children:"A"})]})}),!c&&l.jsx("button",{className:"icon-button",onClick:I,title:S("notes.collapse"),children:"▾"}),g!==void 0&&l.jsx($l,{title:S("settings.hide.notes"),onHide:g,confirmText:null})]}),l.jsx("div",{className:"notes-body",children:U===0||d===null?l.jsx("p",{className:"notes-empty",children:Kt("notes.empty")}):l.jsx(uE,{note:d,notes:t,closing:w===d.noteId,focusRequest:a,onConfirmClose:b,onCancelClose:()=>k(null),onOpenImage:f,onSend:n===null?null:()=>n(d.noteId),sendTargetCwd:i},d.noteId)})]}):l.jsxs("div",{className:"strip-collapsed-row",children:[l.jsxs("button",{className:"strip-collapsed",onClick:I,title:S("notes.expand"),children:[l.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),l.jsx("span",{children:S("notes.name")}),U>0&&l.jsx("span",{className:"strip-collapsed-count",children:U})]}),g!==void 0&&l.jsx($l,{title:S("settings.hide.notes"),onHide:g,confirmText:null})]}),L!==null&&l.jsx("div",{className:"notes-lightbox",onClick:()=>f(null),title:S("notes.lightboxClose"),children:typeof F=="string"?l.jsx("img",{src:F,alt:S("notes.imageAlt")}):l.jsx("span",{className:"notes-lightbox-missing",children:S("notes.imageUnavailable")})})]})}function aE(){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 cE(){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 uE({note:t,notes:n,closing:i,focusRequest:c,onConfirmClose:g,onCancelClose:T,onOpenImage:C,onSend:r,sendTargetCwd:u}){const _=N.useRef(null),[v,h]=N.useState(!1),w=t.text.trim().length===0&&t.images.length===0;N.useEffect(()=>{var f;c>0&&((f=_.current)==null||f.focus())},[c]);const k=N.useCallback(f=>{const a=Array.from(f).filter(p=>p.type.startsWith("image/"));for(const p of a)n.addImage(t.noteId,p);return a.length>0},[n,t.noteId]),L=N.useCallback(f=>{f.clipboardData!==null&&k(f.clipboardData.files)&&f.preventDefault()},[k]);return l.jsxs("div",{className:`note-editor${v?" note-editor-dragging":""}`,onDragOver:f=>{Array.from(f.dataTransfer.types).includes("Files")&&(f.preventDefault(),h(!0))},onDragLeave:()=>h(!1),onDrop:f=>{f.preventDefault(),h(!1),k(f.dataTransfer.files)},children:[i&&l.jsxs("div",{className:"note-closing",children:[l.jsx("span",{children:S("notes.closeConfirm")}),l.jsx("button",{className:"link-button link-danger",onClick:g,children:S("common.close")}),l.jsx("button",{className:"link-button",onClick:T,children:S("common.cancel")})]}),n.problem!==null&&l.jsxs("div",{className:"composer-problem",children:[l.jsx("span",{children:n.problem}),l.jsx("button",{className:"icon-button",onClick:n.dismissProblem,title:S("common.close"),children:"×"})]}),l.jsx("textarea",{ref:_,className:"note-input",value:t.text,placeholder:S("notes.placeholder"),onChange:f=>n.updateText(t.noteId,f.target.value),onPaste:L,spellCheck:!1}),t.images.length>0&&l.jsx("div",{className:"note-images",children:t.images.map(f=>l.jsx(hE,{image:f,src:n.images[f.imageId],onRequest:n.requestImage,onOpen:()=>C(f.imageId),onRemove:()=>n.removeImage(t.noteId,f.imageId)},f.imageId))}),l.jsxs("div",{className:"note-footer",children:[l.jsx("span",{className:"note-meta",children:es(t.updatedAt)}),l.jsx("span",{className:"composer-spacer"}),l.jsx("button",{className:"icon-button",onClick:()=>r==null?void 0:r(),disabled:r===null||w,title:Qw(r!==null,u,w),children:l.jsx(cE,{})}),l.jsxs("label",{className:"icon-button note-attach",title:S("notes.attach"),children:[l.jsx(aE,{}),l.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:f=>{f.target.files!==null&&k(f.target.files),f.target.value=""}})]})]})]})}function hE({image:t,src:n,onRequest:i,onOpen:c,onRemove:g}){return N.useEffect(()=>{n===void 0&&i(t.imageId)},[n,t.imageId,i]),l.jsxs("figure",{className:"chip chip-image note-thumb",title:fn(t.bytes),children:[typeof n=="string"?l.jsx("img",{src:n,alt:S("notes.imageAlt"),onClick:c}):l.jsx("span",{className:"note-thumb-placeholder",children:n===null?S("notes.thumbMissing"):"…"}),l.jsx("button",{className:"chip-remove",onClick:g,title:S("notes.removeImage"),children:"×"})]})}function Fg(){const t=ao(),n=Gb(),[i,c]=N.useState(null),g=N.useCallback(()=>c(null),[]),T=N.useRef(null),C=_=>{Vb(_).catch(()=>{})},r=[{label:S("header.locale.auto",{name:Oc[Wb()]}),checked:n==="auto",onSelect:()=>C("auto")},...Mu.map(_=>({label:Oc[_],lang:_,checked:n===_,onSelect:()=>C(_)}))],u=Oc[t];return l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:T,className:"icon-button locale-button",onClick:_=>{const v=_.currentTarget.getBoundingClientRect();c(h=>h===null?{x:v.left,y:v.bottom+4}:null)},title:n==="auto"?S("header.locale.titleAuto",{name:u}):S("header.locale.title",{name:u}),"aria-haspopup":"menu","aria-expanded":i!==null,children:hw[t]}),i!==null&&l.jsx(wu,{x:i.x,y:i.y,items:r,onClose:g,anchor:T.current})]})}function dE({onKey:t}){return l.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":S("narrow.keys.label"),children:a1.map(n=>l.jsx("button",{className:"narrow-key",onPointerDown:i=>i.preventDefault(),onClick:()=>t(n.data),title:S(n.titleKey),children:n.label},n.id))})}function fE({banners:t,status:n,statusLabel:i,terminals:c,activeTerminalId:g,activity:T,agents:C,offerAgentChoice:r,newTabAgent:u,canOpen:_,newTabBlockedTitle:v,onSelectTab:h,onCloseTab:w,onRenameTab:k,onNewTab:L,drawer:f,drawerOpen:a,onDrawerChange:p,menu:m,view:d,views:x,onViewChange:I,badges:E,chat:M,panel:b,notes:R,console:D,onTerminalKey:B}){const[O,F]=N.useState(null),U=c.find(j=>j.terminalId===g)??null,q=j=>{var $;return(($=C.find(H=>H.id===j.agent))==null?void 0:$.statusLine)??null};N.useEffect(()=>{if(!a&&O===null)return;const j=$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),O!==null?F(null):p(!1))};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[a,O,p]);const X=N.useRef({sheet:O,drawerOpen:a,view:d,onDrawerChange:p,onViewChange:I});X.current={sheet:O,drawerOpen:a,view:d,onDrawerChange:p,onViewChange:I},N.useEffect(()=>{const j=window;return j[Nf]=()=>{const $=X.current;switch(f1({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 F(null),!0;case"close-drawer":return $.onDrawerChange(!1),!0;case"show-chat":return $.onViewChange("chat"),!0;case null:return!1}},()=>{delete j[Nf]}},[]);const Y=N.useRef(null);N.useEffect(()=>{var j;(j=Y.current)==null||j.scrollIntoView({block:"nearest",inline:"nearest"})},[d]);const V=j=>{const $=j==="git"?E.changes:j==="plans"?E.plans:j==="memory"?E.memory:0;return $>0?l.jsx("span",{className:"side-panel-badge",children:$}):j==="cli"&&E.cliUnseen&&d!=="cli"?l.jsx("span",{className:"narrow-view-dot",title:S("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:()=>p(!0),title:S("narrow.projects"),"aria-label":S("narrow.projects"),children:"☰"}),l.jsxs("button",{className:"narrow-current",onClick:()=>F("tabs"),title:S("narrow.tabs.open"),children:[U===null?l.jsx("span",{className:"app-name",children:"Agent Workbench"}):l.jsxs(l.Fragment,{children:[l.jsx(Bu,{terminal:U,activity:T.get(U.terminalId),statusLine:q(U)}),l.jsx("span",{className:"project-swatch",style:{background:wr(U.cwd)}}),l.jsx("span",{className:"narrow-current-label",children:ro(U)})]}),l.jsx("span",{className:"narrow-caret","aria-hidden":"true",children:"▾"})]}),n!=="open"&&l.jsx("span",{className:`status status-${n}`,children:i}),l.jsx("button",{className:"icon-button narrow-icon",onClick:()=>F("menu"),title:S("narrow.more"),"aria-label":S("narrow.more"),children:"⋮"})]}),t,l.jsxs("div",{className:"narrow-body",children:[l.jsx("nav",{className:"narrow-views",role:"tablist",children:x.map(j=>l.jsxs("button",{ref:j===d?Y:null,role:"tab","aria-selected":j===d,className:`narrow-view-tab${j===d?" narrow-view-active":""}`,onClick:()=>I(j),children:[l.jsx("span",{children:S(r1(j))}),V(j)]},j))}),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:R}),l.jsx("div",{className:`narrow-pane${d==="console"?"":" narrow-pane-hidden"}`,children:D})]}),B!==null&&l.jsx(dE,{onKey:B})]}),a&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>p(!1),children:l.jsx("div",{className:"narrow-drawer",onClick:j=>j.stopPropagation(),children:f})}),O==="tabs"&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>F(null),children:l.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":S("narrow.tabs.open"),onClick:j=>j.stopPropagation(),children:[l.jsx(pE,{terminals:c,activeTerminalId:g,activity:T,statusLineOf:q,onSelect:j=>{h(j),F(null)},onClose:w,onRename:k}),l.jsx(ju,{className:"narrow-sheet-new",text:S("narrow.tabs.new"),title:v??S("narrow.tabs.new"),disabled:!_||v!==null,offerAgentChoice:r,agents:C,agent:u,onOpen:j=>{L(j),F(null)}})]})}),O==="menu"&&l.jsx("div",{className:"narrow-backdrop",onClick:()=>F(null),children:l.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":S("narrow.more"),onClick:j=>j.stopPropagation(),children:l.jsx(gE,{menu:m,status:n,statusLabel:i,onClose:()=>F(null)})})})]})}function pE({terminals:t,activeTerminalId:n,activity:i,statusLineOf:c,onSelect:g,onClose:T,onRename:C}){const[r,u]=N.useState(null),[_,v]=N.useState(""),h=N.useRef(null);N.useEffect(()=>{var k;r!==null&&((k=h.current)==null||k.select())},[r]);const w=()=>{r!==null&&C(r,_.trim()),u(null)};return t.length===0?l.jsx("p",{className:"narrow-sheet-empty",children:S("narrow.tabs.none")}):l.jsx("ul",{className:"narrow-tabs",children:t.map(k=>{const L=r===k.terminalId;return l.jsxs("li",{className:`narrow-tab-row${k.terminalId===n?" narrow-tab-active":""}`,style:{"--tab-project-color":wr(k.cwd)},children:[L?l.jsx("input",{ref:h,className:"narrow-tab-input",value:_,onChange:f=>v(f.target.value),onBlur:w,onKeyDown:f=>{f.key==="Enter"&&w(),f.key==="Escape"&&(f.stopPropagation(),u(null))}}):l.jsxs("button",{className:"narrow-tab-select",onClick:()=>g(k.terminalId),children:[l.jsx(Bu,{terminal:k,activity:i.get(k.terminalId),statusLine:c(k)}),l.jsx("span",{className:"narrow-tab-label",children:ro(k)})]}),l.jsx("button",{className:"icon-button",onClick:()=>{u(k.terminalId),v(k.label.length>0?k.label:ro(k))},title:S("narrow.tabs.rename"),children:"✎"}),l.jsx("button",{className:"icon-button",onClick:()=>T(k.terminalId),title:S("narrow.tabs.close"),children:"×"})]},k.terminalId)})})}function mE({choice:t}){const n=[{source:"system",label:S("narrow.menu.chimeSystem")},{source:"page",label:S("narrow.menu.chimePage")}];return l.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":S("narrow.menu.sound"),children:n.map(({source:i,label:c})=>l.jsx("button",{className:`narrow-chime-option${t.source===i?" is-on":""}`,"aria-pressed":t.source===i,onClick:()=>t.setSource(i),children:c},i))})}function gE({menu:t,status:n,statusLabel:i,onClose:c}){return l.jsxs("div",{className:"narrow-menu",children:[l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.connection")}),l.jsx("span",{className:`status status-${n}`,children:i}),$m(navigator.userAgent)&&l.jsxs(l.Fragment,{children:[l.jsx("a",{className:"link-button",href:d1,onClick:c,children:S("narrow.menu.phoneAppDisconnect")}),l.jsx("a",{className:"link-button",href:h1,onClick:c,children:S("narrow.menu.phoneAppSettings")})]})]}),t.cwd!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.folder")}),l.jsx("span",{className:"narrow-menu-value",title:t.cwd,children:t.cwd})]}),t.cliVersion!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.cli")}),l.jsx("span",{className:"narrow-menu-value",title:t.cliVersion,children:t.cliVersion})]}),t.remoteClient&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("app.header.remoteBadge")}),l.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:S("app.header.remoteBadgeTitle")})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.theme")}),l.jsx("button",{className:"icon-button",onClick:t.onCycleTheme,title:t.themeTitle,children:t.themeIcon})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.language")}),l.jsx(Fg,{})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.sound")}),t.sound.phoneChime===null?l.jsx(jg,{sound:t.sound}):l.jsx(mE,{choice:t.sound.phoneChime})]}),t.sound.notify.supported&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.notifications")}),l.jsx(Pg,{notify:t.sound.notify})]}),t.remote!==null&&l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("app.header.remoteAccess")}),l.jsx("button",{className:`icon-button${t.remote.active?" icon-button-on":""}`,onClick:()=>{var g;c(),(g=t.remote)==null||g.onOpen()},title:t.remote.title,children:"⇄"})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("narrow.menu.shortcuts")}),l.jsx("button",{className:"icon-button",onClick:()=>{c(),t.onShortcuts()},title:S("app.header.shortcuts"),children:"?"})]}),l.jsxs("div",{className:"narrow-menu-row",children:[l.jsx("span",{className:"narrow-menu-label",children:S("settings.title")}),l.jsx("button",{className:"icon-button",onClick:()=>{c(),t.onSettings()},title:S("settings.open"),"aria-label":S("settings.open"),children:"⚙"})]})]})}function _E(){const t=window.location.search,n=new URLSearchParams(t).get(ou),i=n!==null&&n.length>0?n:null,c=o1(t);return i===null&&c===null?{token:i,tab:c}:(window.history.replaceState(null,"",`${window.location.pathname}${l1(t,[ou,Fm])}`),{token:i,tab:c})}const Hg=_E(),Pp=Hg.token,vE=Hg.tab,ru=new Set;function wE(t){const[n,i]=N.useState(null),[c,g]=N.useState(null),[T,C]=N.useState(ru),[r,u]=N.useState(null);N.useEffect(()=>{const a=t.onMessage(m=>{switch(m.type){case"vault.status":i(m.status);break;case"vault.exported":C(d=>{if(!d.has(m.projectKey))return d;const x=new Set(d);return x.delete(m.projectKey),x}),u({projectKey:m.projectKey,sessions:m.sessions,at:Date.now()});break;case"error":if(m.code!=="vault-failed")break;g(Pt(m.text)),m.detail!==void 0&&console.error("[servidor]",m.detail),C(ru);break}}),p=t.onReopen(()=>C(ru));return()=>{a(),p()}},[t]);const _=N.useCallback(()=>{g(null),t.send({type:"vault.measure"})},[t]),v=N.useCallback(a=>{g(null),t.send({type:"vault.enable",enabled:a})},[t]),h=N.useCallback(a=>{g(null),t.send({type:"vault.setDir",pickerId:a})},[t]),w=N.useCallback(a=>{g(null),C(p=>new Set(p).add(a)),t.send({type:"vault.exportProject",projectKey:a})},[t]),k=N.useCallback((a,p)=>{g(null),t.send({type:"vault.openSession",agent:a,sessionId:p})},[t]),L=N.useCallback(()=>{g(null),t.send({type:"vault.reveal"})},[t]),f=N.useCallback(()=>g(null),[]);return{status:n,problem:c,exporting:T,lastExported:r,measure:_,setEnabled:v,chooseDir:h,exportProject:w,openSession:k,reveal:L,dismissProblem:f}}function yE(t){return S("summary.outdatedServer",{server:t,page:Xr})}function bE(t){const[n,...i]=t;if(n===void 0||n.missingMessage===null)return null;const c=Pt(n.missingMessage);return i.length===0?c:`${c}
139
- ${S("summary.alsoWorksWith",{names:i.map(g=>g.label).join(", ")})}`}function SE(t){const n=t.version??"?";return n.toLowerCase().includes(t.label.toLowerCase())?n:`${t.label} ${n}`}function CE(t,n,i=Xr){var C,r;if(n&&i<Xr)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:yE(i),environmentNotice:null};if(n&&i>Xr)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:S("summary.newerServer",{server:i,page:Xr}),environmentNotice:null};const c=t.filter(u=>u.available);let g=null;c.length===1?g=((C=c[0])==null?void 0:C.version)??null:c.length>1&&(g=c.map(SE).join(" · "));const T=n&&c.length===0;return{cliAvailable:!n||c.length>0,cliVersion:g,cliMissingMessage:T?bE(t):null,environmentNotice:((r=t.find(u=>u.environmentNotice!==null))==null?void 0:r.environmentNotice)??null}}const xE=500,kE=8e3;class EE{constructor(){It(this,"socket",null);It(this,"status","connecting");It(this,"attempt",0);It(this,"closedByUs",!1);It(this,"hasConnectedOnce",!1);It(this,"reconnectTimer");It(this,"messageHandlers",new Set);It(this,"statusHandlers",new Set);It(this,"reopenHandlers",new Set);It(this,"outbox",[])}getStatus(){return this.status}onMessage(n){return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}onStatus(n){return this.statusHandlers.add(n),()=>this.statusHandlers.delete(n)}onReopen(n){return this.reopenHandlers.add(n),()=>this.reopenHandlers.delete(n)}connect(){if(this.socket!==null)return;const n=new URL(V0,window.location.href);n.protocol=window.location.protocol==="https:"?"wss:":"ws:",Pp!==null&&n.searchParams.set(ou,Pp);const i=new WebSocket(n);this.socket=i,i.onopen=()=>{for(this.attempt=0,this.setStatus("open");this.outbox.length>0;){const c=this.outbox.shift();c!==void 0&&i.send(_f(c))}if(this.hasConnectedOnce)for(const c of this.reopenHandlers)c();this.hasConnectedOnce=!0},i.onmessage=c=>{const g=J0(c.data);if(g===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const T of this.messageHandlers)T(g)},i.onclose=c=>{if(this.socket=null,!this.closedByUs){if(c.code===I0){this.setStatus("revoked");return}this.setStatus("reconnecting"),this.scheduleReconnect()}},i.onerror=()=>{}}send(n){return this.socket!==null&&this.socket.readyState===WebSocket.OPEN?(this.socket.send(_f(n)),!0):(n.type!=="input"&&n.type!=="resize"&&this.outbox.push(n),!1)}close(){var n;this.closedByUs=!0,window.clearTimeout(this.reconnectTimer),(n=this.socket)==null||n.close(),this.socket=null}setStatus(n){if(this.status!==n){this.status=n;for(const i of this.statusHandlers)i(n)}}scheduleReconnect(){if(this.attempt+=1,!this.hasConnectedOnce&&this.attempt>4){this.setStatus("failed");return}const n=Math.min(xE*2**(this.attempt-1),kE);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),n)}}const ku="agent-workbench.activeTab";function LE(){try{return window.sessionStorage.getItem(ku)}catch{return null}}const TE={state:"idle",scannedFiles:0,totalFiles:0};function RE(t,n,i){const c=new Map(i?[]:t.map(g=>[g.key,g]));for(const g of n)c.set(g.key,g);return[...c.values()].sort((g,T)=>T.lastActivityAt-g.lastActivityAt)}function ME(){const t=N.useMemo(()=>new EE,[]),n=N.useMemo(()=>new Ky({send:(xe,be)=>t.send({type:"composer.draft",terminalId:xe,draft:be}),connected:()=>t.getStatus()==="open",setTimer:(xe,be)=>window.setTimeout(xe,be),clearTimer:xe=>window.clearTimeout(xe),newId:()=>crypto.randomUUID()}),[t]),[i,c]=N.useState("connecting"),[g,T]=N.useState([]),[C,r]=N.useState(null),[u,_]=N.useState(!1),[v,h]=N.useState(Xr),[w,k]=N.useState(""),[L,f]=N.useState(""),[a,p]=N.useState(null),[m,d]=N.useState(!1),[x,I]=N.useState(!1),[E,M]=N.useState([]),[b,R]=N.useState([]),[D,B]=N.useState(TE),[O,F]=N.useState(LE);N.useEffect(()=>{try{O===null?window.sessionStorage.removeItem(ku):window.sessionStorage.setItem(ku,O)}catch{}},[O]);const[U,q]=N.useState(new Set),[X,Y]=N.useState(new Map),[V,j]=N.useState(new Map),$=N.useRef(new Map),H=N.useRef(new Map),[K,te]=N.useState(new Set),[re,le]=N.useState(null),[de,G]=N.useState([]),[z,Q]=N.useState(new Map),[Z,ae]=N.useState([]),fe=N.useRef(1),[Ee,Ae]=N.useState(new Set),ze=N.useRef(new Set),ue=N.useRef(new Map),Me=N.useRef(new Map),he=N.useCallback(xe=>{const be=Me.current.get(xe);be!==void 0&&(clearTimeout(be),Me.current.delete(xe)),G(tt=>tt.some(Ce=>Ce.requestId===xe)?tt.filter(Ce=>Ce.requestId!==xe):tt)},[]),Te=N.useCallback(()=>{for(const xe of Me.current.values())clearTimeout(xe);Me.current.clear(),G(xe=>xe.length===0?xe:[])},[]);N.useEffect(()=>{const xe=t.onStatus(Ce=>{c(Ce),Ce==="failed"&&le({message:S("workspace.connectFailed"),at:Date.now()})}),be=t.onMessage(Ce=>{switch(Ce.type){case"agents":T(Ce.agents),r(Ce.defaultAgent);break;case"hello":T(Ce.agents),r(Ce.defaultAgent),_(!0),h(Ce.protocolVersion),k(Ce.platform),f(Ce.defaultCwd),p(Ce.shellName),d(Ce.remoteClient),I(Ce.fileCheck);break;case"terminal.list":{M(Ce.terminals),n.retain(Ce.terminals.map(Qe=>Qe.terminalId));const rt=by(H.current,Ce.terminals),St=rt.finished.length>0||[...rt.phases].some(([Qe,ht])=>H.current.get(Qe)!==ht);H.current=rt.phases,St&&te(new Set(rt.phases.keys())),q(Qe=>{if(Qe.size===0)return Qe;const ht=new Set(Qe);for(const Ot of Qe){if(rt.phases.has(Ot))continue;const Nt=Ce.terminals.find(Tn=>Tn.terminalId===Ot);(Nt===void 0||Nt.alive)&&ht.delete(Ot)}return ht.size===Qe.size?Qe:ht}),j(Qe=>{if(Qe.size===0)return Qe;const ht=new Map([...Qe].filter(([Ot])=>Ce.terminals.some(Nt=>Nt.terminalId===Ot)));return ht.size===Qe.size?Qe:($.current=ht,ht)});const gt=Ce.terminals.filter(Qe=>Qe.kind==="agent");F(Qe=>{var ht;return Qe!==null&&gt.some(Ot=>Ot.terminalId===Qe)?Qe:((ht=gt[0])==null?void 0:ht.terminalId)??null}),Q(Qe=>{if(Qe.size===0)return Qe;const ht=new Map(Qe);for(const Ot of Qe.keys())Ce.terminals.some(Nt=>Nt.terminalId===Ot)||ht.delete(Ot);return ht.size===Qe.size?Qe:ht}),Ae(Qe=>{if(Qe.size===0)return Qe;const ht=new Set([...Qe].filter(Ot=>Ce.terminals.some(Nt=>Nt.terminalId===Ot)));return ht.size===Qe.size?Qe:ht});break}case"session.continued":Q(rt=>new Map(rt).set(Ce.terminalId,{sourceAgent:Ce.source.agent,includedTurns:Ce.includedTurns,totalTurns:Ce.totalTurns,totalTurnsIsMinimum:Ce.totalTurnsIsMinimum,delivery:Ce.delivery,prefillReason:null}));break;case"composer.prefill":{const rt=fe.current;fe.current+=1,ae(gt=>[...gt,{id:rt,terminalId:Ce.terminalId,text:Ce.text}]);const{reason:St}=Ce;if(St==="returned-by-cli"){Ae(gt=>gt.has(Ce.terminalId)?gt:new Set(gt).add(Ce.terminalId));break}Q(gt=>{const Qe=gt.get(Ce.terminalId);return Qe===void 0?gt:new Map(gt).set(Ce.terminalId,{...Qe,delivery:"prefilled",prefillReason:St})});break}case"composer.drafts":n.restore(Ce.drafts);break;case"terminal.opened":{he(Ce.requestId),ze.current.delete(Ce.requestId)&&Ce.terminal.kind==="agent"&&F(Ce.terminal.terminalId);const rt=ue.current.get(Ce.requestId);rt!==void 0&&(ue.current.delete(Ce.requestId),rt(Ce.terminal));break}case"terminal.activity":Y(rt=>rt.get(Ce.terminalId)===Ce.activity?rt:new Map(rt).set(Ce.terminalId,Ce.activity)),j(rt=>{const St=Ce.offlineReason??null;if((rt.get(Ce.terminalId)??null)===St)return rt;const gt=new Map(rt);return St===null?gt.delete(Ce.terminalId):gt.set(Ce.terminalId,St),$.current=gt,gt});break;case"index.status":B(Ce.status);break;case"index.projects":R(rt=>RE(rt,Ce.projects,Ce.replace));break;case"error":if(Yx(Ce.requestId)){Ce.detail!==void 0&&console.error("[servidor]",Ce.detail);break}if(Ce.code==="vault-failed"||Ce.code==="search-failed"||Ce.code==="remote-failed"||Ce.code==="settings-failed")break;le({message:Pt(Ce.text),at:Date.now()}),q(rt=>rt.size===0?rt:new Set),H.current.size>0&&(H.current=new Map,te(new Set)),Ce.detail!==void 0&&console.error("[servidor]",Ce.detail),Ce.requestId!==void 0&&(ze.current.delete(Ce.requestId),ue.current.delete(Ce.requestId),he(Ce.requestId));break}}),tt=t.onReopen(()=>{Te(),q(Ce=>Ce.size===0?Ce:new Set),H.current.size>0&&(H.current=new Map,te(new Set))});return t.connect(),()=>{xe(),be(),tt(),t.close()}},[t,n,he,Te]),N.useEffect(()=>{const xe=t.onReopen(()=>n.reconnected()),be=()=>n.flushAll(),tt=()=>{document.visibilityState==="hidden"&&n.flushAll()};return window.addEventListener("pagehide",be),document.addEventListener("visibilitychange",tt),()=>{xe(),window.removeEventListener("pagehide",be),document.removeEventListener("visibilitychange",tt)}},[t,n]),N.useEffect(()=>Te,[Te]);const ge=N.useCallback(xe=>{const be=crypto.randomUUID();ze.current.add(be),xe.onOpened!==void 0&&ue.current.set(be,xe.onOpened),G(Ce=>[...Ce,{requestId:be,cwd:xe.cwd,agent:xe.agent??null,label:xe.label??"",at:Date.now()}]);const tt=setTimeout(()=>he(be),Cy);Me.current.set(be,tt),t.send({type:"terminal.open",requestId:be,cwd:xe.cwd,...xe.resumeSessionId!==void 0?{resumeSessionId:xe.resumeSessionId}:{},...xe.label!==void 0?{label:xe.label}:{},...xe.agent!==void 0?{agent:xe.agent}:{}})},[t,he]),Re=N.useCallback(xe=>{t.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:xe,kind:"shell"})},[t]),Ue=N.useCallback(xe=>t.send({type:"terminal.close",terminalId:xe}),[t]),ke=N.useCallback(xe=>{q(be=>new Set(be).add(xe)),$.current.get(xe)==="server-closed"&&(H.current=new Map(H.current).set(xe,"waiting-exit"),te(new Set(H.current.keys()))),t.send({type:"terminal.wake",terminalId:xe})},[t]),Ne=N.useCallback((xe,be)=>t.send({type:"terminal.rename",terminalId:xe,label:be}),[t]),st=N.useCallback(xe=>t.send({type:"tabs.reorder",terminalIds:xe}),[t]),ot=N.useCallback((xe,be)=>t.send({type:"session.archive",sessionIds:xe,archived:be}),[t]),wt=N.useCallback((xe,be,tt)=>{const Ce=crypto.randomUUID();ze.current.add(Ce),t.send({type:"session.continue",requestId:Ce,agent:xe.agent,sessionId:xe.sessionId,target:be,label:tt})},[t]),ct=N.useCallback(xe=>{Q(be=>{if(!be.has(xe))return be;const tt=new Map(be);return tt.delete(xe),tt})},[]),bt=N.useCallback(xe=>{Ae(be=>{if(!be.has(xe))return be;const tt=new Set(be);return tt.delete(xe),tt})},[]),Pe=N.useCallback(xe=>{ae(be=>be.some(tt=>tt.id===xe)?be.filter(tt=>tt.id!==xe):be)},[]),Ze=N.useCallback(()=>t.send({type:"index.refresh"}),[t]),qe=N.useCallback(()=>t.send({type:"agents.refresh"}),[t]),et=N.useCallback(()=>le(null),[]),Gt=N.useMemo(()=>E.filter(xe=>xe.kind==="agent"),[E]),pt=N.useMemo(()=>E.filter(xe=>xe.kind==="shell"),[E]),it=ao(),pe=N.useMemo(()=>CE(g,u,v),[g,u,v,it]),Ke=N.useCallback(xe=>{var be;return(xe===null||(be=g.find(tt=>tt.id===xe))==null?void 0:be.capabilities)??Zp},[g]),Xe=N.useMemo(()=>Lu(g),[g]);return{connection:t,status:i,agents:g,defaultAgent:C,capabilitiesFor:Ke,offerAgentChoice:Xe,cliAvailable:pe.cliAvailable,cliVersion:pe.cliVersion,cliMissingMessage:pe.cliMissingMessage,platform:w,defaultCwd:L,environmentNotice:pe.environmentNotice,shellName:a,remoteClient:m,fileCheck:x,terminals:Gt,shells:pt,pendingOpens:de,activeTerminalId:O,projects:b,indexStatus:D,error:re,dismissError:et,setActiveTerminal:F,openTerminal:ge,openShell:Re,closeTerminal:Ue,wakeTerminal:ke,waking:U,activity:X,offlineReasons:V,relaunching:K,renameTerminal:Ne,reorderTabs:st,refreshIndex:Ze,refreshAgents:qe,archiveSessions:ot,continueSession:wt,handoffs:z,dismissHandoff:ct,returnedMessages:Ee,dismissReturned:bt,prefills:Z,prefillApplied:Pe,drafts:n}}const Hu=["git","files","plans","memory","console","notes"],Op="agent-workbench.hiddenPanels";function AE(t){return Hu.includes(t)}const NE=new Set(["memory"]),DE="none";function IE(t){return new Set(t.split(",").map(n=>n.trim()).filter(AE))}function jE(t){const n=Hu.filter(i=>t.has(i));return n.length===0?DE:n.join(",")}function PE(t,n,i){const c=new Set(t);return i?c.delete(n):c.add(n),c}function OE(){const[t,n]=N.useState(()=>xt(Op,NE,IE)),i=N.useCallback((g,T)=>{n(C=>{const r=PE(C,g,T);return vt(Op,jE(r)),r})},[]),c=N.useCallback(g=>!t.has(g),[t]);return{hidden:t,isVisible:c,setVisible:i}}const BE={git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",console:"console.name",notes:"notes.name"},FE={dark:"settings.terminalTheme.dark",follow:"settings.terminalTheme.follow"};function HE(t,n,i){const c=t.filter(g=>g!==n);return i?[...c,n]:c}function $E(t,n){return t.length===n.length&&t.every(i=>n.includes(i))}function UE({onClose:t,terminalTheme:n,panels:i,consoleCount:c,onHideConsole:g,appSettings:T,agents:C,remoteClient:r,onOpenVault:u,onOpenRemote:_}){const[v,h]=N.useState(!1),w=T.status,k=w!==null&&!r,[L,f]=N.useState(null),[a,p]=N.useState(null);N.useEffect(()=>{f(null),p(null)},[w,T.problem]);const m=L??(w==null?void 0:w.consoleShell)??"auto",d=a??(w==null?void 0:w.disabledAgents)??[];N.useEffect(()=>{const b=R=>{R.key==="Escape"&&(R.preventDefault(),R.stopPropagation(),t())};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[t]);const x=(b,R)=>{if(b==="console"&&!R&&c>0){h(!0);return}i.setVisible(b,R)},I=(w==null?void 0:w.consoleShells.find(b=>b.id!=="git-bash"&&b.id!=="zsh"))??null,E=w!==null&&!$E(w.disabledAgents,w.disabledAtStart),M=w===null?[]:[{id:"auto",label:I===null?S("settings.console.auto"):S("settings.console.autoWith",{shell:I.label})},...w.consoleShells];return l.jsx("div",{className:"modal-backdrop",onClick:t,children:l.jsxs("div",{className:"modal settings-dialog",role:"dialog","aria-label":S("settings.title"),onClick:b=>b.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:S("settings.title")}),l.jsx("button",{className:"icon-button",onClick:t,title:S("common.closeEsc"),children:"×"})]}),l.jsxs("div",{className:"modal-body settings-body",children:[l.jsx("h3",{className:"modal-section",children:S("settings.section.appearance")}),l.jsxs("div",{className:"settings-row",children:[l.jsx("span",{className:"settings-label",children:S("settings.language")}),l.jsx(Fg,{})]}),l.jsxs("div",{className:"settings-row settings-row-top",children:[l.jsx("span",{className:"settings-label",children:S("settings.terminalTheme")}),l.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":S("settings.terminalTheme"),children:[["dark","follow"].map(b=>l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"radio",name:"terminal-theme",checked:n.preference===b,onChange:()=>n.setPreference(b)}),S(FE[b])]},b)),l.jsx("p",{className:"modal-hint",children:S("settings.terminalTheme.hint")})]})]}),l.jsx("h3",{className:"modal-section",children:S("settings.section.panels")}),l.jsx("div",{className:"settings-panels",children:Hu.map(b=>l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"checkbox",checked:i.isVisible(b),onChange:R=>x(b,R.target.checked)}),S(BE[b])]},b))}),v&&l.jsxs("div",{className:"settings-confirm",role:"alert",children:[l.jsx("span",{children:S("settings.panels.consoleConfirm",{count:c})}),l.jsx("button",{className:"link-button",onClick:()=>{h(!1),g()},children:S("settings.panels.consoleConfirmYes")}),l.jsx("button",{className:"link-button",onClick:()=>h(!1),children:S("common.cancel")})]}),l.jsx("p",{className:"modal-hint",children:S("settings.panels.cliAlways")}),w===null?l.jsx("p",{className:"modal-hint",children:S("settings.oldServer")}):l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("settings.section.console")}),w.consoleShells.length===0?l.jsx("p",{className:"modal-hint",children:S("console.noShell")}):l.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":S("settings.section.console"),children:[M.map(b=>l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"radio",name:"console-shell",checked:m===b.id,disabled:!k,onChange:()=>{f(b.id),T.setConsoleShell(b.id)}}),b.label]},b.id)),l.jsx("p",{className:"modal-hint",children:S("settings.console.hint")})]}),l.jsx("h3",{className:"modal-section",children:S("settings.section.clis")}),l.jsx("ul",{className:"settings-clis",children:C.map(b=>{const R=d.includes(b.id),D=w.disabledAtStart.includes(b.id),B=b.available||D;return l.jsxs("li",{className:"settings-cli",children:[B?l.jsxs("label",{className:"settings-choice",children:[l.jsx("input",{type:"checkbox",checked:!R,disabled:!k,onChange:O=>{const F=HE(d,b.id,!O.target.checked);p(F),T.setDisabledAgents(F)}}),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??"":S(D?"settings.cli.disabled":"settings.cli.notInstalled")}),!B&&l.jsx("a",{className:"link-button",href:b.installUrl,target:"_blank",rel:"noreferrer noopener",children:S("settings.cli.install")})]},b.id)})}),l.jsx("p",{className:"modal-hint",children:S("settings.cli.hint")}),E&&l.jsx("p",{className:"settings-restart",children:S("settings.cli.restart")}),r&&l.jsx("p",{className:"modal-hint",children:S("settings.hostOnly")}),T.problem!==null&&l.jsxs("p",{className:"settings-problem",role:"alert",children:[T.problem,l.jsx("button",{className:"link-button",onClick:T.dismissProblem,children:S("common.close")})]})]}),(u!==null||_!==null)&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("settings.section.more")}),l.jsxs("div",{className:"settings-row settings-more",children:[u!==null&&l.jsx("button",{className:"primary-button primary-button-small",onClick:u,children:S("settings.more.open",{name:ni()})}),_!==null&&l.jsx("button",{className:"primary-button primary-button-small",onClick:_,children:S("settings.more.open",{name:S("app.header.remoteAccess")})})]})]})]})]})})}function WE(t){const[n,i]=N.useState(null),[c,g]=N.useState(null);N.useEffect(()=>t.onMessage(u=>{switch(u.type){case"settings.status":i(u.settings),g(null);break;case"error":if(u.code!=="settings-failed")break;g(Pt(u.text)),u.detail!==void 0&&console.error("[servidor]",u.detail);break}}),[t]);const T=N.useCallback(u=>t.send({type:"settings.update",consoleShell:u}),[t]),C=N.useCallback(u=>t.send({type:"settings.update",disabledAgents:u}),[t]),r=N.useCallback(()=>g(null),[]);return{status:n,problem:c,setConsoleShell:T,setDisabledAgents:C,dismissProblem:r}}function zE({status:t,agents:n,indexReady:i,problem:c,covered:g,onMeasure:T,onSetEnabled:C,onChangeDir:r,onReveal:u,onDismissProblem:_,onClose:v}){return N.useEffect(()=>{if(g)return;const h=w=>{w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),v())};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[g,v]),l.jsx("div",{className:"modal-backdrop",onClick:v,children:l.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":ni(),onClick:h=>h.stopPropagation(),children:[l.jsxs("header",{className:"modal-header",children:[l.jsx("span",{className:"modal-title",children:ni()}),t!==null&&l.jsx("span",{className:`vault-state${t.enabled?" vault-state-on":""}`,children:uC(t)}),l.jsx("button",{className:"icon-button",onClick:v,title:S("common.closeEsc"),children:"×"})]}),l.jsxs("div",{className:"modal-body",children:[l.jsx("p",{className:"vault-lead",children:iC()}),l.jsx("p",{className:"modal-hint",children:oC()}),t===null?l.jsx("p",{className:"modal-hint",children:S("vault.dialog.waiting")}):l.jsx(VE,{status:t,agents:n,indexReady:i,onMeasure:T,onSetEnabled:C,onChangeDir:r,onReveal:u}),c!==null&&l.jsxs("div",{className:"vault-problem",role:"alert",children:[l.jsx("span",{children:c}),l.jsx("button",{className:"icon-button",onClick:_,title:S("common.dismissNotice"),children:"×"})]})]})]})})}function VE({status:t,agents:n,indexReady:i,onMeasure:c,onSetEnabled:g,onChangeDir:T,onReveal:C}){const r=pC(t,i),u=mC(t),_=fC(t),v=t.measurement===null?null:vC(t.measurement,n),h=t.progress;return l.jsxs(l.Fragment,{children:[t.enabled&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("vault.dialog.inFolder")}),l.jsxs("p",{className:"vault-summary",children:[yg(t.sessions)," · ",fn(t.bytes),t.lastPassAt!==null&&l.jsxs(l.Fragment,{children:[" · ",S("vault.dialog.lastPass",{when:es(t.lastPassAt)})]}),t.pending>0&&l.jsxs(l.Fragment,{children:[" · ",S("vault.dialog.pendingCalm",{count:t.pending})]})]})]}),h!==null&&h.total>0&&l.jsx("progress",{className:"vault-progress",value:h.done,max:h.total}),l.jsx("h3",{className:"modal-section",children:S("vault.dialog.sizeSection")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"link-button vault-measure",onClick:c,disabled:r!==null,title:r??S("vault.dialog.measureTitle"),children:t.state==="measuring"?S("vault.state.measuring"):S(v===null?"vault.dialog.measure":"vault.dialog.measureAgain")}),v!==null&&l.jsx("span",{className:"modal-hint",children:v.summary})]}),v!==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:S("vault.dialog.table.sessions")}),l.jsx("th",{children:S("vault.dialog.table.size")}),l.jsx("th",{children:S("vault.dialog.table.images")}),l.jsx("th",{title:S("vault.dialog.table.archivedTitle"),children:S("vault.dialog.table.archived")})]})}),l.jsxs("tbody",{children:[v.rows.map(w=>l.jsxs("tr",{children:[l.jsxs("td",{children:[w.label,w.note!==null&&l.jsx("span",{className:"vault-table-note",children:w.note})]}),l.jsx("td",{children:w.sessions}),l.jsx("td",{children:fn(w.bytes)}),l.jsx("td",{title:w.images>0?fn(w.imageBytes):void 0,children:w.images}),l.jsx("td",{children:w.skippedArchived})]},w.agent)),l.jsxs("tr",{children:[l.jsx("td",{children:S("vault.dialog.table.memory",{count:v.memoryProjects})}),l.jsx("td",{}),l.jsx("td",{children:fn(v.memoryBytes)}),l.jsx("td",{}),l.jsx("td",{})]})]}),l.jsx("tfoot",{children:l.jsxs("tr",{children:[l.jsx("td",{children:S("vault.dialog.table.total")}),l.jsx("td",{children:v.total.sessions}),l.jsx("td",{children:fn(v.total.bytes)}),l.jsx("td",{children:v.total.images}),l.jsx("td",{children:v.total.skippedArchived})]})})]})}),l.jsxs("div",{className:"vault-actions vault-switch",children:[_==="enabled"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"link-button",onClick:()=>g(!1),children:S("vault.dialog.turnOff")}),l.jsx("span",{className:"modal-hint",children:S("vault.dialog.turnOffHint")})]}),(_==="measured"||_==="existing")&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"primary-button",onClick:()=>g(!0),title:S(_==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:S("vault.dialog.activate")}),l.jsx("span",{className:"modal-hint",children:S(_==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),_==="needs-measure"&&l.jsx("span",{className:"modal-hint",children:S("vault.dialog.needsMeasure",{activate:S("vault.dialog.activate")})})]}),l.jsx("h3",{className:"modal-section",children:S("vault.dialog.folderSection")}),l.jsx("p",{className:"vault-dir",title:t.dir,children:t.dir}),t.isDefaultDir&&l.jsx("p",{className:"modal-hint",children:S("vault.dialog.defaultDir")}),l.jsxs("div",{className:"vault-actions",children:[l.jsx("button",{className:"link-button",onClick:T,disabled:u!==null,title:u??S("vault.dialog.changeDirTitle"),children:S("vault.dialog.changeDir")}),C!==null&&l.jsx("button",{className:"link-button",onClick:C,title:S("vault.dialog.openFolderTitle"),children:S("vault.dialog.openFolder")})]}),t.previousDir!==null&&l.jsx("p",{className:"modal-hint",children:gC(t.previousDir)}),t.lastError!==null&&l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"modal-section",children:S("vault.dialog.lastError")}),l.jsx("p",{className:"vault-error",children:Pt(t.lastError)})]})]})}const Bp={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},Fp=320,qE=1400,KE=640,Hp=200,$p=560,GE=270,YE=120,XE=720,QE=260,Up="agent-workbench.panel-width",Wp="agent-workbench.panel-visible",zp="agent-workbench.panel-tab",iu="agent-workbench.panel-expanded",Vp="agent-workbench.sidebar-visible",qp="agent-workbench.sidebar-width",Kp="agent-workbench.console-visible",Gp="agent-workbench.console-height",Yp="agent-workbench.marker-notice-dismissed",Xp="agent-workbench.hidden-hint-shown";function JE(){var Io,jo;const t=ao(),n=ME(),{connection:i,status:c,agents:g,defaultAgent:T,capabilitiesFor:C,offerAgentChoice:r,cliAvailable:u,cliVersion:_,cliMissingMessage:v,platform:h,defaultCwd:w,environmentNotice:k,shellName:L,terminals:f,archiveSessions:a,shells:p,pendingOpens:m,activeTerminalId:d,projects:x,indexStatus:I,error:E,dismissError:M,setActiveTerminal:b,openTerminal:R,openShell:D,closeTerminal:B,wakeTerminal:O,waking:F,activity:U,offlineReasons:q,relaunching:X,renameTerminal:Y,reorderTabs:V,refreshIndex:j,refreshAgents:$,continueSession:H,handoffs:K,dismissHandoff:te,returnedMessages:re,dismissReturned:le,prefills:de,prefillApplied:G,drafts:z,remoteClient:Q,fileCheck:Z}=n,ae=sk(),fe=ok(ae.resolved),Ee=N.useMemo(()=>({nameOf:se=>xk(f.find(ye=>ye.terminalId===se)),activate:b}),[f,b]),Ae=Tk(U,Ee),ze=Rk(),ue=f.find(se=>se.terminalId===d)??null,Me=N.useCallback(se=>{se!==d&&M(),b(se)},[d,M,b]),he=(ue==null?void 0:ue.agent)??null,Te=C(he),ge=N.useMemo(()=>Tw(Te),[Te]),Re=g.find(se=>se.id===he)??null,Ue=N.useMemo(()=>{if(ue===null||he===null)return null;for(const se of x){const ye=se.sessions.find(lt=>lt.agent===he&&lt.sessionId===ue.sessionId);if(ye!==void 0)return Zn(ye.title,ye.titleSource)}return null},[ue,he,x,t]),ke=N.useMemo(()=>xw(f,x.flatMap(se=>se.sessions)),[f,x]),Ne=(Re==null?void 0:Re.statusLine)??null,st=(ue==null?void 0:ue.cwd)??w,ot=N.useMemo(()=>r?Zw(f,st,h,g,T):null,[r,f,st,h,g,T]),wt=N.useMemo(()=>Ef(m,st,h),[m,st,h]),ct=wt?Am():null,bt=Zx(i),Pe=wE(i),[Ze,qe]=N.useState(!1),et=Ik(i),[Gt,pt]=N.useState(!1),it=A1(),pe=OE(),[Ke,Xe]=N.useState(!1),xe=N.useCallback(()=>Xe(!1),[]),[be,tt]=N.useState(()=>xt(Mf,"chat",e1)),Ce=N.useMemo(()=>t1({hasTab:ue!==null,plansAvailable:ge.plansAvailable,hidden:pe.hidden}),[ue,ge.plansAvailable,pe.hidden]),rt=n1(be,Ce),St=N.useCallback(se=>{tt(se),vt(Mf,se)},[]),gt=N.useRef(vE);N.useEffect(()=>{if(gt.current!==null)return i.onMessage(se=>{if(se.type!=="terminal.list"||gt.current===null)return;const ye=gt.current;gt.current=null,se.terminals.some(lt=>lt.terminalId===ye&&lt.kind==="agent")&&b(ye)})},[i,b]);const Qe=yx(i),ht=LS(g,Pe.status),[Ot,Nt]=N.useState(null),Tn=N.useRef(0),ns=N.useCallback(se=>{Nt(ye=>ye!==null&&ye.seq===se?null:ye)},[]),ii=(se,ye)=>{const lt=$S(se,{projects:x,terminals:f,platform:h,canResume:as=>Sf(g,as)}),Kn=()=>{ye.length!==0&&(Tn.current+=1,Nt({query:ye,seq:Tn.current}))};switch(lt.kind){case"activate":Me(lt.terminalId),Kn();break;case"resume":lt.session.archived&&a([lt.session.sessionId],!1),R({cwd:lt.cwd,resumeSessionId:lt.session.sessionId,agent:lt.session.agent,label:Zn(lt.session.title,lt.session.titleSource)}),Kn();break;case"copy":Pe.openSession(se.agent,se.sessionId);break}},ss=N.useMemo(()=>new Set(f.map(se=>se.sessionId).filter(se=>se.length>0)),[f]),[pn,rs]=N.useState(()=>xt(Wp,!0,se=>se==="true")),[vs,Ks]=N.useState(()=>xt(zp,"cli",se=>se==="git"||se==="files"||se==="cli"||se==="plans"||se==="memory"?se:se==="conversation"?"cli":null)),[me,je]=N.useState(()=>xt(Up,KE,se=>{const ye=Number.parseInt(se,10);return Number.isFinite(ye)?Math.max(ye,Fp):null})),[Ve,_t]=N.useState(()=>xt(iu,!1,se=>se==="true")),[ut,mn]=N.useState(()=>xt(Vp,!0,se=>se==="true")),[Rn,ws]=N.useState(()=>xt(qp,GE,se=>{const ye=Number.parseInt(se,10);return Number.isFinite(ye)?Math.min($p,Math.max(Hp,ye)):null})),[uo,ho]=N.useState(()=>xt(Kp,!1,se=>se==="true")),[fo,Jl]=N.useState(()=>xt(Gp,QE,se=>{const ye=Number.parseInt(se,10);return Number.isFinite(ye)?ye:null})),[Rt,Zl]=N.useState(()=>xt(Yp,!0,se=>se!=="true")),[oi,yr]=N.useState(!1),ys=WE(i),[ea,bs]=N.useState(!1),is=ys.status!==null?ys.status.shellName:L,[gn,po]=N.useState(null),[_n,li]=N.useState(!1);N.useEffect(()=>{Ne===null&&li(!1)},[Ne]);const[ai,Ss]=N.useState(null),$n=pn&&ue!==null,os=Hw(vs,ge.plansAvailable,pe.hidden),Un=uo&&pe.isVisible("console"),Mn=ue!==null?pn||Un:pn,ci=Ve&&ue!==null,bn=N.useMemo(()=>ue===null?[]:p.filter(se=>se.cwd===ue.cwd),[p,ue]),[ui,hi]=N.useState(null),Wn=bn.find(se=>se.terminalId===ui)??bn[0]??null,zn=rt==="cli"?d:rt==="console"?(Wn==null?void 0:Wn.terminalId)??null:null,ta=N.useCallback(se=>{zn!==null&&i.send({type:"input",terminalId:zn,data:se})},[i,zn]),Ft=cS(i,d),dt=Ak(i,U),di=it?ue!==null:$n,mo=it?rt==="files":$n&&os==="files",br=Gx(i,di?d:null),go=wx(i,mo?d:null),fi=bx(i,d),pi=Px(i,f,d),Gs=Jx(i,di?d:null),Sr=it?rt==="cli":$n&&os==="cli",An=Ft.usage.lastModel,Nn=Ew(Ft.events,Ft.usage.lastEffort,(ue==null?void 0:ue.launchedAt)??null),Dn=An??Ft.defaults.model,Cs=Nn??Ft.defaults.effort,Ys=An===null&&Dn!==null,Vn=Nn===null&&Cs!==null,_o=_x(i,d,Sr),Cr=d===null?null:U.get(d)??null,xs=gy(Te,Ft.openToolCall,(Re==null?void 0:Re.label)??null,(ue==null?void 0:ue.alive)??!1,Cr),mi=_y({offlineReason:d===null?null:q.get(d)??null,alive:(ue==null?void 0:ue.alive)??!1,relaunching:d!==null&&X.has(d)}),xr=mi===null?null:vy((Re==null?void 0:Re.label)??null),kr=xr??xs??Sy(Te,Ft.waitingFor,(ue==null?void 0:ue.alive)??!1),vo=!Jp(Te,Cr),na=N.useMemo(()=>Rm(g,he),[g,he]),ks=ue!==null&&fy(he,ue.sessionId,Te),rn=d===null?null:K.get(d)??null,Er=(rn===null?null:{text:ly(lo(rn.sourceAgent,g),rn.includedTurns,rn.totalTurns,rn.totalTurnsIsMinimum),status:rn.prefillReason!==null?uy(rn.prefillReason):rn.delivery==="sending"&&Ft.events.length===0?ay():null})??(d!==null&&re.has(d)?{text:cy((Re==null?void 0:Re.label)??null),status:null}:null),wo=N.useCallback(se=>{te(se),le(se)},[te,le]),Es=N.useCallback(()=>{rs(se=>{const ye=!se;return vt(Wp,String(ye)),ye})},[]),Lr=N.useCallback(()=>{mn(se=>{const ye=!se;return vt(Vp,String(ye)),ye})},[]),Qs=N.useCallback(()=>{ho(se=>{const ye=!se;return vt(Kp,String(ye)),ye})},[]),Js=N.useCallback(se=>{Ks(se),vt(zp,se)},[]),yo=N.useCallback(()=>{_t(se=>{const ye=!se;return vt(iu,String(ye)),ye})},[]),qn=N.useCallback(()=>{d!==null&&i.send({type:"input",terminalId:d,data:"\x1B\x1B"})},[i,d]),gi=N.useCallback(se=>{d!==null&&i.send({type:"input",terminalId:d,data:`${se} `})},[i,d]),ls=N.useRef(null),bo=N.useCallback(se=>{var ye;return(ye=ls.current)==null?void 0:ye.call(ls,se,!it)},[it]),Zs=se=>{if(pi.files.open({key:se,title:se.split("/").pop()??se}),it){St("files");return}$n||Es(),Js("files")},er=N.useRef(Zs);er.current=Zs;const So=N.useCallback(se=>er.current(se),[]),tn=N.useMemo(()=>f.map(se=>se.terminalId),[f]),Ls=Kx({connection:i,enabled:Z&&pe.isVisible("files"),terminalId:d,cwd:(ue==null?void 0:ue.cwd)??"",platform:h,events:Ft.events,liveTerminalIds:tn,onOpen:So}),_i=N.useCallback(se=>{d!==null&&i.send({type:"agent.submit",terminalId:d,text:se,images:[],keepDraft:!0})},[i,d]),tr=N.useCallback(se=>{d!==null&&i.send({type:"files.reveal",terminalId:d,path:se})},[i,d]),Ts=N.useRef(new Set);N.useEffect(()=>{const se=db(Ts.current,{consoleShown:Un,cwd:(ue==null?void 0:ue.cwd)??null,shellCwds:p.map(ye=>ye.cwd)});Ts.current=se.requested,se.open!==null&&D(se.open)},[Un,ue,p,D]);const vi=N.useCallback(se=>{const ye=bn.find(lt=>lt.terminalId===se);ye!==void 0&&(Ts.current=Vf(Ts.current,ye.cwd)),B(se)},[bn,B]),nr=N.useCallback(se=>{if(se==="console")for(const ye of p)B(ye.terminalId);pe.setVisible(se,!1),!xt(Xp,!1,ye=>ye==="true")&&(vt(Xp,"true"),po(se))},[p,B,pe]),sr=N.useCallback(()=>{for(const se of p)B(se.terminalId);pe.setVisible("console",!1)},[p,B,pe]),rr=N.useRef(new Set);N.useEffect(()=>{const se=bn.filter(lt=>!rr.current.has(lt.terminalId));for(const lt of bn)rr.current.add(lt.terminalId);const ye=se[se.length-1];ye!==void 0&&hi(ye.terminalId)},[bn]);const Co=N.useCallback(()=>{ue!==null&&(Ts.current=Vf(Ts.current,ue.cwd),D(ue.cwd))},[ue,D]),sa=Pl({min:Fp,max:qE,value:me,measure:N.useCallback(se=>window.innerWidth-se.clientX,[]),onChange:je,onCommit:N.useCallback(se=>vt(Up,String(se)),[]),onStart:N.useCallback(()=>{_t(!1),vt(iu,"false")},[])}),ra=Pl({min:Hp,max:$p,value:Rn,measure:N.useCallback(se=>se.clientX,[]),onChange:ws,onCommit:N.useCallback(se=>vt(qp,String(se)),[])}),xo=N.useRef(0),wi=Pl({min:YE,max:XE,value:fo,measure:N.useCallback(se=>Math.round(xo.current-se.clientY),[]),onChange:Jl,onCommit:N.useCallback(se=>vt(Gp,String(se)),[]),onStart:N.useCallback(se=>{const ye=se.currentTarget.nextElementSibling;xo.current=ye===null?window.innerHeight:se.clientY+ye.getBoundingClientRect().height},[])}),ia=N.useCallback(()=>{Zl(!1),vt(Yp,"true")},[]),yi=N.useCallback(se=>{if(f.length===0)return;const lt=(f.findIndex(as=>as.terminalId===d)+se+f.length)%f.length,Kn=f[lt];Kn!==void 0&&Me(Kn.terminalId)},[f,d,Me]),ko=N.useRef(null),bi=N.useRef(null);N.useEffect(()=>{d!==bi.current&&(ko.current=bi.current,bi.current=d)},[d]);const Eo=N.useCallback(()=>{const se=ko.current;se===null||se===d||f.some(ye=>ye.terminalId===se)&&Me(se)},[d,f,Me]);N.useEffect(()=>{const se=ye=>{if(ye.key!=="Tab"||!ye.shiftKey||ye.altKey||ye.ctrlKey||ye.metaKey)return;const lt=document.activeElement;lt instanceof Element&&lt.closest(".xterm")!==null||(ye.preventDefault(),ye.stopPropagation(),Eo())};return window.addEventListener("keydown",se,!0),()=>window.removeEventListener("keydown",se,!0)},[Eo]),N.useEffect(()=>{const se=ye=>{if(!ye.altKey||ye.ctrlKey||ye.metaKey)return;const lt=ye.key.toLowerCase();if(lt==="t"){u&&w.length>0&&!wt&&(ye.preventDefault(),ye.stopPropagation(),R({cwd:(ue==null?void 0:ue.cwd)??w}));return}if(lt==="w"){d!==null&&(ye.preventDefault(),ye.stopPropagation(),B(d));return}if(lt==="p"){ye.preventDefault(),ye.stopPropagation(),Es();return}if(lt==="arrowright"||lt==="pagedown"){ye.preventDefault(),ye.stopPropagation(),yi(1);return}(lt==="arrowleft"||lt==="pageup")&&(ye.preventDefault(),ye.stopPropagation(),yi(-1))};return window.addEventListener("keydown",se,!0),()=>window.removeEventListener("keydown",se,!0)},[ue,d,u,B,yi,w,wt,R,Es]);const Lo=ue===null?S("app.panel.name"):ue.label.length>0?ue.label:ue.cwd.split(/[\\/]/).filter(se=>se.length>0).pop()??ue.cwd,To=l.jsx(EC,{projects:x,indexStatus:I,disabled:!u,onOpenProject:(se,ye)=>{xe(),R({cwd:se,...ye!==void 0?{agent:ye}:{}})},agents:g,offerAgentChoice:r,agentForProject:se=>ey(f,se,h,g,T),onOpenSession:(se,ye)=>{xe(),R({cwd:se,resumeSessionId:ye.sessionId,agent:ye.agent,label:Zn(ye.title,ye.titleSource)})},canResume:se=>Sf(g,se),platform:h,onRefresh:j,openSessionIds:ss,openBlocked:se=>Ef(m,se,h),onArchive:a,onHide:it?xe:Lr,width:Rn,onNewProject:()=>{xe(),Ss("project")},vault:Pe.status,onOpenVault:()=>{xe(),qe(!0)},onOpenVaultSession:Q?null:se=>Pe.openSession(se.agent,se.sessionId),onExportProject:Q?null:Pe.exportProject,exporting:Pe.exporting,lastExported:Pe.lastExported,onContinueSession:(se,ye)=>{xe(),H({agent:se.agent,sessionId:se.sessionId},ye,xf(Zn(se.title,se.titleSource)))},globalSearch:ht?{...Qe,vaultEnabled:((Io=Pe.status)==null?void 0:Io.enabled)===!0}:null,onOpenSearchHit:(se,ye)=>{xe(),ii(se,ye)}}),Ro=l.jsx("div",{className:"chat-stack",children:f.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx("p",{children:S("app.empty.noTabs")}),l.jsx("p",{className:"empty-hint",children:S("app.empty.hint")}),u&&w.length>0&&l.jsx("button",{className:"primary-button",onClick:()=>R({cwd:w}),disabled:wt,title:ct??void 0,children:wt?S("app.empty.opening"):S("app.empty.newSession",{cwd:w})})]}):l.jsx(dS,{view:Ft,terminalId:d,threadFont:ze,fileLinks:Ls,onRewind:ge.rewind&&(ue==null?void 0:ue.alive)===!0?qn:void 0,questionsAnswerable:ge.questionsAnswerable,contextWindowSource:ge.contextWindowSource,instructionsFile:Lw(he),onGoToCli:()=>{if(it){St("cli");return}$n||Es(),Js("cli")},cliPresence:ue===null||ue.alive?"live":ue.sleeping?"sleeping":"exited",exitCode:(ue==null?void 0:ue.exitCode)??null,waking:d!==null&&F.has(d),onWakeCli:()=>{d!==null&&O(d)},discovering:ks,continueTargets:na,continueBlockedReason:oy((ue==null?void 0:ue.sessionId)??"",ks,Ft.events.length>0),onContinue:ue===null||he===null?void 0:se=>H({agent:he,sessionId:ue.sessionId},se,xf(Ue??ue.label)),searchRequest:Ot,onSearchRequestApplied:ns,toolCallNotice:xs,serverClosed:mi===null||xr===null?null:{state:mi,text:xr},statusLineState:(Ne==null?void 0:Ne.state)??null,onConfigureStatusLine:Ne===null?void 0:()=>li(!0),activity:Cr,receipt:d===null?null:dt.receipts.get(d)??null,clock:d===null?null:dt.clocks.get(d)??null})}),Mo=l.jsx(l.Fragment,{children:ue!==null&&l.jsx(H1,{connection:i,drafts:z,terminalId:d,alive:ue.alive,sleeping:ue.sleeping,projectColor:wr(ue.cwd),activity:U.get(ue.terminalId),imagesAllowed:ge.imagesAllowed,blockedReason:kr,prefills:de,onPrefillApplied:G,notice:Er,onDismissNotice:d===null?void 0:()=>wo(d),onSubmitted:(se,ye,lt)=>{wo(se);const{events:Kn}=Ft,as=se===d?Kn[Kn.length-1]:void 0;dt.track(se,ye,(as==null?void 0:as.eventId)??null,lt)},fontSize:ze.size,insertRef:ls,leading:ge.modeCycle===null?void 0:l.jsx(My,{mode:Ft.permissionMode,cycle:ge.modeCycle,disabled:!ue.alive,waitingFor:Ft.waitingFor,statusKnown:vo,onChange:Ft.setPermissionMode}),controls:ge.models===null&&ge.efforts===null?void 0:l.jsx(Ry,{models:ge.models,efforts:ge.efforts,model:Dn,effort:Cs,modelProvisional:Ys,effortProvisional:Vn,savesChoice:kw(he),effortCommandName:bw(he),disabled:!ue.alive,onCommand:_i})})}),Ao=ue===null?null:l.jsx(dx,{tab:it?Af(rt)??os:os,plansAvailable:ge.plansAvailable,hiddenTabs:pe.hidden,hidden:it?Af(rt)===null:!pn,onTabChange:it?St:Js,title:Lo,cwd:ue.cwd,platform:h,cli:l.jsx("div",{className:"terminal-stack",children:f.map(se=>l.jsx(Xm,{terminalId:se.terminalId,connection:i,active:se.terminalId===d,theme:fe.resolved,autoFocus:!1},se.terminalId))}),cliUnseen:_o,expanded:Ve,onToggleExpanded:yo,git:br,files:go,plans:fi,documents:pi,memory:Gs,onInsert:ge.fileMentions&&ue.alive?gi:void 0,onInsertPath:bo,onReveal:Q?null:tr,onHide:Es}),Tr=ue===null?null:l.jsx(hb,{connection:i,shells:bn,activeShellId:(Wn==null?void 0:Wn.terminalId)??null,cwd:ue.cwd,shellName:is,theme:fe.resolved,onSelect:hi,onOpen:Co,onCloseShell:vi,onCollapse:it?()=>St("chat"):Qs,onHide:it?void 0:()=>nr("console"),hideCount:p.length}),No=pe.isVisible("notes")?l.jsx(lE,{notes:bt,fill:it||ue===null,onHide:it?void 0:()=>nr("notes"),onSendNote:ue===null||!ge.noteSendable?null:se=>{const ye=ue.cwd;R({cwd:ye,...ue.agent!==null?{agent:ue.agent}:{},onOpened:lt=>{i.send({type:"notes.send",noteId:se,terminalId:lt.terminalId}),it&&St("chat")}})},sendTargetCwd:(ue==null?void 0:ue.cwd)??null}):null,oa=ue===null||!pe.isVisible("console")?null:l.jsx(l.Fragment,{children:Un?l.jsxs(l.Fragment,{children:[pn&&l.jsx("div",{className:"hdivider",...wi,title:S("app.divider.consoleHeight")}),l.jsx("div",{className:"console-slot",style:pn?{height:`${fo}px`}:{flex:"1 1 auto"},children:Tr})]}):l.jsxs("div",{className:"strip-collapsed-row",children:[l.jsxs("button",{className:"strip-collapsed",onClick:Qs,title:is===null?S("console.openAnyIn",{cwd:ue.cwd}):S("console.openIn",{shell:is,cwd:ue.cwd}),children:[l.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),l.jsx("span",{children:is??S("console.name")}),bn.length>0&&l.jsx("span",{className:"strip-collapsed-count",children:bn.length})]}),l.jsx($l,{title:S("settings.hide.console"),onHide:()=>nr("console"),confirmText:p.length===0?null:S("settings.panels.consoleConfirm",{count:p.length})})]})}),Do=l.jsxs(l.Fragment,{children:[c==="revoked"&&l.jsx("div",{className:"banner banner-error",children:S("app.banner.revoked")}),gn!==null&&l.jsxs("div",{className:"banner banner-notice",children:[l.jsx("span",{children:S("settings.hiddenHint",{name:S(gn==="console"?"console.name":"notes.name")})}),l.jsx("button",{className:"banner-close",onClick:()=>po(null),title:S("common.gotIt"),children:"×"})]}),!u&&v!==null&&l.jsx("div",{className:"banner banner-error banner-lines",children:v}),k==="child-session-marker"&&Rt&&l.jsxs("div",{className:"banner banner-notice",children:[l.jsx("span",{children:Kt("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),l.jsx("button",{className:"banner-close",onClick:ia,title:S("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:S("common.close"),children:"×"})]}),Pe.problem!==null&&!Ze&&l.jsxs("div",{className:"banner banner-error",children:[l.jsx("span",{children:Pe.problem}),l.jsx("button",{className:"banner-close",onClick:Pe.dismissProblem,title:S("common.close"),children:"×"})]}),l.jsx(QS,{})]}),Si=l.jsxs(l.Fragment,{children:[_n&&Ne!==null&&Re!==null&&l.jsx(XS,{info:Ne,agentLabel:Re.label,onRefresh:$,onClose:()=>li(!1)}),ea&&l.jsx(UE,{onClose:()=>bs(!1),terminalTheme:fe,panels:pe,consoleCount:it?0:p.length,onHideConsole:sr,appSettings:ys,agents:g,remoteClient:Q,onOpenVault:()=>{bs(!1),qe(!0)},onOpenRemote:et.status!==null&&!Q?()=>{bs(!1),pt(!0)}:null}),oi&&l.jsx(KS,{agent:$w(he,g,T),onClose:()=>yr(!1)}),ai==="project"&&l.jsx(rp,{connection:i,title:S("app.picker.project.title"),confirmLabel:S("app.picker.project.confirm"),confirmTitle:se=>S("app.picker.project.confirmTitle",{path:se}),onChoose:(se,ye)=>{Ss(null),R({cwd:ye})},onClose:()=>Ss(null)}),Ze&&l.jsx(zE,{status:Pe.status,agents:g,indexReady:I.state==="ready",problem:Pe.problem,covered:ai==="vault",onMeasure:Pe.measure,onSetEnabled:Pe.setEnabled,onChangeDir:()=>Ss("vault"),onReveal:Q?null:Pe.reveal,onDismissProblem:Pe.dismissProblem,onClose:()=>qe(!1)}),Gt&&et.status!==null&&!Q&&l.jsx(nE,{status:et.status,pairing:et.pairing,phonePairing:et.phonePairing,phoneStarted:et.phoneStarted,problem:et.problem,platform:h,onSetEnabled:et.setEnabled,onSetPort:et.setPort,onStartPairing:et.startPairing,onCancelPairing:et.cancelPairing,onStartPhonePairing:et.startPhonePairing,onCancelPhonePairing:et.cancelPhonePairing,onRenameDevice:et.renameDevice,onRevokeDevice:et.revokeDevice,onDismissProblem:et.dismissProblem,onClose:()=>pt(!1)}),ai==="vault"&&l.jsx(rp,{connection:i,title:S("app.picker.vault.title"),confirmLabel:S("app.picker.vault.confirm"),confirmTitle:se=>S("app.picker.vault.confirmTitle",{path:se}),onChoose:se=>{Pe.chooseDir(se),Ss(null)},onClose:()=>Ss(null)})]});return it?l.jsxs("div",{className:"app app-narrow",children:[l.jsx(fE,{banners:Do,status:c,statusLabel:S(Bp[c]),terminals:f,activeTerminalId:d,activity:U,agents:g,offerAgentChoice:r,newTabAgent:ot,canOpen:u&&w.length>0,newTabBlockedTitle:ct,onSelectTab:Me,onCloseTab:B,onRenameTab:Y,onNewTab:se=>R({cwd:st,...se!==void 0?{agent:se}:{}}),drawer:To,drawerOpen:Ke,onDrawerChange:Xe,menu:{cwd:(ue==null?void 0:ue.cwd)??null,cliVersion:_,themeIcon:Cp[ae.preference],themeTitle:Sp(ae.preference),onCycleTheme:ae.cycle,sound:Ae,remote:et.status!==null&&!Q?{title:`${S("app.header.remoteAccess")} — ${xu(et.status.state,et.status.port)}`,active:Ap(et.status),onOpen:()=>pt(!0)}:null,remoteClient:Q,onShortcuts:()=>yr(!0),onSettings:()=>bs(!0)},view:rt,views:Ce,onViewChange:St,badges:{changes:kg(br.status),plans:fi.plans.length,memory:((jo=Gs.status)==null?void 0:jo.installed)===!0?Gs.status.notes.length:0,cliUnseen:_o},chat:l.jsxs(l.Fragment,{children:[Ro,Mo]}),panel:Ao,notes:No,console:Tr,onTerminalKey:zn===null?null:ta}),Si]}):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-${c}`,children:S(Bp[c])}),ue!==null&&l.jsx("span",{className:"meta",title:ue.cwd,children:ue.cwd}),l.jsx("span",{className:"header-spacer"}),_!==null&&l.jsx("span",{className:"meta meta-dim",children:S("app.header.cliVersion",{version:_})}),l.jsx("button",{className:"icon-button",onClick:ae.cycle,title:Sp(ae.preference),children:Cp[ae.preference]}),l.jsx(jg,{sound:Ae}),l.jsx(Pg,{notify:Ae.notify}),et.status!==null&&!Q&&l.jsx("button",{className:`icon-button${Ap(et.status)?" icon-button-on":""}`,onClick:()=>pt(!0),title:`${S("app.header.remoteAccess")} — ${xu(et.status.state,et.status.port)}`,children:"⇄"}),Q&&l.jsx("span",{className:"remote-badge",title:S("app.header.remoteBadgeTitle"),children:S("app.header.remoteBadge")}),l.jsx("button",{className:"icon-button",onClick:()=>bs(!0),title:S("settings.open"),"aria-label":S("settings.open"),children:"⚙"}),l.jsx("button",{className:"icon-button",onClick:()=>yr(!0),title:S("app.header.shortcuts"),children:"?"})]}),Do,l.jsxs("div",{className:"app-body",children:[!ut&&l.jsxs("button",{className:"panel-peek panel-peek-left",onClick:Lr,title:S("app.sidebar.show"),children:[l.jsx("span",{className:"panel-peek-arrow",children:"»"}),l.jsx("span",{className:"panel-peek-label",children:S("app.sidebar.name")})]}),ut&&To,ut&&l.jsx("div",{className:"divider",...ra,title:S("app.divider.width")}),l.jsxs("main",{className:`workspace${ci&&Mn?" workspace-narrow":""}`,children:[l.jsx(gx,{terminals:f,activeTerminalId:d,activity:U,attention:Ae.attention,canOpen:u&&w.length>0,onSelect:Me,onClose:B,onRename:Y,onReorder:V,onNew:se=>R({cwd:st,...se!==void 0?{agent:se}:{}}),agents:g,offerAgentChoice:r,newTabAgent:ot,pendingOpens:m,platform:h,newTabBlockedTitle:ct,sessionTitles:ke}),Ro,Mo]}),l.jsxs(l.Fragment,{children:[!Mn&&l.jsxs("button",{className:"panel-peek",onClick:Es,title:S("app.panel.show"),children:[l.jsx("span",{className:"panel-peek-arrow",children:"«"}),l.jsx("span",{className:"panel-peek-label",children:S("app.panel.name")})]}),Mn&&l.jsx("div",{className:"divider",...sa,title:S("app.divider.width")}),l.jsxs("div",{className:`panel-slot${Mn?"":" panel-slot-collapsed"}${Mn&&ci?" panel-slot-expanded":""}`,style:Mn&&!ci?{width:`${me}px`}:void 0,children:[ue!==null&&l.jsxs(l.Fragment,{children:[Ao,oa]}),No]})]})]}),Si]})}const $g=document.getElementById("root");if($g===null)throw new Error("Falta el contenedor #root.");const ZE=nv.createRoot($g);zb().then(()=>ZE.render(l.jsx(JE,{})));export{G_ as g};