nterminal 1.2.0 → 1.2.2

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,33 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function oC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cd={exports:{}},cl={};var Kv;function cC(){if(Kv)return cl;Kv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var p in o)p!=="key"&&(c[p]=o[p])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:d,ref:o!==void 0?o:null,props:c}}return cl.Fragment=t,cl.jsx=n,cl.jsxs=n,cl}var Iv;function uC(){return Iv||(Iv=1,Cd.exports=cC()),Cd.exports}var g=uC(),xd={exports:{}},ze={};var Fv;function hC(){if(Fv)return ze;Fv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),w=Symbol.iterator;function x(T){return T===null||typeof T!="object"?null:(T=w&&T[w]||T["@@iterator"],typeof T=="function"?T:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function D(T,W,oe){this.props=T,this.context=W,this.refs=B,this.updater=oe||C}D.prototype.isReactComponent={},D.prototype.setState=function(T,W){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,W,"setState")},D.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function Z(){}Z.prototype=D.prototype;function A(T,W,oe){this.props=T,this.context=W,this.refs=B,this.updater=oe||C}var P=A.prototype=new Z;P.constructor=A,E(P,D.prototype),P.isPureReactComponent=!0;var z=Array.isArray;function K(){}var N={H:null,A:null,T:null,S:null},ae=Object.prototype.hasOwnProperty;function de(T,W,oe){var ne=oe.ref;return{$$typeof:e,type:T,key:W,ref:ne!==void 0?ne:null,props:oe}}function Te(T,W){return de(T.type,W,T.props)}function ce(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function Q(T){var W={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(oe){return W[oe]})}var X=/\/+/g;function se(T,W){return typeof T=="object"&&T!==null&&T.key!=null?Q(""+T.key):W.toString(36)}function le(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(K,K):(T.status="pending",T.then(function(W){T.status==="pending"&&(T.status="fulfilled",T.value=W)},function(W){T.status==="pending"&&(T.status="rejected",T.reason=W)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function R(T,W,oe,ne,_e){var fe=typeof T;(fe==="undefined"||fe==="boolean")&&(T=null);var xe=!1;if(T===null)xe=!0;else switch(fe){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(T.$$typeof){case e:case t:xe=!0;break;case b:return xe=T._init,R(xe(T._payload),W,oe,ne,_e)}}if(xe)return _e=_e(T),xe=ne===""?"."+se(T,0):ne,z(_e)?(oe="",xe!=null&&(oe=xe.replace(X,"$&/")+"/"),R(_e,W,oe,"",function(Ae){return Ae})):_e!=null&&(ce(_e)&&(_e=Te(_e,oe+(_e.key==null||T&&T.key===_e.key?"":(""+_e.key).replace(X,"$&/")+"/")+xe)),W.push(_e)),1;xe=0;var qe=ne===""?".":ne+":";if(z(T))for(var Me=0;Me<T.length;Me++)ne=T[Me],fe=qe+se(ne,Me),xe+=R(ne,W,oe,fe,_e);else if(Me=x(T),typeof Me=="function")for(T=Me.call(T),Me=0;!(ne=T.next()).done;)ne=ne.value,fe=qe+se(ne,Me++),xe+=R(ne,W,oe,fe,_e);else if(fe==="object"){if(typeof T.then=="function")return R(le(T),W,oe,ne,_e);throw W=String(T),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return xe}function q(T,W,oe){if(T==null)return T;var ne=[],_e=0;return R(T,ne,"","",function(fe){return W.call(oe,fe,_e++)}),ne}function $(T){if(T._status===-1){var W=T._result;W=W(),W.then(function(oe){(T._status===0||T._status===-1)&&(T._status=1,T._result=oe)},function(oe){(T._status===0||T._status===-1)&&(T._status=2,T._result=oe)}),T._status===-1&&(T._status=0,T._result=W)}if(T._status===1)return T._result.default;throw T._result}var ue=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},be={map:q,forEach:function(T,W,oe){q(T,function(){W.apply(this,arguments)},oe)},count:function(T){var W=0;return q(T,function(){W++}),W},toArray:function(T){return q(T,function(W){return W})||[]},only:function(T){if(!ce(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return ze.Activity=v,ze.Children=be,ze.Component=D,ze.Fragment=n,ze.Profiler=o,ze.PureComponent=A,ze.StrictMode=a,ze.Suspense=_,ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,ze.__COMPILER_RUNTIME={__proto__:null,c:function(T){return N.H.useMemoCache(T)}},ze.cache=function(T){return function(){return T.apply(null,arguments)}},ze.cacheSignal=function(){return null},ze.cloneElement=function(T,W,oe){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var ne=E({},T.props),_e=T.key;if(W!=null)for(fe in W.key!==void 0&&(_e=""+W.key),W)!ae.call(W,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&W.ref===void 0||(ne[fe]=W[fe]);var fe=arguments.length-2;if(fe===1)ne.children=oe;else if(1<fe){for(var xe=Array(fe),qe=0;qe<fe;qe++)xe[qe]=arguments[qe+2];ne.children=xe}return de(T.type,_e,ne)},ze.createContext=function(T){return T={$$typeof:d,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:c,_context:T},T},ze.createElement=function(T,W,oe){var ne,_e={},fe=null;if(W!=null)for(ne in W.key!==void 0&&(fe=""+W.key),W)ae.call(W,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(_e[ne]=W[ne]);var xe=arguments.length-2;if(xe===1)_e.children=oe;else if(1<xe){for(var qe=Array(xe),Me=0;Me<xe;Me++)qe[Me]=arguments[Me+2];_e.children=qe}if(T&&T.defaultProps)for(ne in xe=T.defaultProps,xe)_e[ne]===void 0&&(_e[ne]=xe[ne]);return de(T,fe,_e)},ze.createRef=function(){return{current:null}},ze.forwardRef=function(T){return{$$typeof:p,render:T}},ze.isValidElement=ce,ze.lazy=function(T){return{$$typeof:b,_payload:{_status:-1,_result:T},_init:$}},ze.memo=function(T,W){return{$$typeof:f,type:T,compare:W===void 0?null:W}},ze.startTransition=function(T){var W=N.T,oe={};N.T=oe;try{var ne=T(),_e=N.S;_e!==null&&_e(oe,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(K,ue)}catch(fe){ue(fe)}finally{W!==null&&oe.types!==null&&(W.types=oe.types),N.T=W}},ze.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},ze.use=function(T){return N.H.use(T)},ze.useActionState=function(T,W,oe){return N.H.useActionState(T,W,oe)},ze.useCallback=function(T,W){return N.H.useCallback(T,W)},ze.useContext=function(T){return N.H.useContext(T)},ze.useDebugValue=function(){},ze.useDeferredValue=function(T,W){return N.H.useDeferredValue(T,W)},ze.useEffect=function(T,W){return N.H.useEffect(T,W)},ze.useEffectEvent=function(T){return N.H.useEffectEvent(T)},ze.useId=function(){return N.H.useId()},ze.useImperativeHandle=function(T,W,oe){return N.H.useImperativeHandle(T,W,oe)},ze.useInsertionEffect=function(T,W){return N.H.useInsertionEffect(T,W)},ze.useLayoutEffect=function(T,W){return N.H.useLayoutEffect(T,W)},ze.useMemo=function(T,W){return N.H.useMemo(T,W)},ze.useOptimistic=function(T,W){return N.H.useOptimistic(T,W)},ze.useReducer=function(T,W,oe){return N.H.useReducer(T,W,oe)},ze.useRef=function(T){return N.H.useRef(T)},ze.useState=function(T){return N.H.useState(T)},ze.useSyncExternalStore=function(T,W,oe){return N.H.useSyncExternalStore(T,W,oe)},ze.useTransition=function(){return N.H.useTransition()},ze.version="19.2.6",ze}var qv;function yp(){return qv||(qv=1,xd.exports=hC()),xd.exports}var S=yp();const gi=oC(S);var Ed={exports:{}},ul={},Td={exports:{}},kd={};var Wv;function dC(){return Wv||(Wv=1,(function(e){function t(R,q){var $=R.length;R.push(q);e:for(;0<$;){var ue=$-1>>>1,be=R[ue];if(0<o(be,q))R[ue]=q,R[$]=be,$=ue;else break e}}function n(R){return R.length===0?null:R[0]}function a(R){if(R.length===0)return null;var q=R[0],$=R.pop();if($!==q){R[0]=$;e:for(var ue=0,be=R.length,T=be>>>1;ue<T;){var W=2*(ue+1)-1,oe=R[W],ne=W+1,_e=R[ne];if(0>o(oe,$))ne<be&&0>o(_e,oe)?(R[ue]=_e,R[ne]=$,ue=ne):(R[ue]=oe,R[W]=$,ue=W);else if(ne<be&&0>o(_e,$))R[ue]=_e,R[ne]=$,ue=ne;else break e}}return q}function o(R,q){var $=R.sortIndex-q.sortIndex;return $!==0?$:R.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var _=[],f=[],b=1,v=null,w=3,x=!1,C=!1,E=!1,B=!1,D=typeof setTimeout=="function"?setTimeout:null,Z=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function P(R){for(var q=n(f);q!==null;){if(q.callback===null)a(f);else if(q.startTime<=R)a(f),q.sortIndex=q.expirationTime,t(_,q);else break;q=n(f)}}function z(R){if(E=!1,P(R),!C)if(n(_)!==null)C=!0,K||(K=!0,Q());else{var q=n(f);q!==null&&le(z,q.startTime-R)}}var K=!1,N=-1,ae=5,de=-1;function Te(){return B?!0:!(e.unstable_now()-de<ae)}function ce(){if(B=!1,K){var R=e.unstable_now();de=R;var q=!0;try{e:{C=!1,E&&(E=!1,Z(N),N=-1),x=!0;var $=w;try{t:{for(P(R),v=n(_);v!==null&&!(v.expirationTime>R&&Te());){var ue=v.callback;if(typeof ue=="function"){v.callback=null,w=v.priorityLevel;var be=ue(v.expirationTime<=R);if(R=e.unstable_now(),typeof be=="function"){v.callback=be,P(R),q=!0;break t}v===n(_)&&a(_),P(R)}else a(_);v=n(_)}if(v!==null)q=!0;else{var T=n(f);T!==null&&le(z,T.startTime-R),q=!1}}break e}finally{v=null,w=$,x=!1}q=void 0}}finally{q?Q():K=!1}}}var Q;if(typeof A=="function")Q=function(){A(ce)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,se=X.port2;X.port1.onmessage=ce,Q=function(){se.postMessage(null)}}else Q=function(){D(ce,0)};function le(R,q){N=D(function(){R(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ae=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(R){switch(w){case 1:case 2:case 3:var q=3;break;default:q=w}var $=w;w=q;try{return R()}finally{w=$}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(R,q){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var $=w;w=R;try{return q()}finally{w=$}},e.unstable_scheduleCallback=function(R,q,$){var ue=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?ue+$:ue):$=ue,R){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=$+be,R={id:b++,callback:q,priorityLevel:R,startTime:$,expirationTime:be,sortIndex:-1},$>ue?(R.sortIndex=$,t(f,R),n(_)===null&&R===n(f)&&(E?(Z(N),N=-1):E=!0,le(z,$-ue))):(R.sortIndex=be,t(_,R),C||x||(C=!0,K||(K=!0,Q()))),R},e.unstable_shouldYield=Te,e.unstable_wrapCallback=function(R){var q=w;return function(){var $=w;w=q;try{return R.apply(this,arguments)}finally{w=$}}}})(kd)),kd}var Yv;function fC(){return Yv||(Yv=1,Td.exports=dC()),Td.exports}var Dd={exports:{}},Si={};var Vv;function pC(){if(Vv)return Si;Vv=1;var e=yp();function t(_){var f="https://react.dev/errors/"+_;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)f+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+_+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(_,f,b){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:v==null?null:""+v,children:_,containerInfo:f,implementation:b}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(_,f){if(_==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Si.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Si.createPortal=function(_,f){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return c(_,f,null,b)},Si.flushSync=function(_){var f=d.T,b=a.p;try{if(d.T=null,a.p=2,_)return _()}finally{d.T=f,a.p=b,a.d.f()}},Si.preconnect=function(_,f){typeof _=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,a.d.C(_,f))},Si.prefetchDNS=function(_){typeof _=="string"&&a.d.D(_)},Si.preinit=function(_,f){if(typeof _=="string"&&f&&typeof f.as=="string"){var b=f.as,v=p(b,f.crossOrigin),w=typeof f.integrity=="string"?f.integrity:void 0,x=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;b==="style"?a.d.S(_,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:v,integrity:w,fetchPriority:x}):b==="script"&&a.d.X(_,{crossOrigin:v,integrity:w,fetchPriority:x,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Si.preinitModule=function(_,f){if(typeof _=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var b=p(f.as,f.crossOrigin);a.d.M(_,{crossOrigin:b,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&a.d.M(_)},Si.preload=function(_,f){if(typeof _=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var b=f.as,v=p(b,f.crossOrigin);a.d.L(_,b,{crossOrigin:v,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Si.preloadModule=function(_,f){if(typeof _=="string")if(f){var b=p(f.as,f.crossOrigin);a.d.m(_,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:b,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else a.d.m(_)},Si.requestFormReset=function(_){a.d.r(_)},Si.unstable_batchedUpdates=function(_,f){return _(f)},Si.useFormState=function(_,f,b){return d.H.useFormState(_,f,b)},Si.useFormStatus=function(){return d.H.useHostTransitionStatus()},Si.version="19.2.6",Si}var $v;function jS(){if($v)return Dd.exports;$v=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Dd.exports=pC(),Dd.exports}var Xv;function _C(){if(Xv)return ul;Xv=1;var e=fC(),t=yp(),n=jS();function a(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function c(i){var s=i,r=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(r=s.return),i=s.return;while(i)}return s.tag===3?r:null}function d(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function p(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function _(i){if(c(i)!==i)throw Error(a(188))}function f(i){var s=i.alternate;if(!s){if(s=c(i),s===null)throw Error(a(188));return s!==i?null:i}for(var r=i,l=s;;){var u=r.return;if(u===null)break;var h=u.alternate;if(h===null){if(l=u.return,l!==null){r=l;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===r)return _(u),i;if(h===l)return _(u),s;h=h.sibling}throw Error(a(188))}if(r.return!==l.return)r=u,l=h;else{for(var m=!1,y=u.child;y;){if(y===r){m=!0,r=u,l=h;break}if(y===l){m=!0,l=u,r=h;break}y=y.sibling}if(!m){for(y=h.child;y;){if(y===r){m=!0,r=h,l=u;break}if(y===l){m=!0,l=h,r=u;break}y=y.sibling}if(!m)throw Error(a(189))}}if(r.alternate!==l)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?i:s}function b(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=b(i),s!==null)return s;i=i.sibling}return null}var v=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),A=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),ae=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),Te=Symbol.for("react.memo_cache_sentinel"),ce=Symbol.iterator;function Q(i){return i===null||typeof i!="object"?null:(i=ce&&i[ce]||i["@@iterator"],typeof i=="function"?i:null)}var X=Symbol.for("react.client.reference");function se(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===X?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case E:return"Fragment";case D:return"Profiler";case B:return"StrictMode";case z:return"Suspense";case K:return"SuspenseList";case de:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case C:return"Portal";case A:return i.displayName||"Context";case Z:return(i._context.displayName||"Context")+".Consumer";case P:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case N:return s=i.displayName||null,s!==null?s:se(i.type)||"Memo";case ae:s=i._payload,i=i._init;try{return se(i(s))}catch{}}return null}var le=Array.isArray,R=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},ue=[],be=-1;function T(i){return{current:i}}function W(i){0>be||(i.current=ue[be],ue[be]=null,be--)}function oe(i,s){be++,ue[be]=i.current,i.current=s}var ne=T(null),_e=T(null),fe=T(null),xe=T(null);function qe(i,s){switch(oe(fe,s),oe(_e,i),oe(ne,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?uv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=uv(s),i=hv(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}W(ne),oe(ne,i)}function Me(){W(ne),W(_e),W(fe)}function Ae(i){i.memoizedState!==null&&oe(xe,i);var s=ne.current,r=hv(s,i.type);s!==r&&(oe(_e,i),oe(ne,r))}function Ze(i){_e.current===i&&(W(ne),W(_e)),xe.current===i&&(W(xe),rl._currentValue=$)}var nt,Re;function te(i){if(nt===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);nt=s&&s[1]||"",Re=-1<r.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+nt+i+Re}var we=!1;function Ce(i,s){if(!i||we)return"";we=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(Y){var I=Y}Reflect.construct(i,[],ee)}else{try{ee.call()}catch(Y){I=Y}i.call(ee.prototype)}}else{try{throw Error()}catch(Y){I=Y}(ee=i())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(Y){if(Y&&I&&typeof Y.stack=="string")return[Y.stack,I.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),m=h[0],y=h[1];if(m&&y){var k=m.split(`
4
- `),U=y.split(`
5
- `);for(u=l=0;l<k.length&&!k[l].includes("DetermineComponentFrameRoot");)l++;for(;u<U.length&&!U[u].includes("DetermineComponentFrameRoot");)u++;if(l===k.length||u===U.length)for(l=k.length-1,u=U.length-1;1<=l&&0<=u&&k[l]!==U[u];)u--;for(;1<=l&&0<=u;l--,u--)if(k[l]!==U[u]){if(l!==1||u!==1)do if(l--,u--,0>u||k[l]!==U[u]){var G=`
6
- `+k[l].replace(" at new "," at ");return i.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",i.displayName)),G}while(1<=l&&0<=u);break}}}finally{we=!1,Error.prepareStackTrace=r}return(r=i?i.displayName||i.name:"")?te(r):""}function Le(i,s){switch(i.tag){case 26:case 27:case 5:return te(i.type);case 16:return te("Lazy");case 13:return i.child!==s&&s!==null?te("Suspense Fallback"):te("Suspense");case 19:return te("SuspenseList");case 0:case 15:return Ce(i.type,!1);case 11:return Ce(i.type.render,!1);case 1:return Ce(i.type,!0);case 31:return te("Activity");default:return""}}function $e(i){try{var s="",r=null;do s+=Le(i,r),r=i,i=i.return;while(i);return s}catch(l){return`
7
- Error generating stack: `+l.message+`
8
- `+l.stack}}var St=Object.prototype.hasOwnProperty,V=e.unstable_scheduleCallback,He=e.unstable_cancelCallback,st=e.unstable_shouldYield,yi=e.unstable_requestPaint,bt=e.unstable_now,fs=e.unstable_getCurrentPriorityLevel,ps=e.unstable_ImmediatePriority,ti=e.unstable_UserBlockingPriority,ii=e.unstable_NormalPriority,Ci=e.unstable_LowPriority,Ls=e.unstable_IdlePriority,xi=e.log,Os=e.unstable_setDisableYieldValue,_s=null,Dt=null;function si(i){if(typeof xi=="function"&&Os(i),Dt&&typeof Dt.setStrictMode=="function")try{Dt.setStrictMode(_s,i)}catch{}}var Pe=Math.clz32?Math.clz32:Yn,zs=Math.log,Hs=Math.LN2;function Yn(i){return i>>>=0,i===0?32:31-(zs(i)/Hs|0)|0}var ms=256,Xi=262144,We=4194304;function ut(i){var s=i&42;if(s!==0)return s;switch(i&-i){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Rt(i,s,r){var l=i.pendingLanes;if(l===0)return 0;var u=0,h=i.suspendedLanes,m=i.pingedLanes;i=i.warmLanes;var y=l&134217727;return y!==0?(l=y&~h,l!==0?u=ut(l):(m&=y,m!==0?u=ut(m):r||(r=y&~i,r!==0&&(u=ut(r))))):(y=l&~h,y!==0?u=ut(y):m!==0?u=ut(m):r||(r=l&~i,r!==0&&(u=ut(r)))),u===0?0:s!==0&&s!==u&&(s&h)===0&&(h=u&-u,r=s&-s,h>=r||h===32&&(r&4194048)!==0)?s:u}function Nt(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function wt(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32: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:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Bt(){var i=We;return We<<=1,(We&62914560)===0&&(We=4194304),i}function Vt(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function hi(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function lt(i,s,r,l,u,h){var m=i.pendingLanes;i.pendingLanes=r,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=r,i.entangledLanes&=r,i.errorRecoveryDisabledLanes&=r,i.shellSuspendCounter=0;var y=i.entanglements,k=i.expirationTimes,U=i.hiddenUpdates;for(r=m&~r;0<r;){var G=31-Pe(r),ee=1<<G;y[G]=0,k[G]=-1;var I=U[G];if(I!==null)for(U[G]=null,G=0;G<I.length;G++){var Y=I[G];Y!==null&&(Y.lane&=-536870913)}r&=~ee}l!==0&&$t(i,l,0),h!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=h&~(m&~s))}function $t(i,s,r){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-Pe(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|r&261930}function O(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var l=31-Pe(r),u=1<<l;u&s|i[l]&s&&(i[l]|=s),r&=~u}}function F(i,s){var r=s&-s;return r=(r&42)!==0?1:re(r),(r&(i.suspendedLanes|s))!==0?0:r}function re(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function ge(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function ke(){var i=q.p;return i!==0?i:(i=window.event,i===void 0?32:Lv(i.type))}function tt(i,s){var r=q.p;try{return q.p=i,s()}finally{q.p=r}}var Ne=Math.random().toString(36).slice(2),ct="__reactFiber$"+Ne,ht="__reactProps$"+Ne,di="__reactContainer$"+Ne,un="__reactEvents$"+Ne,ws="__reactListeners$"+Ne,pu="__reactHandles$"+Ne,Sa="__reactResources$"+Ne,Vn="__reactMarker$"+Ne;function H(i){delete i[ct],delete i[ht],delete i[un],delete i[ws],delete i[pu]}function pe(i){var s=i[ct];if(s)return s;for(var r=i.parentNode;r;){if(s=r[di]||r[ct]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=vv(i);i!==null;){if(r=i[ct])return r;i=vv(i)}return s}i=r,r=i.parentNode}return null}function Qe(i){if(i=i[ct]||i[di]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function Oe(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(a(33))}function it(i){var s=i[Sa];return s||(s=i[Sa]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Fe(i){i[Vn]=!0}var Cs=new Set,hn={};function gs(i,s){js(i,s),js(i+"Capture",s)}function js(i,s){for(hn[i]=s,i=0;i<s.length;i++)Cs.add(s[i])}var ro=RegExp("^[: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]*$"),Hi={},ba={};function _u(i){return St.call(ba,i)?!0:St.call(Hi,i)?!1:ro.test(i)?ba[i]=!0:(Hi[i]=!0,!1)}function ji(i,s,r){if(_u(s))if(r===null)i.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var l=s.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+r)}}function $n(i,s,r){if(r===null)i.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+r)}}function Gi(i,s,r,l){if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttributeNS(s,r,""+l)}}function Zi(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function i_(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function tw(i,s,r){var l=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var u=l.get,h=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(m){r=""+m,h.call(this,m)}}),Object.defineProperty(i,s,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(m){r=""+m},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function mu(i){if(!i._valueTracker){var s=i_(i)?"checked":"value";i._valueTracker=tw(i,s,""+i[s])}}function s_(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var r=s.getValue(),l="";return i&&(l=i_(i)?i.checked?"true":"false":i.value),i=l,i!==r?(s.setValue(i),!0):!1}function ao(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var iw=/[\n"\\]/g;function Qi(i){return i.replace(iw,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function gu(i,s,r,l,u,h,m,y){i.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?i.type=m:i.removeAttribute("type"),s!=null?m==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+Zi(s)):i.value!==""+Zi(s)&&(i.value=""+Zi(s)):m!=="submit"&&m!=="reset"||i.removeAttribute("value"),s!=null?vu(i,m,Zi(s)):r!=null?vu(i,m,Zi(r)):l!=null&&i.removeAttribute("value"),u==null&&h!=null&&(i.defaultChecked=!!h),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?i.name=""+Zi(y):i.removeAttribute("name")}function n_(i,s,r,l,u,h,m,y){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(i.type=h),s!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||s!=null)){mu(i);return}r=r!=null?""+Zi(r):"",s=s!=null?""+Zi(s):r,y||s===i.value||(i.value=s),i.defaultValue=s}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=y?i.checked:!!l,i.defaultChecked=!!l,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(i.name=m),mu(i)}function vu(i,s,r){s==="number"&&ao(i.ownerDocument)===i||i.defaultValue===""+r||(i.defaultValue=""+r)}function xr(i,s,r,l){if(i=i.options,s){s={};for(var u=0;u<r.length;u++)s["$"+r[u]]=!0;for(r=0;r<i.length;r++)u=s.hasOwnProperty("$"+i[r].value),i[r].selected!==u&&(i[r].selected=u),u&&l&&(i[r].defaultSelected=!0)}else{for(r=""+Zi(r),s=null,u=0;u<i.length;u++){if(i[u].value===r){i[u].selected=!0,l&&(i[u].defaultSelected=!0);return}s!==null||i[u].disabled||(s=i[u])}s!==null&&(s.selected=!0)}}function r_(i,s,r){if(s!=null&&(s=""+Zi(s),s!==i.value&&(i.value=s),r==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=r!=null?""+Zi(r):""}function a_(i,s,r,l){if(s==null){if(l!=null){if(r!=null)throw Error(a(92));if(le(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),s=r}r=Zi(s),i.defaultValue=r,l=i.textContent,l===r&&l!==""&&l!==null&&(i.value=l),mu(i)}function Er(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var sw=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function l_(i,s,r){var l=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":l?i.setProperty(s,r):typeof r!="number"||r===0||sw.has(s)?s==="float"?i.cssFloat=r:i[s]=(""+r).trim():i[s]=r+"px"}function o_(i,s,r){if(s!=null&&typeof s!="object")throw Error(a(62));if(i=i.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var u in s)l=s[u],s.hasOwnProperty(u)&&r[u]!==l&&l_(i,u,l)}else for(var h in s)s.hasOwnProperty(h)&&l_(i,h,s[h])}function yu(i){if(i.indexOf("-")===-1)return!1;switch(i){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 nw=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),rw=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function lo(i){return rw.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Us(){}var Su=null;function bu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Tr=null,kr=null;function c_(i){var s=Qe(i);if(s&&(i=s.stateNode)){var r=i[ht]||null;e:switch(i=s.stateNode,s.type){case"input":if(gu(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=i;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Qi(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var l=r[s];if(l!==i&&l.form===i.form){var u=l[ht]||null;if(!u)throw Error(a(90));gu(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(s=0;s<r.length;s++)l=r[s],l.form===i.form&&s_(l)}break e;case"textarea":r_(i,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&xr(i,!!r.multiple,s,!1)}}}var wu=!1;function u_(i,s,r){if(wu)return i(s,r);wu=!0;try{var l=i(s);return l}finally{if(wu=!1,(Tr!==null||kr!==null)&&(Xo(),Tr&&(s=Tr,i=kr,kr=Tr=null,c_(s),i)))for(s=0;s<i.length;s++)c_(i[s])}}function wa(i,s){var r=i.stateNode;if(r===null)return null;var l=r[ht]||null;if(l===null)return null;r=l[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":(l=!l.disabled)||(i=i.type,l=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!l;break e;default:i=!1}if(i)return null;if(r&&typeof r!="function")throw Error(a(231,s,typeof r));return r}var Ps=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cu=!1;if(Ps)try{var Ca={};Object.defineProperty(Ca,"passive",{get:function(){Cu=!0}}),window.addEventListener("test",Ca,Ca),window.removeEventListener("test",Ca,Ca)}catch{Cu=!1}var dn=null,xu=null,oo=null;function h_(){if(oo)return oo;var i,s=xu,r=s.length,l,u="value"in dn?dn.value:dn.textContent,h=u.length;for(i=0;i<r&&s[i]===u[i];i++);var m=r-i;for(l=1;l<=m&&s[r-l]===u[h-l];l++);return oo=u.slice(i,1<l?1-l:void 0)}function co(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function uo(){return!0}function d_(){return!1}function Ri(i){function s(r,l,u,h,m){this._reactName=r,this._targetInst=u,this.type=l,this.nativeEvent=h,this.target=m,this.currentTarget=null;for(var y in i)i.hasOwnProperty(y)&&(r=i[y],this[y]=r?r(h):h[y]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?uo:d_,this.isPropagationStopped=d_,this}return v(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=uo)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=uo)},persist:function(){},isPersistent:uo}),s}var Xn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ho=Ri(Xn),xa=v({},Xn,{view:0,detail:0}),aw=Ri(xa),Eu,Tu,Ea,fo=v({},xa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Du,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Ea&&(Ea&&i.type==="mousemove"?(Eu=i.screenX-Ea.screenX,Tu=i.screenY-Ea.screenY):Tu=Eu=0,Ea=i),Eu)},movementY:function(i){return"movementY"in i?i.movementY:Tu}}),f_=Ri(fo),lw=v({},fo,{dataTransfer:0}),ow=Ri(lw),cw=v({},xa,{relatedTarget:0}),ku=Ri(cw),uw=v({},Xn,{animationName:0,elapsedTime:0,pseudoElement:0}),hw=Ri(uw),dw=v({},Xn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),fw=Ri(dw),pw=v({},Xn,{data:0}),p_=Ri(pw),_w={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mw={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"},gw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vw(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=gw[i])?!!s[i]:!1}function Du(){return vw}var yw=v({},xa,{key:function(i){if(i.key){var s=_w[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=co(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?mw[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Du,charCode:function(i){return i.type==="keypress"?co(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?co(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Sw=Ri(yw),bw=v({},fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),__=Ri(bw),ww=v({},xa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Du}),Cw=Ri(ww),xw=v({},Xn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ew=Ri(xw),Tw=v({},fo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),kw=Ri(Tw),Dw=v({},Xn,{newState:0,oldState:0}),Rw=Ri(Dw),Mw=[9,13,27,32],Ru=Ps&&"CompositionEvent"in window,Ta=null;Ps&&"documentMode"in document&&(Ta=document.documentMode);var Aw=Ps&&"TextEvent"in window&&!Ta,m_=Ps&&(!Ru||Ta&&8<Ta&&11>=Ta),g_=" ",v_=!1;function y_(i,s){switch(i){case"keyup":return Mw.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S_(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Dr=!1;function Nw(i,s){switch(i){case"compositionend":return S_(s);case"keypress":return s.which!==32?null:(v_=!0,g_);case"textInput":return i=s.data,i===g_&&v_?null:i;default:return null}}function Bw(i,s){if(Dr)return i==="compositionend"||!Ru&&y_(i,s)?(i=h_(),oo=xu=dn=null,Dr=!1,i):null;switch(i){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 m_&&s.locale!=="ko"?null:s.data;default:return null}}var Lw={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 b_(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!Lw[i.type]:s==="textarea"}function w_(i,s,r,l){Tr?kr?kr.push(l):kr=[l]:Tr=l,s=ic(s,"onChange"),0<s.length&&(r=new ho("onChange","change",null,r,l),i.push({event:r,listeners:s}))}var ka=null,Da=null;function Ow(i){nv(i,0)}function po(i){var s=Oe(i);if(s_(s))return i}function C_(i,s){if(i==="change")return s}var x_=!1;if(Ps){var Mu;if(Ps){var Au="oninput"in document;if(!Au){var E_=document.createElement("div");E_.setAttribute("oninput","return;"),Au=typeof E_.oninput=="function"}Mu=Au}else Mu=!1;x_=Mu&&(!document.documentMode||9<document.documentMode)}function T_(){ka&&(ka.detachEvent("onpropertychange",k_),Da=ka=null)}function k_(i){if(i.propertyName==="value"&&po(Da)){var s=[];w_(s,Da,i,bu(i)),u_(Ow,s)}}function zw(i,s,r){i==="focusin"?(T_(),ka=s,Da=r,ka.attachEvent("onpropertychange",k_)):i==="focusout"&&T_()}function Hw(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return po(Da)}function jw(i,s){if(i==="click")return po(s)}function Uw(i,s){if(i==="input"||i==="change")return po(s)}function Pw(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var Ui=typeof Object.is=="function"?Object.is:Pw;function Ra(i,s){if(Ui(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var r=Object.keys(i),l=Object.keys(s);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var u=r[l];if(!St.call(s,u)||!Ui(i[u],s[u]))return!1}return!0}function D_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function R_(i,s){var r=D_(i);i=0;for(var l;r;){if(r.nodeType===3){if(l=i+r.textContent.length,i<=s&&l>=s)return{node:r,offset:s-i};i=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=D_(r)}}function M_(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?M_(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function A_(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=ao(i.document);s instanceof i.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)i=s.contentWindow;else break;s=ao(i.document)}return s}function Nu(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var Kw=Ps&&"documentMode"in document&&11>=document.documentMode,Rr=null,Bu=null,Ma=null,Lu=!1;function N_(i,s,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Lu||Rr==null||Rr!==ao(l)||(l=Rr,"selectionStart"in l&&Nu(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Ma&&Ra(Ma,l)||(Ma=l,l=ic(Bu,"onSelect"),0<l.length&&(s=new ho("onSelect","select",null,s,r),i.push({event:s,listeners:l}),s.target=Rr)))}function Gn(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var Mr={animationend:Gn("Animation","AnimationEnd"),animationiteration:Gn("Animation","AnimationIteration"),animationstart:Gn("Animation","AnimationStart"),transitionrun:Gn("Transition","TransitionRun"),transitionstart:Gn("Transition","TransitionStart"),transitioncancel:Gn("Transition","TransitionCancel"),transitionend:Gn("Transition","TransitionEnd")},Ou={},B_={};Ps&&(B_=document.createElement("div").style,"AnimationEvent"in window||(delete Mr.animationend.animation,delete Mr.animationiteration.animation,delete Mr.animationstart.animation),"TransitionEvent"in window||delete Mr.transitionend.transition);function Zn(i){if(Ou[i])return Ou[i];if(!Mr[i])return i;var s=Mr[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in B_)return Ou[i]=s[r];return i}var L_=Zn("animationend"),O_=Zn("animationiteration"),z_=Zn("animationstart"),Iw=Zn("transitionrun"),Fw=Zn("transitionstart"),qw=Zn("transitioncancel"),H_=Zn("transitionend"),j_=new Map,zu="abort auxClick beforeToggle 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(" ");zu.push("scrollEnd");function vs(i,s){j_.set(i,s),gs(s,[i])}var _o=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Ji=[],Ar=0,Hu=0;function mo(){for(var i=Ar,s=Hu=Ar=0;s<i;){var r=Ji[s];Ji[s++]=null;var l=Ji[s];Ji[s++]=null;var u=Ji[s];Ji[s++]=null;var h=Ji[s];if(Ji[s++]=null,l!==null&&u!==null){var m=l.pending;m===null?u.next=u:(u.next=m.next,m.next=u),l.pending=u}h!==0&&U_(r,u,h)}}function go(i,s,r,l){Ji[Ar++]=i,Ji[Ar++]=s,Ji[Ar++]=r,Ji[Ar++]=l,Hu|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function ju(i,s,r,l){return go(i,s,r,l),vo(i)}function Qn(i,s){return go(i,null,null,s),vo(i)}function U_(i,s,r){i.lanes|=r;var l=i.alternate;l!==null&&(l.lanes|=r);for(var u=!1,h=i.return;h!==null;)h.childLanes|=r,l=h.alternate,l!==null&&(l.childLanes|=r),h.tag===22&&(i=h.stateNode,i===null||i._visibility&1||(u=!0)),i=h,h=h.return;return i.tag===3?(h=i.stateNode,u&&s!==null&&(u=31-Pe(r),i=h.hiddenUpdates,l=i[u],l===null?i[u]=[s]:l.push(s),s.lane=r|536870912),h):null}function vo(i){if(50<Qa)throw Qa=0,Vh=null,Error(a(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Nr={};function Ww(i,s,r,l){this.tag=i,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pi(i,s,r,l){return new Ww(i,s,r,l)}function Uu(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ks(i,s){var r=i.alternate;return r===null?(r=Pi(i.tag,s,i.key,i.mode),r.elementType=i.elementType,r.type=i.type,r.stateNode=i.stateNode,r.alternate=i,i.alternate=r):(r.pendingProps=s,r.type=i.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=i.flags&65011712,r.childLanes=i.childLanes,r.lanes=i.lanes,r.child=i.child,r.memoizedProps=i.memoizedProps,r.memoizedState=i.memoizedState,r.updateQueue=i.updateQueue,s=i.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=i.sibling,r.index=i.index,r.ref=i.ref,r.refCleanup=i.refCleanup,r}function P_(i,s){i.flags&=65011714;var r=i.alternate;return r===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=r.childLanes,i.lanes=r.lanes,i.child=r.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=r.memoizedProps,i.memoizedState=r.memoizedState,i.updateQueue=r.updateQueue,i.type=r.type,s=r.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function yo(i,s,r,l,u,h){var m=0;if(l=i,typeof i=="function")Uu(i)&&(m=1);else if(typeof i=="string")m=G1(i,r,ne.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case de:return i=Pi(31,r,s,u),i.elementType=de,i.lanes=h,i;case E:return Jn(r.children,u,h,s);case B:m=8,u|=24;break;case D:return i=Pi(12,r,s,u|2),i.elementType=D,i.lanes=h,i;case z:return i=Pi(13,r,s,u),i.elementType=z,i.lanes=h,i;case K:return i=Pi(19,r,s,u),i.elementType=K,i.lanes=h,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case A:m=10;break e;case Z:m=9;break e;case P:m=11;break e;case N:m=14;break e;case ae:m=16,l=null;break e}m=29,r=Error(a(130,i===null?"null":typeof i,"")),l=null}return s=Pi(m,r,s,u),s.elementType=i,s.type=l,s.lanes=h,s}function Jn(i,s,r,l){return i=Pi(7,i,l,s),i.lanes=r,i}function Pu(i,s,r){return i=Pi(6,i,null,s),i.lanes=r,i}function K_(i){var s=Pi(18,null,null,0);return s.stateNode=i,s}function Ku(i,s,r){return s=Pi(4,i.children!==null?i.children:[],i.key,s),s.lanes=r,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var I_=new WeakMap;function es(i,s){if(typeof i=="object"&&i!==null){var r=I_.get(i);return r!==void 0?r:(s={value:i,source:s,stack:$e(s)},I_.set(i,s),s)}return{value:i,source:s,stack:$e(s)}}var Br=[],Lr=0,So=null,Aa=0,ts=[],is=0,fn=null,xs=1,Es="";function Is(i,s){Br[Lr++]=Aa,Br[Lr++]=So,So=i,Aa=s}function F_(i,s,r){ts[is++]=xs,ts[is++]=Es,ts[is++]=fn,fn=i;var l=xs;i=Es;var u=32-Pe(l)-1;l&=~(1<<u),r+=1;var h=32-Pe(s)+u;if(30<h){var m=u-u%5;h=(l&(1<<m)-1).toString(32),l>>=m,u-=m,xs=1<<32-Pe(s)+u|r<<u|l,Es=h+i}else xs=1<<h|r<<u|l,Es=i}function Iu(i){i.return!==null&&(Is(i,1),F_(i,1,0))}function Fu(i){for(;i===So;)So=Br[--Lr],Br[Lr]=null,Aa=Br[--Lr],Br[Lr]=null;for(;i===fn;)fn=ts[--is],ts[is]=null,Es=ts[--is],ts[is]=null,xs=ts[--is],ts[is]=null}function q_(i,s){ts[is++]=xs,ts[is++]=Es,ts[is++]=fn,xs=s.id,Es=s.overflow,fn=i}var fi=null,Ct=null,Je=!1,pn=null,ss=!1,qu=Error(a(519));function _n(i){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Na(es(s,i)),qu}function W_(i){var s=i.stateNode,r=i.type,l=i.memoizedProps;switch(s[ct]=i,s[ht]=l,r){case"dialog":Ve("cancel",s),Ve("close",s);break;case"iframe":case"object":case"embed":Ve("load",s);break;case"video":case"audio":for(r=0;r<el.length;r++)Ve(el[r],s);break;case"source":Ve("error",s);break;case"img":case"image":case"link":Ve("error",s),Ve("load",s);break;case"details":Ve("toggle",s);break;case"input":Ve("invalid",s),n_(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ve("invalid",s);break;case"textarea":Ve("invalid",s),a_(s,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||l.suppressHydrationWarning===!0||ov(s.textContent,r)?(l.popover!=null&&(Ve("beforetoggle",s),Ve("toggle",s)),l.onScroll!=null&&Ve("scroll",s),l.onScrollEnd!=null&&Ve("scrollend",s),l.onClick!=null&&(s.onclick=Us),s=!0):s=!1,s||_n(i,!0)}function Y_(i){for(fi=i.return;fi;)switch(fi.tag){case 5:case 31:case 13:ss=!1;return;case 27:case 3:ss=!0;return;default:fi=fi.return}}function Or(i){if(i!==fi)return!1;if(!Je)return Y_(i),Je=!0,!1;var s=i.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=i.type,r=!(r!=="form"&&r!=="button")||od(i.type,i.memoizedProps)),r=!r),r&&Ct&&_n(i),Y_(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Ct=gv(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Ct=gv(i)}else s===27?(s=Ct,Rn(i.type)?(i=fd,fd=null,Ct=i):Ct=s):Ct=fi?rs(i.stateNode.nextSibling):null;return!0}function er(){Ct=fi=null,Je=!1}function Wu(){var i=pn;return i!==null&&(Bi===null?Bi=i:Bi.push.apply(Bi,i),pn=null),i}function Na(i){pn===null?pn=[i]:pn.push(i)}var Yu=T(null),tr=null,Fs=null;function mn(i,s,r){oe(Yu,s._currentValue),s._currentValue=r}function qs(i){i._currentValue=Yu.current,W(Yu)}function Vu(i,s,r){for(;i!==null;){var l=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,l!==null&&(l.childLanes|=s)):l!==null&&(l.childLanes&s)!==s&&(l.childLanes|=s),i===r)break;i=i.return}}function $u(i,s,r,l){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var h=u.dependencies;if(h!==null){var m=u.child;h=h.firstContext;e:for(;h!==null;){var y=h;h=u;for(var k=0;k<s.length;k++)if(y.context===s[k]){h.lanes|=r,y=h.alternate,y!==null&&(y.lanes|=r),Vu(h.return,r,i),l||(m=null);break e}h=y.next}}else if(u.tag===18){if(m=u.return,m===null)throw Error(a(341));m.lanes|=r,h=m.alternate,h!==null&&(h.lanes|=r),Vu(m,r,i),m=null}else m=u.child;if(m!==null)m.return=u;else for(m=u;m!==null;){if(m===i){m=null;break}if(u=m.sibling,u!==null){u.return=m.return,m=u;break}m=m.return}u=m}}function zr(i,s,r,l){i=null;for(var u=s,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var m=u.alternate;if(m===null)throw Error(a(387));if(m=m.memoizedProps,m!==null){var y=u.type;Ui(u.pendingProps.value,m.value)||(i!==null?i.push(y):i=[y])}}else if(u===xe.current){if(m=u.alternate,m===null)throw Error(a(387));m.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(rl):i=[rl])}u=u.return}i!==null&&$u(s,i,r,l),s.flags|=262144}function bo(i){for(i=i.firstContext;i!==null;){if(!Ui(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function ir(i){tr=i,Fs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function pi(i){return V_(tr,i)}function wo(i,s){return tr===null&&ir(i),V_(i,s)}function V_(i,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},Fs===null){if(i===null)throw Error(a(308));Fs=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else Fs=Fs.next=s;return r}var Yw=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(r,l){i.push(l)}};this.abort=function(){s.aborted=!0,i.forEach(function(r){return r()})}},Vw=e.unstable_scheduleCallback,$w=e.unstable_NormalPriority,Kt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Xu(){return{controller:new Yw,data:new Map,refCount:0}}function Ba(i){i.refCount--,i.refCount===0&&Vw($w,function(){i.controller.abort()})}var La=null,Gu=0,Hr=0,jr=null;function Xw(i,s){if(La===null){var r=La=[];Gu=0,Hr=Jh(),jr={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Gu++,s.then($_,$_),s}function $_(){if(--Gu===0&&La!==null){jr!==null&&(jr.status="fulfilled");var i=La;La=null,Hr=0,jr=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function Gw(i,s){var r=[],l={status:"pending",value:null,reason:null,then:function(u){r.push(u)}};return i.then(function(){l.status="fulfilled",l.value=s;for(var u=0;u<r.length;u++)(0,r[u])(s)},function(u){for(l.status="rejected",l.reason=u,u=0;u<r.length;u++)(0,r[u])(void 0)}),l}var X_=R.S;R.S=function(i,s){Ng=bt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Xw(i,s),X_!==null&&X_(i,s)};var sr=T(null);function Zu(){var i=sr.current;return i!==null?i:vt.pooledCache}function Co(i,s){s===null?oe(sr,sr.current):oe(sr,s.pool)}function G_(){var i=Zu();return i===null?null:{parent:Kt._currentValue,pool:i}}var Ur=Error(a(460)),Qu=Error(a(474)),xo=Error(a(542)),Eo={then:function(){}};function Z_(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Q_(i,s,r){switch(r=i[r],r===void 0?i.push(s):r!==s&&(s.then(Us,Us),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,em(i),i;default:if(typeof s.status=="string")s.then(Us,Us);else{if(i=vt,i!==null&&100<i.shellSuspendCounter)throw Error(a(482));i=s,i.status="pending",i.then(function(l){if(s.status==="pending"){var u=s;u.status="fulfilled",u.value=l}},function(l){if(s.status==="pending"){var u=s;u.status="rejected",u.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,em(i),i}throw rr=s,Ur}}function nr(i){try{var s=i._init;return s(i._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(rr=r,Ur):r}}var rr=null;function J_(){if(rr===null)throw Error(a(459));var i=rr;return rr=null,i}function em(i){if(i===Ur||i===xo)throw Error(a(483))}var Pr=null,Oa=0;function To(i){var s=Oa;return Oa+=1,Pr===null&&(Pr=[]),Q_(Pr,i,s)}function za(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function ko(i,s){throw s.$$typeof===w?Error(a(525)):(i=Object.prototype.toString.call(s),Error(a(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function tm(i){function s(L,M){if(i){var j=L.deletions;j===null?(L.deletions=[M],L.flags|=16):j.push(M)}}function r(L,M){if(!i)return null;for(;M!==null;)s(L,M),M=M.sibling;return null}function l(L){for(var M=new Map;L!==null;)L.key!==null?M.set(L.key,L):M.set(L.index,L),L=L.sibling;return M}function u(L,M){return L=Ks(L,M),L.index=0,L.sibling=null,L}function h(L,M,j){return L.index=j,i?(j=L.alternate,j!==null?(j=j.index,j<M?(L.flags|=67108866,M):j):(L.flags|=67108866,M)):(L.flags|=1048576,M)}function m(L){return i&&L.alternate===null&&(L.flags|=67108866),L}function y(L,M,j,J){return M===null||M.tag!==6?(M=Pu(j,L.mode,J),M.return=L,M):(M=u(M,j),M.return=L,M)}function k(L,M,j,J){var Ee=j.type;return Ee===E?G(L,M,j.props.children,J,j.key):M!==null&&(M.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===ae&&nr(Ee)===M.type)?(M=u(M,j.props),za(M,j),M.return=L,M):(M=yo(j.type,j.key,j.props,null,L.mode,J),za(M,j),M.return=L,M)}function U(L,M,j,J){return M===null||M.tag!==4||M.stateNode.containerInfo!==j.containerInfo||M.stateNode.implementation!==j.implementation?(M=Ku(j,L.mode,J),M.return=L,M):(M=u(M,j.children||[]),M.return=L,M)}function G(L,M,j,J,Ee){return M===null||M.tag!==7?(M=Jn(j,L.mode,J,Ee),M.return=L,M):(M=u(M,j),M.return=L,M)}function ee(L,M,j){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=Pu(""+M,L.mode,j),M.return=L,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case x:return j=yo(M.type,M.key,M.props,null,L.mode,j),za(j,M),j.return=L,j;case C:return M=Ku(M,L.mode,j),M.return=L,M;case ae:return M=nr(M),ee(L,M,j)}if(le(M)||Q(M))return M=Jn(M,L.mode,j,null),M.return=L,M;if(typeof M.then=="function")return ee(L,To(M),j);if(M.$$typeof===A)return ee(L,wo(L,M),j);ko(L,M)}return null}function I(L,M,j,J){var Ee=M!==null?M.key:null;if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return Ee!==null?null:y(L,M,""+j,J);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case x:return j.key===Ee?k(L,M,j,J):null;case C:return j.key===Ee?U(L,M,j,J):null;case ae:return j=nr(j),I(L,M,j,J)}if(le(j)||Q(j))return Ee!==null?null:G(L,M,j,J,null);if(typeof j.then=="function")return I(L,M,To(j),J);if(j.$$typeof===A)return I(L,M,wo(L,j),J);ko(L,j)}return null}function Y(L,M,j,J,Ee){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return L=L.get(j)||null,y(M,L,""+J,Ee);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case x:return L=L.get(J.key===null?j:J.key)||null,k(M,L,J,Ee);case C:return L=L.get(J.key===null?j:J.key)||null,U(M,L,J,Ee);case ae:return J=nr(J),Y(L,M,j,J,Ee)}if(le(J)||Q(J))return L=L.get(j)||null,G(M,L,J,Ee,null);if(typeof J.then=="function")return Y(L,M,j,To(J),Ee);if(J.$$typeof===A)return Y(L,M,j,wo(M,J),Ee);ko(M,J)}return null}function ve(L,M,j,J){for(var Ee=null,rt=null,Se=M,Ue=M=0,Ge=null;Se!==null&&Ue<j.length;Ue++){Se.index>Ue?(Ge=Se,Se=null):Ge=Se.sibling;var at=I(L,Se,j[Ue],J);if(at===null){Se===null&&(Se=Ge);break}i&&Se&&at.alternate===null&&s(L,Se),M=h(at,M,Ue),rt===null?Ee=at:rt.sibling=at,rt=at,Se=Ge}if(Ue===j.length)return r(L,Se),Je&&Is(L,Ue),Ee;if(Se===null){for(;Ue<j.length;Ue++)Se=ee(L,j[Ue],J),Se!==null&&(M=h(Se,M,Ue),rt===null?Ee=Se:rt.sibling=Se,rt=Se);return Je&&Is(L,Ue),Ee}for(Se=l(Se);Ue<j.length;Ue++)Ge=Y(Se,L,Ue,j[Ue],J),Ge!==null&&(i&&Ge.alternate!==null&&Se.delete(Ge.key===null?Ue:Ge.key),M=h(Ge,M,Ue),rt===null?Ee=Ge:rt.sibling=Ge,rt=Ge);return i&&Se.forEach(function(Ln){return s(L,Ln)}),Je&&Is(L,Ue),Ee}function De(L,M,j,J){if(j==null)throw Error(a(151));for(var Ee=null,rt=null,Se=M,Ue=M=0,Ge=null,at=j.next();Se!==null&&!at.done;Ue++,at=j.next()){Se.index>Ue?(Ge=Se,Se=null):Ge=Se.sibling;var Ln=I(L,Se,at.value,J);if(Ln===null){Se===null&&(Se=Ge);break}i&&Se&&Ln.alternate===null&&s(L,Se),M=h(Ln,M,Ue),rt===null?Ee=Ln:rt.sibling=Ln,rt=Ln,Se=Ge}if(at.done)return r(L,Se),Je&&Is(L,Ue),Ee;if(Se===null){for(;!at.done;Ue++,at=j.next())at=ee(L,at.value,J),at!==null&&(M=h(at,M,Ue),rt===null?Ee=at:rt.sibling=at,rt=at);return Je&&Is(L,Ue),Ee}for(Se=l(Se);!at.done;Ue++,at=j.next())at=Y(Se,L,Ue,at.value,J),at!==null&&(i&&at.alternate!==null&&Se.delete(at.key===null?Ue:at.key),M=h(at,M,Ue),rt===null?Ee=at:rt.sibling=at,rt=at);return i&&Se.forEach(function(lC){return s(L,lC)}),Je&&Is(L,Ue),Ee}function mt(L,M,j,J){if(typeof j=="object"&&j!==null&&j.type===E&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case x:e:{for(var Ee=j.key;M!==null;){if(M.key===Ee){if(Ee=j.type,Ee===E){if(M.tag===7){r(L,M.sibling),J=u(M,j.props.children),J.return=L,L=J;break e}}else if(M.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===ae&&nr(Ee)===M.type){r(L,M.sibling),J=u(M,j.props),za(J,j),J.return=L,L=J;break e}r(L,M);break}else s(L,M);M=M.sibling}j.type===E?(J=Jn(j.props.children,L.mode,J,j.key),J.return=L,L=J):(J=yo(j.type,j.key,j.props,null,L.mode,J),za(J,j),J.return=L,L=J)}return m(L);case C:e:{for(Ee=j.key;M!==null;){if(M.key===Ee)if(M.tag===4&&M.stateNode.containerInfo===j.containerInfo&&M.stateNode.implementation===j.implementation){r(L,M.sibling),J=u(M,j.children||[]),J.return=L,L=J;break e}else{r(L,M);break}else s(L,M);M=M.sibling}J=Ku(j,L.mode,J),J.return=L,L=J}return m(L);case ae:return j=nr(j),mt(L,M,j,J)}if(le(j))return ve(L,M,j,J);if(Q(j)){if(Ee=Q(j),typeof Ee!="function")throw Error(a(150));return j=Ee.call(j),De(L,M,j,J)}if(typeof j.then=="function")return mt(L,M,To(j),J);if(j.$$typeof===A)return mt(L,M,wo(L,j),J);ko(L,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,M!==null&&M.tag===6?(r(L,M.sibling),J=u(M,j),J.return=L,L=J):(r(L,M),J=Pu(j,L.mode,J),J.return=L,L=J),m(L)):r(L,M)}return function(L,M,j,J){try{Oa=0;var Ee=mt(L,M,j,J);return Pr=null,Ee}catch(Se){if(Se===Ur||Se===xo)throw Se;var rt=Pi(29,Se,null,L.mode);return rt.lanes=J,rt.return=L,rt}}}var ar=tm(!0),im=tm(!1),gn=!1;function Ju(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eh(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function vn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function yn(i,s,r){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(ot&2)!==0){var u=l.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),l.pending=s,s=vo(i),U_(i,null,r),s}return go(i,l,s,r),vo(i)}function Ha(i,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,O(i,r)}}function th(i,s){var r=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var u=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var m={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?u=h=m:h=h.next=m,r=r.next}while(r!==null);h===null?u=h=s:h=h.next=s}else u=h=s;r={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},i.updateQueue=r;return}i=r.lastBaseUpdate,i===null?r.firstBaseUpdate=s:i.next=s,r.lastBaseUpdate=s}var ih=!1;function ja(){if(ih){var i=jr;if(i!==null)throw i}}function Ua(i,s,r,l){ih=!1;var u=i.updateQueue;gn=!1;var h=u.firstBaseUpdate,m=u.lastBaseUpdate,y=u.shared.pending;if(y!==null){u.shared.pending=null;var k=y,U=k.next;k.next=null,m===null?h=U:m.next=U,m=k;var G=i.alternate;G!==null&&(G=G.updateQueue,y=G.lastBaseUpdate,y!==m&&(y===null?G.firstBaseUpdate=U:y.next=U,G.lastBaseUpdate=k))}if(h!==null){var ee=u.baseState;m=0,G=U=k=null,y=h;do{var I=y.lane&-536870913,Y=I!==y.lane;if(Y?(Xe&I)===I:(l&I)===I){I!==0&&I===Hr&&(ih=!0),G!==null&&(G=G.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var ve=i,De=y;I=s;var mt=r;switch(De.tag){case 1:if(ve=De.payload,typeof ve=="function"){ee=ve.call(mt,ee,I);break e}ee=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=De.payload,I=typeof ve=="function"?ve.call(mt,ee,I):ve,I==null)break e;ee=v({},ee,I);break e;case 2:gn=!0}}I=y.callback,I!==null&&(i.flags|=64,Y&&(i.flags|=8192),Y=u.callbacks,Y===null?u.callbacks=[I]:Y.push(I))}else Y={lane:I,tag:y.tag,payload:y.payload,callback:y.callback,next:null},G===null?(U=G=Y,k=ee):G=G.next=Y,m|=I;if(y=y.next,y===null){if(y=u.shared.pending,y===null)break;Y=y,y=Y.next,Y.next=null,u.lastBaseUpdate=Y,u.shared.pending=null}}while(!0);G===null&&(k=ee),u.baseState=k,u.firstBaseUpdate=U,u.lastBaseUpdate=G,h===null&&(u.shared.lanes=0),xn|=m,i.lanes=m,i.memoizedState=ee}}function sm(i,s){if(typeof i!="function")throw Error(a(191,i));i.call(s)}function nm(i,s){var r=i.callbacks;if(r!==null)for(i.callbacks=null,i=0;i<r.length;i++)sm(r[i],s)}var Kr=T(null),Do=T(0);function rm(i,s){i=Js,oe(Do,i),oe(Kr,s),Js=i|s.baseLanes}function sh(){oe(Do,Js),oe(Kr,Kr.current)}function nh(){Js=Do.current,W(Kr),W(Do)}var Ki=T(null),ns=null;function Sn(i){var s=i.alternate;oe(jt,jt.current&1),oe(Ki,i),ns===null&&(s===null||Kr.current!==null||s.memoizedState!==null)&&(ns=i)}function rh(i){oe(jt,jt.current),oe(Ki,i),ns===null&&(ns=i)}function am(i){i.tag===22?(oe(jt,jt.current),oe(Ki,i),ns===null&&(ns=i)):bn()}function bn(){oe(jt,jt.current),oe(Ki,Ki.current)}function Ii(i){W(Ki),ns===i&&(ns=null),W(jt)}var jt=T(0);function Ro(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||hd(r)||dd(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Ws=0,je=null,pt=null,It=null,Mo=!1,Ir=!1,lr=!1,Ao=0,Pa=0,Fr=null,Zw=0;function Lt(){throw Error(a(321))}function ah(i,s){if(s===null)return!1;for(var r=0;r<s.length&&r<i.length;r++)if(!Ui(i[r],s[r]))return!1;return!0}function lh(i,s,r,l,u,h){return Ws=h,je=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,R.H=i===null||i.memoizedState===null?Fm:wh,lr=!1,h=r(l,u),lr=!1,Ir&&(h=om(s,r,l,u)),lm(i),h}function lm(i){R.H=Fa;var s=pt!==null&&pt.next!==null;if(Ws=0,It=pt=je=null,Mo=!1,Pa=0,Fr=null,s)throw Error(a(300));i===null||Ft||(i=i.dependencies,i!==null&&bo(i)&&(Ft=!0))}function om(i,s,r,l){je=i;var u=0;do{if(Ir&&(Fr=null),Pa=0,Ir=!1,25<=u)throw Error(a(301));if(u+=1,It=pt=null,i.updateQueue!=null){var h=i.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}R.H=qm,h=s(r,l)}while(Ir);return h}function Qw(){var i=R.H,s=i.useState()[0];return s=typeof s.then=="function"?Ka(s):s,i=i.useState()[0],(pt!==null?pt.memoizedState:null)!==i&&(je.flags|=1024),s}function oh(){var i=Ao!==0;return Ao=0,i}function ch(i,s,r){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~r}function uh(i){if(Mo){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}Mo=!1}Ws=0,It=pt=je=null,Ir=!1,Pa=Ao=0,Fr=null}function Ei(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?je.memoizedState=It=i:It=It.next=i,It}function Ut(){if(pt===null){var i=je.alternate;i=i!==null?i.memoizedState:null}else i=pt.next;var s=It===null?je.memoizedState:It.next;if(s!==null)It=s,pt=i;else{if(i===null)throw je.alternate===null?Error(a(467)):Error(a(310));pt=i,i={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},It===null?je.memoizedState=It=i:It=It.next=i}return It}function No(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ka(i){var s=Pa;return Pa+=1,Fr===null&&(Fr=[]),i=Q_(Fr,i,s),s=je,(It===null?s.memoizedState:It.next)===null&&(s=s.alternate,R.H=s===null||s.memoizedState===null?Fm:wh),i}function Bo(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Ka(i);if(i.$$typeof===A)return pi(i)}throw Error(a(438,String(i)))}function hh(i){var s=null,r=je.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var l=je.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(u){return u.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=No(),je.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(i),l=0;l<i;l++)r[l]=Te;return s.index++,r}function Ys(i,s){return typeof s=="function"?s(i):s}function Lo(i){var s=Ut();return dh(s,pt,i)}function dh(i,s,r){var l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var u=i.baseQueue,h=l.pending;if(h!==null){if(u!==null){var m=u.next;u.next=h.next,h.next=m}s.baseQueue=u=h,l.pending=null}if(h=i.baseState,u===null)i.memoizedState=h;else{s=u.next;var y=m=null,k=null,U=s,G=!1;do{var ee=U.lane&-536870913;if(ee!==U.lane?(Xe&ee)===ee:(Ws&ee)===ee){var I=U.revertLane;if(I===0)k!==null&&(k=k.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),ee===Hr&&(G=!0);else if((Ws&I)===I){U=U.next,I===Hr&&(G=!0);continue}else ee={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},k===null?(y=k=ee,m=h):k=k.next=ee,je.lanes|=I,xn|=I;ee=U.action,lr&&r(h,ee),h=U.hasEagerState?U.eagerState:r(h,ee)}else I={lane:ee,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},k===null?(y=k=I,m=h):k=k.next=I,je.lanes|=ee,xn|=ee;U=U.next}while(U!==null&&U!==s);if(k===null?m=h:k.next=y,!Ui(h,i.memoizedState)&&(Ft=!0,G&&(r=jr,r!==null)))throw r;i.memoizedState=h,i.baseState=m,i.baseQueue=k,l.lastRenderedState=h}return u===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function fh(i){var s=Ut(),r=s.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=i;var l=r.dispatch,u=r.pending,h=s.memoizedState;if(u!==null){r.pending=null;var m=u=u.next;do h=i(h,m.action),m=m.next;while(m!==u);Ui(h,s.memoizedState)||(Ft=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),r.lastRenderedState=h}return[h,l]}function cm(i,s,r){var l=je,u=Ut(),h=Je;if(h){if(r===void 0)throw Error(a(407));r=r()}else r=s();var m=!Ui((pt||u).memoizedState,r);if(m&&(u.memoizedState=r,Ft=!0),u=u.queue,mh(dm.bind(null,l,u,i),[i]),u.getSnapshot!==s||m||It!==null&&It.memoizedState.tag&1){if(l.flags|=2048,qr(9,{destroy:void 0},hm.bind(null,l,u,r,s),null),vt===null)throw Error(a(349));h||(Ws&127)!==0||um(l,s,r)}return r}function um(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=je.updateQueue,s===null?(s=No(),je.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function hm(i,s,r,l){s.value=r,s.getSnapshot=l,fm(s)&&pm(i)}function dm(i,s,r){return r(function(){fm(s)&&pm(i)})}function fm(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!Ui(i,r)}catch{return!0}}function pm(i){var s=Qn(i,2);s!==null&&Li(s,i,2)}function ph(i){var s=Ei();if(typeof i=="function"){var r=i;if(i=r(),lr){si(!0);try{r()}finally{si(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:i},s}function _m(i,s,r,l){return i.baseState=r,dh(i,pt,typeof l=="function"?l:Ys)}function Jw(i,s,r,l,u){if(Ho(i))throw Error(a(485));if(i=s.action,i!==null){var h={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){h.listeners.push(m)}};R.T!==null?r(!0):h.isTransition=!1,l(h),r=s.pending,r===null?(h.next=s.pending=h,mm(s,h)):(h.next=r.next,s.pending=r.next=h)}}function mm(i,s){var r=s.action,l=s.payload,u=i.state;if(s.isTransition){var h=R.T,m={};R.T=m;try{var y=r(u,l),k=R.S;k!==null&&k(m,y),gm(i,s,y)}catch(U){_h(i,s,U)}finally{h!==null&&m.types!==null&&(h.types=m.types),R.T=h}}else try{h=r(u,l),gm(i,s,h)}catch(U){_h(i,s,U)}}function gm(i,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){vm(i,s,l)},function(l){return _h(i,s,l)}):vm(i,s,r)}function vm(i,s,r){s.status="fulfilled",s.value=r,ym(s),i.state=r,s=i.pending,s!==null&&(r=s.next,r===s?i.pending=null:(r=r.next,s.next=r,mm(i,r)))}function _h(i,s,r){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=r,ym(s),s=s.next;while(s!==l)}i.action=null}function ym(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function Sm(i,s){return s}function bm(i,s){if(Je){var r=vt.formState;if(r!==null){e:{var l=je;if(Je){if(Ct){t:{for(var u=Ct,h=ss;u.nodeType!==8;){if(!h){u=null;break t}if(u=rs(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){Ct=rs(u.nextSibling),l=u.data==="F!";break e}}_n(l)}l=!1}l&&(s=r[0])}}return r=Ei(),r.memoizedState=r.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sm,lastRenderedState:s},r.queue=l,r=Pm.bind(null,je,l),l.dispatch=r,l=ph(!1),h=bh.bind(null,je,!1,l.queue),l=Ei(),u={state:s,dispatch:null,action:i,pending:null},l.queue=u,r=Jw.bind(null,je,u,h,r),u.dispatch=r,l.memoizedState=i,[s,r,!1]}function wm(i){var s=Ut();return Cm(s,pt,i)}function Cm(i,s,r){if(s=dh(i,s,Sm)[0],i=Lo(Ys)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=Ka(s)}catch(m){throw m===Ur?xo:m}else l=s;s=Ut();var u=s.queue,h=u.dispatch;return r!==s.memoizedState&&(je.flags|=2048,qr(9,{destroy:void 0},e1.bind(null,u,r),null)),[l,h,i]}function e1(i,s){i.action=s}function xm(i){var s=Ut(),r=pt;if(r!==null)return Cm(s,r,i);Ut(),s=s.memoizedState,r=Ut();var l=r.queue.dispatch;return r.memoizedState=i,[s,l,!1]}function qr(i,s,r,l){return i={tag:i,create:r,deps:l,inst:s,next:null},s=je.updateQueue,s===null&&(s=No(),je.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=i.next=i:(l=r.next,r.next=i,i.next=l,s.lastEffect=i),i}function Em(){return Ut().memoizedState}function Oo(i,s,r,l){var u=Ei();je.flags|=i,u.memoizedState=qr(1|s,{destroy:void 0},r,l===void 0?null:l)}function zo(i,s,r,l){var u=Ut();l=l===void 0?null:l;var h=u.memoizedState.inst;pt!==null&&l!==null&&ah(l,pt.memoizedState.deps)?u.memoizedState=qr(s,h,r,l):(je.flags|=i,u.memoizedState=qr(1|s,h,r,l))}function Tm(i,s){Oo(8390656,8,i,s)}function mh(i,s){zo(2048,8,i,s)}function t1(i){je.flags|=4;var s=je.updateQueue;if(s===null)s=No(),je.updateQueue=s,s.events=[i];else{var r=s.events;r===null?s.events=[i]:r.push(i)}}function km(i){var s=Ut().memoizedState;return t1({ref:s,nextImpl:i}),function(){if((ot&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function Dm(i,s){return zo(4,2,i,s)}function Rm(i,s){return zo(4,4,i,s)}function Mm(i,s){if(typeof s=="function"){i=i();var r=s(i);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function Am(i,s,r){r=r!=null?r.concat([i]):null,zo(4,4,Mm.bind(null,s,i),r)}function gh(){}function Nm(i,s){var r=Ut();s=s===void 0?null:s;var l=r.memoizedState;return s!==null&&ah(s,l[1])?l[0]:(r.memoizedState=[i,s],i)}function Bm(i,s){var r=Ut();s=s===void 0?null:s;var l=r.memoizedState;if(s!==null&&ah(s,l[1]))return l[0];if(l=i(),lr){si(!0);try{i()}finally{si(!1)}}return r.memoizedState=[l,s],l}function vh(i,s,r){return r===void 0||(Ws&1073741824)!==0&&(Xe&261930)===0?i.memoizedState=s:(i.memoizedState=r,i=Lg(),je.lanes|=i,xn|=i,r)}function Lm(i,s,r,l){return Ui(r,s)?r:Kr.current!==null?(i=vh(i,r,l),Ui(i,s)||(Ft=!0),i):(Ws&42)===0||(Ws&1073741824)!==0&&(Xe&261930)===0?(Ft=!0,i.memoizedState=r):(i=Lg(),je.lanes|=i,xn|=i,s)}function Om(i,s,r,l,u){var h=q.p;q.p=h!==0&&8>h?h:8;var m=R.T,y={};R.T=y,bh(i,!1,s,r);try{var k=u(),U=R.S;if(U!==null&&U(y,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var G=Gw(k,l);Ia(i,s,G,Wi(i))}else Ia(i,s,l,Wi(i))}catch(ee){Ia(i,s,{then:function(){},status:"rejected",reason:ee},Wi())}finally{q.p=h,m!==null&&y.types!==null&&(m.types=y.types),R.T=m}}function i1(){}function yh(i,s,r,l){if(i.tag!==5)throw Error(a(476));var u=zm(i).queue;Om(i,u,s,$,r===null?i1:function(){return Hm(i),r(l)})}function zm(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:$},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:r},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function Hm(i){var s=zm(i);s.next===null&&(s=i.alternate.memoizedState),Ia(i,s.next.queue,{},Wi())}function Sh(){return pi(rl)}function jm(){return Ut().memoizedState}function Um(){return Ut().memoizedState}function s1(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var r=Wi();i=vn(r);var l=yn(s,i,r);l!==null&&(Li(l,s,r),Ha(l,s,r)),s={cache:Xu()},i.payload=s;return}s=s.return}}function n1(i,s,r){var l=Wi();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ho(i)?Km(s,r):(r=ju(i,s,r,l),r!==null&&(Li(r,i,l),Im(r,s,l)))}function Pm(i,s,r){var l=Wi();Ia(i,s,r,l)}function Ia(i,s,r,l){var u={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Ho(i))Km(s,u);else{var h=i.alternate;if(i.lanes===0&&(h===null||h.lanes===0)&&(h=s.lastRenderedReducer,h!==null))try{var m=s.lastRenderedState,y=h(m,r);if(u.hasEagerState=!0,u.eagerState=y,Ui(y,m))return go(i,s,u,0),vt===null&&mo(),!1}catch{}if(r=ju(i,s,u,l),r!==null)return Li(r,i,l),Im(r,s,l),!0}return!1}function bh(i,s,r,l){if(l={lane:2,revertLane:Jh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ho(i)){if(s)throw Error(a(479))}else s=ju(i,r,l,2),s!==null&&Li(s,i,2)}function Ho(i){var s=i.alternate;return i===je||s!==null&&s===je}function Km(i,s){Ir=Mo=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function Im(i,s,r){if((r&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,O(i,r)}}var Fa={readContext:pi,use:Bo,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt};Fa.useEffectEvent=Lt;var Fm={readContext:pi,use:Bo,useCallback:function(i,s){return Ei().memoizedState=[i,s===void 0?null:s],i},useContext:pi,useEffect:Tm,useImperativeHandle:function(i,s,r){r=r!=null?r.concat([i]):null,Oo(4194308,4,Mm.bind(null,s,i),r)},useLayoutEffect:function(i,s){return Oo(4194308,4,i,s)},useInsertionEffect:function(i,s){Oo(4,2,i,s)},useMemo:function(i,s){var r=Ei();s=s===void 0?null:s;var l=i();if(lr){si(!0);try{i()}finally{si(!1)}}return r.memoizedState=[l,s],l},useReducer:function(i,s,r){var l=Ei();if(r!==void 0){var u=r(s);if(lr){si(!0);try{r(s)}finally{si(!1)}}}else u=s;return l.memoizedState=l.baseState=u,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:u},l.queue=i,i=i.dispatch=n1.bind(null,je,i),[l.memoizedState,i]},useRef:function(i){var s=Ei();return i={current:i},s.memoizedState=i},useState:function(i){i=ph(i);var s=i.queue,r=Pm.bind(null,je,s);return s.dispatch=r,[i.memoizedState,r]},useDebugValue:gh,useDeferredValue:function(i,s){var r=Ei();return vh(r,i,s)},useTransition:function(){var i=ph(!1);return i=Om.bind(null,je,i.queue,!0,!1),Ei().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,r){var l=je,u=Ei();if(Je){if(r===void 0)throw Error(a(407));r=r()}else{if(r=s(),vt===null)throw Error(a(349));(Xe&127)!==0||um(l,s,r)}u.memoizedState=r;var h={value:r,getSnapshot:s};return u.queue=h,Tm(dm.bind(null,l,h,i),[i]),l.flags|=2048,qr(9,{destroy:void 0},hm.bind(null,l,h,r,s),null),r},useId:function(){var i=Ei(),s=vt.identifierPrefix;if(Je){var r=Es,l=xs;r=(l&~(1<<32-Pe(l)-1)).toString(32)+r,s="_"+s+"R_"+r,r=Ao++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=Zw++,s="_"+s+"r_"+r.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:Sh,useFormState:bm,useActionState:bm,useOptimistic:function(i){var s=Ei();s.memoizedState=s.baseState=i;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=bh.bind(null,je,!0,r),r.dispatch=s,[i,s]},useMemoCache:hh,useCacheRefresh:function(){return Ei().memoizedState=s1.bind(null,je)},useEffectEvent:function(i){var s=Ei(),r={impl:i};return s.memoizedState=r,function(){if((ot&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},wh={readContext:pi,use:Bo,useCallback:Nm,useContext:pi,useEffect:mh,useImperativeHandle:Am,useInsertionEffect:Dm,useLayoutEffect:Rm,useMemo:Bm,useReducer:Lo,useRef:Em,useState:function(){return Lo(Ys)},useDebugValue:gh,useDeferredValue:function(i,s){var r=Ut();return Lm(r,pt.memoizedState,i,s)},useTransition:function(){var i=Lo(Ys)[0],s=Ut().memoizedState;return[typeof i=="boolean"?i:Ka(i),s]},useSyncExternalStore:cm,useId:jm,useHostTransitionStatus:Sh,useFormState:wm,useActionState:wm,useOptimistic:function(i,s){var r=Ut();return _m(r,pt,i,s)},useMemoCache:hh,useCacheRefresh:Um};wh.useEffectEvent=km;var qm={readContext:pi,use:Bo,useCallback:Nm,useContext:pi,useEffect:mh,useImperativeHandle:Am,useInsertionEffect:Dm,useLayoutEffect:Rm,useMemo:Bm,useReducer:fh,useRef:Em,useState:function(){return fh(Ys)},useDebugValue:gh,useDeferredValue:function(i,s){var r=Ut();return pt===null?vh(r,i,s):Lm(r,pt.memoizedState,i,s)},useTransition:function(){var i=fh(Ys)[0],s=Ut().memoizedState;return[typeof i=="boolean"?i:Ka(i),s]},useSyncExternalStore:cm,useId:jm,useHostTransitionStatus:Sh,useFormState:xm,useActionState:xm,useOptimistic:function(i,s){var r=Ut();return pt!==null?_m(r,pt,i,s):(r.baseState=i,[i,r.queue.dispatch])},useMemoCache:hh,useCacheRefresh:Um};qm.useEffectEvent=km;function Ch(i,s,r,l){s=i.memoizedState,r=r(l,s),r=r==null?s:v({},s,r),i.memoizedState=r,i.lanes===0&&(i.updateQueue.baseState=r)}var xh={enqueueSetState:function(i,s,r){i=i._reactInternals;var l=Wi(),u=vn(l);u.payload=s,r!=null&&(u.callback=r),s=yn(i,u,l),s!==null&&(Li(s,i,l),Ha(s,i,l))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var l=Wi(),u=vn(l);u.tag=1,u.payload=s,r!=null&&(u.callback=r),s=yn(i,u,l),s!==null&&(Li(s,i,l),Ha(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=Wi(),l=vn(r);l.tag=2,s!=null&&(l.callback=s),s=yn(i,l,r),s!==null&&(Li(s,i,r),Ha(s,i,r))}};function Wm(i,s,r,l,u,h,m){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,h,m):s.prototype&&s.prototype.isPureReactComponent?!Ra(r,l)||!Ra(u,h):!0}function Ym(i,s,r,l){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,l),s.state!==i&&xh.enqueueReplaceState(s,s.state,null)}function or(i,s){var r=s;if("ref"in s){r={};for(var l in s)l!=="ref"&&(r[l]=s[l])}if(i=i.defaultProps){r===s&&(r=v({},r));for(var u in i)r[u]===void 0&&(r[u]=i[u])}return r}function Vm(i){_o(i)}function $m(i){console.error(i)}function Xm(i){_o(i)}function jo(i,s){try{var r=i.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Gm(i,s,r){try{var l=i.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Eh(i,s,r){return r=vn(r),r.tag=3,r.payload={element:null},r.callback=function(){jo(i,s)},r}function Zm(i){return i=vn(i),i.tag=3,i}function Qm(i,s,r,l){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var h=l.value;i.payload=function(){return u(h)},i.callback=function(){Gm(s,r,l)}}var m=r.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(i.callback=function(){Gm(s,r,l),typeof u!="function"&&(En===null?En=new Set([this]):En.add(this));var y=l.stack;this.componentDidCatch(l.value,{componentStack:y!==null?y:""})})}function r1(i,s,r,l,u){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=r.alternate,s!==null&&zr(s,r,u,!0),r=Ki.current,r!==null){switch(r.tag){case 31:case 13:return ns===null?Go():r.alternate===null&&Ot===0&&(Ot=3),r.flags&=-257,r.flags|=65536,r.lanes=u,l===Eo?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([l]):s.add(l),Gh(i,l,u)),!1;case 22:return r.flags|=65536,l===Eo?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([l]):r.add(l)),Gh(i,l,u)),!1}throw Error(a(435,r.tag))}return Gh(i,l,u),Go(),!1}if(Je)return s=Ki.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,l!==qu&&(i=Error(a(422),{cause:l}),Na(es(i,r)))):(l!==qu&&(s=Error(a(423),{cause:l}),Na(es(s,r))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,l=es(l,r),u=Eh(i.stateNode,l,u),th(i,u),Ot!==4&&(Ot=2)),!1;var h=Error(a(520),{cause:l});if(h=es(h,r),Za===null?Za=[h]:Za.push(h),Ot!==4&&(Ot=2),s===null)return!0;l=es(l,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,i=u&-u,r.lanes|=i,i=Eh(r.stateNode,l,i),th(r,i),!1;case 1:if(s=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(En===null||!En.has(h))))return r.flags|=65536,u&=-u,r.lanes|=u,u=Zm(u),Qm(u,i,r,l),th(r,u),!1}r=r.return}while(r!==null);return!1}var Th=Error(a(461)),Ft=!1;function _i(i,s,r,l){s.child=i===null?im(s,null,r,l):ar(s,i.child,r,l)}function Jm(i,s,r,l,u){r=r.render;var h=s.ref;if("ref"in l){var m={};for(var y in l)y!=="ref"&&(m[y]=l[y])}else m=l;return ir(s),l=lh(i,s,r,m,h,u),y=oh(),i!==null&&!Ft?(ch(i,s,u),Vs(i,s,u)):(Je&&y&&Iu(s),s.flags|=1,_i(i,s,l,u),s.child)}function eg(i,s,r,l,u){if(i===null){var h=r.type;return typeof h=="function"&&!Uu(h)&&h.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=h,tg(i,s,h,l,u)):(i=yo(r.type,null,l,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(h=i.child,!Lh(i,u)){var m=h.memoizedProps;if(r=r.compare,r=r!==null?r:Ra,r(m,l)&&i.ref===s.ref)return Vs(i,s,u)}return s.flags|=1,i=Ks(h,l),i.ref=s.ref,i.return=s,s.child=i}function tg(i,s,r,l,u){if(i!==null){var h=i.memoizedProps;if(Ra(h,l)&&i.ref===s.ref)if(Ft=!1,s.pendingProps=l=h,Lh(i,u))(i.flags&131072)!==0&&(Ft=!0);else return s.lanes=i.lanes,Vs(i,s,u)}return kh(i,s,r,l,u)}function ig(i,s,r,l){var u=l.children,h=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((s.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,i!==null){for(l=s.child=i.child,u=0;l!==null;)u=u|l.lanes|l.childLanes,l=l.sibling;l=u&~h}else l=0,s.child=null;return sg(i,s,h,r,l)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&Co(s,h!==null?h.cachePool:null),h!==null?rm(s,h):sh(),am(s);else return l=s.lanes=536870912,sg(i,s,h!==null?h.baseLanes|r:r,r,l)}else h!==null?(Co(s,h.cachePool),rm(s,h),bn(),s.memoizedState=null):(i!==null&&Co(s,null),sh(),bn());return _i(i,s,u,r),s.child}function qa(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function sg(i,s,r,l,u){var h=Zu();return h=h===null?null:{parent:Kt._currentValue,pool:h},s.memoizedState={baseLanes:r,cachePool:h},i!==null&&Co(s,null),sh(),am(s),i!==null&&zr(i,s,l,!0),s.childLanes=u,null}function Uo(i,s){return s=Ko({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function ng(i,s,r){return ar(s,i.child,null,r),i=Uo(s,s.pendingProps),i.flags|=2,Ii(s),s.memoizedState=null,i}function a1(i,s,r){var l=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Je){if(l.mode==="hidden")return i=Uo(s,l),s.lanes=536870912,qa(null,i);if(rh(s),(i=Ct)?(i=mv(i,ss),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:fn!==null?{id:xs,overflow:Es}:null,retryLane:536870912,hydrationErrors:null},r=K_(i),r.return=s,s.child=r,fi=s,Ct=null)):i=null,i===null)throw _n(s);return s.lanes=536870912,null}return Uo(s,l)}var h=i.memoizedState;if(h!==null){var m=h.dehydrated;if(rh(s),u)if(s.flags&256)s.flags&=-257,s=ng(i,s,r);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(a(558));else if(Ft||zr(i,s,r,!1),u=(r&i.childLanes)!==0,Ft||u){if(l=vt,l!==null&&(m=F(l,r),m!==0&&m!==h.retryLane))throw h.retryLane=m,Qn(i,m),Li(l,i,m),Th;Go(),s=ng(i,s,r)}else i=h.treeContext,Ct=rs(m.nextSibling),fi=s,Je=!0,pn=null,ss=!1,i!==null&&q_(s,i),s=Uo(s,l),s.flags|=4096;return s}return i=Ks(i.child,{mode:l.mode,children:l.children}),i.ref=s.ref,s.child=i,i.return=s,i}function Po(i,s){var r=s.ref;if(r===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(i===null||i.ref!==r)&&(s.flags|=4194816)}}function kh(i,s,r,l,u){return ir(s),r=lh(i,s,r,l,void 0,u),l=oh(),i!==null&&!Ft?(ch(i,s,u),Vs(i,s,u)):(Je&&l&&Iu(s),s.flags|=1,_i(i,s,r,u),s.child)}function rg(i,s,r,l,u,h){return ir(s),s.updateQueue=null,r=om(s,l,r,u),lm(i),l=oh(),i!==null&&!Ft?(ch(i,s,h),Vs(i,s,h)):(Je&&l&&Iu(s),s.flags|=1,_i(i,s,r,h),s.child)}function ag(i,s,r,l,u){if(ir(s),s.stateNode===null){var h=Nr,m=r.contextType;typeof m=="object"&&m!==null&&(h=pi(m)),h=new r(l,h),s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=xh,s.stateNode=h,h._reactInternals=s,h=s.stateNode,h.props=l,h.state=s.memoizedState,h.refs={},Ju(s),m=r.contextType,h.context=typeof m=="object"&&m!==null?pi(m):Nr,h.state=s.memoizedState,m=r.getDerivedStateFromProps,typeof m=="function"&&(Ch(s,r,m,l),h.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(m=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),m!==h.state&&xh.enqueueReplaceState(h,h.state,null),Ua(s,l,h,u),ja(),h.state=s.memoizedState),typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){h=s.stateNode;var y=s.memoizedProps,k=or(r,y);h.props=k;var U=h.context,G=r.contextType;m=Nr,typeof G=="object"&&G!==null&&(m=pi(G));var ee=r.getDerivedStateFromProps;G=typeof ee=="function"||typeof h.getSnapshotBeforeUpdate=="function",y=s.pendingProps!==y,G||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(y||U!==m)&&Ym(s,h,l,m),gn=!1;var I=s.memoizedState;h.state=I,Ua(s,l,h,u),ja(),U=s.memoizedState,y||I!==U||gn?(typeof ee=="function"&&(Ch(s,r,ee,l),U=s.memoizedState),(k=gn||Wm(s,r,k,l,I,U,m))?(G||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(s.flags|=4194308)):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=U),h.props=l,h.state=U,h.context=m,l=k):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{h=s.stateNode,eh(i,s),m=s.memoizedProps,G=or(r,m),h.props=G,ee=s.pendingProps,I=h.context,U=r.contextType,k=Nr,typeof U=="object"&&U!==null&&(k=pi(U)),y=r.getDerivedStateFromProps,(U=typeof y=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(m!==ee||I!==k)&&Ym(s,h,l,k),gn=!1,I=s.memoizedState,h.state=I,Ua(s,l,h,u),ja();var Y=s.memoizedState;m!==ee||I!==Y||gn||i!==null&&i.dependencies!==null&&bo(i.dependencies)?(typeof y=="function"&&(Ch(s,r,y,l),Y=s.memoizedState),(G=gn||Wm(s,r,G,l,I,Y,k)||i!==null&&i.dependencies!==null&&bo(i.dependencies))?(U||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,Y,k),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,Y,k)),typeof h.componentDidUpdate=="function"&&(s.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof h.componentDidUpdate!="function"||m===i.memoizedProps&&I===i.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||m===i.memoizedProps&&I===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=Y),h.props=l,h.state=Y,h.context=k,l=G):(typeof h.componentDidUpdate!="function"||m===i.memoizedProps&&I===i.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||m===i.memoizedProps&&I===i.memoizedState||(s.flags|=1024),l=!1)}return h=l,Po(i,s),l=(s.flags&128)!==0,h||l?(h=s.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:h.render(),s.flags|=1,i!==null&&l?(s.child=ar(s,i.child,null,u),s.child=ar(s,null,r,u)):_i(i,s,r,u),s.memoizedState=h.state,i=s.child):i=Vs(i,s,u),i}function lg(i,s,r,l){return er(),s.flags|=256,_i(i,s,r,l),s.child}var Dh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Rh(i){return{baseLanes:i,cachePool:G_()}}function Mh(i,s,r){return i=i!==null?i.childLanes&~r:0,s&&(i|=qi),i}function og(i,s,r){var l=s.pendingProps,u=!1,h=(s.flags&128)!==0,m;if((m=h)||(m=i!==null&&i.memoizedState===null?!1:(jt.current&2)!==0),m&&(u=!0,s.flags&=-129),m=(s.flags&32)!==0,s.flags&=-33,i===null){if(Je){if(u?Sn(s):bn(),(i=Ct)?(i=mv(i,ss),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:fn!==null?{id:xs,overflow:Es}:null,retryLane:536870912,hydrationErrors:null},r=K_(i),r.return=s,s.child=r,fi=s,Ct=null)):i=null,i===null)throw _n(s);return dd(i)?s.lanes=32:s.lanes=536870912,null}var y=l.children;return l=l.fallback,u?(bn(),u=s.mode,y=Ko({mode:"hidden",children:y},u),l=Jn(l,u,r,null),y.return=s,l.return=s,y.sibling=l,s.child=y,l=s.child,l.memoizedState=Rh(r),l.childLanes=Mh(i,m,r),s.memoizedState=Dh,qa(null,l)):(Sn(s),Ah(s,y))}var k=i.memoizedState;if(k!==null&&(y=k.dehydrated,y!==null)){if(h)s.flags&256?(Sn(s),s.flags&=-257,s=Nh(i,s,r)):s.memoizedState!==null?(bn(),s.child=i.child,s.flags|=128,s=null):(bn(),y=l.fallback,u=s.mode,l=Ko({mode:"visible",children:l.children},u),y=Jn(y,u,r,null),y.flags|=2,l.return=s,y.return=s,l.sibling=y,s.child=l,ar(s,i.child,null,r),l=s.child,l.memoizedState=Rh(r),l.childLanes=Mh(i,m,r),s.memoizedState=Dh,s=qa(null,l));else if(Sn(s),dd(y)){if(m=y.nextSibling&&y.nextSibling.dataset,m)var U=m.dgst;m=U,l=Error(a(419)),l.stack="",l.digest=m,Na({value:l,source:null,stack:null}),s=Nh(i,s,r)}else if(Ft||zr(i,s,r,!1),m=(r&i.childLanes)!==0,Ft||m){if(m=vt,m!==null&&(l=F(m,r),l!==0&&l!==k.retryLane))throw k.retryLane=l,Qn(i,l),Li(m,i,l),Th;hd(y)||Go(),s=Nh(i,s,r)}else hd(y)?(s.flags|=192,s.child=i.child,s=null):(i=k.treeContext,Ct=rs(y.nextSibling),fi=s,Je=!0,pn=null,ss=!1,i!==null&&q_(s,i),s=Ah(s,l.children),s.flags|=4096);return s}return u?(bn(),y=l.fallback,u=s.mode,k=i.child,U=k.sibling,l=Ks(k,{mode:"hidden",children:l.children}),l.subtreeFlags=k.subtreeFlags&65011712,U!==null?y=Ks(U,y):(y=Jn(y,u,r,null),y.flags|=2),y.return=s,l.return=s,l.sibling=y,s.child=l,qa(null,l),l=s.child,y=i.child.memoizedState,y===null?y=Rh(r):(u=y.cachePool,u!==null?(k=Kt._currentValue,u=u.parent!==k?{parent:k,pool:k}:u):u=G_(),y={baseLanes:y.baseLanes|r,cachePool:u}),l.memoizedState=y,l.childLanes=Mh(i,m,r),s.memoizedState=Dh,qa(i.child,l)):(Sn(s),r=i.child,i=r.sibling,r=Ks(r,{mode:"visible",children:l.children}),r.return=s,r.sibling=null,i!==null&&(m=s.deletions,m===null?(s.deletions=[i],s.flags|=16):m.push(i)),s.child=r,s.memoizedState=null,r)}function Ah(i,s){return s=Ko({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function Ko(i,s){return i=Pi(22,i,null,s),i.lanes=0,i}function Nh(i,s,r){return ar(s,i.child,null,r),i=Ah(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function cg(i,s,r){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),Vu(i.return,s,r)}function Bh(i,s,r,l,u,h){var m=i.memoizedState;m===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:u,treeForkCount:h}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=l,m.tail=r,m.tailMode=u,m.treeForkCount=h)}function ug(i,s,r){var l=s.pendingProps,u=l.revealOrder,h=l.tail;l=l.children;var m=jt.current,y=(m&2)!==0;if(y?(m=m&1|2,s.flags|=128):m&=1,oe(jt,m),_i(i,s,l,r),l=Je?Aa:0,!y&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&cg(i,r,s);else if(i.tag===19)cg(i,r,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(u){case"forwards":for(r=s.child,u=null;r!==null;)i=r.alternate,i!==null&&Ro(i)===null&&(u=r),r=r.sibling;r=u,r===null?(u=s.child,s.child=null):(u=r.sibling,r.sibling=null),Bh(s,!1,u,r,h,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,u=s.child,s.child=null;u!==null;){if(i=u.alternate,i!==null&&Ro(i)===null){s.child=u;break}i=u.sibling,u.sibling=r,r=u,u=i}Bh(s,!0,r,null,h,l);break;case"together":Bh(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function Vs(i,s,r){if(i!==null&&(s.dependencies=i.dependencies),xn|=s.lanes,(r&s.childLanes)===0)if(i!==null){if(zr(i,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(a(153));if(s.child!==null){for(i=s.child,r=Ks(i,i.pendingProps),s.child=r,r.return=s;i.sibling!==null;)i=i.sibling,r=r.sibling=Ks(i,i.pendingProps),r.return=s;r.sibling=null}return s.child}function Lh(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&bo(i)))}function l1(i,s,r){switch(s.tag){case 3:qe(s,s.stateNode.containerInfo),mn(s,Kt,i.memoizedState.cache),er();break;case 27:case 5:Ae(s);break;case 4:qe(s,s.stateNode.containerInfo);break;case 10:mn(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,rh(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(Sn(s),s.flags|=128,null):(r&s.child.childLanes)!==0?og(i,s,r):(Sn(s),i=Vs(i,s,r),i!==null?i.sibling:null);Sn(s);break;case 19:var u=(i.flags&128)!==0;if(l=(r&s.childLanes)!==0,l||(zr(i,s,r,!1),l=(r&s.childLanes)!==0),u){if(l)return ug(i,s,r);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),oe(jt,jt.current),l)break;return null;case 22:return s.lanes=0,ig(i,s,r,s.pendingProps);case 24:mn(s,Kt,i.memoizedState.cache)}return Vs(i,s,r)}function hg(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps)Ft=!0;else{if(!Lh(i,r)&&(s.flags&128)===0)return Ft=!1,l1(i,s,r);Ft=(i.flags&131072)!==0}else Ft=!1,Je&&(s.flags&1048576)!==0&&F_(s,Aa,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=nr(s.elementType),s.type=i,typeof i=="function")Uu(i)?(l=or(i,l),s.tag=1,s=ag(null,s,i,l,r)):(s.tag=0,s=kh(null,s,i,l,r));else{if(i!=null){var u=i.$$typeof;if(u===P){s.tag=11,s=Jm(null,s,i,l,r);break e}else if(u===N){s.tag=14,s=eg(null,s,i,l,r);break e}}throw s=se(i)||i,Error(a(306,s,""))}}return s;case 0:return kh(i,s,s.type,s.pendingProps,r);case 1:return l=s.type,u=or(l,s.pendingProps),ag(i,s,l,u,r);case 3:e:{if(qe(s,s.stateNode.containerInfo),i===null)throw Error(a(387));l=s.pendingProps;var h=s.memoizedState;u=h.element,eh(i,s),Ua(s,l,null,r);var m=s.memoizedState;if(l=m.cache,mn(s,Kt,l),l!==h.cache&&$u(s,[Kt],r,!0),ja(),l=m.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:m.cache},s.updateQueue.baseState=h,s.memoizedState=h,s.flags&256){s=lg(i,s,l,r);break e}else if(l!==u){u=es(Error(a(424)),s),Na(u),s=lg(i,s,l,r);break e}else for(i=s.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Ct=rs(i.firstChild),fi=s,Je=!0,pn=null,ss=!0,r=im(s,null,l,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(er(),l===u){s=Vs(i,s,r);break e}_i(i,s,l,r)}s=s.child}return s;case 26:return Po(i,s),i===null?(r=wv(s.type,null,s.pendingProps,null))?s.memoizedState=r:Je||(r=s.type,i=s.pendingProps,l=sc(fe.current).createElement(r),l[ct]=s,l[ht]=i,mi(l,r,i),Fe(l),s.stateNode=l):s.memoizedState=wv(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Ae(s),i===null&&Je&&(l=s.stateNode=yv(s.type,s.pendingProps,fe.current),fi=s,ss=!0,u=Ct,Rn(s.type)?(fd=u,Ct=rs(l.firstChild)):Ct=u),_i(i,s,s.pendingProps.children,r),Po(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Je&&((u=l=Ct)&&(l=H1(l,s.type,s.pendingProps,ss),l!==null?(s.stateNode=l,fi=s,Ct=rs(l.firstChild),ss=!1,u=!0):u=!1),u||_n(s)),Ae(s),u=s.type,h=s.pendingProps,m=i!==null?i.memoizedProps:null,l=h.children,od(u,h)?l=null:m!==null&&od(u,m)&&(s.flags|=32),s.memoizedState!==null&&(u=lh(i,s,Qw,null,null,r),rl._currentValue=u),Po(i,s),_i(i,s,l,r),s.child;case 6:return i===null&&Je&&((i=r=Ct)&&(r=j1(r,s.pendingProps,ss),r!==null?(s.stateNode=r,fi=s,Ct=null,i=!0):i=!1),i||_n(s)),null;case 13:return og(i,s,r);case 4:return qe(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=ar(s,null,l,r):_i(i,s,l,r),s.child;case 11:return Jm(i,s,s.type,s.pendingProps,r);case 7:return _i(i,s,s.pendingProps,r),s.child;case 8:return _i(i,s,s.pendingProps.children,r),s.child;case 12:return _i(i,s,s.pendingProps.children,r),s.child;case 10:return l=s.pendingProps,mn(s,s.type,l.value),_i(i,s,l.children,r),s.child;case 9:return u=s.type._context,l=s.pendingProps.children,ir(s),u=pi(u),l=l(u),s.flags|=1,_i(i,s,l,r),s.child;case 14:return eg(i,s,s.type,s.pendingProps,r);case 15:return tg(i,s,s.type,s.pendingProps,r);case 19:return ug(i,s,r);case 31:return a1(i,s,r);case 22:return ig(i,s,r,s.pendingProps);case 24:return ir(s),l=pi(Kt),i===null?(u=Zu(),u===null&&(u=vt,h=Xu(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=r),u=h),s.memoizedState={parent:l,cache:u},Ju(s),mn(s,Kt,u)):((i.lanes&r)!==0&&(eh(i,s),Ua(s,null,null,r),ja()),u=i.memoizedState,h=s.memoizedState,u.parent!==l?(u={parent:l,cache:l},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),mn(s,Kt,l)):(l=h.cache,mn(s,Kt,l),l!==u.cache&&$u(s,[Kt],r,!0))),_i(i,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function $s(i){i.flags|=4}function Oh(i,s,r,l,u){if((s=(i.mode&32)!==0)&&(s=!1),s){if(i.flags|=16777216,(u&335544128)===u)if(i.stateNode.complete)i.flags|=8192;else if(jg())i.flags|=8192;else throw rr=Eo,Qu}else i.flags&=-16777217}function dg(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!kv(s))if(jg())i.flags|=8192;else throw rr=Eo,Qu}function Io(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Bt():536870912,i.lanes|=s,$r|=s)}function Wa(i,s){if(!Je)switch(i.tailMode){case"hidden":s=i.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?i.tail=null:r.sibling=null;break;case"collapsed":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function xt(i){var s=i.alternate!==null&&i.alternate.child===i.child,r=0,l=0;if(s)for(var u=i.child;u!==null;)r|=u.lanes|u.childLanes,l|=u.subtreeFlags&65011712,l|=u.flags&65011712,u.return=i,u=u.sibling;else for(u=i.child;u!==null;)r|=u.lanes|u.childLanes,l|=u.subtreeFlags,l|=u.flags,u.return=i,u=u.sibling;return i.subtreeFlags|=l,i.childLanes=r,s}function o1(i,s,r){var l=s.pendingProps;switch(Fu(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(s),null;case 1:return xt(s),null;case 3:return r=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),qs(Kt),Me(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(i===null||i.child===null)&&(Or(s)?$s(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Wu())),xt(s),null;case 26:var u=s.type,h=s.memoizedState;return i===null?($s(s),h!==null?(xt(s),dg(s,h)):(xt(s),Oh(s,u,null,l,r))):h?h!==i.memoizedState?($s(s),xt(s),dg(s,h)):(xt(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&$s(s),xt(s),Oh(s,u,i,l,r)),null;case 27:if(Ze(s),r=fe.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&$s(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return xt(s),null}i=ne.current,Or(s)?W_(s):(i=yv(u,l,r),s.stateNode=i,$s(s))}return xt(s),null;case 5:if(Ze(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&$s(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return xt(s),null}if(h=ne.current,Or(s))W_(s);else{var m=sc(fe.current);switch(h){case 1:h=m.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=m.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=m.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=m.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=m.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?m.createElement("select",{is:l.is}):m.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?m.createElement(u,{is:l.is}):m.createElement(u)}}h[ct]=s,h[ht]=l;e:for(m=s.child;m!==null;){if(m.tag===5||m.tag===6)h.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===s)break e;for(;m.sibling===null;){if(m.return===null||m.return===s)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}s.stateNode=h;e:switch(mi(h,u,l),u){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&$s(s)}}return xt(s),Oh(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,r),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&$s(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(a(166));if(i=fe.current,Or(s)){if(i=s.stateNode,r=s.memoizedProps,l=null,u=fi,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}i[ct]=s,i=!!(i.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||ov(i.nodeValue,r)),i||_n(s,!0)}else i=sc(i).createTextNode(l),i[ct]=s,s.stateNode=i}return xt(s),null;case 31:if(r=s.memoizedState,i===null||i.memoizedState!==null){if(l=Or(s),r!==null){if(i===null){if(!l)throw Error(a(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(557));i[ct]=s}else er(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),i=!1}else r=Wu(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=r),i=!0;if(!i)return s.flags&256?(Ii(s),s):(Ii(s),null);if((s.flags&128)!==0)throw Error(a(558))}return xt(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=Or(s),l!==null&&l.dehydrated!==null){if(i===null){if(!u)throw Error(a(318));if(u=s.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(a(317));u[ct]=s}else er(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),u=!1}else u=Wu(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(Ii(s),s):(Ii(s),null)}return Ii(s),(s.flags&128)!==0?(s.lanes=r,s):(r=l!==null,i=i!==null&&i.memoizedState!==null,r&&(l=s.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==u&&(l.flags|=2048)),r!==i&&r&&(s.child.flags|=8192),Io(s,s.updateQueue),xt(s),null);case 4:return Me(),i===null&&sd(s.stateNode.containerInfo),xt(s),null;case 10:return qs(s.type),xt(s),null;case 19:if(W(jt),l=s.memoizedState,l===null)return xt(s),null;if(u=(s.flags&128)!==0,h=l.rendering,h===null)if(u)Wa(l,!1);else{if(Ot!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(h=Ro(i),h!==null){for(s.flags|=128,Wa(l,!1),i=h.updateQueue,s.updateQueue=i,Io(s,i),s.subtreeFlags=0,i=r,r=s.child;r!==null;)P_(r,i),r=r.sibling;return oe(jt,jt.current&1|2),Je&&Is(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&bt()>Vo&&(s.flags|=128,u=!0,Wa(l,!1),s.lanes=4194304)}else{if(!u)if(i=Ro(h),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,Io(s,i),Wa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Je)return xt(s),null}else 2*bt()-l.renderingStartTime>Vo&&r!==536870912&&(s.flags|=128,u=!0,Wa(l,!1),s.lanes=4194304);l.isBackwards?(h.sibling=s.child,s.child=h):(i=l.last,i!==null?i.sibling=h:s.child=h,l.last=h)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=bt(),i.sibling=null,r=jt.current,oe(jt,u?r&1|2:r&1),Je&&Is(s,l.treeForkCount),i):(xt(s),null);case 22:case 23:return Ii(s),nh(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(r&536870912)!==0&&(s.flags&128)===0&&(xt(s),s.subtreeFlags&6&&(s.flags|=8192)):xt(s),r=s.updateQueue,r!==null&&Io(s,r.retryQueue),r=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==r&&(s.flags|=2048),i!==null&&W(sr),null;case 24:return r=null,i!==null&&(r=i.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),qs(Kt),xt(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function c1(i,s){switch(Fu(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return qs(Kt),Me(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return Ze(s),null;case 31:if(s.memoizedState!==null){if(Ii(s),s.alternate===null)throw Error(a(340));er()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(Ii(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(a(340));er()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return W(jt),null;case 4:return Me(),null;case 10:return qs(s.type),null;case 22:case 23:return Ii(s),nh(),i!==null&&W(sr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return qs(Kt),null;case 25:return null;default:return null}}function fg(i,s){switch(Fu(s),s.tag){case 3:qs(Kt),Me();break;case 26:case 27:case 5:Ze(s);break;case 4:Me();break;case 31:s.memoizedState!==null&&Ii(s);break;case 13:Ii(s);break;case 19:W(jt);break;case 10:qs(s.type);break;case 22:case 23:Ii(s),nh(),i!==null&&W(sr);break;case 24:qs(Kt)}}function Ya(i,s){try{var r=s.updateQueue,l=r!==null?r.lastEffect:null;if(l!==null){var u=l.next;r=u;do{if((r.tag&i)===i){l=void 0;var h=r.create,m=r.inst;l=h(),m.destroy=l}r=r.next}while(r!==u)}}catch(y){ft(s,s.return,y)}}function wn(i,s,r){try{var l=s.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var h=u.next;l=h;do{if((l.tag&i)===i){var m=l.inst,y=m.destroy;if(y!==void 0){m.destroy=void 0,u=s;var k=r,U=y;try{U()}catch(G){ft(u,k,G)}}}l=l.next}while(l!==h)}}catch(G){ft(s,s.return,G)}}function pg(i){var s=i.updateQueue;if(s!==null){var r=i.stateNode;try{nm(s,r)}catch(l){ft(i,i.return,l)}}}function _g(i,s,r){r.props=or(i.type,i.memoizedProps),r.state=i.memoizedState;try{r.componentWillUnmount()}catch(l){ft(i,s,l)}}function Va(i,s){try{var r=i.ref;if(r!==null){switch(i.tag){case 26:case 27:case 5:var l=i.stateNode;break;case 30:l=i.stateNode;break;default:l=i.stateNode}typeof r=="function"?i.refCleanup=r(l):r.current=l}}catch(u){ft(i,s,u)}}function Ts(i,s){var r=i.ref,l=i.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(u){ft(i,s,u)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){ft(i,s,u)}else r.current=null}function mg(i){var s=i.type,r=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&l.focus();break e;case"img":r.src?l.src=r.src:r.srcSet&&(l.srcset=r.srcSet)}}catch(u){ft(i,i.return,u)}}function zh(i,s,r){try{var l=i.stateNode;A1(l,i.type,r,s),l[ht]=s}catch(u){ft(i,i.return,u)}}function gg(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Rn(i.type)||i.tag===4}function Hh(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||gg(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Rn(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function jh(i,s,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(i,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(i),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Us));else if(l!==4&&(l===27&&Rn(i.type)&&(r=i.stateNode,s=null),i=i.child,i!==null))for(jh(i,s,r),i=i.sibling;i!==null;)jh(i,s,r),i=i.sibling}function Fo(i,s,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?r.insertBefore(i,s):r.appendChild(i);else if(l!==4&&(l===27&&Rn(i.type)&&(r=i.stateNode),i=i.child,i!==null))for(Fo(i,s,r),i=i.sibling;i!==null;)Fo(i,s,r),i=i.sibling}function vg(i){var s=i.stateNode,r=i.memoizedProps;try{for(var l=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);mi(s,l,r),s[ct]=i,s[ht]=r}catch(h){ft(i,i.return,h)}}var Xs=!1,qt=!1,Uh=!1,yg=typeof WeakSet=="function"?WeakSet:Set,ni=null;function u1(i,s){if(i=i.containerInfo,ad=uc,i=A_(i),Nu(i)){if("selectionStart"in i)var r={start:i.selectionStart,end:i.selectionEnd};else e:{r=(r=i.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var u=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var m=0,y=-1,k=-1,U=0,G=0,ee=i,I=null;t:for(;;){for(var Y;ee!==r||u!==0&&ee.nodeType!==3||(y=m+u),ee!==h||l!==0&&ee.nodeType!==3||(k=m+l),ee.nodeType===3&&(m+=ee.nodeValue.length),(Y=ee.firstChild)!==null;)I=ee,ee=Y;for(;;){if(ee===i)break t;if(I===r&&++U===u&&(y=m),I===h&&++G===l&&(k=m),(Y=ee.nextSibling)!==null)break;ee=I,I=ee.parentNode}ee=Y}r=y===-1||k===-1?null:{start:y,end:k}}else r=null}r=r||{start:0,end:0}}else r=null;for(ld={focusedElem:i,selectionRange:r},uc=!1,ni=s;ni!==null;)if(s=ni,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,ni=i;else for(;ni!==null;){switch(s=ni,h=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(r=0;r<i.length;r++)u=i[r],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&h!==null){i=void 0,r=s,u=h.memoizedProps,h=h.memoizedState,l=r.stateNode;try{var ve=or(r.type,u);i=l.getSnapshotBeforeUpdate(ve,h),l.__reactInternalSnapshotBeforeUpdate=i}catch(De){ft(r,r.return,De)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,r=i.nodeType,r===9)ud(i);else if(r===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":ud(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(a(163))}if(i=s.sibling,i!==null){i.return=s.return,ni=i;break}ni=s.return}}function Sg(i,s,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:Zs(i,r),l&4&&Ya(5,r);break;case 1:if(Zs(i,r),l&4)if(i=r.stateNode,s===null)try{i.componentDidMount()}catch(m){ft(r,r.return,m)}else{var u=or(r.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(m){ft(r,r.return,m)}}l&64&&pg(r),l&512&&Va(r,r.return);break;case 3:if(Zs(i,r),l&64&&(i=r.updateQueue,i!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{nm(i,s)}catch(m){ft(r,r.return,m)}}break;case 27:s===null&&l&4&&vg(r);case 26:case 5:Zs(i,r),s===null&&l&4&&mg(r),l&512&&Va(r,r.return);break;case 12:Zs(i,r);break;case 31:Zs(i,r),l&4&&Cg(i,r);break;case 13:Zs(i,r),l&4&&xg(i,r),l&64&&(i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(r=y1.bind(null,r),U1(i,r))));break;case 22:if(l=r.memoizedState!==null||Xs,!l){s=s!==null&&s.memoizedState!==null||qt,u=Xs;var h=qt;Xs=l,(qt=s)&&!h?Qs(i,r,(r.subtreeFlags&8772)!==0):Zs(i,r),Xs=u,qt=h}break;case 30:break;default:Zs(i,r)}}function bg(i){var s=i.alternate;s!==null&&(i.alternate=null,bg(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&H(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Tt=null,Mi=!1;function Gs(i,s,r){for(r=r.child;r!==null;)wg(i,s,r),r=r.sibling}function wg(i,s,r){if(Dt&&typeof Dt.onCommitFiberUnmount=="function")try{Dt.onCommitFiberUnmount(_s,r)}catch{}switch(r.tag){case 26:qt||Ts(r,s),Gs(i,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:qt||Ts(r,s);var l=Tt,u=Mi;Rn(r.type)&&(Tt=r.stateNode,Mi=!1),Gs(i,s,r),il(r.stateNode),Tt=l,Mi=u;break;case 5:qt||Ts(r,s);case 6:if(l=Tt,u=Mi,Tt=null,Gs(i,s,r),Tt=l,Mi=u,Tt!==null)if(Mi)try{(Tt.nodeType===9?Tt.body:Tt.nodeName==="HTML"?Tt.ownerDocument.body:Tt).removeChild(r.stateNode)}catch(h){ft(r,s,h)}else try{Tt.removeChild(r.stateNode)}catch(h){ft(r,s,h)}break;case 18:Tt!==null&&(Mi?(i=Tt,pv(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.stateNode),ia(i)):pv(Tt,r.stateNode));break;case 4:l=Tt,u=Mi,Tt=r.stateNode.containerInfo,Mi=!0,Gs(i,s,r),Tt=l,Mi=u;break;case 0:case 11:case 14:case 15:wn(2,r,s),qt||wn(4,r,s),Gs(i,s,r);break;case 1:qt||(Ts(r,s),l=r.stateNode,typeof l.componentWillUnmount=="function"&&_g(r,s,l)),Gs(i,s,r);break;case 21:Gs(i,s,r);break;case 22:qt=(l=qt)||r.memoizedState!==null,Gs(i,s,r),qt=l;break;default:Gs(i,s,r)}}function Cg(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{ia(i)}catch(r){ft(s,s.return,r)}}}function xg(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{ia(i)}catch(r){ft(s,s.return,r)}}function h1(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new yg),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new yg),s;default:throw Error(a(435,i.tag))}}function qo(i,s){var r=h1(i);s.forEach(function(l){if(!r.has(l)){r.add(l);var u=S1.bind(null,i,l);l.then(u,u)}})}function Ai(i,s){var r=s.deletions;if(r!==null)for(var l=0;l<r.length;l++){var u=r[l],h=i,m=s,y=m;e:for(;y!==null;){switch(y.tag){case 27:if(Rn(y.type)){Tt=y.stateNode,Mi=!1;break e}break;case 5:Tt=y.stateNode,Mi=!1;break e;case 3:case 4:Tt=y.stateNode.containerInfo,Mi=!0;break e}y=y.return}if(Tt===null)throw Error(a(160));wg(h,m,u),Tt=null,Mi=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Eg(s,i),s=s.sibling}var ys=null;function Eg(i,s){var r=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Ai(s,i),Ni(i),l&4&&(wn(3,i,i.return),Ya(3,i),wn(5,i,i.return));break;case 1:Ai(s,i),Ni(i),l&512&&(qt||r===null||Ts(r,r.return)),l&64&&Xs&&(i=i.updateQueue,i!==null&&(l=i.callbacks,l!==null&&(r=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=r===null?l:r.concat(l))));break;case 26:var u=ys;if(Ai(s,i),Ni(i),l&512&&(qt||r===null||Ts(r,r.return)),l&4){var h=r!==null?r.memoizedState:null;if(l=i.memoizedState,r===null)if(l===null)if(i.stateNode===null){e:{l=i.type,r=i.memoizedProps,u=u.ownerDocument||u;t:switch(l){case"title":h=u.getElementsByTagName("title")[0],(!h||h[Vn]||h[ct]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(l),u.head.insertBefore(h,u.querySelector("head > title"))),mi(h,l,r),h[ct]=i,Fe(h),l=h;break e;case"link":var m=Ev("link","href",u).get(l+(r.href||""));if(m){for(var y=0;y<m.length;y++)if(h=m[y],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){m.splice(y,1);break t}}h=u.createElement(l),mi(h,l,r),u.head.appendChild(h);break;case"meta":if(m=Ev("meta","content",u).get(l+(r.content||""))){for(y=0;y<m.length;y++)if(h=m[y],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){m.splice(y,1);break t}}h=u.createElement(l),mi(h,l,r),u.head.appendChild(h);break;default:throw Error(a(468,l))}h[ct]=i,Fe(h),l=h}i.stateNode=l}else Tv(u,i.type,i.stateNode);else i.stateNode=xv(u,l,i.memoizedProps);else h!==l?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,l===null?Tv(u,i.type,i.stateNode):xv(u,l,i.memoizedProps)):l===null&&i.stateNode!==null&&zh(i,i.memoizedProps,r.memoizedProps)}break;case 27:Ai(s,i),Ni(i),l&512&&(qt||r===null||Ts(r,r.return)),r!==null&&l&4&&zh(i,i.memoizedProps,r.memoizedProps);break;case 5:if(Ai(s,i),Ni(i),l&512&&(qt||r===null||Ts(r,r.return)),i.flags&32){u=i.stateNode;try{Er(u,"")}catch(ve){ft(i,i.return,ve)}}l&4&&i.stateNode!=null&&(u=i.memoizedProps,zh(i,u,r!==null?r.memoizedProps:u)),l&1024&&(Uh=!0);break;case 6:if(Ai(s,i),Ni(i),l&4){if(i.stateNode===null)throw Error(a(162));l=i.memoizedProps,r=i.stateNode;try{r.nodeValue=l}catch(ve){ft(i,i.return,ve)}}break;case 3:if(ac=null,u=ys,ys=nc(s.containerInfo),Ai(s,i),ys=u,Ni(i),l&4&&r!==null&&r.memoizedState.isDehydrated)try{ia(s.containerInfo)}catch(ve){ft(i,i.return,ve)}Uh&&(Uh=!1,Tg(i));break;case 4:l=ys,ys=nc(i.stateNode.containerInfo),Ai(s,i),Ni(i),ys=l;break;case 12:Ai(s,i),Ni(i);break;case 31:Ai(s,i),Ni(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,qo(i,l)));break;case 13:Ai(s,i),Ni(i),i.child.flags&8192&&i.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Yo=bt()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,qo(i,l)));break;case 22:u=i.memoizedState!==null;var k=r!==null&&r.memoizedState!==null,U=Xs,G=qt;if(Xs=U||u,qt=G||k,Ai(s,i),qt=G,Xs=U,Ni(i),l&8192)e:for(s=i.stateNode,s._visibility=u?s._visibility&-2:s._visibility|1,u&&(r===null||k||Xs||qt||cr(i)),r=null,s=i;;){if(s.tag===5||s.tag===26){if(r===null){k=r=s;try{if(h=k.stateNode,u)m=h.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{y=k.stateNode;var ee=k.memoizedProps.style,I=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;y.style.display=I==null||typeof I=="boolean"?"":(""+I).trim()}}catch(ve){ft(k,k.return,ve)}}}else if(s.tag===6){if(r===null){k=s;try{k.stateNode.nodeValue=u?"":k.memoizedProps}catch(ve){ft(k,k.return,ve)}}}else if(s.tag===18){if(r===null){k=s;try{var Y=k.stateNode;u?_v(Y,!0):_v(k.stateNode,!1)}catch(ve){ft(k,k.return,ve)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=i.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,qo(i,r))));break;case 19:Ai(s,i),Ni(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,qo(i,l)));break;case 30:break;case 21:break;default:Ai(s,i),Ni(i)}}function Ni(i){var s=i.flags;if(s&2){try{for(var r,l=i.return;l!==null;){if(gg(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var u=r.stateNode,h=Hh(i);Fo(i,h,u);break;case 5:var m=r.stateNode;r.flags&32&&(Er(m,""),r.flags&=-33);var y=Hh(i);Fo(i,y,m);break;case 3:case 4:var k=r.stateNode.containerInfo,U=Hh(i);jh(i,U,k);break;default:throw Error(a(161))}}catch(G){ft(i,i.return,G)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Tg(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;Tg(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function Zs(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Sg(i,s.alternate,s),s=s.sibling}function cr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:wn(4,s,s.return),cr(s);break;case 1:Ts(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&_g(s,s.return,r),cr(s);break;case 27:il(s.stateNode);case 26:case 5:Ts(s,s.return),cr(s);break;case 22:s.memoizedState===null&&cr(s);break;case 30:cr(s);break;default:cr(s)}i=i.sibling}}function Qs(i,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,u=i,h=s,m=h.flags;switch(h.tag){case 0:case 11:case 15:Qs(u,h,r),Ya(4,h);break;case 1:if(Qs(u,h,r),l=h,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(U){ft(l,l.return,U)}if(l=h,u=l.updateQueue,u!==null){var y=l.stateNode;try{var k=u.shared.hiddenCallbacks;if(k!==null)for(u.shared.hiddenCallbacks=null,u=0;u<k.length;u++)sm(k[u],y)}catch(U){ft(l,l.return,U)}}r&&m&64&&pg(h),Va(h,h.return);break;case 27:vg(h);case 26:case 5:Qs(u,h,r),r&&l===null&&m&4&&mg(h),Va(h,h.return);break;case 12:Qs(u,h,r);break;case 31:Qs(u,h,r),r&&m&4&&Cg(u,h);break;case 13:Qs(u,h,r),r&&m&4&&xg(u,h);break;case 22:h.memoizedState===null&&Qs(u,h,r),Va(h,h.return);break;case 30:break;default:Qs(u,h,r)}s=s.sibling}}function Ph(i,s){var r=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==r&&(i!=null&&i.refCount++,r!=null&&Ba(r))}function Kh(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&Ba(i))}function Ss(i,s,r,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)kg(i,s,r,l),s=s.sibling}function kg(i,s,r,l){var u=s.flags;switch(s.tag){case 0:case 11:case 15:Ss(i,s,r,l),u&2048&&Ya(9,s);break;case 1:Ss(i,s,r,l);break;case 3:Ss(i,s,r,l),u&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&Ba(i)));break;case 12:if(u&2048){Ss(i,s,r,l),i=s.stateNode;try{var h=s.memoizedProps,m=h.id,y=h.onPostCommit;typeof y=="function"&&y(m,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(k){ft(s,s.return,k)}}else Ss(i,s,r,l);break;case 31:Ss(i,s,r,l);break;case 13:Ss(i,s,r,l);break;case 23:break;case 22:h=s.stateNode,m=s.alternate,s.memoizedState!==null?h._visibility&2?Ss(i,s,r,l):$a(i,s):h._visibility&2?Ss(i,s,r,l):(h._visibility|=2,Wr(i,s,r,l,(s.subtreeFlags&10256)!==0||!1)),u&2048&&Ph(m,s);break;case 24:Ss(i,s,r,l),u&2048&&Kh(s.alternate,s);break;default:Ss(i,s,r,l)}}function Wr(i,s,r,l,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var h=i,m=s,y=r,k=l,U=m.flags;switch(m.tag){case 0:case 11:case 15:Wr(h,m,y,k,u),Ya(8,m);break;case 23:break;case 22:var G=m.stateNode;m.memoizedState!==null?G._visibility&2?Wr(h,m,y,k,u):$a(h,m):(G._visibility|=2,Wr(h,m,y,k,u)),u&&U&2048&&Ph(m.alternate,m);break;case 24:Wr(h,m,y,k,u),u&&U&2048&&Kh(m.alternate,m);break;default:Wr(h,m,y,k,u)}s=s.sibling}}function $a(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=i,l=s,u=l.flags;switch(l.tag){case 22:$a(r,l),u&2048&&Ph(l.alternate,l);break;case 24:$a(r,l),u&2048&&Kh(l.alternate,l);break;default:$a(r,l)}s=s.sibling}}var Xa=8192;function Yr(i,s,r){if(i.subtreeFlags&Xa)for(i=i.child;i!==null;)Dg(i,s,r),i=i.sibling}function Dg(i,s,r){switch(i.tag){case 26:Yr(i,s,r),i.flags&Xa&&i.memoizedState!==null&&Z1(r,ys,i.memoizedState,i.memoizedProps);break;case 5:Yr(i,s,r);break;case 3:case 4:var l=ys;ys=nc(i.stateNode.containerInfo),Yr(i,s,r),ys=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=Xa,Xa=16777216,Yr(i,s,r),Xa=l):Yr(i,s,r));break;default:Yr(i,s,r)}}function Rg(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function Ga(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var l=s[r];ni=l,Ag(l,i)}Rg(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Mg(i),i=i.sibling}function Mg(i){switch(i.tag){case 0:case 11:case 15:Ga(i),i.flags&2048&&wn(9,i,i.return);break;case 3:Ga(i);break;case 12:Ga(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Wo(i)):Ga(i);break;default:Ga(i)}}function Wo(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var l=s[r];ni=l,Ag(l,i)}Rg(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:wn(8,s,s.return),Wo(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,Wo(s));break;default:Wo(s)}i=i.sibling}}function Ag(i,s){for(;ni!==null;){var r=ni;switch(r.tag){case 0:case 11:case 15:wn(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var l=r.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ba(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,ni=l;else e:for(r=i;ni!==null;){l=ni;var u=l.sibling,h=l.return;if(bg(l),l===r){ni=null;break e}if(u!==null){u.return=h,ni=u;break e}ni=h}}}var d1={getCacheForType:function(i){var s=pi(Kt),r=s.data.get(i);return r===void 0&&(r=i(),s.data.set(i,r)),r},cacheSignal:function(){return pi(Kt).controller.signal}},f1=typeof WeakMap=="function"?WeakMap:Map,ot=0,vt=null,Ye=null,Xe=0,dt=0,Fi=null,Cn=!1,Vr=!1,Ih=!1,Js=0,Ot=0,xn=0,ur=0,Fh=0,qi=0,$r=0,Za=null,Bi=null,qh=!1,Yo=0,Ng=0,Vo=1/0,$o=null,En=null,Xt=0,Tn=null,Xr=null,en=0,Wh=0,Yh=null,Bg=null,Qa=0,Vh=null;function Wi(){return(ot&2)!==0&&Xe!==0?Xe&-Xe:R.T!==null?Jh():ke()}function Lg(){if(qi===0)if((Xe&536870912)===0||Je){var i=Xi;Xi<<=1,(Xi&3932160)===0&&(Xi=262144),qi=i}else qi=536870912;return i=Ki.current,i!==null&&(i.flags|=32),qi}function Li(i,s,r){(i===vt&&(dt===2||dt===9)||i.cancelPendingCommit!==null)&&(Gr(i,0),kn(i,Xe,qi,!1)),hi(i,r),((ot&2)===0||i!==vt)&&(i===vt&&((ot&2)===0&&(ur|=r),Ot===4&&kn(i,Xe,qi,!1)),ks(i))}function Og(i,s,r){if((ot&6)!==0)throw Error(a(327));var l=!r&&(s&127)===0&&(s&i.expiredLanes)===0||Nt(i,s),u=l?m1(i,s):Xh(i,s,!0),h=l;do{if(u===0){Vr&&!l&&kn(i,s,0,!1);break}else{if(r=i.current.alternate,h&&!p1(r)){u=Xh(i,s,!1),h=!1;continue}if(u===2){if(h=s,i.errorRecoveryDisabledLanes&h)var m=0;else m=i.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){s=m;e:{var y=i;u=Za;var k=y.current.memoizedState.isDehydrated;if(k&&(Gr(y,m).flags|=256),m=Xh(y,m,!1),m!==2){if(Ih&&!k){y.errorRecoveryDisabledLanes|=h,ur|=h,u=4;break e}h=Bi,Bi=u,h!==null&&(Bi===null?Bi=h:Bi.push.apply(Bi,h))}u=m}if(h=!1,u!==2)continue}}if(u===1){Gr(i,0),kn(i,s,0,!0);break}e:{switch(l=i,h=u,h){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:kn(l,s,qi,!Cn);break e;case 2:Bi=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(u=Yo+300-bt(),10<u)){if(kn(l,s,qi,!Cn),Rt(l,0,!0)!==0)break e;en=s,l.timeoutHandle=dv(zg.bind(null,l,r,Bi,$o,qh,s,qi,ur,$r,Cn,h,"Throttled",-0,0),u);break e}zg(l,r,Bi,$o,qh,s,qi,ur,$r,Cn,h,null,-0,0)}}break}while(!0);ks(i)}function zg(i,s,r,l,u,h,m,y,k,U,G,ee,I,Y){if(i.timeoutHandle=-1,ee=s.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Us},Dg(s,h,ee);var ve=(h&62914560)===h?Yo-bt():(h&4194048)===h?Ng-bt():0;if(ve=Q1(ee,ve),ve!==null){en=h,i.cancelPendingCommit=ve(qg.bind(null,i,s,h,r,l,u,m,y,k,G,ee,null,I,Y)),kn(i,h,m,!U);return}}qg(i,s,h,r,l,u,m,y,k)}function p1(i){for(var s=i;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var l=0;l<r.length;l++){var u=r[l],h=u.getSnapshot;u=u.value;try{if(!Ui(h(),u))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function kn(i,s,r,l){s&=~Fh,s&=~ur,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var u=s;0<u;){var h=31-Pe(u),m=1<<h;l[h]=-1,u&=~m}r!==0&&$t(i,r,s)}function Xo(){return(ot&6)===0?(Ja(0),!1):!0}function $h(){if(Ye!==null){if(dt===0)var i=Ye.return;else i=Ye,Fs=tr=null,uh(i),Pr=null,Oa=0,i=Ye;for(;i!==null;)fg(i.alternate,i),i=i.return;Ye=null}}function Gr(i,s){var r=i.timeoutHandle;r!==-1&&(i.timeoutHandle=-1,L1(r)),r=i.cancelPendingCommit,r!==null&&(i.cancelPendingCommit=null,r()),en=0,$h(),vt=i,Ye=r=Ks(i.current,null),Xe=s,dt=0,Fi=null,Cn=!1,Vr=Nt(i,s),Ih=!1,$r=qi=Fh=ur=xn=Ot=0,Bi=Za=null,qh=!1,(s&8)!==0&&(s|=s&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=s;0<l;){var u=31-Pe(l),h=1<<u;s|=i[u],l&=~h}return Js=s,mo(),r}function Hg(i,s){je=null,R.H=Fa,s===Ur||s===xo?(s=J_(),dt=3):s===Qu?(s=J_(),dt=4):dt=s===Th?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Fi=s,Ye===null&&(Ot=1,jo(i,es(s,i.current)))}function jg(){var i=Ki.current;return i===null?!0:(Xe&4194048)===Xe?ns===null:(Xe&62914560)===Xe||(Xe&536870912)!==0?i===ns:!1}function Ug(){var i=R.H;return R.H=Fa,i===null?Fa:i}function Pg(){var i=R.A;return R.A=d1,i}function Go(){Ot=4,Cn||(Xe&4194048)!==Xe&&Ki.current!==null||(Vr=!0),(xn&134217727)===0&&(ur&134217727)===0||vt===null||kn(vt,Xe,qi,!1)}function Xh(i,s,r){var l=ot;ot|=2;var u=Ug(),h=Pg();(vt!==i||Xe!==s)&&($o=null,Gr(i,s)),s=!1;var m=Ot;e:do try{if(dt!==0&&Ye!==null){var y=Ye,k=Fi;switch(dt){case 8:$h(),m=6;break e;case 3:case 2:case 9:case 6:Ki.current===null&&(s=!0);var U=dt;if(dt=0,Fi=null,Zr(i,y,k,U),r&&Vr){m=0;break e}break;default:U=dt,dt=0,Fi=null,Zr(i,y,k,U)}}_1(),m=Ot;break}catch(G){Hg(i,G)}while(!0);return s&&i.shellSuspendCounter++,Fs=tr=null,ot=l,R.H=u,R.A=h,Ye===null&&(vt=null,Xe=0,mo()),m}function _1(){for(;Ye!==null;)Kg(Ye)}function m1(i,s){var r=ot;ot|=2;var l=Ug(),u=Pg();vt!==i||Xe!==s?($o=null,Vo=bt()+500,Gr(i,s)):Vr=Nt(i,s);e:do try{if(dt!==0&&Ye!==null){s=Ye;var h=Fi;t:switch(dt){case 1:dt=0,Fi=null,Zr(i,s,h,1);break;case 2:case 9:if(Z_(h)){dt=0,Fi=null,Ig(s);break}s=function(){dt!==2&&dt!==9||vt!==i||(dt=7),ks(i)},h.then(s,s);break e;case 3:dt=7;break e;case 4:dt=5;break e;case 7:Z_(h)?(dt=0,Fi=null,Ig(s)):(dt=0,Fi=null,Zr(i,s,h,7));break;case 5:var m=null;switch(Ye.tag){case 26:m=Ye.memoizedState;case 5:case 27:var y=Ye;if(m?kv(m):y.stateNode.complete){dt=0,Fi=null;var k=y.sibling;if(k!==null)Ye=k;else{var U=y.return;U!==null?(Ye=U,Zo(U)):Ye=null}break t}}dt=0,Fi=null,Zr(i,s,h,5);break;case 6:dt=0,Fi=null,Zr(i,s,h,6);break;case 8:$h(),Ot=6;break e;default:throw Error(a(462))}}g1();break}catch(G){Hg(i,G)}while(!0);return Fs=tr=null,R.H=l,R.A=u,ot=r,Ye!==null?0:(vt=null,Xe=0,mo(),Ot)}function g1(){for(;Ye!==null&&!st();)Kg(Ye)}function Kg(i){var s=hg(i.alternate,i,Js);i.memoizedProps=i.pendingProps,s===null?Zo(i):Ye=s}function Ig(i){var s=i,r=s.alternate;switch(s.tag){case 15:case 0:s=rg(r,s,s.pendingProps,s.type,void 0,Xe);break;case 11:s=rg(r,s,s.pendingProps,s.type.render,s.ref,Xe);break;case 5:uh(s);default:fg(r,s),s=Ye=P_(s,Js),s=hg(r,s,Js)}i.memoizedProps=i.pendingProps,s===null?Zo(i):Ye=s}function Zr(i,s,r,l){Fs=tr=null,uh(s),Pr=null,Oa=0;var u=s.return;try{if(r1(i,u,s,r,Xe)){Ot=1,jo(i,es(r,i.current)),Ye=null;return}}catch(h){if(u!==null)throw Ye=u,h;Ot=1,jo(i,es(r,i.current)),Ye=null;return}s.flags&32768?(Je||l===1?i=!0:Vr||(Xe&536870912)!==0?i=!1:(Cn=i=!0,(l===2||l===9||l===3||l===6)&&(l=Ki.current,l!==null&&l.tag===13&&(l.flags|=16384))),Fg(s,i)):Zo(s)}function Zo(i){var s=i;do{if((s.flags&32768)!==0){Fg(s,Cn);return}i=s.return;var r=o1(s.alternate,s,Js);if(r!==null){Ye=r;return}if(s=s.sibling,s!==null){Ye=s;return}Ye=s=i}while(s!==null);Ot===0&&(Ot=5)}function Fg(i,s){do{var r=c1(i.alternate,i);if(r!==null){r.flags&=32767,Ye=r;return}if(r=i.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(i=i.sibling,i!==null)){Ye=i;return}Ye=i=r}while(i!==null);Ot=6,Ye=null}function qg(i,s,r,l,u,h,m,y,k){i.cancelPendingCommit=null;do Qo();while(Xt!==0);if((ot&6)!==0)throw Error(a(327));if(s!==null){if(s===i.current)throw Error(a(177));if(h=s.lanes|s.childLanes,h|=Hu,lt(i,r,h,m,y,k),i===vt&&(Ye=vt=null,Xe=0),Xr=s,Tn=i,en=r,Wh=h,Yh=u,Bg=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,b1(ii,function(){return Xg(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=R.T,R.T=null,u=q.p,q.p=2,m=ot,ot|=4;try{u1(i,s,r)}finally{ot=m,q.p=u,R.T=l}}Xt=1,Wg(),Yg(),Vg()}}function Wg(){if(Xt===1){Xt=0;var i=Tn,s=Xr,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=R.T,R.T=null;var l=q.p;q.p=2;var u=ot;ot|=4;try{Eg(s,i);var h=ld,m=A_(i.containerInfo),y=h.focusedElem,k=h.selectionRange;if(m!==y&&y&&y.ownerDocument&&M_(y.ownerDocument.documentElement,y)){if(k!==null&&Nu(y)){var U=k.start,G=k.end;if(G===void 0&&(G=U),"selectionStart"in y)y.selectionStart=U,y.selectionEnd=Math.min(G,y.value.length);else{var ee=y.ownerDocument||document,I=ee&&ee.defaultView||window;if(I.getSelection){var Y=I.getSelection(),ve=y.textContent.length,De=Math.min(k.start,ve),mt=k.end===void 0?De:Math.min(k.end,ve);!Y.extend&&De>mt&&(m=mt,mt=De,De=m);var L=R_(y,De),M=R_(y,mt);if(L&&M&&(Y.rangeCount!==1||Y.anchorNode!==L.node||Y.anchorOffset!==L.offset||Y.focusNode!==M.node||Y.focusOffset!==M.offset)){var j=ee.createRange();j.setStart(L.node,L.offset),Y.removeAllRanges(),De>mt?(Y.addRange(j),Y.extend(M.node,M.offset)):(j.setEnd(M.node,M.offset),Y.addRange(j))}}}}for(ee=[],Y=y;Y=Y.parentNode;)Y.nodeType===1&&ee.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<ee.length;y++){var J=ee[y];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}uc=!!ad,ld=ad=null}finally{ot=u,q.p=l,R.T=r}}i.current=s,Xt=2}}function Yg(){if(Xt===2){Xt=0;var i=Tn,s=Xr,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=R.T,R.T=null;var l=q.p;q.p=2;var u=ot;ot|=4;try{Sg(i,s.alternate,s)}finally{ot=u,q.p=l,R.T=r}}Xt=3}}function Vg(){if(Xt===4||Xt===3){Xt=0,yi();var i=Tn,s=Xr,r=en,l=Bg;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Xt=5:(Xt=0,Xr=Tn=null,$g(i,i.pendingLanes));var u=i.pendingLanes;if(u===0&&(En=null),ge(r),s=s.stateNode,Dt&&typeof Dt.onCommitFiberRoot=="function")try{Dt.onCommitFiberRoot(_s,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=R.T,u=q.p,q.p=2,R.T=null;try{for(var h=i.onRecoverableError,m=0;m<l.length;m++){var y=l[m];h(y.value,{componentStack:y.stack})}}finally{R.T=s,q.p=u}}(en&3)!==0&&Qo(),ks(i),u=i.pendingLanes,(r&261930)!==0&&(u&42)!==0?i===Vh?Qa++:(Qa=0,Vh=i):Qa=0,Ja(0)}}function $g(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,Ba(s)))}function Qo(){return Wg(),Yg(),Vg(),Xg()}function Xg(){if(Xt!==5)return!1;var i=Tn,s=Wh;Wh=0;var r=ge(en),l=R.T,u=q.p;try{q.p=32>r?32:r,R.T=null,r=Yh,Yh=null;var h=Tn,m=en;if(Xt=0,Xr=Tn=null,en=0,(ot&6)!==0)throw Error(a(331));var y=ot;if(ot|=4,Mg(h.current),kg(h,h.current,m,r),ot=y,Ja(0,!1),Dt&&typeof Dt.onPostCommitFiberRoot=="function")try{Dt.onPostCommitFiberRoot(_s,h)}catch{}return!0}finally{q.p=u,R.T=l,$g(i,s)}}function Gg(i,s,r){s=es(r,s),s=Eh(i.stateNode,s,2),i=yn(i,s,2),i!==null&&(hi(i,2),ks(i))}function ft(i,s,r){if(i.tag===3)Gg(i,i,r);else for(;s!==null;){if(s.tag===3){Gg(s,i,r);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(En===null||!En.has(l))){i=es(r,i),r=Zm(2),l=yn(s,r,2),l!==null&&(Qm(r,l,s,i),hi(l,2),ks(l));break}}s=s.return}}function Gh(i,s,r){var l=i.pingCache;if(l===null){l=i.pingCache=new f1;var u=new Set;l.set(s,u)}else u=l.get(s),u===void 0&&(u=new Set,l.set(s,u));u.has(r)||(Ih=!0,u.add(r),i=v1.bind(null,i,s,r),s.then(i,i))}function v1(i,s,r){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&r,i.warmLanes&=~r,vt===i&&(Xe&r)===r&&(Ot===4||Ot===3&&(Xe&62914560)===Xe&&300>bt()-Yo?(ot&2)===0&&Gr(i,0):Fh|=r,$r===Xe&&($r=0)),ks(i)}function Zg(i,s){s===0&&(s=Bt()),i=Qn(i,s),i!==null&&(hi(i,s),ks(i))}function y1(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),Zg(i,r)}function S1(i,s){var r=0;switch(i.tag){case 31:case 13:var l=i.stateNode,u=i.memoizedState;u!==null&&(r=u.retryLane);break;case 19:l=i.stateNode;break;case 22:l=i.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(s),Zg(i,r)}function b1(i,s){return V(i,s)}var Jo=null,Qr=null,Zh=!1,ec=!1,Qh=!1,Dn=0;function ks(i){i!==Qr&&i.next===null&&(Qr===null?Jo=Qr=i:Qr=Qr.next=i),ec=!0,Zh||(Zh=!0,C1())}function Ja(i,s){if(!Qh&&ec){Qh=!0;do for(var r=!1,l=Jo;l!==null;){if(i!==0){var u=l.pendingLanes;if(u===0)var h=0;else{var m=l.suspendedLanes,y=l.pingedLanes;h=(1<<31-Pe(42|i)+1)-1,h&=u&~(m&~y),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,tv(l,h))}else h=Xe,h=Rt(l,l===vt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||Nt(l,h)||(r=!0,tv(l,h));l=l.next}while(r);Qh=!1}}function w1(){Qg()}function Qg(){ec=Zh=!1;var i=0;Dn!==0&&B1()&&(i=Dn);for(var s=bt(),r=null,l=Jo;l!==null;){var u=l.next,h=Jg(l,s);h===0?(l.next=null,r===null?Jo=u:r.next=u,u===null&&(Qr=r)):(r=l,(i!==0||(h&3)!==0)&&(ec=!0)),l=u}Xt!==0&&Xt!==5||Ja(i),Dn!==0&&(Dn=0)}function Jg(i,s){for(var r=i.suspendedLanes,l=i.pingedLanes,u=i.expirationTimes,h=i.pendingLanes&-62914561;0<h;){var m=31-Pe(h),y=1<<m,k=u[m];k===-1?((y&r)===0||(y&l)!==0)&&(u[m]=wt(y,s)):k<=s&&(i.expiredLanes|=y),h&=~y}if(s=vt,r=Xe,r=Rt(i,i===s?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,r===0||i===s&&(dt===2||dt===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&He(l),i.callbackNode=null,i.callbackPriority=0;if((r&3)===0||Nt(i,r)){if(s=r&-r,s===i.callbackPriority)return s;switch(l!==null&&He(l),ge(r)){case 2:case 8:r=ti;break;case 32:r=ii;break;case 268435456:r=Ls;break;default:r=ii}return l=ev.bind(null,i),r=V(r,l),i.callbackPriority=s,i.callbackNode=r,s}return l!==null&&l!==null&&He(l),i.callbackPriority=2,i.callbackNode=null,2}function ev(i,s){if(Xt!==0&&Xt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var r=i.callbackNode;if(Qo()&&i.callbackNode!==r)return null;var l=Xe;return l=Rt(i,i===vt?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(Og(i,l,s),Jg(i,bt()),i.callbackNode!=null&&i.callbackNode===r?ev.bind(null,i):null)}function tv(i,s){if(Qo())return null;Og(i,s,!0)}function C1(){O1(function(){(ot&6)!==0?V(ps,w1):Qg()})}function Jh(){if(Dn===0){var i=Hr;i===0&&(i=ms,ms<<=1,(ms&261888)===0&&(ms=256)),Dn=i}return Dn}function iv(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:lo(""+i)}function sv(i,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,i.id&&r.setAttribute("form",i.id),s.parentNode.insertBefore(r,s),i=new FormData(i),r.parentNode.removeChild(r),i}function x1(i,s,r,l,u){if(s==="submit"&&r&&r.stateNode===u){var h=iv((u[ht]||null).action),m=l.submitter;m&&(s=(s=m[ht]||null)?iv(s.formAction):m.getAttribute("formAction"),s!==null&&(h=s,m=null));var y=new ho("action","action",null,l,u);i.push({event:y,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Dn!==0){var k=m?sv(u,m):new FormData(u);yh(r,{pending:!0,data:k,method:u.method,action:h},null,k)}}else typeof h=="function"&&(y.preventDefault(),k=m?sv(u,m):new FormData(u),yh(r,{pending:!0,data:k,method:u.method,action:h},h,k))},currentTarget:u}]})}}for(var ed=0;ed<zu.length;ed++){var td=zu[ed],E1=td.toLowerCase(),T1=td[0].toUpperCase()+td.slice(1);vs(E1,"on"+T1)}vs(L_,"onAnimationEnd"),vs(O_,"onAnimationIteration"),vs(z_,"onAnimationStart"),vs("dblclick","onDoubleClick"),vs("focusin","onFocus"),vs("focusout","onBlur"),vs(Iw,"onTransitionRun"),vs(Fw,"onTransitionStart"),vs(qw,"onTransitionCancel"),vs(H_,"onTransitionEnd"),js("onMouseEnter",["mouseout","mouseover"]),js("onMouseLeave",["mouseout","mouseover"]),js("onPointerEnter",["pointerout","pointerover"]),js("onPointerLeave",["pointerout","pointerover"]),gs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gs("onBeforeInput",["compositionend","keypress","textInput","paste"]),gs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var el="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(" "),k1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(el));function nv(i,s){s=(s&4)!==0;for(var r=0;r<i.length;r++){var l=i[r],u=l.event;l=l.listeners;e:{var h=void 0;if(s)for(var m=l.length-1;0<=m;m--){var y=l[m],k=y.instance,U=y.currentTarget;if(y=y.listener,k!==h&&u.isPropagationStopped())break e;h=y,u.currentTarget=U;try{h(u)}catch(G){_o(G)}u.currentTarget=null,h=k}else for(m=0;m<l.length;m++){if(y=l[m],k=y.instance,U=y.currentTarget,y=y.listener,k!==h&&u.isPropagationStopped())break e;h=y,u.currentTarget=U;try{h(u)}catch(G){_o(G)}u.currentTarget=null,h=k}}}}function Ve(i,s){var r=s[un];r===void 0&&(r=s[un]=new Set);var l=i+"__bubble";r.has(l)||(rv(s,i,2,!1),r.add(l))}function id(i,s,r){var l=0;s&&(l|=4),rv(r,i,l,s)}var tc="_reactListening"+Math.random().toString(36).slice(2);function sd(i){if(!i[tc]){i[tc]=!0,Cs.forEach(function(r){r!=="selectionchange"&&(k1.has(r)||id(r,!1,i),id(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[tc]||(s[tc]=!0,id("selectionchange",!1,s))}}function rv(i,s,r,l){switch(Lv(s)){case 2:var u=tC;break;case 8:u=iC;break;default:u=vd}r=u.bind(null,s,r,i),u=void 0,!Cu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),l?u!==void 0?i.addEventListener(s,r,{capture:!0,passive:u}):i.addEventListener(s,r,!0):u!==void 0?i.addEventListener(s,r,{passive:u}):i.addEventListener(s,r,!1)}function nd(i,s,r,l,u){var h=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var m=l.tag;if(m===3||m===4){var y=l.stateNode.containerInfo;if(y===u)break;if(m===4)for(m=l.return;m!==null;){var k=m.tag;if((k===3||k===4)&&m.stateNode.containerInfo===u)return;m=m.return}for(;y!==null;){if(m=pe(y),m===null)return;if(k=m.tag,k===5||k===6||k===26||k===27){l=h=m;continue e}y=y.parentNode}}l=l.return}u_(function(){var U=h,G=bu(r),ee=[];e:{var I=j_.get(i);if(I!==void 0){var Y=ho,ve=i;switch(i){case"keypress":if(co(r)===0)break e;case"keydown":case"keyup":Y=Sw;break;case"focusin":ve="focus",Y=ku;break;case"focusout":ve="blur",Y=ku;break;case"beforeblur":case"afterblur":Y=ku;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Y=f_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=ow;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=Cw;break;case L_:case O_:case z_:Y=hw;break;case H_:Y=Ew;break;case"scroll":case"scrollend":Y=aw;break;case"wheel":Y=kw;break;case"copy":case"cut":case"paste":Y=fw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=__;break;case"toggle":case"beforetoggle":Y=Rw}var De=(s&4)!==0,mt=!De&&(i==="scroll"||i==="scrollend"),L=De?I!==null?I+"Capture":null:I;De=[];for(var M=U,j;M!==null;){var J=M;if(j=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||j===null||L===null||(J=wa(M,L),J!=null&&De.push(tl(M,J,j))),mt)break;M=M.return}0<De.length&&(I=new Y(I,ve,null,r,G),ee.push({event:I,listeners:De}))}}if((s&7)===0){e:{if(I=i==="mouseover"||i==="pointerover",Y=i==="mouseout"||i==="pointerout",I&&r!==Su&&(ve=r.relatedTarget||r.fromElement)&&(pe(ve)||ve[di]))break e;if((Y||I)&&(I=G.window===G?G:(I=G.ownerDocument)?I.defaultView||I.parentWindow:window,Y?(ve=r.relatedTarget||r.toElement,Y=U,ve=ve?pe(ve):null,ve!==null&&(mt=c(ve),De=ve.tag,ve!==mt||De!==5&&De!==27&&De!==6)&&(ve=null)):(Y=null,ve=U),Y!==ve)){if(De=f_,J="onMouseLeave",L="onMouseEnter",M="mouse",(i==="pointerout"||i==="pointerover")&&(De=__,J="onPointerLeave",L="onPointerEnter",M="pointer"),mt=Y==null?I:Oe(Y),j=ve==null?I:Oe(ve),I=new De(J,M+"leave",Y,r,G),I.target=mt,I.relatedTarget=j,J=null,pe(G)===U&&(De=new De(L,M+"enter",ve,r,G),De.target=j,De.relatedTarget=mt,J=De),mt=J,Y&&ve)t:{for(De=D1,L=Y,M=ve,j=0,J=L;J;J=De(J))j++;J=0;for(var Ee=M;Ee;Ee=De(Ee))J++;for(;0<j-J;)L=De(L),j--;for(;0<J-j;)M=De(M),J--;for(;j--;){if(L===M||M!==null&&L===M.alternate){De=L;break t}L=De(L),M=De(M)}De=null}else De=null;Y!==null&&av(ee,I,Y,De,!1),ve!==null&&mt!==null&&av(ee,mt,ve,De,!0)}}e:{if(I=U?Oe(U):window,Y=I.nodeName&&I.nodeName.toLowerCase(),Y==="select"||Y==="input"&&I.type==="file")var rt=C_;else if(b_(I))if(x_)rt=Uw;else{rt=Hw;var Se=zw}else Y=I.nodeName,!Y||Y.toLowerCase()!=="input"||I.type!=="checkbox"&&I.type!=="radio"?U&&yu(U.elementType)&&(rt=C_):rt=jw;if(rt&&(rt=rt(i,U))){w_(ee,rt,r,G);break e}Se&&Se(i,I,U),i==="focusout"&&U&&I.type==="number"&&U.memoizedProps.value!=null&&vu(I,"number",I.value)}switch(Se=U?Oe(U):window,i){case"focusin":(b_(Se)||Se.contentEditable==="true")&&(Rr=Se,Bu=U,Ma=null);break;case"focusout":Ma=Bu=Rr=null;break;case"mousedown":Lu=!0;break;case"contextmenu":case"mouseup":case"dragend":Lu=!1,N_(ee,r,G);break;case"selectionchange":if(Kw)break;case"keydown":case"keyup":N_(ee,r,G)}var Ue;if(Ru)e:{switch(i){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else Dr?y_(i,r)&&(Ge="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(Ge="onCompositionStart");Ge&&(m_&&r.locale!=="ko"&&(Dr||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&Dr&&(Ue=h_()):(dn=G,xu="value"in dn?dn.value:dn.textContent,Dr=!0)),Se=ic(U,Ge),0<Se.length&&(Ge=new p_(Ge,i,null,r,G),ee.push({event:Ge,listeners:Se}),Ue?Ge.data=Ue:(Ue=S_(r),Ue!==null&&(Ge.data=Ue)))),(Ue=Aw?Nw(i,r):Bw(i,r))&&(Ge=ic(U,"onBeforeInput"),0<Ge.length&&(Se=new p_("onBeforeInput","beforeinput",null,r,G),ee.push({event:Se,listeners:Ge}),Se.data=Ue)),x1(ee,i,U,r,G)}nv(ee,s)})}function tl(i,s,r){return{instance:i,listener:s,currentTarget:r}}function ic(i,s){for(var r=s+"Capture",l=[];i!==null;){var u=i,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=wa(i,r),u!=null&&l.unshift(tl(i,u,h)),u=wa(i,s),u!=null&&l.push(tl(i,u,h))),i.tag===3)return l;i=i.return}return[]}function D1(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function av(i,s,r,l,u){for(var h=s._reactName,m=[];r!==null&&r!==l;){var y=r,k=y.alternate,U=y.stateNode;if(y=y.tag,k!==null&&k===l)break;y!==5&&y!==26&&y!==27||U===null||(k=U,u?(U=wa(r,h),U!=null&&m.unshift(tl(r,U,k))):u||(U=wa(r,h),U!=null&&m.push(tl(r,U,k)))),r=r.return}m.length!==0&&i.push({event:s,listeners:m})}var R1=/\r\n?/g,M1=/\u0000|\uFFFD/g;function lv(i){return(typeof i=="string"?i:""+i).replace(R1,`
9
- `).replace(M1,"")}function ov(i,s){return s=lv(s),lv(i)===s}function _t(i,s,r,l,u,h){switch(r){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Er(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Er(i,""+l);break;case"className":$n(i,"class",l);break;case"tabIndex":$n(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":$n(i,r,l);break;case"style":o_(i,l,h);break;case"data":if(s!=="object"){$n(i,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||r!=="href")){i.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=lo(""+l),i.setAttribute(r,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(r==="formAction"?(s!=="input"&&_t(i,s,"name",u.name,u,null),_t(i,s,"formEncType",u.formEncType,u,null),_t(i,s,"formMethod",u.formMethod,u,null),_t(i,s,"formTarget",u.formTarget,u,null)):(_t(i,s,"encType",u.encType,u,null),_t(i,s,"method",u.method,u,null),_t(i,s,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=lo(""+l),i.setAttribute(r,l);break;case"onClick":l!=null&&(i.onclick=Us);break;case"onScroll":l!=null&&Ve("scroll",i);break;case"onScrollEnd":l!=null&&Ve("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(u.children!=null)throw Error(a(60));i.innerHTML=r}}break;case"multiple":i.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":i.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){i.removeAttribute("xlink:href");break}r=lo(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,""+l):i.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,""):i.removeAttribute(r);break;case"capture":case"download":l===!0?i.setAttribute(r,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,l):i.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(r,l):i.removeAttribute(r);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(r):i.setAttribute(r,l);break;case"popover":Ve("beforetoggle",i),Ve("toggle",i),ji(i,"popover",l);break;case"xlinkActuate":Gi(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Gi(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Gi(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Gi(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Gi(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Gi(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Gi(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Gi(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Gi(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":ji(i,"is",l);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=nw.get(r)||r,ji(i,r,l))}}function rd(i,s,r,l,u,h){switch(r){case"style":o_(i,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(u.children!=null)throw Error(a(60));i.innerHTML=r}}break;case"children":typeof l=="string"?Er(i,l):(typeof l=="number"||typeof l=="bigint")&&Er(i,""+l);break;case"onScroll":l!=null&&Ve("scroll",i);break;case"onScrollEnd":l!=null&&Ve("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Us);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!hn.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),s=r.slice(2,u?r.length-7:void 0),h=i[ht]||null,h=h!=null?h[r]:null,typeof h=="function"&&i.removeEventListener(s,h,u),typeof l=="function")){typeof h!="function"&&h!==null&&(r in i?i[r]=null:i.hasAttribute(r)&&i.removeAttribute(r)),i.addEventListener(s,l,u);break e}r in i?i[r]=l:l===!0?i.setAttribute(r,""):ji(i,r,l)}}}function mi(i,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ve("error",i),Ve("load",i);var l=!1,u=!1,h;for(h in r)if(r.hasOwnProperty(h)){var m=r[h];if(m!=null)switch(h){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:_t(i,s,h,m,r,null)}}u&&_t(i,s,"srcSet",r.srcSet,r,null),l&&_t(i,s,"src",r.src,r,null);return;case"input":Ve("invalid",i);var y=h=m=u=null,k=null,U=null;for(l in r)if(r.hasOwnProperty(l)){var G=r[l];if(G!=null)switch(l){case"name":u=G;break;case"type":m=G;break;case"checked":k=G;break;case"defaultChecked":U=G;break;case"value":h=G;break;case"defaultValue":y=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(a(137,s));break;default:_t(i,s,l,G,r,null)}}n_(i,h,y,k,U,m,u,!1);return;case"select":Ve("invalid",i),l=m=h=null;for(u in r)if(r.hasOwnProperty(u)&&(y=r[u],y!=null))switch(u){case"value":h=y;break;case"defaultValue":m=y;break;case"multiple":l=y;default:_t(i,s,u,y,r,null)}s=h,r=m,i.multiple=!!l,s!=null?xr(i,!!l,s,!1):r!=null&&xr(i,!!l,r,!0);return;case"textarea":Ve("invalid",i),h=u=l=null;for(m in r)if(r.hasOwnProperty(m)&&(y=r[m],y!=null))switch(m){case"value":l=y;break;case"defaultValue":u=y;break;case"children":h=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:_t(i,s,m,y,r,null)}a_(i,l,u,h);return;case"option":for(k in r)r.hasOwnProperty(k)&&(l=r[k],l!=null)&&(k==="selected"?i.selected=l&&typeof l!="function"&&typeof l!="symbol":_t(i,s,k,l,r,null));return;case"dialog":Ve("beforetoggle",i),Ve("toggle",i),Ve("cancel",i),Ve("close",i);break;case"iframe":case"object":Ve("load",i);break;case"video":case"audio":for(l=0;l<el.length;l++)Ve(el[l],i);break;case"image":Ve("error",i),Ve("load",i);break;case"details":Ve("toggle",i);break;case"embed":case"source":case"link":Ve("error",i),Ve("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in r)if(r.hasOwnProperty(U)&&(l=r[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:_t(i,s,U,l,r,null)}return;default:if(yu(s)){for(G in r)r.hasOwnProperty(G)&&(l=r[G],l!==void 0&&rd(i,s,G,l,r,void 0));return}}for(y in r)r.hasOwnProperty(y)&&(l=r[y],l!=null&&_t(i,s,y,l,r,null))}function A1(i,s,r,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,m=null,y=null,k=null,U=null,G=null;for(Y in r){var ee=r[Y];if(r.hasOwnProperty(Y)&&ee!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":k=ee;default:l.hasOwnProperty(Y)||_t(i,s,Y,null,l,ee)}}for(var I in l){var Y=l[I];if(ee=r[I],l.hasOwnProperty(I)&&(Y!=null||ee!=null))switch(I){case"type":h=Y;break;case"name":u=Y;break;case"checked":U=Y;break;case"defaultChecked":G=Y;break;case"value":m=Y;break;case"defaultValue":y=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,s));break;default:Y!==ee&&_t(i,s,I,Y,l,ee)}}gu(i,m,y,k,U,G,h,u);return;case"select":Y=m=y=I=null;for(h in r)if(k=r[h],r.hasOwnProperty(h)&&k!=null)switch(h){case"value":break;case"multiple":Y=k;default:l.hasOwnProperty(h)||_t(i,s,h,null,l,k)}for(u in l)if(h=l[u],k=r[u],l.hasOwnProperty(u)&&(h!=null||k!=null))switch(u){case"value":I=h;break;case"defaultValue":y=h;break;case"multiple":m=h;default:h!==k&&_t(i,s,u,h,l,k)}s=y,r=m,l=Y,I!=null?xr(i,!!r,I,!1):!!l!=!!r&&(s!=null?xr(i,!!r,s,!0):xr(i,!!r,r?[]:"",!1));return;case"textarea":Y=I=null;for(y in r)if(u=r[y],r.hasOwnProperty(y)&&u!=null&&!l.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:_t(i,s,y,null,l,u)}for(m in l)if(u=l[m],h=r[m],l.hasOwnProperty(m)&&(u!=null||h!=null))switch(m){case"value":I=u;break;case"defaultValue":Y=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(a(91));break;default:u!==h&&_t(i,s,m,u,l,h)}r_(i,I,Y);return;case"option":for(var ve in r)I=r[ve],r.hasOwnProperty(ve)&&I!=null&&!l.hasOwnProperty(ve)&&(ve==="selected"?i.selected=!1:_t(i,s,ve,null,l,I));for(k in l)I=l[k],Y=r[k],l.hasOwnProperty(k)&&I!==Y&&(I!=null||Y!=null)&&(k==="selected"?i.selected=I&&typeof I!="function"&&typeof I!="symbol":_t(i,s,k,I,l,Y));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var De in r)I=r[De],r.hasOwnProperty(De)&&I!=null&&!l.hasOwnProperty(De)&&_t(i,s,De,null,l,I);for(U in l)if(I=l[U],Y=r[U],l.hasOwnProperty(U)&&I!==Y&&(I!=null||Y!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(a(137,s));break;default:_t(i,s,U,I,l,Y)}return;default:if(yu(s)){for(var mt in r)I=r[mt],r.hasOwnProperty(mt)&&I!==void 0&&!l.hasOwnProperty(mt)&&rd(i,s,mt,void 0,l,I);for(G in l)I=l[G],Y=r[G],!l.hasOwnProperty(G)||I===Y||I===void 0&&Y===void 0||rd(i,s,G,I,l,Y);return}}for(var L in r)I=r[L],r.hasOwnProperty(L)&&I!=null&&!l.hasOwnProperty(L)&&_t(i,s,L,null,l,I);for(ee in l)I=l[ee],Y=r[ee],!l.hasOwnProperty(ee)||I===Y||I==null&&Y==null||_t(i,s,ee,I,l,Y)}function cv(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function N1(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var u=r[l],h=u.transferSize,m=u.initiatorType,y=u.duration;if(h&&y&&cv(m)){for(m=0,y=u.responseEnd,l+=1;l<r.length;l++){var k=r[l],U=k.startTime;if(U>y)break;var G=k.transferSize,ee=k.initiatorType;G&&cv(ee)&&(k=k.responseEnd,m+=G*(k<y?1:(y-U)/(k-U)))}if(--l,s+=8*(h+m)/(u.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var ad=null,ld=null;function sc(i){return i.nodeType===9?i:i.ownerDocument}function uv(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function hv(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function od(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var cd=null;function B1(){var i=window.event;return i&&i.type==="popstate"?i===cd?!1:(cd=i,!0):(cd=null,!1)}var dv=typeof setTimeout=="function"?setTimeout:void 0,L1=typeof clearTimeout=="function"?clearTimeout:void 0,fv=typeof Promise=="function"?Promise:void 0,O1=typeof queueMicrotask=="function"?queueMicrotask:typeof fv<"u"?function(i){return fv.resolve(null).then(i).catch(z1)}:dv;function z1(i){setTimeout(function(){throw i})}function Rn(i){return i==="head"}function pv(i,s){var r=s,l=0;do{var u=r.nextSibling;if(i.removeChild(r),u&&u.nodeType===8)if(r=u.data,r==="/$"||r==="/&"){if(l===0){i.removeChild(u),ia(s);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")il(i.ownerDocument.documentElement);else if(r==="head"){r=i.ownerDocument.head,il(r);for(var h=r.firstChild;h;){var m=h.nextSibling,y=h.nodeName;h[Vn]||y==="SCRIPT"||y==="STYLE"||y==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=m}}else r==="body"&&il(i.ownerDocument.body);r=u}while(r);ia(s)}function _v(i,s){var r=i;i=0;do{var l=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),l&&l.nodeType===8)if(r=l.data,r==="/$"){if(i===0)break;i--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||i++;r=l}while(r)}function ud(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":ud(r),H(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}i.removeChild(r)}}function H1(i,s,r,l){for(;i.nodeType===1;){var u=r;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[Vn])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(h=i.getAttribute("rel"),h==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(h!==u.rel||i.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||i.getAttribute("title")!==(u.title==null?null:u.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(h=i.getAttribute("src"),(h!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===h)return i}else return i;if(i=rs(i.nextSibling),i===null)break}return null}function j1(i,s,r){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=rs(i.nextSibling),i===null))return null;return i}function mv(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=rs(i.nextSibling),i===null))return null;return i}function hd(i){return i.data==="$?"||i.data==="$~"}function dd(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function U1(i,s){var r=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||r.readyState!=="loading")s();else{var l=function(){s(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function rs(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var fd=null;function gv(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"||r==="/&"){if(s===0)return rs(i.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}i=i.nextSibling}return null}function vv(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return i;s--}else r!=="/$"&&r!=="/&"||s++}i=i.previousSibling}return null}function yv(i,s,r){switch(s=sc(r),i){case"html":if(i=s.documentElement,!i)throw Error(a(452));return i;case"head":if(i=s.head,!i)throw Error(a(453));return i;case"body":if(i=s.body,!i)throw Error(a(454));return i;default:throw Error(a(451))}}function il(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);H(i)}var as=new Map,Sv=new Set;function nc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var tn=q.d;q.d={f:P1,r:K1,D:I1,C:F1,L:q1,m:W1,X:V1,S:Y1,M:$1};function P1(){var i=tn.f(),s=Xo();return i||s}function K1(i){var s=Qe(i);s!==null&&s.tag===5&&s.type==="form"?Hm(s):tn.r(i)}var Jr=typeof document>"u"?null:document;function bv(i,s,r){var l=Jr;if(l&&typeof s=="string"&&s){var u=Qi(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),Sv.has(u)||(Sv.add(u),i={rel:i,crossOrigin:r,href:s},l.querySelector(u)===null&&(s=l.createElement("link"),mi(s,"link",i),Fe(s),l.head.appendChild(s)))}}function I1(i){tn.D(i),bv("dns-prefetch",i,null)}function F1(i,s){tn.C(i,s),bv("preconnect",i,s)}function q1(i,s,r){tn.L(i,s,r);var l=Jr;if(l&&i&&s){var u='link[rel="preload"][as="'+Qi(s)+'"]';s==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+Qi(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+Qi(r.imageSizes)+'"]')):u+='[href="'+Qi(i)+'"]';var h=u;switch(s){case"style":h=ea(i);break;case"script":h=ta(i)}as.has(h)||(i=v({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:i,as:s},r),as.set(h,i),l.querySelector(u)!==null||s==="style"&&l.querySelector(sl(h))||s==="script"&&l.querySelector(nl(h))||(s=l.createElement("link"),mi(s,"link",i),Fe(s),l.head.appendChild(s)))}}function W1(i,s){tn.m(i,s);var r=Jr;if(r&&i){var l=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+Qi(l)+'"][href="'+Qi(i)+'"]',h=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=ta(i)}if(!as.has(h)&&(i=v({rel:"modulepreload",href:i},s),as.set(h,i),r.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(nl(h)))return}l=r.createElement("link"),mi(l,"link",i),Fe(l),r.head.appendChild(l)}}}function Y1(i,s,r){tn.S(i,s,r);var l=Jr;if(l&&i){var u=it(l).hoistableStyles,h=ea(i);s=s||"default";var m=u.get(h);if(!m){var y={loading:0,preload:null};if(m=l.querySelector(sl(h)))y.loading=5;else{i=v({rel:"stylesheet",href:i,"data-precedence":s},r),(r=as.get(h))&&pd(i,r);var k=m=l.createElement("link");Fe(k),mi(k,"link",i),k._p=new Promise(function(U,G){k.onload=U,k.onerror=G}),k.addEventListener("load",function(){y.loading|=1}),k.addEventListener("error",function(){y.loading|=2}),y.loading|=4,rc(m,s,l)}m={type:"stylesheet",instance:m,count:1,state:y},u.set(h,m)}}}function V1(i,s){tn.X(i,s);var r=Jr;if(r&&i){var l=it(r).hoistableScripts,u=ta(i),h=l.get(u);h||(h=r.querySelector(nl(u)),h||(i=v({src:i,async:!0},s),(s=as.get(u))&&_d(i,s),h=r.createElement("script"),Fe(h),mi(h,"link",i),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function $1(i,s){tn.M(i,s);var r=Jr;if(r&&i){var l=it(r).hoistableScripts,u=ta(i),h=l.get(u);h||(h=r.querySelector(nl(u)),h||(i=v({src:i,async:!0,type:"module"},s),(s=as.get(u))&&_d(i,s),h=r.createElement("script"),Fe(h),mi(h,"link",i),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function wv(i,s,r,l){var u=(u=fe.current)?nc(u):null;if(!u)throw Error(a(446));switch(i){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=ea(r.href),r=it(u).hoistableStyles,l=r.get(s),l||(l={type:"style",instance:null,count:0,state:null},r.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){i=ea(r.href);var h=it(u).hoistableStyles,m=h.get(i);if(m||(u=u.ownerDocument||u,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(i,m),(h=u.querySelector(sl(i)))&&!h._p&&(m.instance=h,m.state.loading=5),as.has(i)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},as.set(i,r),h||X1(u,i,r,m.state))),s&&l===null)throw Error(a(528,""));return m}if(s&&l!==null)throw Error(a(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=ta(r),r=it(u).hoistableScripts,l=r.get(s),l||(l={type:"script",instance:null,count:0,state:null},r.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,i))}}function ea(i){return'href="'+Qi(i)+'"'}function sl(i){return'link[rel="stylesheet"]['+i+"]"}function Cv(i){return v({},i,{"data-precedence":i.precedence,precedence:null})}function X1(i,s,r,l){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=i.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),mi(s,"link",r),Fe(s),i.head.appendChild(s))}function ta(i){return'[src="'+Qi(i)+'"]'}function nl(i){return"script[async]"+i}function xv(i,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+Qi(r.href)+'"]');if(l)return s.instance=l,Fe(l),l;var u=v({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),Fe(l),mi(l,"style",u),rc(l,r.precedence,i),s.instance=l;case"stylesheet":u=ea(r.href);var h=i.querySelector(sl(u));if(h)return s.state.loading|=4,s.instance=h,Fe(h),h;l=Cv(r),(u=as.get(u))&&pd(l,u),h=(i.ownerDocument||i).createElement("link"),Fe(h);var m=h;return m._p=new Promise(function(y,k){m.onload=y,m.onerror=k}),mi(h,"link",l),s.state.loading|=4,rc(h,r.precedence,i),s.instance=h;case"script":return h=ta(r.src),(u=i.querySelector(nl(h)))?(s.instance=u,Fe(u),u):(l=r,(u=as.get(h))&&(l=v({},r),_d(l,u)),i=i.ownerDocument||i,u=i.createElement("script"),Fe(u),mi(u,"link",l),i.head.appendChild(u),s.instance=u);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,rc(l,r.precedence,i));return s.instance}function rc(i,s,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,h=u,m=0;m<l.length;m++){var y=l[m];if(y.dataset.precedence===s)h=y;else if(h!==u)break}h?h.parentNode.insertBefore(i,h.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(i,s.firstChild))}function pd(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function _d(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var ac=null;function Ev(i,s,r){if(ac===null){var l=new Map,u=ac=new Map;u.set(r,l)}else u=ac,l=u.get(r),l||(l=new Map,u.set(r,l));if(l.has(i))return l;for(l.set(i,null),r=r.getElementsByTagName(i),u=0;u<r.length;u++){var h=r[u];if(!(h[Vn]||h[ct]||i==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var m=h.getAttribute(s)||"";m=i+m;var y=l.get(m);y?y.push(h):l.set(m,[h])}}return l}function Tv(i,s,r){i=i.ownerDocument||i,i.head.insertBefore(r,s==="title"?i.querySelector("head > title"):null)}function G1(i,s,r){if(r===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(i=s.disabled,typeof s.precedence=="string"&&i==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function kv(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Z1(i,s,r,l){if(r.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=ea(l.href),h=s.querySelector(sl(u));if(h){s=h._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=lc.bind(i),s.then(i,i)),r.state.loading|=4,r.instance=h,Fe(h);return}h=s.ownerDocument||s,l=Cv(l),(u=as.get(u))&&pd(l,u),h=h.createElement("link"),Fe(h);var m=h;m._p=new Promise(function(y,k){m.onload=y,m.onerror=k}),mi(h,"link",l),r.instance=h}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(i.count++,r=lc.bind(i),s.addEventListener("load",r),s.addEventListener("error",r))}}var md=0;function Q1(i,s){return i.stylesheets&&i.count===0&&cc(i,i.stylesheets),0<i.count||0<i.imgCount?function(r){var l=setTimeout(function(){if(i.stylesheets&&cc(i,i.stylesheets),i.unsuspend){var h=i.unsuspend;i.unsuspend=null,h()}},6e4+s);0<i.imgBytes&&md===0&&(md=62500*N1());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&cc(i,i.stylesheets),i.unsuspend)){var h=i.unsuspend;i.unsuspend=null,h()}},(i.imgBytes>md?50:800)+s);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function lc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var oc=null;function cc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,oc=new Map,s.forEach(J1,i),oc=null,lc.call(i))}function J1(i,s){if(!(s.state.loading&4)){var r=oc.get(i);if(r)var l=r.get(null);else{r=new Map,oc.set(i,r);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var m=u[h];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(r.set(m.dataset.precedence,m),l=m)}l&&r.set(null,l)}u=s.instance,m=u.getAttribute("data-precedence"),h=r.get(m)||l,h===l&&r.set(null,u),r.set(m,u),this.count++,l=lc.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),h?h.parentNode.insertBefore(u,h.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var rl={$$typeof:A,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function eC(i,s,r,l,u,h,m,y,k){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Vt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vt(0),this.hiddenUpdates=Vt(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=k,this.incompleteTransitions=new Map}function Dv(i,s,r,l,u,h,m,y,k,U,G,ee){return i=new eC(i,s,r,m,k,U,G,ee,y),s=1,h===!0&&(s|=24),h=Pi(3,null,null,s),i.current=h,h.stateNode=i,s=Xu(),s.refCount++,i.pooledCache=s,s.refCount++,h.memoizedState={element:l,isDehydrated:r,cache:s},Ju(h),i}function Rv(i){return i?(i=Nr,i):Nr}function Mv(i,s,r,l,u,h){u=Rv(u),l.context===null?l.context=u:l.pendingContext=u,l=vn(s),l.payload={element:r},h=h===void 0?null:h,h!==null&&(l.callback=h),r=yn(i,l,s),r!==null&&(Li(r,i,s),Ha(r,i,s))}function Av(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<s?r:s}}function gd(i,s){Av(i,s),(i=i.alternate)&&Av(i,s)}function Nv(i){if(i.tag===13||i.tag===31){var s=Qn(i,67108864);s!==null&&Li(s,i,67108864),gd(i,67108864)}}function Bv(i){if(i.tag===13||i.tag===31){var s=Wi();s=re(s);var r=Qn(i,s);r!==null&&Li(r,i,s),gd(i,s)}}var uc=!0;function tC(i,s,r,l){var u=R.T;R.T=null;var h=q.p;try{q.p=2,vd(i,s,r,l)}finally{q.p=h,R.T=u}}function iC(i,s,r,l){var u=R.T;R.T=null;var h=q.p;try{q.p=8,vd(i,s,r,l)}finally{q.p=h,R.T=u}}function vd(i,s,r,l){if(uc){var u=yd(l);if(u===null)nd(i,s,l,hc,r),Ov(i,l);else if(nC(u,i,s,r,l))l.stopPropagation();else if(Ov(i,l),s&4&&-1<sC.indexOf(i)){for(;u!==null;){var h=Qe(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var m=ut(h.pendingLanes);if(m!==0){var y=h;for(y.pendingLanes|=2,y.entangledLanes|=2;m;){var k=1<<31-Pe(m);y.entanglements[1]|=k,m&=~k}ks(h),(ot&6)===0&&(Vo=bt()+500,Ja(0))}}break;case 31:case 13:y=Qn(h,2),y!==null&&Li(y,h,2),Xo(),gd(h,2)}if(h=yd(l),h===null&&nd(i,s,l,hc,r),h===u)break;u=h}u!==null&&l.stopPropagation()}else nd(i,s,l,null,r)}}function yd(i){return i=bu(i),Sd(i)}var hc=null;function Sd(i){if(hc=null,i=pe(i),i!==null){var s=c(i);if(s===null)i=null;else{var r=s.tag;if(r===13){if(i=d(s),i!==null)return i;i=null}else if(r===31){if(i=p(s),i!==null)return i;i=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return hc=i,null}function Lv(i){switch(i){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(fs()){case ps:return 2;case ti:return 8;case ii:case Ci:return 32;case Ls:return 268435456;default:return 32}default:return 32}}var bd=!1,Mn=null,An=null,Nn=null,al=new Map,ll=new Map,Bn=[],sC="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".split(" ");function Ov(i,s){switch(i){case"focusin":case"focusout":Mn=null;break;case"dragenter":case"dragleave":An=null;break;case"mouseover":case"mouseout":Nn=null;break;case"pointerover":case"pointerout":al.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":ll.delete(s.pointerId)}}function ol(i,s,r,l,u,h){return i===null||i.nativeEvent!==h?(i={blockedOn:s,domEventName:r,eventSystemFlags:l,nativeEvent:h,targetContainers:[u]},s!==null&&(s=Qe(s),s!==null&&Nv(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function nC(i,s,r,l,u){switch(s){case"focusin":return Mn=ol(Mn,i,s,r,l,u),!0;case"dragenter":return An=ol(An,i,s,r,l,u),!0;case"mouseover":return Nn=ol(Nn,i,s,r,l,u),!0;case"pointerover":var h=u.pointerId;return al.set(h,ol(al.get(h)||null,i,s,r,l,u)),!0;case"gotpointercapture":return h=u.pointerId,ll.set(h,ol(ll.get(h)||null,i,s,r,l,u)),!0}return!1}function zv(i){var s=pe(i.target);if(s!==null){var r=c(s);if(r!==null){if(s=r.tag,s===13){if(s=d(r),s!==null){i.blockedOn=s,tt(i.priority,function(){Bv(r)});return}}else if(s===31){if(s=p(r),s!==null){i.blockedOn=s,tt(i.priority,function(){Bv(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){i.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}i.blockedOn=null}function dc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=yd(i.nativeEvent);if(r===null){r=i.nativeEvent;var l=new r.constructor(r.type,r);Su=l,r.target.dispatchEvent(l),Su=null}else return s=Qe(r),s!==null&&Nv(s),i.blockedOn=r,!1;s.shift()}return!0}function Hv(i,s,r){dc(i)&&r.delete(s)}function rC(){bd=!1,Mn!==null&&dc(Mn)&&(Mn=null),An!==null&&dc(An)&&(An=null),Nn!==null&&dc(Nn)&&(Nn=null),al.forEach(Hv),ll.forEach(Hv)}function fc(i,s){i.blockedOn===s&&(i.blockedOn=null,bd||(bd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rC)))}var pc=null;function jv(i){pc!==i&&(pc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){pc===i&&(pc=null);for(var s=0;s<i.length;s+=3){var r=i[s],l=i[s+1],u=i[s+2];if(typeof l!="function"){if(Sd(l||r)===null)continue;break}var h=Qe(r);h!==null&&(i.splice(s,3),s-=3,yh(h,{pending:!0,data:u,method:r.method,action:l},l,u))}}))}function ia(i){function s(k){return fc(k,i)}Mn!==null&&fc(Mn,i),An!==null&&fc(An,i),Nn!==null&&fc(Nn,i),al.forEach(s),ll.forEach(s);for(var r=0;r<Bn.length;r++){var l=Bn[r];l.blockedOn===i&&(l.blockedOn=null)}for(;0<Bn.length&&(r=Bn[0],r.blockedOn===null);)zv(r),r.blockedOn===null&&Bn.shift();if(r=(i.ownerDocument||i).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var u=r[l],h=r[l+1],m=u[ht]||null;if(typeof h=="function")m||jv(r);else if(m){var y=null;if(h&&h.hasAttribute("formAction")){if(u=h,m=h[ht]||null)y=m.formAction;else if(Sd(u)!==null)continue}else y=m.action;typeof y=="function"?r[l+1]=y:(r.splice(l,3),l-=3),jv(r)}}}function Uv(){function i(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(m){return u=m})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,u=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),u!==null&&(u(),u=null)}}}function wd(i){this._internalRoot=i}_c.prototype.render=wd.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(a(409));var r=s.current,l=Wi();Mv(r,l,i,s,null,null)},_c.prototype.unmount=wd.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Mv(i.current,2,null,i,null,null),Xo(),s[di]=null}};function _c(i){this._internalRoot=i}_c.prototype.unstable_scheduleHydration=function(i){if(i){var s=ke();i={blockedOn:null,target:i,priority:s};for(var r=0;r<Bn.length&&s!==0&&s<Bn[r].priority;r++);Bn.splice(r,0,i),r===0&&zv(i)}};var Pv=t.version;if(Pv!=="19.2.6")throw Error(a(527,Pv,"19.2.6"));q.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(a(188)):(i=Object.keys(i).join(","),Error(a(268,i)));return i=f(s),i=i!==null?b(i):null,i=i===null?null:i.stateNode,i};var aC={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mc.isDisabled&&mc.supportsFiber)try{_s=mc.inject(aC),Dt=mc}catch{}}return ul.createRoot=function(i,s){if(!o(i))throw Error(a(299));var r=!1,l="",u=Vm,h=$m,m=Xm;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(h=s.onCaughtError),s.onRecoverableError!==void 0&&(m=s.onRecoverableError)),s=Dv(i,1,!1,null,null,r,l,null,u,h,m,Uv),i[di]=s.current,sd(i),new wd(s)},ul.hydrateRoot=function(i,s,r){if(!o(i))throw Error(a(299));var l=!1,u="",h=Vm,m=$m,y=Xm,k=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(y=r.onRecoverableError),r.formState!==void 0&&(k=r.formState)),s=Dv(i,1,!0,s,r??null,l,u,k,h,m,y,Uv),s.context=Rv(null),r=s.current,l=Wi(),l=re(l),u=vn(l),u.callback=null,yn(r,u,l),r=l,s.current.lanes=r,hi(s,r),ks(s),i[di]=s.current,sd(i),new _c(s)},ul.version="19.2.6",ul}var Gv;function mC(){if(Gv)return Ed.exports;Gv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ed.exports=_C(),Ed.exports}var gC=mC();class ln extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status}function eu(e=fetch){return{getSession:()=>ye(e,"/api/auth/session"),setupPassword:t=>ye(e,"/api/auth/password",et("POST",t)),login:t=>ye(e,"/api/auth/login",et("POST",t)),reauth:t=>ye(e,"/api/auth/reauth",et("POST",t)),logout:()=>ye(e,"/api/auth/logout",{method:"POST",credentials:"same-origin"}),setupTotp:()=>ye(e,"/api/auth/totp/setup",{method:"POST",credentials:"same-origin"}),activateTotp:t=>ye(e,"/api/auth/totp/activate",et("POST",t)),disableTotp:()=>ye(e,"/api/auth/totp",{method:"DELETE",credentials:"same-origin"}),listDevices:()=>ye(e,"/api/auth/devices"),revokeDevice:async t=>{await aa(e,`/api/auth/devices/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listNetworks:()=>ye(e,"/api/auth/networks"),addNetwork:t=>ye(e,"/api/auth/networks",et("POST",t)),removeNetwork:async t=>{await aa(e,`/api/auth/networks/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listAgents:()=>ye(e,"/api/agents"),addAgent:t=>ye(e,"/api/agents",et("POST",t)),renameAgent:(t,n)=>ye(e,`/api/agents/${encodeURIComponent(t)}`,et("PATCH",{name:n})),getMainInfo:()=>ye(e,"/api/main"),renameMain:t=>ye(e,"/api/main",et("PATCH",{name:t})),removeAgent:async t=>{await aa(e,`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},pingAgent:t=>ye(e,`/api/agents/${encodeURIComponent(t)}/ping`),getMainStats:()=>ye(e,"/api/stats"),getAgentStats:t=>ye(e,`/api/agents/${encodeURIComponent(t)}/stats`),getVersion:()=>ye(e,"/api/version"),checkUpdate:()=>ye(e,"/api/update/check",{method:"POST",credentials:"same-origin"}),runUpdate:()=>ye(e,"/api/update",{method:"POST",credentials:"same-origin"}),getAgentVersion:t=>ye(e,`/api/agents/${encodeURIComponent(t)}/version`),checkAgentUpdate:t=>ye(e,`/api/agents/${encodeURIComponent(t)}/update/check`,{method:"POST",credentials:"same-origin"}),runAgentUpdate:t=>ye(e,`/api/agents/${encodeURIComponent(t)}/update`,{method:"POST",credentials:"same-origin"}),listTerminals:()=>ye(e,"/api/terminals"),getTerminalLayout:()=>ye(e,"/api/terminal-layout"),saveTerminalLayout:t=>ye(e,"/api/terminal-layout",et("PUT",t)),createFileRoot:t=>ye(e,"/api/files/root",et("POST",t)),listFiles:t=>ye(e,"/api/files/list",et("POST",t)),readFile:t=>ye(e,"/api/files/read",et("POST",t)),writeFile:t=>ye(e,"/api/files/write",et("POST",t)),createFileEntry:t=>ye(e,"/api/files/create",et("POST",t)),moveFileEntry:t=>ye(e,"/api/files/move",et("POST",t)),previewDeleteFileEntry:t=>ye(e,"/api/files/delete-preview",et("POST",t)),deleteFileEntry:t=>ye(e,"/api/files/delete",et("POST",t)),openFileInTerminal:t=>ye(e,"/api/files/open",et("POST",t)),previewFile:t=>US(e,"/api/files/preview",et("POST",t)),createTerminal:(t={})=>ye(e,"/api/terminals",et("POST",t)),closeTerminal:async t=>{await aa(e,`/api/terminals/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},renameTerminal:(t,n)=>ye(e,`/api/terminals/${encodeURIComponent(t)}`,et("PATCH",{title:n})),getTerminalHistory:(t,n={})=>ye(e,`/api/terminals/${encodeURIComponent(t)}/history${zc(n)}`),getTerminalTranscriptHistory:(t,n={})=>ye(e,`/api/terminals/${encodeURIComponent(t)}/transcript-history${zc(n)}`),getTerminalTranscriptSource:t=>ye(e,`/api/terminals/${encodeURIComponent(t)}/transcript-source`),listNotificationAssets:()=>ye(e,"/api/notification-assets"),uploadNotificationAsset:t=>{const n=new FormData;return n.append("asset",t),ye(e,"/api/notification-assets",{method:"POST",credentials:"same-origin",body:n})},updateNotificationAssetSelection:t=>ye(e,"/api/notification-assets/selection",et("PUT",t)),deleteNotificationAsset:async t=>{await aa(e,`/api/notification-assets/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})}}}function tu(e,t=fetch){const n=a=>e?`/api/agents/${encodeURIComponent(e)}/${a}`:`/api/${a}`;return{isAgent:e!==null,listTerminals:()=>ye(t,n("terminals")),createTerminal:(a={})=>ye(t,n("terminals"),et("POST",a)),closeTerminal:async a=>{await aa(t,n(`terminals/${encodeURIComponent(a)}`),{method:"DELETE",credentials:"same-origin"})},renameTerminal:(a,o)=>ye(t,n(`terminals/${encodeURIComponent(a)}`),et("PATCH",{title:o})),getTerminalHistory:(a,o={})=>ye(t,`${n(`terminals/${encodeURIComponent(a)}/history`)}${zc(o)}`),getTerminalTranscriptHistory:(a,o={})=>ye(t,`${n(`terminals/${encodeURIComponent(a)}/transcript-history`)}${zc(o)}`),getTerminalTranscriptSource:a=>ye(t,n(`terminals/${encodeURIComponent(a)}/transcript-source`)),getTerminalLayout:()=>ye(t,n("terminal-layout")),saveTerminalLayout:a=>ye(t,n("terminal-layout"),et("PUT",a)),createFileRoot:a=>ye(t,n("files/root"),et("POST",a)),listFiles:a=>ye(t,n("files/list"),et("POST",a)),readFile:a=>ye(t,n("files/read"),et("POST",a)),writeFile:a=>ye(t,n("files/write"),et("POST",a)),createFileEntry:a=>ye(t,n("files/create"),et("POST",a)),moveFileEntry:a=>ye(t,n("files/move"),et("POST",a)),previewDeleteFileEntry:a=>ye(t,n("files/delete-preview"),et("POST",a)),deleteFileEntry:a=>ye(t,n("files/delete"),et("POST",a)),openFileInTerminal:a=>ye(t,n("files/open"),et("POST",a)),previewFile:a=>US(t,n("files/preview"),et("POST",a)),createWebSocketUrl:(a,o=window.location.href)=>vC(n(`terminals/${encodeURIComponent(a)}/ws`),o)}}function vC(e,t){const n=new URL(t);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.pathname=e,n.search="",n.hash="",n.toString()}function et(e,t){return{method:e,headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)}}function zc(e){const t=new URLSearchParams;e.beforeLine!==void 0&&t.set("beforeLine",String(e.beforeLine)),e.cursor!==void 0&&t.set("cursor",e.cursor),e.limit!==void 0&&t.set("limit",String(e.limit));const n=t.toString();return n?`?${n}`:""}async function ye(e,t,n){const a=await e(t,n??{credentials:"same-origin"});await Sp(a);try{return await a.json()}catch{throw new ln(a.status,"invalid_json_response")}}async function aa(e,t,n){const a=await e(t,n);await Sp(a)}async function US(e,t,n){const a=await e(t,n);return await Sp(a),a.blob()}async function Sp(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json(),a=typeof n.error=="string"?n.error:n.message;typeof a=="string"&&a.trim()&&(t=a)}catch{}throw new ln(e.status,t)}function PS({size:e=22}){return g.jsx("img",{className:"nterminal-mark",src:"/brand/nterminal-mark.svg",width:e,height:e,alt:"","aria-hidden":"true"})}function KS({height:e=18}){const t=Math.round(7.147058823529412*e);return g.jsx("img",{className:"nterminal-wordmark",src:"/brand/nterminal-wordmark.svg",width:t,height:e,alt:"NTerminal"})}var wl=jS();const iu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _a(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function bp(e){return"nodeType"in e}function zi(e){var t,n;return e?_a(e)?e:bp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function wp(e){const{Document:t}=zi(e);return e instanceof t}function $l(e){return _a(e)?!1:e instanceof zi(e).HTMLElement}function IS(e){return e instanceof zi(e).SVGElement}function ma(e){return e?_a(e)?e.document:bp(e)?wp(e)?e:$l(e)||IS(e)?e.ownerDocument:document:document:document}const qn=iu?S.useLayoutEffect:S.useEffect;function Cp(e){const t=S.useRef(e);return qn(()=>{t.current=e}),S.useCallback(function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return t.current==null?void 0:t.current(...a)},[])}function yC(){const e=S.useRef(null),t=S.useCallback((a,o)=>{e.current=setInterval(a,o)},[]),n=S.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ol(e,t){t===void 0&&(t=[e]);const n=S.useRef(e);return qn(()=>{n.current!==e&&(n.current=e)},t),n}function Xl(e,t){const n=S.useRef();return S.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function Hc(e){const t=Cp(e),n=S.useRef(null),a=S.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,a]}function tf(e){const t=S.useRef();return S.useEffect(()=>{t.current=e},[e]),t.current}let Rd={};function su(e,t){return S.useMemo(()=>{if(t)return t;const n=Rd[e]==null?0:Rd[e]+1;return Rd[e]=n,e+"-"+n},[e,t])}function FS(e){return function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return a.reduce((c,d)=>{const p=Object.entries(d);for(const[_,f]of p){const b=c[_];b!=null&&(c[_]=b+e*f)}return c},{...t})}}const ha=FS(1),jc=FS(-1);function SC(e){return"clientX"in e&&"clientY"in e}function qS(e){if(!e)return!1;const{KeyboardEvent:t}=zi(e.target);return t&&e instanceof t}function bC(e){if(!e)return!1;const{TouchEvent:t}=zi(e.target);return t&&e instanceof t}function sf(e){if(bC(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return SC(e)?{x:e.clientX,y:e.clientY}:null}const nf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[nf.Translate.toString(e),nf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),Zv="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function wC(e){return e.matches(Zv)?e:e.querySelector(Zv)}const CC={display:"none"};function xC(e){let{id:t,value:n}=e;return gi.createElement("div",{id:t,style:CC},n)}function EC(e){let{id:t,announcement:n,ariaLiveType:a="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return gi.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":!0},n)}function TC(){const[e,t]=S.useState("");return{announce:S.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const WS=S.createContext(null);function kC(e){const t=S.useContext(WS);S.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function DC(){const[e]=S.useState(()=>new Set),t=S.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[S.useCallback(a=>{let{type:o,event:c}=a;e.forEach(d=>{var p;return(p=d[o])==null?void 0:p.call(d,c)})},[e]),t]}const RC={draggable:`
10
- To pick up a draggable item, press the space bar.
11
- While dragging, use the arrow keys to move the item.
12
- Press space again to drop the item in its new position, or press escape to cancel.
13
- `},MC={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function AC(e){let{announcements:t=MC,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=RC}=e;const{announce:c,announcement:d}=TC(),p=su("DndLiveRegion"),[_,f]=S.useState(!1);if(S.useEffect(()=>{f(!0)},[]),kC(S.useMemo(()=>({onDragStart(v){let{active:w}=v;c(t.onDragStart({active:w}))},onDragMove(v){let{active:w,over:x}=v;t.onDragMove&&c(t.onDragMove({active:w,over:x}))},onDragOver(v){let{active:w,over:x}=v;c(t.onDragOver({active:w,over:x}))},onDragEnd(v){let{active:w,over:x}=v;c(t.onDragEnd({active:w,over:x}))},onDragCancel(v){let{active:w,over:x}=v;c(t.onDragCancel({active:w,over:x}))}}),[c,t])),!_)return null;const b=gi.createElement(gi.Fragment,null,gi.createElement(xC,{id:a,value:o.draggable}),gi.createElement(EC,{id:p,announcement:d}));return n?wl.createPortal(b,n):b}var Jt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Jt||(Jt={}));function Uc(){}function Qv(e,t){return S.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function NC(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return S.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const bs=Object.freeze({x:0,y:0});function BC(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function LC(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function OC(e,t){const n=Math.max(t.top,e.top),a=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),c=Math.min(t.top+t.height,e.top+e.height),d=o-a,p=c-n;if(a<o&&n<c){const _=t.width*t.height,f=e.width*e.height,b=d*p,v=b/(_+f-b);return Number(v.toFixed(4))}return 0}const zC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const o=[];for(const c of a){const{id:d}=c,p=n.get(d);if(p){const _=OC(p,t);_>0&&o.push({id:d,data:{droppableContainer:c,value:_}})}}return o.sort(BC)};function HC(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function YS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:bs}function jC(e){return function(n){for(var a=arguments.length,o=new Array(a>1?a-1:0),c=1;c<a;c++)o[c-1]=arguments[c];return o.reduce((d,p)=>({...d,top:d.top+e*p.y,bottom:d.bottom+e*p.y,left:d.left+e*p.x,right:d.right+e*p.x}),{...n})}}const UC=jC(1);function PC(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function KC(e,t,n){const a=PC(t);if(!a)return e;const{scaleX:o,scaleY:c,x:d,y:p}=a,_=e.left-d-(1-o)*parseFloat(n),f=e.top-p-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),b=o?e.width/o:e.width,v=c?e.height/c:e.height;return{width:b,height:v,top:f,right:_+b,bottom:f+v,left:_}}const IC={ignoreTransform:!1};function Gl(e,t){t===void 0&&(t=IC);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:b}=zi(e).getComputedStyle(e);f&&(n=KC(n,f,b))}const{top:a,left:o,width:c,height:d,bottom:p,right:_}=n;return{top:a,left:o,width:c,height:d,bottom:p,right:_}}function Jv(e){return Gl(e,{ignoreTransform:!0})}function FC(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function qC(e,t){return t===void 0&&(t=zi(e).getComputedStyle(e)),t.position==="fixed"}function WC(e,t){t===void 0&&(t=zi(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const c=t[o];return typeof c=="string"?n.test(c):!1})}function xp(e,t){const n=[];function a(o){if(t!=null&&n.length>=t||!o)return n;if(wp(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!$l(o)||IS(o)||n.includes(o))return n;const c=zi(e).getComputedStyle(o);return o!==e&&WC(o,c)&&n.push(o),qC(o,c)?n:a(o.parentNode)}return e?a(e):n}function VS(e){const[t]=xp(e,1);return t??null}function Md(e){return!iu||!e?null:_a(e)?e:bp(e)?wp(e)||e===ma(e).scrollingElement?window:$l(e)?e:null:null}function $S(e){return _a(e)?e.scrollX:e.scrollLeft}function XS(e){return _a(e)?e.scrollY:e.scrollTop}function rf(e){return{x:$S(e),y:XS(e)}}var ai;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ai||(ai={}));function GS(e){return!iu||!e?!1:e===document.scrollingElement}function ZS(e){const t={x:0,y:0},n=GS(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,c=e.scrollLeft<=t.x,d=e.scrollTop>=a.y,p=e.scrollLeft>=a.x;return{isTop:o,isLeft:c,isBottom:d,isRight:p,maxScroll:a,minScroll:t}}const YC={x:.2,y:.2};function VC(e,t,n,a,o){let{top:c,left:d,right:p,bottom:_}=n;a===void 0&&(a=10),o===void 0&&(o=YC);const{isTop:f,isBottom:b,isLeft:v,isRight:w}=ZS(e),x={x:0,y:0},C={x:0,y:0},E={height:t.height*o.y,width:t.width*o.x};return!f&&c<=t.top+E.height?(x.y=ai.Backward,C.y=a*Math.abs((t.top+E.height-c)/E.height)):!b&&_>=t.bottom-E.height&&(x.y=ai.Forward,C.y=a*Math.abs((t.bottom-E.height-_)/E.height)),!w&&p>=t.right-E.width?(x.x=ai.Forward,C.x=a*Math.abs((t.right-E.width-p)/E.width)):!v&&d<=t.left+E.width&&(x.x=ai.Backward,C.x=a*Math.abs((t.left+E.width-d)/E.width)),{direction:x,speed:C}}function $C(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:t,left:n,right:a,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:a,bottom:o,width:e.clientWidth,height:e.clientHeight}}function QS(e){return e.reduce((t,n)=>ha(t,rf(n)),bs)}function XC(e){return e.reduce((t,n)=>t+$S(n),0)}function GC(e){return e.reduce((t,n)=>t+XS(n),0)}function ZC(e,t){if(t===void 0&&(t=Gl),!e)return;const{top:n,left:a,bottom:o,right:c}=t(e);VS(e)&&(o<=0||c<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const QC=[["x",["left","right"],XC],["y",["top","bottom"],GC]];class Ep{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=xp(n),o=QS(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,d,p]of QC)for(const _ of d)Object.defineProperty(this,_,{get:()=>{const f=p(a),b=o[c]-f;return this.rect[_]+b},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ml{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=t}add(t,n,a){var o;(o=this.target)==null||o.addEventListener(t,n,a),this.listeners.push([t,n,a])}}function JC(e){const{EventTarget:t}=zi(e);return e instanceof t?e:ma(e)}function Ad(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var cs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(cs||(cs={}));function ey(e){e.preventDefault()}function ex(e){e.stopPropagation()}var yt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(yt||(yt={}));const JS={start:[yt.Space,yt.Enter],cancel:[yt.Esc],end:[yt.Space,yt.Enter,yt.Tab]},tx=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case yt.Right:return{...n,x:n.x+25};case yt.Left:return{...n,x:n.x-25};case yt.Down:return{...n,y:n.y+25};case yt.Up:return{...n,y:n.y-25}}};class eb{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Ml(ma(n)),this.windowListeners=new Ml(zi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(cs.Resize,this.handleCancel),this.windowListeners.add(cs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(cs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&ZC(a),n(bs)}handleKeyDown(t){if(qS(t)){const{active:n,context:a,options:o}=this.props,{keyboardCodes:c=JS,coordinateGetter:d=tx,scrollBehavior:p="smooth"}=o,{code:_}=t;if(c.end.includes(_)){this.handleEnd(t);return}if(c.cancel.includes(_)){this.handleCancel(t);return}const{collisionRect:f}=a.current,b=f?{x:f.left,y:f.top}:bs;this.referenceCoordinates||(this.referenceCoordinates=b);const v=d(t,{active:n,context:a.current,currentCoordinates:b});if(v){const w=jc(v,b),x={x:0,y:0},{scrollableAncestors:C}=a.current;for(const E of C){const B=t.code,{isTop:D,isRight:Z,isLeft:A,isBottom:P,maxScroll:z,minScroll:K}=ZS(E),N=$C(E),ae={x:Math.min(B===yt.Right?N.right-N.width/2:N.right,Math.max(B===yt.Right?N.left:N.left+N.width/2,v.x)),y:Math.min(B===yt.Down?N.bottom-N.height/2:N.bottom,Math.max(B===yt.Down?N.top:N.top+N.height/2,v.y))},de=B===yt.Right&&!Z||B===yt.Left&&!A,Te=B===yt.Down&&!P||B===yt.Up&&!D;if(de&&ae.x!==v.x){const ce=E.scrollLeft+w.x,Q=B===yt.Right&&ce<=z.x||B===yt.Left&&ce>=K.x;if(Q&&!w.y){E.scrollTo({left:ce,behavior:p});return}Q?x.x=E.scrollLeft-ce:x.x=B===yt.Right?E.scrollLeft-z.x:E.scrollLeft-K.x,x.x&&E.scrollBy({left:-x.x,behavior:p});break}else if(Te&&ae.y!==v.y){const ce=E.scrollTop+w.y,Q=B===yt.Down&&ce<=z.y||B===yt.Up&&ce>=K.y;if(Q&&!w.x){E.scrollTo({top:ce,behavior:p});return}Q?x.y=E.scrollTop-ce:x.y=B===yt.Down?E.scrollTop-z.y:E.scrollTop-K.y,x.y&&E.scrollBy({top:-x.y,behavior:p});break}}this.handleMove(t,ha(jc(v,this.referenceCoordinates),x))}}}handleMove(t,n){const{onMove:a}=this.props;t.preventDefault(),a(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}eb.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=JS,onActivation:o}=t,{active:c}=n;const{code:d}=e.nativeEvent;if(a.start.includes(d)){const p=c.activatorNode.current;return p&&e.target!==p?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function ty(e){return!!(e&&"distance"in e)}function iy(e){return!!(e&&"delay"in e)}class Tp{constructor(t,n,a){var o;a===void 0&&(a=JC(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:c}=t,{target:d}=c;this.props=t,this.events=n,this.document=ma(d),this.documentListeners=new Ml(this.document),this.listeners=new Ml(a),this.windowListeners=new Ml(zi(d)),this.initialCoordinates=(o=sf(c))!=null?o:bs,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(cs.Resize,this.handleCancel),this.windowListeners.add(cs.DragStart,ey),this.windowListeners.add(cs.VisibilityChange,this.handleCancel),this.windowListeners.add(cs.ContextMenu,ey),this.documentListeners.add(cs.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(iy(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(ty(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:o}=this.props;o(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(cs.Click,ex,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(cs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:o,props:c}=this,{onMove:d,options:{activationConstraint:p}}=c;if(!o)return;const _=(n=sf(t))!=null?n:bs,f=jc(o,_);if(!a&&p){if(ty(p)){if(p.tolerance!=null&&Ad(f,p.tolerance))return this.handleCancel();if(Ad(f,p.distance))return this.handleStart()}if(iy(p)&&Ad(f,p.tolerance))return this.handleCancel();this.handlePending(p,f);return}t.cancelable&&t.preventDefault(),d(_)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===yt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ix={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class tb extends Tp{constructor(t){const{event:n}=t,a=ma(n.target);super(t,ix,a)}}tb.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!n.isPrimary||n.button!==0?!1:(a?.({event:n}),!0)}}];const sx={move:{name:"mousemove"},end:{name:"mouseup"}};var af;(function(e){e[e.RightClick=2]="RightClick"})(af||(af={}));class ib extends Tp{constructor(t){super(t,sx,ma(t.event.target))}}ib.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===af.RightClick?!1:(a?.({event:n}),!0)}}];const Nd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class sb extends Tp{constructor(t){super(t,Nd)}static setup(){return window.addEventListener(Nd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Nd.move.name,t)};function t(){}}}sb.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:o}=n;return o.length>1?!1:(a?.({event:n}),!0)}}];var Al;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Al||(Al={}));var Pc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Pc||(Pc={}));function nx(e){let{acceleration:t,activator:n=Al.Pointer,canScroll:a,draggingRect:o,enabled:c,interval:d=5,order:p=Pc.TreeOrder,pointerCoordinates:_,scrollableAncestors:f,scrollableAncestorRects:b,delta:v,threshold:w}=e;const x=ax({delta:v,disabled:!c}),[C,E]=yC(),B=S.useRef({x:0,y:0}),D=S.useRef({x:0,y:0}),Z=S.useMemo(()=>{switch(n){case Al.Pointer:return _?{top:_.y,bottom:_.y,left:_.x,right:_.x}:null;case Al.DraggableRect:return o}},[n,o,_]),A=S.useRef(null),P=S.useCallback(()=>{const K=A.current;if(!K)return;const N=B.current.x*D.current.x,ae=B.current.y*D.current.y;K.scrollBy(N,ae)},[]),z=S.useMemo(()=>p===Pc.TreeOrder?[...f].reverse():f,[p,f]);S.useEffect(()=>{if(!c||!f.length||!Z){E();return}for(const K of z){if(a?.(K)===!1)continue;const N=f.indexOf(K),ae=b[N];if(!ae)continue;const{direction:de,speed:Te}=VC(K,ae,Z,t,w);for(const ce of["x","y"])x[ce][de[ce]]||(Te[ce]=0,de[ce]=0);if(Te.x>0||Te.y>0){E(),A.current=K,C(P,d),B.current=Te,D.current=de;return}}B.current={x:0,y:0},D.current={x:0,y:0},E()},[t,P,a,E,c,d,JSON.stringify(Z),JSON.stringify(x),C,f,z,b,JSON.stringify(w)])}const rx={x:{[ai.Backward]:!1,[ai.Forward]:!1},y:{[ai.Backward]:!1,[ai.Forward]:!1}};function ax(e){let{delta:t,disabled:n}=e;const a=tf(t);return Xl(o=>{if(n||!a||!o)return rx;const c={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[ai.Backward]:o.x[ai.Backward]||c.x===-1,[ai.Forward]:o.x[ai.Forward]||c.x===1},y:{[ai.Backward]:o.y[ai.Backward]||c.y===-1,[ai.Forward]:o.y[ai.Forward]||c.y===1}}},[n,t,a])}function lx(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return Xl(o=>{var c;return t==null?null:(c=a??o)!=null?c:null},[a,t])}function ox(e,t){return S.useMemo(()=>e.reduce((n,a)=>{const{sensor:o}=a,c=o.activators.map(d=>({eventName:d.eventName,handler:t(d.handler,a)}));return[...n,...c]},[]),[e,t])}var zl;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zl||(zl={}));var lf;(function(e){e.Optimized="optimized"})(lf||(lf={}));const sy=new Map;function cx(e,t){let{dragging:n,dependencies:a,config:o}=t;const[c,d]=S.useState(null),{frequency:p,measure:_,strategy:f}=o,b=S.useRef(e),v=B(),w=Ol(v),x=S.useCallback(function(D){D===void 0&&(D=[]),!w.current&&d(Z=>Z===null?D:Z.concat(D.filter(A=>!Z.includes(A))))},[w]),C=S.useRef(null),E=Xl(D=>{if(v&&!n)return sy;if(!D||D===sy||b.current!==e||c!=null){const Z=new Map;for(let A of e){if(!A)continue;if(c&&c.length>0&&!c.includes(A.id)&&A.rect.current){Z.set(A.id,A.rect.current);continue}const P=A.node.current,z=P?new Ep(_(P),P):null;A.rect.current=z,z&&Z.set(A.id,z)}return Z}return D},[e,c,n,v,_]);return S.useEffect(()=>{b.current=e},[e]),S.useEffect(()=>{v||x()},[n,v]),S.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),S.useEffect(()=>{v||typeof p!="number"||C.current!==null||(C.current=setTimeout(()=>{x(),C.current=null},p))},[p,v,x,...a]),{droppableRects:E,measureDroppableContainers:x,measuringScheduled:c!=null};function B(){switch(f){case zl.Always:return!1;case zl.BeforeDragging:return n;default:return!n}}}function nb(e,t){return Xl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function ux(e,t){return nb(e,t)}function hx(e){let{callback:t,disabled:n}=e;const a=Cp(t),o=S.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(a)},[a,n]);return S.useEffect(()=>()=>o?.disconnect(),[o]),o}function nu(e){let{callback:t,disabled:n}=e;const a=Cp(t),o=S.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(a)},[n]);return S.useEffect(()=>()=>o?.disconnect(),[o]),o}function dx(e){return new Ep(Gl(e),e)}function ny(e,t,n){t===void 0&&(t=dx);const[a,o]=S.useState(null);function c(){o(_=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=_??n)!=null?f:null}const b=t(e);return JSON.stringify(_)===JSON.stringify(b)?_:b})}const d=hx({callback(_){if(e)for(const f of _){const{type:b,target:v}=f;if(b==="childList"&&v instanceof HTMLElement&&v.contains(e)){c();break}}}}),p=nu({callback:c});return qn(()=>{c(),e?(p?.observe(e),d?.observe(document.body,{childList:!0,subtree:!0})):(p?.disconnect(),d?.disconnect())},[e]),a}function fx(e){const t=nb(e);return YS(e,t)}const ry=[];function px(e){const t=S.useRef(e),n=Xl(a=>e?a&&a!==ry&&e&&t.current&&e.parentNode===t.current.parentNode?a:xp(e):ry,[e]);return S.useEffect(()=>{t.current=e},[e]),n}function _x(e){const[t,n]=S.useState(null),a=S.useRef(e),o=S.useCallback(c=>{const d=Md(c.target);d&&n(p=>p?(p.set(d,rf(d)),new Map(p)):null)},[]);return S.useEffect(()=>{const c=a.current;if(e!==c){d(c);const p=e.map(_=>{const f=Md(_);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,rf(f)]):null}).filter(_=>_!=null);n(p.length?new Map(p):null),a.current=e}return()=>{d(e),d(c)};function d(p){p.forEach(_=>{const f=Md(_);f?.removeEventListener("scroll",o)})}},[o,e]),S.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,d)=>ha(c,d),bs):QS(e):bs,[e,t])}function ay(e,t){t===void 0&&(t=[]);const n=S.useRef(null);return S.useEffect(()=>{n.current=null},t),S.useEffect(()=>{const a=e!==bs;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?jc(e,n.current):bs}function mx(e){S.useEffect(()=>{if(!iu)return;const t=e.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function gx(e,t){return S.useMemo(()=>e.reduce((n,a)=>{let{eventName:o,handler:c}=a;return n[o]=d=>{c(d,t)},n},{}),[e,t])}function rb(e){return S.useMemo(()=>e?FC(e):null,[e])}const ly=[];function vx(e,t){t===void 0&&(t=Gl);const[n]=e,a=rb(n?zi(n):null),[o,c]=S.useState(ly);function d(){c(()=>e.length?e.map(_=>GS(_)?a:new Ep(t(_),_)):ly)}const p=nu({callback:d});return qn(()=>{p?.disconnect(),d(),e.forEach(_=>p?.observe(_))},[e]),o}function yx(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return $l(t)?t:e}function Sx(e){let{measure:t}=e;const[n,a]=S.useState(null),o=S.useCallback(f=>{for(const{target:b}of f)if($l(b)){a(v=>{const w=t(b);return v?{...v,width:w.width,height:w.height}:w});break}},[t]),c=nu({callback:o}),d=S.useCallback(f=>{const b=yx(f);c?.disconnect(),b&&c?.observe(b),a(b?t(b):null)},[t,c]),[p,_]=Hc(d);return S.useMemo(()=>({nodeRef:p,rect:n,setRef:_}),[n,p,_])}const bx=[{sensor:tb,options:{}},{sensor:eb,options:{}}],wx={current:{}},Rc={draggable:{measure:Jv},droppable:{measure:Jv,strategy:zl.WhileDragging,frequency:lf.Optimized},dragOverlay:{measure:Gl}};class Nl extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,a;return(n=(a=this.get(t))==null?void 0:a.node.current)!=null?n:void 0}}const Cx={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Nl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Uc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Rc,measureDroppableContainers:Uc,windowRect:null,measuringScheduled:!1},xx={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Uc,draggableNodes:new Map,over:null,measureDroppableContainers:Uc},ru=S.createContext(xx),Ex=S.createContext(Cx);function Tx(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Nl}}}function kx(e,t){switch(t.type){case Jt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Jt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Jt.DragEnd:case Jt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Jt.RegisterDroppable:{const{element:n}=t,{id:a}=n,o=new Nl(e.droppable.containers);return o.set(a,n),{...e,droppable:{...e.droppable,containers:o}}}case Jt.SetDroppableDisabled:{const{id:n,key:a,disabled:o}=t,c=e.droppable.containers.get(n);if(!c||a!==c.key)return e;const d=new Nl(e.droppable.containers);return d.set(n,{...c,disabled:o}),{...e,droppable:{...e.droppable,containers:d}}}case Jt.UnregisterDroppable:{const{id:n,key:a}=t,o=e.droppable.containers.get(n);if(!o||a!==o.key)return e;const c=new Nl(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function Dx(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:o}=S.useContext(ru),c=tf(a),d=tf(n?.id);return S.useEffect(()=>{if(!t&&!a&&c&&d!=null){if(!qS(c)||document.activeElement===c.target)return;const p=o.get(d);if(!p)return;const{activatorNode:_,node:f}=p;if(!_.current&&!f.current)return;requestAnimationFrame(()=>{for(const b of[_.current,f.current]){if(!b)continue;const v=wC(b);if(v){v.focus();break}}})}},[a,t,o,d,c]),null}function Rx(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((o,c)=>c({transform:o,...a}),n):n}function Mx(e){return S.useMemo(()=>({draggable:{...Rc.draggable,...e?.draggable},droppable:{...Rc.droppable,...e?.droppable},dragOverlay:{...Rc.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ax(e){let{activeNode:t,measure:n,initialRect:a,config:o=!0}=e;const c=S.useRef(!1),{x:d,y:p}=typeof o=="boolean"?{x:o,y:o}:o;qn(()=>{if(!d&&!p||!t){c.current=!1;return}if(c.current||!a)return;const f=t?.node.current;if(!f||f.isConnected===!1)return;const b=n(f),v=YS(b,a);if(d||(v.x=0),p||(v.y=0),c.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const w=VS(f);w&&w.scrollBy({top:v.y,left:v.x})}},[t,d,p,a,n])}const ab=S.createContext({...bs,scaleX:1,scaleY:1});var Pn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Pn||(Pn={}));const Nx=S.memo(function(t){var n,a,o,c;let{id:d,accessibility:p,autoScroll:_=!0,children:f,sensors:b=bx,collisionDetection:v=zC,measuring:w,modifiers:x,...C}=t;const E=S.useReducer(kx,void 0,Tx),[B,D]=E,[Z,A]=DC(),[P,z]=S.useState(Pn.Uninitialized),K=P===Pn.Initialized,{draggable:{active:N,nodes:ae,translate:de},droppable:{containers:Te}}=B,ce=N!=null?ae.get(N):null,Q=S.useRef({initial:null,translated:null}),X=S.useMemo(()=>{var We;return N!=null?{id:N,data:(We=ce?.data)!=null?We:wx,rect:Q}:null},[N,ce]),se=S.useRef(null),[le,R]=S.useState(null),[q,$]=S.useState(null),ue=Ol(C,Object.values(C)),be=su("DndDescribedBy",d),T=S.useMemo(()=>Te.getEnabled(),[Te]),W=Mx(w),{droppableRects:oe,measureDroppableContainers:ne,measuringScheduled:_e}=cx(T,{dragging:K,dependencies:[de.x,de.y],config:W.droppable}),fe=lx(ae,N),xe=S.useMemo(()=>q?sf(q):null,[q]),qe=Xi(),Me=ux(fe,W.draggable.measure);Ax({activeNode:N!=null?ae.get(N):null,config:qe.layoutShiftCompensation,initialRect:Me,measure:W.draggable.measure});const Ae=ny(fe,W.draggable.measure,Me),Ze=ny(fe?fe.parentElement:null),nt=S.useRef({activatorEvent:null,active:null,activeNode:fe,collisionRect:null,collisions:null,droppableRects:oe,draggableNodes:ae,draggingNode:null,draggingNodeRect:null,droppableContainers:Te,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Re=Te.getNodeFor((n=nt.current.over)==null?void 0:n.id),te=Sx({measure:W.dragOverlay.measure}),we=(a=te.nodeRef.current)!=null?a:fe,Ce=K?(o=te.rect)!=null?o:Ae:null,Le=!!(te.nodeRef.current&&te.rect),$e=fx(Le?null:Ae),St=rb(we?zi(we):null),V=px(K?Re??fe:null),He=vx(V),st=Rx(x,{transform:{x:de.x-$e.x,y:de.y-$e.y,scaleX:1,scaleY:1},activatorEvent:q,active:X,activeNodeRect:Ae,containerNodeRect:Ze,draggingNodeRect:Ce,over:nt.current.over,overlayNodeRect:te.rect,scrollableAncestors:V,scrollableAncestorRects:He,windowRect:St}),yi=xe?ha(xe,de):null,bt=_x(V),fs=ay(bt),ps=ay(bt,[Ae]),ti=ha(st,fs),ii=Ce?UC(Ce,st):null,Ci=X&&ii?v({active:X,collisionRect:ii,droppableRects:oe,droppableContainers:T,pointerCoordinates:yi}):null,Ls=LC(Ci,"id"),[xi,Os]=S.useState(null),_s=Le?st:ha(st,ps),Dt=HC(_s,(c=xi?.rect)!=null?c:null,Ae),si=S.useRef(null),Pe=S.useCallback((We,ut)=>{let{sensor:Rt,options:Nt}=ut;if(se.current==null)return;const wt=ae.get(se.current);if(!wt)return;const Bt=We.nativeEvent,Vt=new Rt({active:se.current,activeNode:wt,event:Bt,options:Nt,context:nt,onAbort(lt){if(!ae.get(lt))return;const{onDragAbort:O}=ue.current,F={id:lt};O?.(F),Z({type:"onDragAbort",event:F})},onPending(lt,$t,O,F){if(!ae.get(lt))return;const{onDragPending:ge}=ue.current,ke={id:lt,constraint:$t,initialCoordinates:O,offset:F};ge?.(ke),Z({type:"onDragPending",event:ke})},onStart(lt){const $t=se.current;if($t==null)return;const O=ae.get($t);if(!O)return;const{onDragStart:F}=ue.current,re={activatorEvent:Bt,active:{id:$t,data:O.data,rect:Q}};wl.unstable_batchedUpdates(()=>{F?.(re),z(Pn.Initializing),D({type:Jt.DragStart,initialCoordinates:lt,active:$t}),Z({type:"onDragStart",event:re}),R(si.current),$(Bt)})},onMove(lt){D({type:Jt.DragMove,coordinates:lt})},onEnd:hi(Jt.DragEnd),onCancel:hi(Jt.DragCancel)});si.current=Vt;function hi(lt){return async function(){const{active:O,collisions:F,over:re,scrollAdjustedTranslate:ge}=nt.current;let ke=null;if(O&&ge){const{cancelDrop:tt}=ue.current;ke={activatorEvent:Bt,active:O,collisions:F,delta:ge,over:re},lt===Jt.DragEnd&&typeof tt=="function"&&await Promise.resolve(tt(ke))&&(lt=Jt.DragCancel)}se.current=null,wl.unstable_batchedUpdates(()=>{D({type:lt}),z(Pn.Uninitialized),Os(null),R(null),$(null),si.current=null;const tt=lt===Jt.DragEnd?"onDragEnd":"onDragCancel";if(ke){const Ne=ue.current[tt];Ne?.(ke),Z({type:tt,event:ke})}})}}},[ae]),zs=S.useCallback((We,ut)=>(Rt,Nt)=>{const wt=Rt.nativeEvent,Bt=ae.get(Nt);if(se.current!==null||!Bt||wt.dndKit||wt.defaultPrevented)return;const Vt={active:Bt};We(Rt,ut.options,Vt)===!0&&(wt.dndKit={capturedBy:ut.sensor},se.current=Nt,Pe(Rt,ut))},[ae,Pe]),Hs=ox(b,zs);mx(b),qn(()=>{Ae&&P===Pn.Initializing&&z(Pn.Initialized)},[Ae,P]),S.useEffect(()=>{const{onDragMove:We}=ue.current,{active:ut,activatorEvent:Rt,collisions:Nt,over:wt}=nt.current;if(!ut||!Rt)return;const Bt={active:ut,activatorEvent:Rt,collisions:Nt,delta:{x:ti.x,y:ti.y},over:wt};wl.unstable_batchedUpdates(()=>{We?.(Bt),Z({type:"onDragMove",event:Bt})})},[ti.x,ti.y]),S.useEffect(()=>{const{active:We,activatorEvent:ut,collisions:Rt,droppableContainers:Nt,scrollAdjustedTranslate:wt}=nt.current;if(!We||se.current==null||!ut||!wt)return;const{onDragOver:Bt}=ue.current,Vt=Nt.get(Ls),hi=Vt&&Vt.rect.current?{id:Vt.id,rect:Vt.rect.current,data:Vt.data,disabled:Vt.disabled}:null,lt={active:We,activatorEvent:ut,collisions:Rt,delta:{x:wt.x,y:wt.y},over:hi};wl.unstable_batchedUpdates(()=>{Os(hi),Bt?.(lt),Z({type:"onDragOver",event:lt})})},[Ls]),qn(()=>{nt.current={activatorEvent:q,active:X,activeNode:fe,collisionRect:ii,collisions:Ci,droppableRects:oe,draggableNodes:ae,draggingNode:we,draggingNodeRect:Ce,droppableContainers:Te,over:xi,scrollableAncestors:V,scrollAdjustedTranslate:ti},Q.current={initial:Ce,translated:ii}},[X,fe,Ci,ii,ae,we,Ce,oe,Te,xi,V,ti]),nx({...qe,delta:de,draggingRect:ii,pointerCoordinates:yi,scrollableAncestors:V,scrollableAncestorRects:He});const Yn=S.useMemo(()=>({active:X,activeNode:fe,activeNodeRect:Ae,activatorEvent:q,collisions:Ci,containerNodeRect:Ze,dragOverlay:te,draggableNodes:ae,droppableContainers:Te,droppableRects:oe,over:xi,measureDroppableContainers:ne,scrollableAncestors:V,scrollableAncestorRects:He,measuringConfiguration:W,measuringScheduled:_e,windowRect:St}),[X,fe,Ae,q,Ci,Ze,te,ae,Te,oe,xi,ne,V,He,W,_e,St]),ms=S.useMemo(()=>({activatorEvent:q,activators:Hs,active:X,activeNodeRect:Ae,ariaDescribedById:{draggable:be},dispatch:D,draggableNodes:ae,over:xi,measureDroppableContainers:ne}),[q,Hs,X,Ae,D,be,ae,xi,ne]);return gi.createElement(WS.Provider,{value:A},gi.createElement(ru.Provider,{value:ms},gi.createElement(Ex.Provider,{value:Yn},gi.createElement(ab.Provider,{value:Dt},f)),gi.createElement(Dx,{disabled:p?.restoreFocus===!1})),gi.createElement(AC,{...p,hiddenTextDescribedById:be}));function Xi(){const We=le?.autoScrollEnabled===!1,ut=typeof _=="object"?_.enabled===!1:_===!1,Rt=K&&!We&&!ut;return typeof _=="object"?{..._,enabled:Rt}:{enabled:Rt}}}),Bx=S.createContext(null),oy="button",Lx="Draggable";function lb(e){let{id:t,data:n,disabled:a=!1,attributes:o}=e;const c=su(Lx),{activators:d,activatorEvent:p,active:_,activeNodeRect:f,ariaDescribedById:b,draggableNodes:v,over:w}=S.useContext(ru),{role:x=oy,roleDescription:C="draggable",tabIndex:E=0}=o??{},B=_?.id===t,D=S.useContext(B?ab:Bx),[Z,A]=Hc(),[P,z]=Hc(),K=gx(d,t),N=Ol(n);qn(()=>(v.set(t,{id:t,key:c,node:Z,activatorNode:P,data:N}),()=>{const de=v.get(t);de&&de.key===c&&v.delete(t)}),[v,t]);const ae=S.useMemo(()=>({role:x,tabIndex:E,"aria-disabled":a,"aria-pressed":B&&x===oy?!0:void 0,"aria-roledescription":C,"aria-describedby":b.draggable}),[a,x,E,B,C,b.draggable]);return{active:_,activatorEvent:p,activeNodeRect:f,attributes:ae,isDragging:B,listeners:a?void 0:K,node:Z,over:w,setNodeRef:A,setActivatorNodeRef:z,transform:D}}const Ox="Droppable",zx={timeout:25};function ob(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:o}=e;const c=su(Ox),{active:d,dispatch:p,over:_,measureDroppableContainers:f}=S.useContext(ru),b=S.useRef({disabled:n}),v=S.useRef(!1),w=S.useRef(null),x=S.useRef(null),{disabled:C,updateMeasurementsFor:E,timeout:B}={...zx,...o},D=Ol(E??a),Z=S.useCallback(()=>{if(!v.current){v.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{f(Array.isArray(D.current)?D.current:[D.current]),x.current=null},B)},[B]),A=nu({callback:Z,disabled:C||!d}),P=S.useCallback((ae,de)=>{A&&(de&&(A.unobserve(de),v.current=!1),ae&&A.observe(ae))},[A]),[z,K]=Hc(P),N=Ol(t);return S.useEffect(()=>{!A||!z.current||(A.disconnect(),v.current=!1,A.observe(z.current))},[z,A]),S.useEffect(()=>(p({type:Jt.RegisterDroppable,element:{id:a,key:c,disabled:n,node:z,rect:w,data:N}}),()=>p({type:Jt.UnregisterDroppable,key:c,id:a})),[a]),S.useEffect(()=>{n!==b.current.disabled&&(p({type:Jt.SetDroppableDisabled,id:a,key:c,disabled:n}),b.current.disabled=n)},[a,c,n,p]),{active:d,rect:w,isOver:_?.id===a,node:z,over:_,setNodeRef:K}}const Hx=128,jx=512,Ux=64,Px=4096;function cb(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.activeWorkspaceId!="string"&&t.activeWorkspaceId!==null||!Array.isArray(t.workspaces)||t.workspaces.length>Hx)return null;const n=t.workspaces.map(Kx);return n.some(a=>a===null)?null:{activeWorkspaceId:t.activeWorkspaceId,workspaces:n}}function Kx(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.title!="string"||typeof t.activeTabId!="string"&&t.activeTabId!==null||!Array.isArray(t.tabs)||t.tabs.length>jx)return null;const n=t.tabs.map(ub);return n.some(a=>a===null)?null:{id:t.id,title:t.title,activeTabId:t.activeTabId,tabs:n}}function Ix(e){return ub(e)!==null}function ub(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.title!="string"||typeof t.activeTerminalId!="string")return null;const n=Fx(t.root);return n?{id:t.id,title:t.title,activeTerminalId:t.activeTerminalId,root:n}:null}function Fx(e){if(!e||typeof e!="object")return null;let t=0;return of(e,1,()=>(t+=1,t<=Px))}function of(e,t,n){if(!e||typeof e!="object"||t>Ux||!n())return null;const a=e;if(a.type==="pane")return typeof a.terminalId=="string"?{type:"pane",terminalId:a.terminalId}:null;if(a.type!=="split"||a.direction!=="horizontal"&&a.direction!=="vertical")return null;const o=of(a.first,t+1,n),c=of(a.second,t+1,n);return!o||!c?null:{type:"split",direction:a.direction,ratio:qx(a.ratio),first:o,second:c}}function qx(e){return typeof e=="number"&&Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}const hb=[{id:"builtin-character-2260",filename:"character-2260.mp4",contentType:"video/mp4",size:123288,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2260.mp4"},{id:"builtin-character-2272",filename:"character-2272.mp4",contentType:"video/mp4",size:55873,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2272.mp4"},{id:"builtin-character-2258",filename:"character-2258.mp4",contentType:"video/mp4",size:112612,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2258.mp4"}];function cy(e){return e===void 0?"unknown":e==="error"?"offline":"ok"}function uy(e){const t=e.trim();return t?t.charAt(0).toUpperCase():"?"}const hy="Local",Wx=3e4;function hl(e){if(e===void 0)return"";if(e==="error")return"offline";const t=e.cpuPercent===null?"–":`${Math.round(e.cpuPercent)}%`,n=`${Math.round(e.memoryPercent)}%`;return`CPU ${t} · MEM ${n}`}function dy(e){if(e===void 0||e==="error")return;const t=a=>(a/1024**3).toFixed(1);return`CPU ${e.cpuPercent===null?"sampling…":`${e.cpuPercent.toFixed(1)}%`} across ${e.cores} cores · RAM ${t(e.memoryUsedBytes)} / ${t(e.memoryTotalBytes)} GB`}function Bd({api:e,activeAgentId:t,onSelectServer:n,onSessionInvalid:a,compact:o=!1}){const[c,d]=S.useState([]),[p,_]=S.useState(null),[f,b]=S.useState(null),[v,w]=S.useState(""),x=S.useRef(null),[C,E]=S.useState({});S.useEffect(()=>{let z=!1;return e.listAgents().then(K=>{z||d(K.agents)}).catch(()=>{}),e.getMainInfo().then(K=>{z||_(K.name)}).catch(()=>{}),()=>{z=!0}},[e]),S.useEffect(()=>{f&&(x.current?.focus(),x.current?.select())},[f]),S.useEffect(()=>{let z=!1;async function K(){let ae=!1;const de=[{key:"__main__",load:()=>e.getMainStats()},...c.map(ce=>({key:ce.id,load:()=>e.getAgentStats(ce.id)}))],Te=await Promise.all(de.map(async ce=>{try{return[ce.key,await ce.load()]}catch(Q){return Q instanceof ln&&Q.status===401?(ae=!0,[ce.key,"error"]):[ce.key,"error"]}}));if(!z){if(ae){a?.();return}E(ce=>{const Q={};for(const[se,le]of Te)Q[se]=le;const X=new Set(["__main__",...c.map(se=>se.id)]);for(const se of Object.keys(ce))!X.has(se)||se in Q||(Q[se]=ce[se]);return Q})}}K();const N=window.setInterval(()=>{K()},Wx);return()=>{z=!0,window.clearInterval(N)}},[e,c,a]);function B(z){z==="main"?(w(p??""),b({kind:"main"})):(w(z.name),b({kind:"agent",id:z.id}))}async function D(){if(!f)return;const z=v.trim(),K=f;if(b(null),K.kind==="main"){const N=z||"";try{const ae=await e.renameMain(N);_(ae.name)}catch{}}else{if(!z)return;const N=c.find(ae=>ae.id===K.id)?.name;d(ae=>ae.map(de=>de.id===K.id?{...de,name:z}:de));try{await e.renameAgent(K.id,z)}catch{N!==void 0&&d(ae=>ae.map(de=>de.id===K.id?{...de,name:N}:de))}}}function Z(){b(null)}const A=p?.trim()||hy,P=f?.kind==="main";return o?g.jsxs("div",{className:"server-list server-list--compact",children:[g.jsxs("button",{type:"button",className:`server-list-chip${t===null?" server-list-chip--active":""}`,onClick:()=>n(null),"aria-label":A,title:`${A}${hl(C.__main__)?` — ${hl(C.__main__)}`:""}`,children:[g.jsx("span",{className:"server-list-chip-initial",children:uy(A)}),g.jsx("span",{className:"server-list-chip-pip","data-status":cy(C.__main__)})]}),c.map(z=>{const K=C[z.id],N=hl(K);return g.jsxs("button",{type:"button",className:`server-list-chip${t===z.id?" server-list-chip--active":""}`,onClick:()=>n(z.id),"aria-label":z.name,title:`${z.name}${N?` — ${N}`:""}`,children:[g.jsx("span",{className:"server-list-chip-initial",children:uy(z.name)}),g.jsx("span",{className:"server-list-chip-pip","data-status":cy(K)})]},z.id)})]}):g.jsxs("div",{className:"server-list",children:[g.jsx("div",{className:"server-list-row",children:P?g.jsx("form",{className:"server-list-editor",onSubmit:z=>{z.preventDefault(),D()},children:g.jsx("input",{ref:x,"aria-label":"Rename main server",value:v,onChange:z=>w(z.target.value),onBlur:()=>{D()},onKeyDown:z=>{z.key==="Escape"&&(z.preventDefault(),Z())},placeholder:hy})}):g.jsxs("button",{type:"button",className:`server-list-item${t===null?" server-list-item--active":""}`,onClick:()=>n(null),onDoubleClick:z=>{z.preventDefault(),B("main")},title:"Double-click to rename",children:[g.jsx("span",{className:"server-list-dot"}),g.jsx("span",{className:"server-list-name",children:A}),g.jsx("span",{className:"server-list-stats",title:dy(C.__main__),children:hl(C.__main__)})]})}),c.map(z=>{const K=f?.kind==="agent"&&f.id===z.id;return g.jsx("div",{className:"server-list-row",children:K?g.jsx("form",{className:"server-list-editor",onSubmit:N=>{N.preventDefault(),D()},children:g.jsx("input",{ref:x,"aria-label":`Rename ${z.name}`,value:v,onChange:N=>w(N.target.value),onBlur:()=>{D()},onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),Z())}})}):g.jsxs("button",{type:"button",className:`server-list-item${t===z.id?" server-list-item--active":""}`,onClick:()=>n(z.id),onDoubleClick:N=>{N.preventDefault(),B({id:z.id,name:z.name})},title:"Double-click to rename",children:[g.jsx("span",{className:"server-list-dot"}),g.jsx("span",{className:"server-list-name",title:z.url,children:z.name}),g.jsx("span",{className:"server-list-stats",title:dy(C[z.id]),children:hl(C[z.id])})]})},z.id)})]})}function Yx({api:e}){const[t,n]=S.useState([]),[a,o]=S.useState([]),[c,d]=S.useState(!1),[p,_]=S.useState(null),[f,b]=S.useState(""),[v,w]=S.useState("");async function x(){try{const[D,Z,A]=await Promise.all([e.listDevices(),e.listNetworks(),e.getSession()]);n(D.devices),o(Z.networks),d(A.totpEnabled),_(null)}catch(D){_(D instanceof Error?D.message:"Failed to load")}}S.useEffect(()=>{x()},[]);async function C(D){await e.revokeDevice(D),await x()}async function E(D){await e.removeNetwork(D),await x()}async function B(D){D.preventDefault(),_(null);try{await e.addNetwork({value:f.trim(),label:v.trim()}),b(""),w(""),await x()}catch(Z){_(Z instanceof Error?Z.message:"Failed to add network")}}return g.jsxs(g.Fragment,{children:[p?g.jsx("p",{className:"form-error",children:p}):null,g.jsxs("section",{className:"security-section",children:[g.jsx("h3",{children:"Trusted devices"}),g.jsx("p",{className:"muted",children:"Devices that can re-authenticate with a 2FA code only (no password) for 30 days."}),t.length===0?g.jsx("p",{className:"muted",children:"No trusted devices."}):g.jsx("ul",{className:"security-list",children:t.map(D=>g.jsxs("li",{children:[g.jsxs("div",{children:[g.jsxs("span",{className:"security-item-label",children:[D.label,D.current?g.jsx("span",{className:"security-badge",children:"this device"}):null]}),g.jsxs("span",{className:"security-item-meta",children:["last seen ",new Date(D.lastSeenAt).toLocaleString()]})]}),g.jsx("button",{type:"button",className:"security-remove",onClick:()=>{C(D.id)},children:"revoke"})]},D.id))})]}),g.jsxs("section",{className:"security-section",children:[g.jsx("h3",{children:"Trusted networks"}),g.jsx("p",{className:"muted",children:"Sessions from these IPs/ranges skip the 2FA re-auth prompt."}),a.length===0?g.jsx("p",{className:"muted",children:"No trusted networks."}):g.jsx("ul",{className:"security-list",children:a.map(D=>g.jsxs("li",{children:[g.jsxs("div",{children:[g.jsx("span",{className:"security-item-label",children:D.value}),D.label!==D.value?g.jsx("span",{className:"security-item-meta",children:D.label}):null]}),g.jsx("button",{type:"button",className:"security-remove",onClick:()=>{E(D.id)},children:"remove"})]},D.id))}),g.jsxs("form",{className:"security-add-form",onSubmit:B,children:[g.jsx("input",{type:"text",placeholder:"IP or CIDR (e.g. 203.0.113.4 or 192.168.0.0/24)",value:f,onChange:D=>b(D.currentTarget.value),required:!0}),g.jsx("input",{type:"text",placeholder:"Label (optional)",value:v,onChange:D=>w(D.currentTarget.value)}),g.jsx("button",{type:"submit",disabled:!f.trim(),children:"Add"})]})]}),c?g.jsxs("section",{className:"security-section",children:[g.jsx("h3",{children:"Two-factor authentication"}),g.jsx("p",{className:"muted",children:"2FA is enabled. Disabling it removes the requirement; you will be asked to set it up again on next login."}),g.jsx("button",{type:"button",className:"security-remove",onClick:async()=>{await e.disableTotp(),await x()},children:"Disable 2FA"})]}):null]})}const db="nterminal.notifications.completionEnabled",kp="nterminal.notifications.completionToastEnabled",Dp="nterminal.notifications.completionToastDurationSeconds",Rp="nterminal.notifications.completionToastPersistent",cf="nterminal:completion-toast-display",Bl=6.5,uf=2,hf=60;function au(){return typeof window<"u"&&"Notification"in window}function fb(){try{return window.localStorage.getItem(db)==="true"}catch{return!1}}function fy(e){try{window.localStorage.setItem(db,e?"true":"false")}catch{}}function vr(){return{enabled:Gx(),durationSeconds:Xx(),persistUntilDismissed:Zx()}}function Vx(e){if(typeof window<"u"){try{window.localStorage.setItem(kp,e?"true":"false")}catch{}Ap()}return vr()}function py(e){const t=_b(e);if(typeof window<"u"){try{window.localStorage.setItem(Dp,String(t))}catch{}Ap()}return vr()}function $x(e){if(typeof window<"u"){try{window.localStorage.setItem(Rp,e?"true":"false")}catch{}Ap()}return vr()}function pb(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===kp||n.key===Dp||n.key===Rp)&&e()};return window.addEventListener(cf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(cf,e),window.removeEventListener("storage",t)}}function Mp(){return au()?window.Notification.permission:"unsupported"}function Xx(){if(typeof window>"u")return Bl;try{const e=window.localStorage.getItem(Dp);return e===null?Bl:_b(Number(e))}catch{return Bl}}function Gx(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(kp)!=="false"}catch{return!0}}function Zx(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Rp)==="true"}catch{return!1}}function _b(e){if(!Number.isFinite(e))return Bl;const t=Math.round(e*2)/2;return Math.max(uf,Math.min(hf,t))}function Ap(){typeof window<"u"&&window.dispatchEvent(new CustomEvent(cf))}async function Qx(){if(!au())return"unsupported";try{return await window.Notification.requestPermission()}catch{return Mp()}}function Jx(e){if(!au()||Mp()!=="granted"||!fb()||typeof document<"u"&&document.visibilityState==="visible")return;const t=e.commandName?`${e.commandName} finished`:"Command finished";try{new Notification(`NTerminal · ${e.tabTitle}`,{body:t,tag:e.terminalId,icon:"/icons/app-icon-384.png",silent:!0})}catch{}}const eE=1500,Np="nterminal.terminal.fontSize",Bp="nterminal.terminal.fontFamily",df="nterminal:terminal-font-size",ff="nterminal:terminal-font-family",pf=11,_f=20,mr=14,Kc=[{id:"meslo",label:"MesloLGS NF",cssFamily:['"MesloLGS NF"','"MesloLGS Nerd Font Mono"','"MesloLGSNerdFontMono"','"JetBrainsMono Nerd Font"','"Hack Nerd Font"','"FiraCode Nerd Font"','"SF Mono"',"Menlo","Monaco","Consolas",'"Liberation Mono"','"Symbols Nerd Font Mono"','"Apple Symbols"','"Apple Color Emoji"',"monospace"].join(", "),webFontFamilies:['"MesloLGS NF"']},{id:"jetbrains",label:"JetBrains Mono",cssFamily:['"JetBrainsMono Nerd Font"','"JetBrains Mono"','"Hack Nerd Font"','"FiraCode Nerd Font"','"SF Mono"',"Menlo","Monaco","Consolas",'"Liberation Mono"','"Symbols Nerd Font Mono"','"Apple Symbols"','"Apple Color Emoji"',"monospace"].join(", "),webFontFamilies:[]},{id:"system",label:"System mono",cssFamily:['"SF Mono"',"Menlo","Monaco","Consolas",'"Liberation Mono"','"Symbols Nerd Font Mono"','"Apple Symbols"','"Apple Color Emoji"',"monospace"].join(", "),webFontFamilies:[]}],da="meslo";mf(da);async function Ld(e=mr,t=da){if(typeof document>"u"||!document.fonts)return;const n=vb(t).webFontFamilies;if(n.length===0)return;const a=Promise.all(n.map(o=>document.fonts.load(`${e}px ${o}`))).then(()=>{}).catch(()=>{});await Promise.race([a,new Promise(o=>{globalThis.setTimeout(o,eE)})])}function mb(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return mr;const n=Math.round(t);return Math.max(pf,Math.min(_f,n))}function gb(e){return Kc.some(t=>t.id===e)?e:da}function mf(e){return vb(e).cssFamily}function vb(e){return Kc.find(t=>t.id===e)??Kc[0]}function gf(){if(typeof window>"u")return mr;try{const e=window.localStorage.getItem(Np);return e?mb(e):mr}catch{return mr}}function vf(){if(typeof window>"u")return da;try{return gb(window.localStorage.getItem(Bp))}catch{return da}}function gc(e){const t=mb(e);if(typeof window>"u")return t;try{window.localStorage.setItem(Np,String(t))}catch{}return window.dispatchEvent(new CustomEvent(df,{detail:t})),t}function tE(e){const t=gb(e);if(typeof window>"u")return t;try{window.localStorage.setItem(Bp,t)}catch{}return window.dispatchEvent(new CustomEvent(ff,{detail:t})),t}function yb(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Np&&e()};return window.addEventListener(df,e),window.addEventListener("storage",t),()=>{window.removeEventListener(df,e),window.removeEventListener("storage",t)}}function Sb(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Bp&&e()};return window.addEventListener(ff,e),window.addEventListener("storage",t),()=>{window.removeEventListener(ff,e),window.removeEventListener("storage",t)}}const Lp="nterminal.terminal.showScrollProgress",yf="nterminal:terminal-scroll-progress";function Sf(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(Lp)!=="false"}catch{return!0}}function iE(e){if(typeof window<"u"){try{window.localStorage.setItem(Lp,e?"true":"false")}catch{}window.dispatchEvent(new CustomEvent(yf,{detail:e}))}return e}function bb(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Lp&&e()};return window.addEventListener(yf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(yf,e),window.removeEventListener("storage",t)}}const Op="nterminal.shortcuts.workspace.v1",bf="nterminal:workspace-shortcuts",Hl=[{id:"server.previous",label:"Previous server",group:"Servers"},{id:"server.next",label:"Next server",group:"Servers"},{id:"tab.previous",label:"Previous tab",group:"Tabs"},{id:"tab.next",label:"Next tab",group:"Tabs"},{id:"tab.index",label:"Select tab 1-9",group:"Tabs",indexed:!0},{id:"pane.index",label:"Select pane 1-9",group:"Panes",indexed:!0},{id:"split.right",label:"Split right",group:"Panes"},{id:"split.down",label:"Split down",group:"Panes"}],zp={"server.previous":wi("ArrowUp",{ctrlKey:!0}),"server.next":wi("ArrowDown",{ctrlKey:!0}),"tab.previous":wi("ArrowLeft",{ctrlKey:!0}),"tab.next":wi("ArrowRight",{ctrlKey:!0}),"tab.index":wi("Digit",{ctrlKey:!0,altKey:!0}),"pane.index":wi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.right":wi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":wi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})},sE={"server.previous":wi("BracketLeft",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"server.next":wi("BracketRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"tab.previous":wi("BracketLeft",{ctrlKey:!0,altKey:!0}),"tab.next":wi("BracketRight",{ctrlKey:!0,altKey:!0}),"tab.index":wi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"pane.index":wi("Digit",{ctrlKey:!0,altKey:!0}),"split.right":wi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":wi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})};function yr(){const e=Eb(zp);if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Op);if(!t)return e;const n=JSON.parse(t);for(const a of Hl){const o=n[a.id];if(dE(o)){const c=Tb(o,a);hE(c,sE[a.id])||(e[a.id]=c)}}}catch{return e}return e}function _y(){return JSON.stringify(yr())}function nE(e,t){const n=yr(),a=Hl.find(o=>o.id===e);return a&&(n[e]=Tb(t,a),Hp(n)),n}function rE(e){const t=yr();return t[e]={...zp[e]},Hp(t),t}function aE(){const e=Eb(zp);return Hp(e),e}function wb(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Op&&e()};return window.addEventListener(bf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(bf,e),window.removeEventListener("storage",t)}}function lE(e,t){const n=Db(e);return!n||pE(n)||t.indexed&&kb(e)===null?null:{ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,code:t.indexed?"Digit":n}}function oE(e){const t=yr();for(const n of Hl){const a=t[n.id];if(!(!a||!fE(e,a))){if(n.indexed){if(a.code!=="Digit")continue;const o=kb(e);if(o!==null)return{id:n.id,index:o};continue}if(Db(e)===a.code)return{id:n.id,index:null}}}return null}function Cb(e){return xb(yr()[e])}function xb(e){const t=[];return e.ctrlKey&&t.push("Ctrl"),e.altKey&&t.push("Alt"),e.shiftKey&&t.push("Shift"),e.metaKey&&t.push("Meta"),t.push(_E(e.code)),t.join("+")}const cE=()=>Cb("split.right"),uE=()=>Cb("split.down");function wi(e,t){return{ctrlKey:t.ctrlKey??!1,altKey:t.altKey??!1,shiftKey:t.shiftKey??!1,metaKey:t.metaKey??!1,code:e}}function Eb(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{...n}]))}function hE(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey&&e.code===t.code}function Hp(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Op,JSON.stringify(e))}catch{}window.dispatchEvent(new CustomEvent(bf))}}function Tb(e,t){return{ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,shiftKey:!!e.shiftKey,metaKey:!!e.metaKey,code:t.indexed?"Digit":e.code}}function dE(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.ctrlKey=="boolean"&&typeof t.altKey=="boolean"&&typeof t.shiftKey=="boolean"&&typeof t.metaKey=="boolean"&&typeof t.code=="string"&&t.code.length>0}function fE(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey}function kb(e){const t=/^Digit([1-9])$/.exec(e.code);return t?.[1]?Number(t[1]):/^[1-9]$/.test(e.key)?Number(e.key):null}function Db(e){if(e.code)return e.code;if(/^[a-z]$/i.test(e.key))return`Key${e.key.toUpperCase()}`;if(/^[0-9]$/.test(e.key))return`Digit${e.key}`;switch(e.key){case"[":case"{":return"BracketLeft";case"]":case"}":return"BracketRight";case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Tab":case"Enter":case"Escape":case"Space":return e.key==="Space"?"Space":e.key;default:return null}}function pE(e){return e==="ControlLeft"||e==="ControlRight"||e==="AltLeft"||e==="AltRight"||e==="ShiftLeft"||e==="ShiftRight"||e==="MetaLeft"||e==="MetaRight"}function _E(e){if(e==="Digit")return"1-9";const t=/^Digit([0-9])$/.exec(e);if(t?.[1])return t[1];const n=/^Key([A-Z])$/.exec(e);if(n?.[1])return n[1];switch(e){case"BracketLeft":return"[";case"BracketRight":return"]";case"ArrowLeft":return"Left";case"ArrowRight":return"Right";case"ArrowUp":return"Up";case"ArrowDown":return"Down";case"Space":return"Space";default:return e.replace(/^(Numpad|Digit|Key)/,"")}}const jp="nterminal.theme.accent",wf="nterminal:theme-accent",jl=[{id:"aqua",label:"Aqua Teal",accent:"#5EEAD4",soft:"rgba(94, 234, 212, 0.10)",glow:"rgba(94, 234, 212, 0.55)",xtermSelection:"#1f3f45"},{id:"signal-red",label:"Signal Red",accent:"#FF2A3D",soft:"rgba(255, 42, 61, 0.12)",glow:"rgba(255, 42, 61, 0.52)",xtermSelection:"#4a1b22"}],Ic="aqua";function Zl(e){return jl.some(t=>t.id===e)?e:Ic}function Up(e){return jl.find(t=>t.id===e)??jl[0]}function Wn(){if(typeof window>"u")return Ic;try{return Zl(window.localStorage.getItem(jp))}catch{return Ic}}function mE(e){const t=Zl(e);if(typeof window<"u"){try{window.localStorage.setItem(jp,t)}catch{}Pp(t),window.dispatchEvent(new CustomEvent(wf,{detail:t}))}return t}function Pp(e=Wn()){if(typeof document>"u")return;const t=Up(Zl(e)),n=document.documentElement;n.style.setProperty("--nt-accent",t.accent),n.style.setProperty("--nt-accent-soft",t.soft),n.style.setProperty("--nt-accent-glow",t.glow)}function gE(e=Wn()){return Up(Zl(e)).accent}function vE(e=Wn()){return Up(Zl(e)).xtermSelection}function Rb(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===jp&&(Pp(Wn()),e())};return window.addEventListener(wf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(wf,e),window.removeEventListener("storage",t)}}const yE=e=>new Promise(t=>setTimeout(t,e));function SE({api:e}){const[t,n]=S.useState([{key:"local",id:null,name:"Local (main)"}]),[a,o]=S.useState({}),[c,d]=S.useState(!1);function p(A,P){o(z=>({...z,[A]:{...z[A],...P}}))}const _=A=>A.id===null?e.getVersion():e.getAgentVersion(A.id),f=A=>A.id===null?e.checkUpdate():e.checkAgentUpdate(A.id),b=A=>A.id===null?e.runUpdate():e.runAgentUpdate(A.id);S.useEffect(()=>{let A=!1;return e.listAgents().then(P=>{if(A)return;const z=[{key:"local",id:null,name:"Local (main)"},...P.agents.map(K=>({key:K.id,id:K.id,name:K.name}))];n(z);for(const K of z)_(K).then(N=>p(K.key,{version:N})).catch(N=>p(K.key,{error:N instanceof Error?N.message:"unreachable"}))}).catch(()=>{}),()=>{A=!0}},[]);async function v(A){p(A.key,{busy:!0,status:"checking…",error:void 0});try{const P=await f(A);p(A.key,{behind:P.behind,latestVersion:P.latestVersion,updateAvailable:P.updateAvailable,status:D(P),busy:!1})}catch(P){p(A.key,{busy:!1,error:P instanceof Error?P.message:"check failed"})}}async function w(){d(!0),await Promise.all(t.map(A=>v(A))),d(!1)}async function x(A,P){const z=Date.now()+18e4;for(;Date.now()<z;){await yE(3e3);try{const K=await _(A);if(P?.runningCommit&&K.runningCommit&&K.runningCommit!==P.runningCommit||P?.installMode==="package"&&K.runningVersion!==P.runningVersion)return K}catch{}}return null}async function C(A){const P=a[A.key]?.version;p(A.key,{busy:!0,status:"updating…",error:void 0});let z;try{z=await b(A)}catch(N){return p(A.key,{busy:!1,error:N instanceof Error?N.message:"update failed"}),"failed"}if(!z.ok)return p(A.key,{busy:!1,status:void 0,error:z.message}),"failed";if(!z.changed)return p(A.key,{busy:!1,status:"already up to date",behind:0}),"unchanged";p(A.key,{status:P?.installMode==="package"?"restarting…":"rebuilding & restarting…"});const K=await x(A,P);return K?(p(A.key,{busy:!1,version:K,behind:0,updateAvailable:!1,status:"updated"}),"updated"):(p(A.key,{busy:!1,status:void 0,error:"timed out — check the server log"}),"failed")}async function E(){d(!0);const A=t.filter(N=>N.id!==null),P=t.find(N=>N.id===null);if((await Promise.all(A.map(N=>C(N)))).filter(N=>N==="failed").length>0){d(!1);return}if(P&&await C(P)==="updated"){window.location.reload();return}d(!1)}function B(A){return A?A.error?A.error:A.status?A.status:A.version?`v${A.version.version}`:"…":"…"}function D(A){return A.error?A.error:typeof A.updateAvailable=="boolean"?A.updateAvailable?`latest v${A.latestVersion??"available"}`:"up to date":A.behind===0?"up to date":`${A.behind??"unknown"} behind`}function Z(A){const P=A?.version;if(!P)return"";const z=P.runningCommit??P.commit??null,K=z?z.slice(0,8):null;return P.installMode==="package"?`npm package v${P.runningVersion}`:`${P.branch??""}${K?` @ ${K}`:""}${P.dirty?" (modified)":""}`.trim()}return g.jsxs("section",{className:"security-section",children:[g.jsx("h3",{children:"Updates"}),g.jsxs("div",{className:"update-actions",children:[g.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{w()},disabled:c,children:"Check for updates"}),g.jsx("button",{type:"button",onClick:()=>{E()},disabled:c,children:"Update all"})]}),g.jsx("ul",{className:"security-list",children:t.map(A=>{const P=a[A.key],z=Z(P),K=P?.version!==void 0&&!P?.busy&&!c;return g.jsxs("li",{children:[g.jsxs("div",{children:[g.jsx("span",{className:"security-item-label",children:A.name}),g.jsxs("span",{className:"security-item-meta",children:[z?`${z} — `:"",B(P)]})]}),g.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{C(A)},disabled:!K,children:P?.busy?"…":"Update"})]},A.key)})}),g.jsxs("p",{className:"muted",children:["Git checkouts run ",g.jsx("code",{children:"git pull --ff-only"})," then rebuild and restart. npm package installs compare against the npm registry, run ",g.jsx("code",{children:"npm install -g nterminal@latest"}),", then restart."]})]})}const vc=[{id:"terminal",label:"Terminal"},{id:"shortcuts",label:"Shortcuts"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"},{id:"updates",label:"Updates"}];function bE({onClose:e,api:t,onNotificationAssetsChanged:n}){const a=S.useMemo(()=>t??eu(),[t]),[o,c]=S.useState(()=>gf()),[d,p]=S.useState(()=>vf()),[_,f]=S.useState(()=>Sf()),[b,v]=S.useState(()=>Wn()),[w,x]=S.useState(()=>yr()),[C,E]=S.useState(null),[B,D]=S.useState(null),[Z,A]=S.useState("terminal"),[P,z]=S.useState(()=>fb()),[K,N]=S.useState(()=>vr()),[ae,de]=S.useState(()=>Mp()),[Te,ce]=S.useState([]),[Q,X]=S.useState([]),[se,le]=S.useState([]),[R,q]=S.useState(5*1024*1024),[$,ue]=S.useState(!1),[be,T]=S.useState(null),W=S.useRef(null),oe=S.useRef(null),ne=S.useRef({terminal:null,shortcuts:null,notifications:null,security:null,updates:null}),_e=S.useMemo(()=>new Set(Q),[Q]),fe=!wE(Q,se);S.useEffect(()=>yb(()=>c(gf())),[]),S.useEffect(()=>Sb(()=>p(vf())),[]),S.useEffect(()=>bb(()=>f(Sf())),[]),S.useEffect(()=>Rb(()=>v(Wn())),[]),S.useEffect(()=>wb(()=>x(yr())),[]),S.useEffect(()=>pb(()=>N(vr())),[]),S.useEffect(()=>{if(!C)return;const V=Hl.find(st=>st.id===C);if(!V)return;const He=st=>{if(st.preventDefault(),st.stopPropagation(),st.key==="Escape"){E(null),D(null);return}const yi=lE(st,V);if(!yi){D(V.indexed?"Press a shortcut ending in a number from 1 to 9.":"Press a complete shortcut.");return}x(nE(C,yi)),E(null),D(null)};return window.addEventListener("keydown",He,!0),()=>window.removeEventListener("keydown",He,!0)},[C]),S.useEffect(()=>{let V=!1;return a.listNotificationAssets().then(He=>{V||Re(He)}).catch(He=>{V||T(yc(He))}),()=>{V=!0}},[a]);function xe(V){c(gc(Number(V)))}function qe(V){N(py(Number(V)))}function Me(V){A(V),ne.current[V]?.scrollIntoView?.({block:"start",behavior:"smooth"})}function Ae(){const V=oe.current;if(!V)return;if(V.scrollTop+V.clientHeight>=V.scrollHeight-2){A(vc[vc.length-1].id);return}const He=V.getBoundingClientRect();let st="terminal",yi=0;for(const bt of vc){const fs=ne.current[bt.id];if(!fs)continue;const ps=fs.getBoundingClientRect(),ti=Math.max(ps.top,He.top),ii=Math.min(ps.bottom,He.bottom),Ci=Math.max(0,ii-ti);Ci>yi&&(st=bt.id,yi=Ci)}A(st)}function Ze(V){x(rE(V)),E(null),D(null)}function nt(){x(aE()),E(null),D(null)}function Re(V){const He=V.assets.filter(st=>st.enabled).map(st=>st.id);ce(V.assets),X(He),le(He),q(V.maxFileBytes),T(null)}async function te(){if(P){fy(!1),z(!1);return}let V=ae;V==="default"&&(V=await Qx(),de(V)),V==="granted"&&(fy(!0),z(!0))}async function we(V){const He=V?.[0];if(He){if(He.size>R){T(`File must be ${Od(R)} or smaller.`),Le();return}if(He.type!=="video/mp4"&&He.type!=="video/webm"){T("Upload an MP4 or WebM video."),Le();return}ue(!0),T(null);try{await a.uploadNotificationAsset(He),Re(await a.listNotificationAssets()),n?.()}catch(st){T(yc(st))}finally{ue(!1),Le()}}}async function Ce(V){ue(!0),T(null);try{await a.deleteNotificationAsset(V),Re(await a.listNotificationAssets()),n?.()}catch(He){T(yc(He))}finally{ue(!1)}}function Le(){W.current&&(W.current.value="")}function $e(V,He){const st=new Set(Q);if(He?st.add(V):st.delete(V),st.size===0){T("Keep at least one toast video selected.");return}T(null),X(Array.from(st))}async function St(){if(Q.length===0){T("Keep at least one toast video selected.");return}ue(!0),T(null);try{const V=await a.updateNotificationAssetSelection({enabledAssetIds:Q});Re(V),n?.()}catch(V){T(yc(V))}finally{ue(!1)}}return g.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-label":"Settings",onClick:e,children:g.jsxs("div",{className:"security-panel settings-panel",onClick:V=>V.stopPropagation(),children:[g.jsxs("header",{className:"security-panel-header",children:[g.jsx("h2",{children:"Settings"}),g.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:e,children:"×"})]}),g.jsxs("div",{className:"settings-layout",children:[g.jsx("nav",{className:"settings-nav","aria-label":"Settings categories",children:vc.map(V=>g.jsx("button",{type:"button","data-active":Z===V.id?"true":"false","aria-current":Z===V.id?"true":void 0,onClick:()=>Me(V.id),children:V.label},V.id))}),g.jsxs("div",{ref:oe,className:"settings-content",onScroll:Ae,children:[g.jsxs("section",{id:"settings-terminal",ref:V=>{ne.current.terminal=V},className:"security-section settings-section",children:[g.jsx("h3",{children:"Terminal"}),g.jsxs("label",{className:"settings-control",children:[g.jsx("span",{children:"Font size"}),g.jsxs("span",{className:"settings-control-value",children:[o,"px"]}),g.jsx("input",{type:"range",min:pf,max:_f,step:1,value:o,"aria-label":"Terminal font size",onChange:V=>xe(V.currentTarget.value)})]}),g.jsxs("div",{className:"settings-stepper-row",children:[g.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>c(gc(o-1)),children:"-"}),g.jsx("input",{type:"number",min:pf,max:_f,step:1,value:o,"aria-label":"Terminal font size value",onChange:V=>xe(V.currentTarget.value)}),g.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>c(gc(o+1)),children:"+"}),g.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:()=>c(gc(mr)),children:"Reset"})]}),g.jsxs("label",{className:"settings-control",children:[g.jsx("span",{children:"Font family"}),g.jsx("select",{value:d,"aria-label":"Terminal font family",onChange:V=>p(tE(V.currentTarget.value)),children:Kc.map(V=>g.jsx("option",{value:V.id,children:V.label},V.id))})]}),g.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[g.jsx("input",{type:"checkbox",checked:_,onChange:V=>f(iE(V.currentTarget.checked))}),"Show scroll progress"]}),g.jsxs("label",{className:"settings-control",children:[g.jsx("span",{children:"Accent theme"}),g.jsx("select",{value:b,"aria-label":"Theme accent",onChange:V=>v(mE(V.currentTarget.value)),children:jl.map(V=>g.jsx("option",{value:V.id,children:V.label},V.id))})]}),g.jsx("div",{className:"settings-theme-swatches","aria-hidden":"true",children:jl.map(V=>g.jsx("span",{className:"settings-theme-swatch","data-active":b===V.id?"true":"false",style:{"--settings-theme-accent":V.accent}},V.id))})]}),g.jsxs("section",{id:"settings-shortcuts",ref:V=>{ne.current.shortcuts=V},className:"security-section settings-section",children:[g.jsxs("div",{className:"settings-section-heading",children:[g.jsx("h3",{children:"Shortcuts"}),g.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:nt,children:"Reset all"})]}),g.jsx("p",{className:"muted",children:"Defaults avoid Chrome's browser-tab shortcuts. Click a shortcut, then press the new key combo."}),B?g.jsx("p",{className:"settings-error",children:B}):null,g.jsx("ul",{className:"settings-shortcut-list","aria-label":"Workspace shortcuts",children:Hl.map(V=>{const He=C===V.id;return g.jsxs("li",{children:[g.jsxs("div",{children:[g.jsx("span",{className:"settings-shortcut-label",children:V.label}),g.jsx("span",{className:"settings-shortcut-group",children:V.group})]}),g.jsxs("div",{className:"settings-shortcut-actions",children:[g.jsx("button",{type:"button",className:"settings-shortcut-recorder","data-recording":He?"true":"false",onClick:()=>{E(V.id),D(null)},children:He?"Press keys…":xb(w[V.id])}),g.jsx("button",{type:"button",className:"secondary-button settings-shortcut-reset",onClick:()=>Ze(V.id),children:"Reset"})]})]},V.id)})})]}),g.jsxs("section",{id:"settings-notifications",ref:V=>{ne.current.notifications=V},className:"security-section settings-section",children:[g.jsx("h3",{children:"Notifications"}),au()?g.jsxs(g.Fragment,{children:[g.jsxs("label",{className:"auth-checkbox",children:[g.jsx("input",{type:"checkbox",checked:P&&ae==="granted",onChange:()=>{te()},disabled:ae==="denied"}),"System notification when page is hidden"]}),ae==="denied"?g.jsx("p",{className:"muted",children:"Notification permission is blocked for this site. Re-enable it in the browser's site settings, then come back here to turn the toggle on."}):g.jsx("p",{className:"muted",children:"Uses browser notifications only when this page isn't visible. Animated toast is controlled separately below."})]}):g.jsx("p",{className:"muted",children:"This browser doesn't expose the Notification API; animated toast and in-app badges can still work."}),g.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[g.jsx("input",{type:"checkbox",checked:K.enabled,onChange:V=>N(Vx(V.currentTarget.checked))}),"Show animated completion toast"]}),g.jsxs("label",{className:"settings-control",children:[g.jsx("span",{children:"Toast duration"}),g.jsx("span",{className:"settings-control-value",children:K.persistUntilDismissed?"Until closed":`${K.durationSeconds}s`}),g.jsx("input",{type:"range",min:uf,max:hf,step:.5,value:K.durationSeconds,disabled:!K.enabled||K.persistUntilDismissed,"aria-label":"Completion toast duration",onChange:V=>qe(V.currentTarget.value)})]}),g.jsxs("div",{className:"settings-stepper-row settings-duration-row",children:[g.jsx("input",{type:"number",min:uf,max:hf,step:.5,value:K.durationSeconds,disabled:!K.enabled||K.persistUntilDismissed,"aria-label":"Completion toast duration value",onChange:V=>qe(V.currentTarget.value)}),g.jsx("button",{type:"button",className:"secondary-button settings-reset-button",disabled:!K.enabled||K.persistUntilDismissed,onClick:()=>N(py(Bl)),children:"Reset"})]}),g.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[g.jsx("input",{type:"checkbox",checked:K.persistUntilDismissed,disabled:!K.enabled,onChange:V=>N($x(V.currentTarget.checked))}),"Keep toast until dismissed"]}),g.jsxs("div",{className:"settings-assets-header",children:[g.jsx("span",{children:"Toast videos"}),g.jsxs("span",{children:[Od(R)," max"]})]}),g.jsx("input",{ref:W,type:"file",accept:"video/mp4,video/webm",className:"settings-asset-input","aria-label":"Upload toast video",onChange:V=>{we(V.currentTarget.files)}}),g.jsx("button",{type:"button",className:"secondary-button settings-upload-button",disabled:$,onClick:()=>W.current?.click(),children:"Upload video"}),be?g.jsx("p",{className:"settings-error",children:be}):null,Te.length>0?g.jsx("ul",{className:"settings-asset-list","aria-label":"Toast videos",children:Te.map(V=>g.jsxs("li",{"data-enabled":_e.has(V.id)?"true":"false",children:[g.jsxs("label",{className:"settings-asset-choice",children:[g.jsx("input",{type:"checkbox",checked:_e.has(V.id),disabled:$,"aria-label":`Use ${V.filename}`,onChange:He=>$e(V.id,He.currentTarget.checked)}),g.jsx("video",{src:V.url,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),g.jsxs("span",{className:"settings-asset-copy",children:[g.jsx("span",{children:V.filename}),g.jsx("small",{children:V.source==="built-in"?"Built-in":Od(V.size)})]})]}),V.source==="uploaded"?g.jsx("button",{type:"button",className:"secondary-button settings-asset-delete",disabled:$,"aria-label":`Delete ${V.filename}`,onClick:()=>{Ce(V.id)},children:"x"}):null]},V.id))}):g.jsx("p",{className:"muted",children:"Built-in videos will be used."}),g.jsx("button",{type:"button",className:"secondary-button settings-save-assets-button",disabled:$||Te.length===0||!fe,onClick:()=>{St()},children:"Save selected videos"})]}),g.jsx("div",{id:"settings-security",ref:V=>{ne.current.security=V},className:"settings-section-group",children:g.jsx(Yx,{api:a})}),g.jsx("div",{id:"settings-updates",ref:V=>{ne.current.updates=V},className:"settings-section-group",children:g.jsx(SE,{api:a})})]})]})]})})}function Od(e){return e>=1024*1024?`${Math.round(e/1024/1024*10)/10} MB`:e>=1024?`${Math.round(e/1024*10)/10} KB`:`${e} B`}function yc(e){return e instanceof Error?e.message:"Request failed."}function wE(e,t){if(e.length!==t.length)return!1;const n=new Set(t);return e.every(a=>n.has(a))}class dl extends Error{constructor(t,n){super(n),this.status=t,this.name="UploadClientError"}status}function CE(e){const t=e.createXhr?.()??new XMLHttpRequest,n=new FormData,a=e.files.map((o,c)=>({fieldName:`file${c}`,relativePath:o.relativePath,size:o.file.size}));n.append("manifest",JSON.stringify({terminalId:e.terminalId,entries:a}));for(const[o,c]of e.files.entries())n.append(`file${o}`,c.file);return new Promise((o,c)=>{t.open("POST","/api/uploads"),t.withCredentials=!0,t.upload.onprogress=d=>{if(e.onProgress){if(d.lengthComputable&&d.total>0){e.onProgress({loaded:d.loaded,total:d.total,percent:Math.round(d.loaded/d.total*100)});return}e.onProgress({loaded:d.loaded,total:null,percent:null})}},t.onload=()=>{if(t.status>=200&&t.status<300){try{o(JSON.parse(t.responseText))}catch{c(new dl(t.status,"Invalid upload response."))}return}c(new dl(t.status,xE(t.responseText,t.statusText||`HTTP ${t.status}`)))},t.onerror=()=>c(new dl(0,"Upload failed.")),t.onabort=()=>c(new dl(0,"Upload aborted.")),t.ontimeout=()=>c(new dl(0,"Upload timed out.")),t.send(n)})}function xE(e,t){try{const n=JSON.parse(e),a=typeof n.error=="string"?n.error:n.message;if(typeof a=="string"&&a.trim())return a}catch{}return t}const EE="modulepreload",TE=function(e){return"/"+e},my={},Mb=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let _=function(f){return Promise.all(f.map(b=>Promise.resolve(b).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=d?.nonce||d?.getAttribute("nonce");o=_(n.map(f=>{if(f=TE(f),f in my)return;my[f]=!0;const b=f.endsWith(".css"),v=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${v}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":EE,b||(w.as="script"),w.crossOrigin="",w.href=f,p&&w.setAttribute("nonce",p),document.head.appendChild(w),b)return new Promise((x,C)=>{w.addEventListener("load",x),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${f}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return o.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})},kE=S.lazy(()=>Mb(()=>import("./MarkdownPreview-BeDi-V7k.js"),[]));function DE({api:e,activeTerminalId:t,activeTerminalCwd:n,onOpenFile:a}){const[o,c]=S.useState(null),[d,p]=S.useState(""),[_,f]=S.useState({}),[b,v]=S.useState(()=>new Set),[w,x]=S.useState(null),[C,E]=S.useState({type:"empty"}),[B,D]=S.useState("idle"),[Z,A]=S.useState(null),P=S.useRef(null),z=S.useRef(null),K=S.useRef(!1),N=S.useRef(0),ae=S.useRef(null);ae.current===null&&t&&(ae.current=t);const de=ae.current,Te=t?Hd(t,n):null,ce=o?[o.rootPath,d].filter(Boolean).join("/"):"",Q=w?.path??null;S.useEffect(()=>(K.current=!0,()=>{K.current=!1,N.current+=1,qe()}),[]),S.useEffect(()=>{ae.current=t,z.current=null;const te=t?Hd(t,n):null;X(t,te)},[e]),S.useEffect(()=>{if(!de||t!==de)return;const te=Hd(de,n);te!==z.current&&X(de,te)},[de,t,n]);async function X(te,we=Te){const Ce=Me();if(z.current=we,qe(),c(null),p(""),f({}),v(new Set),x(null),E({type:"empty"}),A(null),!te){D("idle");return}D("loading");try{const Le=await e.createFileRoot({terminalId:te});if(!Ae(Ce))return;c({rootToken:Le.rootToken,rootPath:Le.rootPath});const $e=await e.listFiles({rootToken:Le.rootToken,path:""});if(!Ae(Ce))return;R($e),D("idle")}catch(Le){if(await Ze(Le,Ce))return;Ae(Ce)&&(A(On(Le)),D("idle"))}}async function se(te=d,we=o){if(!we)return;const Ce=Me();D("loading"),A(null);try{const Le=await e.listFiles({rootToken:we.rootToken,path:te});if(!Ae(Ce))return;R(Le),D("idle")}catch(Le){if(await Ze(Le,Ce))return;Ae(Ce)&&(A(On(Le)),D("idle"))}}async function le(){ae.current=t,await X(t,Te)}function R(te){f(we=>({...we,[te.path]:ME(te.entries)}))}async function q(te){if(!(!zd(te)||!o)){if(x(te),A(null),te.kind==="directory"){p(te.path),xe(),await ue(te);return}if(p(hr(te.path)),te.editable){await T(te);return}te.previewKind!=="none"&&await oe(te,te.previewKind)}}async function $(te){if(!(!zd(te)||!o)){if(x(te),A(null),te.kind==="directory"){p(te.path),xe(),await ue(te);return}if(p(hr(te.path)),te.editable){await W(te);return}te.previewKind!=="none"&&await oe(te,te.previewKind)}}async function ue(te){if(b.has(te.path)){v(we=>{const Ce=new Set(we);return Ce.delete(te.path),Ce});return}v(we=>new Set(we).add(te.path)),await se(te.path)}function be(te,we){te.key==="Enter"&&(te.preventDefault(),$(we))}async function T(te){if(!o)return;const we=Me();D("loading"),qe();try{const Ce=await e.readFile({rootToken:o.rootToken,path:te.path});if(!Ae(we))return;E({type:"text-preview",file:te,read:Ce}),D("idle")}catch(Ce){if(await Ze(Ce,we))return;Ae(we)&&(A(On(Ce)),D("idle"))}}async function W(te){if(!o)return;const we=Me();D("loading");try{await a({rootToken:o.rootToken,path:te.path}),Ae(we)&&D("idle")}catch(Ce){if(await Ze(Ce,we))return;Ae(we)&&(A(On(Ce)),D("idle"))}}async function oe(te,we){if(!o)return;const Ce=Me();D("loading"),qe();try{const Le=await e.previewFile({rootToken:o.rootToken,path:te.path});if(!Ae(Ce))return;const $e=URL.createObjectURL(Le);if(!Ae(Ce)){URL.revokeObjectURL($e);return}P.current=$e,E({type:"preview",file:te,previewKind:we,url:$e}),D("idle")}catch(Le){if(await Ze(Le,Ce))return;Ae(Ce)&&(A(On(Le)),D("idle"))}}async function ne(te){if(!o)return;const we=te==="file"?"New file":"New folder",Ce=window.prompt(we,""),Le=w?w.kind==="directory"?w.path:hr(w.path):d,$e=gy(Ce,Le);if($e){A(null);try{const St=await e.createFileEntry({rootToken:o.rootToken,path:$e,kind:te});x(St.entry),await se(Le)}catch(St){if(await Ze(St))return;A(On(St))}}}async function _e(){if(!o||!w)return;const te=window.prompt("Move selected entry",w.path),we=gy(te,"");if(!we||we===w.path)return;const Ce=hr(w.path),Le=hr(we);A(null);try{const $e=await e.moveFileEntry({rootToken:o.rootToken,sourcePath:w.path,destinationPath:we});x($e.entry),p($e.entry.kind==="directory"?$e.entry.path:hr($e.entry.path)),xe(),await se(Ce),Le!==Ce&&await se(Le)}catch($e){if(await Ze($e))return;A(On($e))}}async function fe(){if(!o||!w)return;const te=w.path,we=hr(te);A(null);try{const Ce=await e.previewDeleteFileEntry({rootToken:o.rootToken,path:w.path}),Le=Ce.descendantCount>0?` and ${Ce.descendantCount} nested item${Ce.descendantCount===1?"":"s"}`:"";if(!window.confirm(`Delete ${Ce.path}${Le}?`))return;await e.deleteFileEntry({rootToken:o.rootToken,path:w.path,previewToken:Ce.previewToken}),x(null),p(we),v($e=>{const St=new Set($e);for(const V of $e)(V===te||V.startsWith(`${te}/`))&&St.delete(V);return St}),xe(),await se(we)}catch(Ce){if(await Ze(Ce))return;A(On(Ce))}}function xe(){N.current+=1,qe(),E({type:"empty"})}function qe(){P.current&&(URL.revokeObjectURL(P.current),P.current=null)}function Me(){return N.current+=1,N.current}function Ae(te){return K.current&&te===N.current}async function Ze(te,we){return AE(te)?(we!==void 0&&!Ae(we)||await X(t,Te),!0):!1}function nt(te,we){const Ce=zd(te),Le=te.kind==="directory"&&b.has(te.path),$e=_[te.path]??[],St={"--file-tree-depth":we};return g.jsxs(gi.Fragment,{children:[g.jsxs("button",{type:"button",className:"file-entry-button","data-kind":te.kind,"data-expanded":Le,"data-active":Q===te.path,disabled:!Ce,style:St,"aria-expanded":te.kind==="directory"?Le:void 0,"aria-label":`${te.kind==="directory"?"Open folder":"Open file"} ${te.name}`,title:te.kind==="directory"?"Expand or collapse folder":"Click to preview. Double-click or press Enter to open.",onClick:()=>{q(te)},onDoubleClick:()=>{$(te)},onKeyDown:V=>be(V,te),children:[g.jsx("span",{className:"file-entry-disclosure","aria-hidden":"true",children:te.kind==="directory"?Le?"▾":"▸":""}),g.jsx("span",{className:"file-entry-name",children:te.name}),g.jsx("small",{children:RE(te)})]}),Le?g.jsx("div",{className:"file-tree-children",role:"group",children:$e.map(V=>nt(V,we+1))}):null]},te.path)}const Re=_[""]??[];return g.jsxs("section",{className:"file-explorer","aria-label":"Files","aria-busy":B==="loading",children:[g.jsxs("header",{className:"file-explorer-header",children:[g.jsx("div",{className:"file-explorer-path",title:ce,children:ce||"No active pane"}),g.jsxs("div",{className:"file-explorer-toolbar","aria-label":"File actions",children:[g.jsx("button",{type:"button","aria-label":"Refresh files",title:"Refresh",disabled:!t,onClick:()=>{le()},children:"↻"}),g.jsx("button",{type:"button","aria-label":"New file",title:"New file",disabled:!o,onClick:()=>{ne("file")},children:"+"}),g.jsx("button",{type:"button","aria-label":"New folder",title:"New folder",disabled:!o,onClick:()=>{ne("directory")},children:"▣"})]})]}),Z?g.jsx("div",{className:"file-explorer-alert",role:"alert",children:Z}):null,g.jsxs("div",{className:"file-explorer-layout",children:[g.jsx("div",{className:"file-tree","aria-label":ce?`Files in ${ce}`:"Files",children:Re.map(te=>nt(te,0))}),g.jsxs("section",{className:"file-detail","aria-label":"File detail",children:[g.jsxs("div",{className:"file-detail-header",children:[g.jsx("strong",{children:w?.name??"detail"}),g.jsxs("div",{className:"file-detail-actions",children:[g.jsx("button",{type:"button","aria-label":"Move selected entry",disabled:!w,onClick:()=>{_e()},children:"Move"}),g.jsx("button",{type:"button","aria-label":"Delete selected entry",disabled:!w,onClick:()=>{fe()},children:"Delete"})]})]}),B==="loading"?g.jsx("div",{className:"file-detail-empty",children:"loading"}):null,C.type==="empty"&&B!=="loading"?g.jsx("div",{className:"file-detail-empty",children:"No file selected"}):null,C.type==="preview"?g.jsxs("div",{className:"file-preview-frame",children:[C.previewKind==="image"?g.jsx("img",{src:C.url,alt:C.file.name}):null,C.previewKind==="pdf"?g.jsx("iframe",{src:C.url,title:C.file.name}):null]}):null,C.type==="text-preview"&&C.read.language==="markdown"?g.jsx("div",{className:"file-markdown-preview","aria-label":`Preview for ${C.file.name}`,children:g.jsx(S.Suspense,{fallback:g.jsx("div",{className:"file-markdown-preview-loading",children:"loading preview"}),children:g.jsx(kE,{content:C.read.content})})}):null,C.type==="text-preview"&&C.read.language==="text"?g.jsx("pre",{className:"file-text-preview","aria-label":`Preview for ${C.file.name}`,children:C.read.content}):null]})]})]})}function zd(e){return e.kind==="directory"||e.editable||e.previewKind!=="none"}function RE(e){return e.kind==="directory"?"dir":e.editable?"edit":e.previewKind!=="none"?e.previewKind:"unsupported"}function Hd(e,t){return`${e}\0${t??""}`}function ME(e){return[...e].sort((t,n)=>t.kind==="directory"&&n.kind!=="directory"?-1:t.kind!=="directory"&&n.kind==="directory"?1:t.name.localeCompare(n.name))}function hr(e){const t=e.split("/").filter(Boolean);return t.pop(),t.join("/")}function gy(e,t){if(e===null)return null;const n=e.trim().replace(/^\/+/,"").replace(/\/{2,}/g,"/").replace(/\/$/,"");return n?!t||n.includes("/")?n:`${t}/${n}`:null}function On(e){return e instanceof Error?e.message:"Request failed"}function AE(e){return e instanceof ln&&e.status===409&&e.message==="terminal_cwd_changed"}const NE=S.lazy(()=>Mb(()=>import("./MarkdownPreview-BeDi-V7k.js"),[]));function BE({api:e,editor:t,canClose:n,onClose:a}){const[o,c]=S.useState(t.read),[d,p]=S.useState(t.read.content),[_,f]=S.useState("idle"),[b,v]=S.useState(null),[w,x]=S.useState(!1),[C,E]=S.useState("edit"),B=S.useRef(t),D=S.useRef(t.read),Z=S.useRef(t.read.content),A=S.useRef(!1),P=S.useRef(!1),z=S.useRef(0),K=d!==o.content&&_!=="saving"&&!w;S.useEffect(()=>(P.current=!0,()=>{P.current=!1,z.current+=1}),[]),S.useEffect(()=>{z.current+=1,A.current=!1,B.current=t,D.current=t.read,Z.current=t.read.content,c(t.read),p(t.read.content),f("idle"),v(null),x(!1),E("edit")},[t.id,t.read]),S.useEffect(()=>{B.current=t},[t]),S.useEffect(()=>{D.current=o},[o]),S.useEffect(()=>{Z.current=d},[d]),S.useEffect(()=>{if(d===o.content||w)return;const ce=window.setInterval(()=>{!A.current&&Z.current!==D.current.content&&N()},1e3);return()=>window.clearInterval(ce)},[d===o.content,w,t.id]);async function N(){if(A.current)return;const ce=Z.current,Q=D.current;if(ce===Q.content)return;const X=B.current,se=z.current;A.current=!0,f("saving"),v(null),x(!1);try{const le=await e.writeFile({rootToken:X.rootToken,path:X.path,content:ce,expectedVersion:Q.version});if(!P.current||se!==z.current)return;const R={...Q,content:ce,version:le.version};D.current=R,c(R),f(Z.current===ce?"saved":"idle")}catch(le){if(!P.current||se!==z.current)return;if(le instanceof ln&&le.status===409){x(!0),f("idle");return}v(LE(le)),f("idle")}finally{se===z.current&&(A.current=!1)}}const ae=_==="saving"?"saving":_==="saved"?"saved":o.language,de=o.language==="markdown",Te=de&&C==="preview";return g.jsxs("section",{className:"editor-pane","aria-label":`Editor pane ${t.title}`,children:[g.jsxs("header",{className:"editor-pane-header",children:[g.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),g.jsx("strong",{children:t.title}),g.jsx("span",{className:"terminal-pane-spacer"}),g.jsx("span",{className:"terminal-pane-state",children:ae}),g.jsx("button",{type:"button","aria-label":`Save ${t.title}`,disabled:!K,onClick:()=>{N()},children:"Save"}),de?g.jsx("button",{type:"button","aria-label":`${Te?"Edit":"Preview"} ${t.title}`,onClick:()=>E(ce=>ce==="preview"?"edit":"preview"),children:Te?"Edit":"Preview"}):null,n?g.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close editor ${t.title}`,onClick:a,children:"x"}):null]}),b?g.jsx("div",{className:"editor-pane-alert",role:"alert",children:b}):null,w?g.jsx("div",{className:"editor-pane-alert",role:"alert",children:"File changed on disk."}):null,Te?g.jsx("div",{className:"editor-markdown-preview","aria-label":`Markdown preview for ${t.title}`,children:g.jsx(S.Suspense,{fallback:g.jsx("div",{className:"editor-markdown-preview-loading",children:"loading preview"}),children:g.jsx(NE,{content:d})})}):g.jsx("textarea",{className:"editor-pane-textarea","aria-label":`Editor for ${t.title}`,spellCheck:!1,value:d,onChange:ce=>{const Q=ce.target.value;Z.current=Q,p(Q),f("idle"),v(null),x(!1)}})]})}function LE(e){return e instanceof Error?e.message:"Request failed"}var OE=2,zE=1,HE=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(n.getPropertyValue("height")),o=Math.max(0,parseInt(n.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),d={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},p=d.top+d.bottom,_=d.right+d.left,f=a-p,b=o-_-t;return{cols:Math.max(OE,Math.floor(b/e.css.cell.width)),rows:Math.max(zE,Math.floor(f/e.css.cell.height))}}};var Ab=Object.defineProperty,jE=Object.getOwnPropertyDescriptor,UE=(e,t)=>{for(var n in t)Ab(e,n,{get:t[n],enumerable:!0})},Ht=(e,t,n,a)=>{for(var o=a>1?void 0:a?jE(t,n):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(o=(a?d(t,n,o):d(o))||o);return a&&o&&Ab(t,n,o),o},me=(e,t)=>(n,a)=>t(n,a,e),vy="Terminal input",Cf={get:()=>vy,set:e=>vy=e},yy="Too much output to announce, navigate to rows manually to read",xf={get:()=>yy,set:e=>yy=e};function PE(e){return e.replace(/\r?\n/g,"\r")}function KE(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function IE(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function FE(e,t,n,a){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");Nb(o,t,n,a)}}function Nb(e,t,n,a){e=PE(e),e=KE(e,n.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function Bb(e,t,n){let a=n.getBoundingClientRect(),o=e.clientX-a.left-10,c=e.clientY-a.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${c}px`,t.style.zIndex="1000",t.focus()}function Sy(e,t,n,a,o){Bb(e,t,n),o&&a.rightClickSelect(e),t.value=a.selectionText,t.select()}function Kn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function lu(e,t=0,n=e.length){let a="";for(let o=t;o<n;++o){let c=e[o];c>65535?(c-=65536,a+=String.fromCharCode((c>>10)+55296)+String.fromCharCode(c%1024+56320)):a+=String.fromCharCode(c)}return a}var qE=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let a=0,o=0;if(this._interim){let c=e.charCodeAt(o++);56320<=c&&c<=57343?t[a++]=(this._interim-55296)*1024+c-56320+65536:(t[a++]=this._interim,t[a++]=c),this._interim=0}for(let c=o;c<n;++c){let d=e.charCodeAt(c);if(55296<=d&&d<=56319){if(++c>=n)return this._interim=d,a;let p=e.charCodeAt(c);56320<=p&&p<=57343?t[a++]=(d-55296)*1024+p-56320+65536:(t[a++]=d,t[a++]=p);continue}d!==65279&&(t[a++]=d)}return a}},WE=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let a=0,o,c,d,p,_=0,f=0;if(this.interim[0]){let w=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let C=0,E;for(;(E=this.interim[++C]&63)&&C<4;)x<<=6,x|=E;let B=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=B-C;for(;f<D;){if(f>=n)return 0;if(E=e[f++],(E&192)!==128){f--,w=!0;break}else this.interim[C++]=E,x<<=6,x|=E&63}w||(B===2?x<128?f--:t[a++]=x:B===3?x<2048||x>=55296&&x<=57343||x===65279||(t[a++]=x):x<65536||x>1114111||(t[a++]=x)),this.interim.fill(0)}let b=n-4,v=f;for(;v<n;){for(;v<b&&!((o=e[v])&128)&&!((c=e[v+1])&128)&&!((d=e[v+2])&128)&&!((p=e[v+3])&128);)t[a++]=o,t[a++]=c,t[a++]=d,t[a++]=p,v+=4;if(o=e[v++],o<128)t[a++]=o;else if((o&224)===192){if(v>=n)return this.interim[0]=o,a;if(c=e[v++],(c&192)!==128){v--;continue}if(_=(o&31)<<6|c&63,_<128){v--;continue}t[a++]=_}else if((o&240)===224){if(v>=n)return this.interim[0]=o,a;if(c=e[v++],(c&192)!==128){v--;continue}if(v>=n)return this.interim[0]=o,this.interim[1]=c,a;if(d=e[v++],(d&192)!==128){v--;continue}if(_=(o&15)<<12|(c&63)<<6|d&63,_<2048||_>=55296&&_<=57343||_===65279)continue;t[a++]=_}else if((o&248)===240){if(v>=n)return this.interim[0]=o,a;if(c=e[v++],(c&192)!==128){v--;continue}if(v>=n)return this.interim[0]=o,this.interim[1]=c,a;if(d=e[v++],(d&192)!==128){v--;continue}if(v>=n)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=d,a;if(p=e[v++],(p&192)!==128){v--;continue}if(_=(o&7)<<18|(c&63)<<12|(d&63)<<6|p&63,_<65536||_>1114111)continue;t[a++]=_}}return a}},Lb="",In=" ",Ql=class Ob{constructor(){this.fg=0,this.bg=0,this.extended=new Fc}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Ob;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Fc=class zb{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new zb(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},hs=class Hb extends Ql{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Fc,this.combinedData=""}static fromCharData(t){let n=new Hb;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Kn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let a=t[1].charCodeAt(0);if(55296<=a&&a<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(a-55296)*1024+o-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},by="di$target",Ef="di$dependencies",jd=new Map;function YE(e){return e[Ef]||[]}function ui(e){if(jd.has(e))return jd.get(e);let t=function(n,a,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");VE(t,n,o)};return t._id=e,jd.set(e,t),t}function VE(e,t,n){t[by]===t?t[Ef].push({id:e,index:n}):(t[Ef]=[{id:e,index:n}],t[by]=t)}var ki=ui("BufferService"),jb=ui("CoreMouseService"),wr=ui("CoreService"),$E=ui("CharsetService"),Kp=ui("InstantiationService"),Ub=ui("LogService"),Di=ui("OptionsService"),Pb=ui("OscLinkService"),XE=ui("UnicodeService"),Jl=ui("DecorationService"),Tf=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let a=[],o=this._optionsService.rawOptions.linkHandler,c=new hs,d=n.getTrimmedLength(),p=-1,_=-1,f=!1;for(let b=0;b<d;b++)if(!(_===-1&&!n.hasContent(b))){if(n.loadCell(b,c),c.hasExtendedAttrs()&&c.extended.urlId)if(_===-1){_=b,p=c.extended.urlId;continue}else f=c.extended.urlId!==p;else _!==-1&&(f=!0);if(f||_!==-1&&b===d-1){let v=this._oscLinkService.getLinkData(p)?.uri;if(v){let w={start:{x:_+1,y:e},end:{x:b+(!f&&b===d-1?1:0),y:e}},x=!1;if(!o?.allowNonHttpProtocols)try{let C=new URL(v);["http:","https:"].includes(C.protocol)||(x=!0)}catch{x=!0}x||a.push({text:v,range:w,activate:(C,E)=>o?o.activate(C,E,w):GE(C,E),hover:(C,E)=>o?.hover?.(C,E,w),leave:(C,E)=>o?.leave?.(C,E,w)})}f=!1,c.hasExtendedAttrs()&&c.extended.urlId?(_=b,p=c.extended.urlId):(_=-1,p=-1)}}t(a)}};Tf=Ht([me(0,ki),me(1,Di),me(2,Pb)],Tf);function GE(e,t){if(confirm(`Do you want to navigate to ${t}?
14
-
15
- WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var ou=ui("CharSizeService"),on=ui("CoreBrowserService"),Ip=ui("MouseService"),cn=ui("RenderService"),ZE=ui("SelectionService"),Kb=ui("CharacterJoinerService"),ga=ui("ThemeService"),Ib=ui("LinkProviderService"),QE=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?wy.isErrorNoTelemetry(e)?new wy(e.message+`
16
-
17
- `+e.stack):new Error(e.message+`
18
-
19
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},JE=new QE;function Mc(e){e2(e)||JE.onUnexpectedError(e)}var kf="Canceled";function e2(e){return e instanceof t2?!0:e instanceof Error&&e.name===kf&&e.message===kf}var t2=class extends Error{constructor(){super(kf),this.name=this.message}};function i2(e){return new Error(`Illegal argument: ${e}`)}var wy=class Df extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Df)return t;let n=new Df;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Rf=class Fb extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Fb.prototype)}};function Yi(e,t=0){return e[e.length-(1+t)]}var s2;(e=>{function t(c){return c<0}e.isLessThan=t;function n(c){return c<=0}e.isLessThanOrEqual=n;function a(c){return c>0}e.isGreaterThan=a;function o(c){return c===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(s2||={});function n2(e,t){let n=this,a=!1,o;return function(){return a||(a=!0,t||(o=e.apply(n,arguments))),o}}var qb;(e=>{function t(P){return P&&typeof P=="object"&&typeof P[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function a(){return n}e.empty=a;function*o(P){yield P}e.single=o;function c(P){return t(P)?P:o(P)}e.wrap=c;function d(P){return P||n}e.from=d;function*p(P){for(let z=P.length-1;z>=0;z--)yield P[z]}e.reverse=p;function _(P){return!P||P[Symbol.iterator]().next().done===!0}e.isEmpty=_;function f(P){return P[Symbol.iterator]().next().value}e.first=f;function b(P,z){let K=0;for(let N of P)if(z(N,K++))return!0;return!1}e.some=b;function v(P,z){for(let K of P)if(z(K))return K}e.find=v;function*w(P,z){for(let K of P)z(K)&&(yield K)}e.filter=w;function*x(P,z){let K=0;for(let N of P)yield z(N,K++)}e.map=x;function*C(P,z){let K=0;for(let N of P)yield*z(N,K++)}e.flatMap=C;function*E(...P){for(let z of P)yield*z}e.concat=E;function B(P,z,K){let N=K;for(let ae of P)N=z(N,ae);return N}e.reduce=B;function*D(P,z,K=P.length){for(z<0&&(z+=P.length),K<0?K+=P.length:K>P.length&&(K=P.length);z<K;z++)yield P[z]}e.slice=D;function Z(P,z=Number.POSITIVE_INFINITY){let K=[];if(z===0)return[K,P];let N=P[Symbol.iterator]();for(let ae=0;ae<z;ae++){let de=N.next();if(de.done)return[K,e.empty()];K.push(de.value)}return[K,{[Symbol.iterator](){return N}}]}e.consume=Z;async function A(P){let z=[];for await(let K of P)z.push(K);return Promise.resolve(z)}e.asyncToArray=A})(qb||={});function Sr(e){if(qb.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(a){t.push(a)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function r2(...e){return kt(()=>Sr(e))}function kt(e){return{dispose:n2(()=>{e()})}}var Wb=class Yb{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Sr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Yb.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};Wb.DISABLE_DISPOSED_WARNING=!1;var Fn=Wb,Ie=class{constructor(){this._store=new Fn,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ie.None=Object.freeze({dispose(){}});var fa=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},an=typeof window=="object"?window:globalThis,Mf=class Af{constructor(t){this.element=t,this.next=Af.Undefined,this.prev=Af.Undefined}};Mf.Undefined=new Mf(void 0);var Mt=Mf,Cy=class{constructor(){this._first=Mt.Undefined,this._last=Mt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Mt.Undefined}clear(){let e=this._first;for(;e!==Mt.Undefined;){let t=e.next;e.prev=Mt.Undefined,e.next=Mt.Undefined,e=t}this._first=Mt.Undefined,this._last=Mt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Mt(e);if(this._first===Mt.Undefined)this._first=n,this._last=n;else if(t){let o=this._last;this._last=n,n.prev=o,o.next=n}else{let o=this._first;this._first=n,n.next=o,o.prev=n}this._size+=1;let a=!1;return()=>{a||(a=!0,this._remove(n))}}shift(){if(this._first!==Mt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Mt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Mt.Undefined&&e.next!==Mt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Mt.Undefined&&e.next===Mt.Undefined?(this._first=Mt.Undefined,this._last=Mt.Undefined):e.next===Mt.Undefined?(this._last=this._last.prev,this._last.next=Mt.Undefined):e.prev===Mt.Undefined&&(this._first=this._first.next,this._first.prev=Mt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Mt.Undefined;)yield e.element,e=e.next}},a2=globalThis.performance&&typeof globalThis.performance.now=="function",l2=class Vb{static create(t){return new Vb(t)}constructor(t){this._now=a2&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},vi;(e=>{e.None=()=>Ie.None;function t(Q,X){return v(Q,()=>{},0,void 0,!0,void 0,X)}e.defer=t;function n(Q){return(X,se=null,le)=>{let R=!1,q;return q=Q($=>{if(!R)return q?q.dispose():R=!0,X.call(se,$)},null,le),R&&q.dispose(),q}}e.once=n;function a(Q,X,se){return f((le,R=null,q)=>Q($=>le.call(R,X($)),null,q),se)}e.map=a;function o(Q,X,se){return f((le,R=null,q)=>Q($=>{X($),le.call(R,$)},null,q),se)}e.forEach=o;function c(Q,X,se){return f((le,R=null,q)=>Q($=>X($)&&le.call(R,$),null,q),se)}e.filter=c;function d(Q){return Q}e.signal=d;function p(...Q){return(X,se=null,le)=>{let R=r2(...Q.map(q=>q($=>X.call(se,$))));return b(R,le)}}e.any=p;function _(Q,X,se,le){let R=se;return a(Q,q=>(R=X(R,q),R),le)}e.reduce=_;function f(Q,X){let se,le={onWillAddFirstListener(){se=Q(R.fire,R)},onDidRemoveLastListener(){se?.dispose()}},R=new he(le);return X?.add(R),R.event}function b(Q,X){return X instanceof Array?X.push(Q):X&&X.add(Q),Q}function v(Q,X,se=100,le=!1,R=!1,q,$){let ue,be,T,W=0,oe,ne={leakWarningThreshold:q,onWillAddFirstListener(){ue=Q(fe=>{W++,be=X(be,fe),le&&!T&&(_e.fire(be),be=void 0),oe=()=>{let xe=be;be=void 0,T=void 0,(!le||W>1)&&_e.fire(xe),W=0},typeof se=="number"?(clearTimeout(T),T=setTimeout(oe,se)):T===void 0&&(T=0,queueMicrotask(oe))})},onWillRemoveListener(){R&&W>0&&oe?.()},onDidRemoveLastListener(){oe=void 0,ue.dispose()}},_e=new he(ne);return $?.add(_e),_e.event}e.debounce=v;function w(Q,X=0,se){return e.debounce(Q,(le,R)=>le?(le.push(R),le):[R],X,void 0,!0,void 0,se)}e.accumulate=w;function x(Q,X=(le,R)=>le===R,se){let le=!0,R;return c(Q,q=>{let $=le||!X(q,R);return le=!1,R=q,$},se)}e.latch=x;function C(Q,X,se){return[e.filter(Q,X,se),e.filter(Q,le=>!X(le),se)]}e.split=C;function E(Q,X=!1,se=[],le){let R=se.slice(),q=Q(be=>{R?R.push(be):ue.fire(be)});le&&le.add(q);let $=()=>{R?.forEach(be=>ue.fire(be)),R=null},ue=new he({onWillAddFirstListener(){q||(q=Q(be=>ue.fire(be)),le&&le.add(q))},onDidAddFirstListener(){R&&(X?setTimeout($):$())},onDidRemoveLastListener(){q&&q.dispose(),q=null}});return le&&le.add(ue),ue.event}e.buffer=E;function B(Q,X){return(se,le,R)=>{let q=X(new Z);return Q(function($){let ue=q.evaluate($);ue!==D&&se.call(le,ue)},void 0,R)}}e.chain=B;let D=Symbol("HaltChainable");class Z{constructor(){this.steps=[]}map(X){return this.steps.push(X),this}forEach(X){return this.steps.push(se=>(X(se),se)),this}filter(X){return this.steps.push(se=>X(se)?se:D),this}reduce(X,se){let le=se;return this.steps.push(R=>(le=X(le,R),le)),this}latch(X=(se,le)=>se===le){let se=!0,le;return this.steps.push(R=>{let q=se||!X(R,le);return se=!1,le=R,q?R:D}),this}evaluate(X){for(let se of this.steps)if(X=se(X),X===D)break;return X}}function A(Q,X,se=le=>le){let le=(...ue)=>$.fire(se(...ue)),R=()=>Q.on(X,le),q=()=>Q.removeListener(X,le),$=new he({onWillAddFirstListener:R,onDidRemoveLastListener:q});return $.event}e.fromNodeEventEmitter=A;function P(Q,X,se=le=>le){let le=(...ue)=>$.fire(se(...ue)),R=()=>Q.addEventListener(X,le),q=()=>Q.removeEventListener(X,le),$=new he({onWillAddFirstListener:R,onDidRemoveLastListener:q});return $.event}e.fromDOMEventEmitter=P;function z(Q){return new Promise(X=>n(Q)(X))}e.toPromise=z;function K(Q){let X=new he;return Q.then(se=>{X.fire(se)},()=>{X.fire(void 0)}).finally(()=>{X.dispose()}),X.event}e.fromPromise=K;function N(Q,X){return Q(se=>X.fire(se))}e.forward=N;function ae(Q,X,se){return X(se),Q(le=>X(le))}e.runAndSubscribe=ae;class de{constructor(X,se){this._observable=X,this._counter=0,this._hasChanged=!1;let le={onWillAddFirstListener:()=>{X.addObserver(this)},onDidRemoveLastListener:()=>{X.removeObserver(this)}};this.emitter=new he(le),se&&se.add(this.emitter)}beginUpdate(X){this._counter++}handlePossibleChange(X){}handleChange(X,se){this._hasChanged=!0}endUpdate(X){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Te(Q,X){return new de(Q,X).emitter.event}e.fromObservable=Te;function ce(Q){return(X,se,le)=>{let R=0,q=!1,$={beginUpdate(){R++},endUpdate(){R--,R===0&&(Q.reportChanges(),q&&(q=!1,X.call(se)))},handlePossibleChange(){},handleChange(){q=!0}};Q.addObserver($),Q.reportChanges();let ue={dispose(){Q.removeObserver($)}};return le instanceof Fn?le.add(ue):Array.isArray(le)&&le.push(ue),ue}}e.fromObservableLight=ce})(vi||={});var Nf=class Bf{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Bf._idPool++}`,Bf.all.add(this)}start(t){this._stopWatch=new l2,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Nf.all=new Set,Nf._idPool=0;var o2=Nf,c2=-1,$b=class Xb{constructor(t,n,a=(Xb._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=a,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let a=this.threshold;if(a<=0||n<a)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;let[c,d]=this.getMostFrequentStack(),p=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(p),console.warn(c);let _=new d2(p,c);this._errorHandler(_)}return()=>{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[a,o]of this._stacks)(!t||n<o)&&(t=[a,o],n=o);return t}};$b._idPool=1;var u2=$b,h2=class Gb{constructor(t){this.value=t}static create(){let t=new Error;return new Gb(t.stack??"")}print(){console.warn(this.value.split(`
20
- `).slice(2).join(`
21
- `))}},d2=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},f2=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},p2=0,Ud=class{constructor(e){this.value=e,this.id=p2++}},_2=2,m2,he=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new u2(e?.onListenerError??Mc,this._options?.leakWarningThreshold??c2):void 0,this._perfMon=this._options?._profName?new o2(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],_=new f2(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Mc)(_),Ie.None}if(this._disposed)return Ie.None;t&&(e=e.bind(t));let a=new Ud(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=h2.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Ud?(this._deliveryQueue??=new g2,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=kt(()=>{o?.(),this._removeListener(a)});return n instanceof Fn?n.add(c):Array.isArray(n)&&n.push(c),c},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let a=this._deliveryQueue.current===this;if(this._size*_2<=t.length){let o=0;for(let c=0;c<t.length;c++)t[c]?t[o++]=t[c]:a&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Mc;if(!n){e.value(t);return}try{e.value(t)}catch(a){n(a)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ud)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},g2=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Lf=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new he,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new he,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let a=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(a,t),this._onDidChangeZoomLevel.fire(a)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let a=this.getWindowId(n);this.mapWindowIdToFullScreen.set(a,t),this._onDidChangeFullscreen.fire(a)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Lf.INSTANCE=new Lf;var Fp=Lf;function v2(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Fp.INSTANCE.onDidChangeZoomLevel;function y2(e){return Fp.INSTANCE.getZoomFactor(e)}Fp.INSTANCE.onDidChangeFullscreen;var va=typeof navigator=="object"?navigator.userAgent:"",Of=va.indexOf("Firefox")>=0,S2=va.indexOf("AppleWebKit")>=0,qp=va.indexOf("Chrome")>=0,b2=!qp&&va.indexOf("Safari")>=0;va.indexOf("Electron/")>=0;va.indexOf("Android")>=0;var Pd=!1;if(typeof an.matchMedia=="function"){let e=an.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=an.matchMedia("(display-mode: fullscreen)");Pd=e.matches,v2(an,e,({matches:n})=>{Pd&&t.matches||(Pd=n)})}var la="en",zf=!1,Hf=!1,Ac=!1,Zb=!1,Sc,Nc=la,xy=la,w2,nn,gr=globalThis,$i;typeof gr.vscode<"u"&&typeof gr.vscode.process<"u"?$i=gr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&($i=process);var C2=typeof $i?.versions?.electron=="string",x2=C2&&$i?.type==="renderer";if(typeof $i=="object"){zf=$i.platform==="win32",Hf=$i.platform==="darwin",Ac=$i.platform==="linux",Ac&&$i.env.SNAP&&$i.env.SNAP_REVISION,$i.env.CI||$i.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Sc=la,Nc=la;let e=$i.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Sc=t.userLocale,xy=t.osLocale,Nc=t.resolvedLanguage||la,w2=t.languagePack?.translationsConfigFile}catch{}Zb=!0}else typeof navigator=="object"&&!x2?(nn=navigator.userAgent,zf=nn.indexOf("Windows")>=0,Hf=nn.indexOf("Macintosh")>=0,(nn.indexOf("Macintosh")>=0||nn.indexOf("iPad")>=0||nn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ac=nn.indexOf("Linux")>=0,nn?.indexOf("Mobi")>=0,Nc=globalThis._VSCODE_NLS_LANGUAGE||la,Sc=navigator.language.toLowerCase(),xy=Sc):console.error("Unable to resolve platform.");var Qb=zf,Ns=Hf,E2=Ac,Ey=Zb,Bs=nn,zn=Nc,T2;(e=>{function t(){return zn}e.value=t;function n(){return zn.length===2?zn==="en":zn.length>=3?zn[0]==="e"&&zn[1]==="n"&&zn[2]==="-":!1}e.isDefaultVariant=n;function a(){return zn==="en"}e.isDefault=a})(T2||={});var k2=typeof gr.postMessage=="function"&&!gr.importScripts;(()=>{if(k2){let e=[];gr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let a=0,o=e.length;a<o;a++){let c=e[a];if(c.id===n.data.vscodeScheduleAsyncWork){e.splice(a,1),c.callback();return}}});let t=0;return n=>{let a=++t;e.push({id:a,callback:n}),gr.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})();var D2=!!(Bs&&Bs.indexOf("Chrome")>=0);Bs&&Bs.indexOf("Firefox")>=0;!D2&&Bs&&Bs.indexOf("Safari")>=0;Bs&&Bs.indexOf("Edg/")>=0;Bs&&Bs.indexOf("Android")>=0;var sa=typeof navigator=="object"?navigator:{};Ey||document.queryCommandSupported&&document.queryCommandSupported("copy")||sa&&sa.clipboard&&sa.clipboard.writeText,Ey||sa&&sa.clipboard&&sa.clipboard.readText;var Wp=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Kd=new Wp,Ty=new Wp,ky=new Wp,R2=new Array(230),Jb;(e=>{function t(p){return Kd.keyCodeToStr(p)}e.toString=t;function n(p){return Kd.strToKeyCode(p)}e.fromString=n;function a(p){return Ty.keyCodeToStr(p)}e.toUserSettingsUS=a;function o(p){return ky.keyCodeToStr(p)}e.toUserSettingsGeneral=o;function c(p){return Ty.strToKeyCode(p)||ky.strToKeyCode(p)}e.fromUserSettings=c;function d(p){if(p>=98&&p<=113)return null;switch(p){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Kd.keyCodeToStr(p)}e.toElectronAccelerator=d})(Jb||={});var M2=class e0{constructor(t,n,a,o,c){this.ctrlKey=t,this.shiftKey=n,this.altKey=a,this.metaKey=o,this.keyCode=c}equals(t){return t instanceof e0&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",a=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${n}${a}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new A2([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},A2=class{constructor(e){if(e.length===0)throw i2("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function N2(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return Jb.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Of)switch(t){case 59:return 85;case 60:if(E2)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ns)return 57;break}else if(S2&&(Ns&&t===93||!Ns&&t===92))return 57;return R2[t]||0}var B2=Ns?256:2048,L2=512,O2=1024,z2=Ns?2048:256,Dy=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=N2(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=B2),this.altKey&&(t|=L2),this.shiftKey&&(t|=O2),this.metaKey&&(t|=z2),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new M2(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Ry=new WeakMap;function H2(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var j2=class{static getSameOriginWindowChain(e){let t=Ry.get(e);if(!t){t=[],Ry.set(e,t);let n=e,a;do a=H2(n),a?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=a;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,a=0,o=this.getSameOriginWindowChain(e);for(let c of o){let d=c.window.deref();if(n+=d?.scrollY??0,a+=d?.scrollX??0,d===t||!c.iframeElement)break;let p=c.iframeElement.getBoundingClientRect();n+=p.top,a+=p.left}return{top:n,left:a}}},bc=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=j2.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},My=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let a=!1;if(qp){let o=navigator.userAgent.match(/Chrome\/(\d+)/);a=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,d=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")a?this.deltaY=o.wheelDeltaY/(120*d):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Of&&!Ns?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")b2&&Qb?this.deltaX=-(o.wheelDeltaX/120):a?this.deltaX=o.wheelDeltaX/(120*d):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?Of&&!Ns?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(a?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},t0=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),U2;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof P2?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:vi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:t0})})(U2||={});var P2=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?t0:(this._emitter||(this._emitter=new he),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Yp=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Rf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Rf("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},K2=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Rf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=n.setInterval(()=>{e()},t);this.disposable=kt(()=>{n.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},I2;(e=>{async function t(a){let o,c=await Promise.all(a.map(d=>d.then(p=>p,p=>{o||(o=p)})));if(typeof o<"u")throw o;return c}e.settled=t;function n(a){return new Promise(async(o,c)=>{try{await a(o,c)}catch(d){c(d)}})}e.withAsyncBody=n})(I2||={});var Ay=class os{static fromArray(t){return new os(n=>{n.emitMany(t)})}static fromPromise(t){return new os(async n=>{n.emitMany(await t)})}static fromPromises(t){return new os(async n=>{await Promise.all(t.map(async a=>n.emitOne(await a)))})}static merge(t){return new os(async n=>{await Promise.all(t.map(async a=>{for await(let o of a)n.emitOne(o)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new he,queueMicrotask(async()=>{let a={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(a)),this.resolve()}catch(o){this.reject(o)}finally{a.emitOne=void 0,a.emitMany=void 0,a.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await vi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new os(async a=>{for await(let o of t)a.emitOne(n(o))})}map(t){return os.map(this,t)}static filter(t,n){return new os(async a=>{for await(let o of t)n(o)&&a.emitOne(o)})}filter(t){return os.filter(this,t)}static coalesce(t){return os.filter(t,n=>!!n)}coalesce(){return os.coalesce(this)}static async toPromise(t){let n=[];for await(let a of t)n.push(a);return n}toPromise(){return os.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Ay.EMPTY=Ay.fromArray([]);var{getWindow:As,getWindowId:F2,onDidRegisterWindow:q2}=(function(){let e=new Map,t={window:an,disposables:new Fn};e.set(an.vscodeWindowId,t);let n=new he,a=new he,o=new he;function c(d,p){return(typeof d=="number"?e.get(d):void 0)??(p?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:a.event,registerWindow(d){if(e.has(d.vscodeWindowId))return Ie.None;let p=new Fn,_={window:d,disposables:p.add(new Fn)};return e.set(d.vscodeWindowId,_),p.add(kt(()=>{e.delete(d.vscodeWindowId),a.fire(d)})),p.add(Be(d,ri.BEFORE_UNLOAD,()=>{o.fire(d)})),n.fire(_),p},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:c,getWindow(d){let p=d;if(p?.ownerDocument?.defaultView)return p.ownerDocument.defaultView.window;let _=d;return _?.view?_.view.window:an},getDocument(d){return As(d).document}}})(),W2=class{constructor(e,t,n,a){this._node=e,this._type=t,this._handler=n,this._options=a||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Be(e,t,n,a){return new W2(e,t,n,a)}var Ny=function(e,t,n,a){return Be(e,t,n,a)},Vp,Y2=class extends K2{constructor(e){super(),this.defaultTarget=e&&As(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},By=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Mc(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,a=new Map,o=c=>{n.set(c,!1);let d=e.get(c)??[];for(t.set(c,d),e.set(c,[]),a.set(c,!0);d.length>0;)d.sort(By.sort),d.shift().execute();a.set(c,!1)};Vp=(c,d,p=0)=>{let _=F2(c),f=new By(d,p),b=e.get(_);return b||(b=[],e.set(_,b)),b.push(f),n.get(_)||(n.set(_,!0),c.requestAnimationFrame(()=>o(_))),f}})();function V2(e){let t=e.getBoundingClientRect(),n=As(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var ri={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},$2=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Oi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Oi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Oi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Oi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Oi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Oi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Oi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Oi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Oi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Oi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Oi(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Oi(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Oi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Oi(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Oi(e){return typeof e=="number"?`${e}px`:e}function Ll(e){return new $2(e)}var i0=class{constructor(){this._hooks=new Fn,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,a,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=a,this._onStopCallback=o;let c=e;try{e.setPointerCapture(t),this._hooks.add(kt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=As(e)}this._hooks.add(Be(c,ri.POINTER_MOVE,d=>{if(d.buttons!==n){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(Be(c,ri.POINTER_UP,d=>this.stopMonitoring(!0)))}};function X2(e,t,n){let a=null,o=null;if(typeof n.value=="function"?(a="value",o=n.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(a="get",o=n.get),!o)throw new Error("not supported");let c=`$memoize$${t}`;n[a]=function(...d){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,d)}),this[c]}}var Ms;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ms||={});var Cl=class bi extends Ie{constructor(){super(),this.dispatched=!1,this.targets=new Cy,this.ignoreTargets=new Cy,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(vi.runAndSubscribe(q2,({window:t,disposables:n})=>{n.add(Be(t.document,"touchstart",a=>this.onTouchStart(a),{passive:!1})),n.add(Be(t.document,"touchend",a=>this.onTouchEnd(t,a))),n.add(Be(t.document,"touchmove",a=>this.onTouchMove(a),{passive:!1}))},{window:an,disposables:this._store}))}static addTarget(t){if(!bi.isTouchDevice())return Ie.None;bi.INSTANCE||(bi.INSTANCE=new bi);let n=bi.INSTANCE.targets.push(t);return kt(n)}static ignoreTarget(t){if(!bi.isTouchDevice())return Ie.None;bi.INSTANCE||(bi.INSTANCE=new bi);let n=bi.INSTANCE.ignoreTargets.push(t);return kt(n)}static isTouchDevice(){return"ontouchstart"in an||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let a=0,o=t.targetTouches.length;a<o;a++){let c=t.targetTouches.item(a);this.activeTouches[c.identifier]={id:c.identifier,initialTarget:c.target,initialTimeStamp:n,initialPageX:c.pageX,initialPageY:c.pageY,rollingTimestamps:[n],rollingPageX:[c.pageX],rollingPageY:[c.pageY]};let d=this.newGestureEvent(Ms.Start,c.target);d.pageX=c.pageX,d.pageY=c.pageY,this.dispatchEvent(d)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let a=Date.now(),o=Object.keys(this.activeTouches).length;for(let c=0,d=n.changedTouches.length;c<d;c++){let p=n.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(p.identifier))){console.warn("move of an UNKNOWN touch",p);continue}let _=this.activeTouches[p.identifier],f=Date.now()-_.initialTimeStamp;if(f<bi.HOLD_DELAY&&Math.abs(_.initialPageX-Yi(_.rollingPageX))<30&&Math.abs(_.initialPageY-Yi(_.rollingPageY))<30){let b=this.newGestureEvent(Ms.Tap,_.initialTarget);b.pageX=Yi(_.rollingPageX),b.pageY=Yi(_.rollingPageY),this.dispatchEvent(b)}else if(f>=bi.HOLD_DELAY&&Math.abs(_.initialPageX-Yi(_.rollingPageX))<30&&Math.abs(_.initialPageY-Yi(_.rollingPageY))<30){let b=this.newGestureEvent(Ms.Contextmenu,_.initialTarget);b.pageX=Yi(_.rollingPageX),b.pageY=Yi(_.rollingPageY),this.dispatchEvent(b)}else if(o===1){let b=Yi(_.rollingPageX),v=Yi(_.rollingPageY),w=Yi(_.rollingTimestamps)-_.rollingTimestamps[0],x=b-_.rollingPageX[0],C=v-_.rollingPageY[0],E=[...this.targets].filter(B=>_.initialTarget instanceof Node&&B.contains(_.initialTarget));this.inertia(t,E,a,Math.abs(x)/w,x>0?1:-1,b,Math.abs(C)/w,C>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent(Ms.End,_.initialTarget)),delete this.activeTouches[p.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let a=document.createEvent("CustomEvent");return a.initEvent(t,!1,!0),a.initialTarget=n,a.tapCount=0,a}dispatchEvent(t){if(t.type===Ms.Tap){let n=new Date().getTime(),a=0;n-this._lastSetTapCountTime>bi.CLEAR_TAP_COUNT_TIME?a=1:a=2,this._lastSetTapCountTime=n,t.tapCount=a}else(t.type===Ms.Change||t.type===Ms.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let a of this.ignoreTargets)if(a.contains(t.initialTarget))return;let n=[];for(let a of this.targets)if(a.contains(t.initialTarget)){let o=0,c=t.initialTarget;for(;c&&c!==a;)o++,c=c.parentElement;n.push([o,a])}n.sort((a,o)=>a[0]-o[0]);for(let[a,o]of n)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,a,o,c,d,p,_,f){this.handle=Vp(t,()=>{let b=Date.now(),v=b-a,w=0,x=0,C=!0;o+=bi.SCROLL_FRICTION*v,p+=bi.SCROLL_FRICTION*v,o>0&&(C=!1,w=c*o*v),p>0&&(C=!1,x=_*p*v);let E=this.newGestureEvent(Ms.Change);E.translationX=w,E.translationY=x,n.forEach(B=>B.dispatchEvent(E)),C||this.inertia(t,n,b,o,c,d+w,p,_,f+x)})}onTouchMove(t){let n=Date.now();for(let a=0,o=t.changedTouches.length;a<o;a++){let c=t.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("end of an UNKNOWN touch",c);continue}let d=this.activeTouches[c.identifier],p=this.newGestureEvent(Ms.Change,d.initialTarget);p.translationX=c.pageX-Yi(d.rollingPageX),p.translationY=c.pageY-Yi(d.rollingPageY),p.pageX=c.pageX,p.pageY=c.pageY,this.dispatchEvent(p),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(c.pageX),d.rollingPageY.push(c.pageY),d.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Cl.SCROLL_FRICTION=-.005,Cl.HOLD_DELAY=700,Cl.CLEAR_TAP_COUNT_TIME=400,Ht([X2],Cl,"isTouchDevice",1);var G2=Cl,$p=class extends Ie{onclick(e,t){this._register(Be(e,ri.CLICK,n=>t(new bc(As(e),n))))}onmousedown(e,t){this._register(Be(e,ri.MOUSE_DOWN,n=>t(new bc(As(e),n))))}onmouseover(e,t){this._register(Be(e,ri.MOUSE_OVER,n=>t(new bc(As(e),n))))}onmouseleave(e,t){this._register(Be(e,ri.MOUSE_LEAVE,n=>t(new bc(As(e),n))))}onkeydown(e,t){this._register(Be(e,ri.KEY_DOWN,n=>t(new Dy(n))))}onkeyup(e,t){this._register(Be(e,ri.KEY_UP,n=>t(new Dy(n))))}oninput(e,t){this._register(Be(e,ri.INPUT,t))}onblur(e,t){this._register(Be(e,ri.BLUR,t))}onfocus(e,t){this._register(Be(e,ri.FOCUS,t))}onchange(e,t){this._register(Be(e,ri.CHANGE,t))}ignoreGesture(e){return G2.ignoreTarget(e)}},Ly=11,Z2=class extends $p{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Ly+"px",this.domNode.style.height=Ly+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new i0),this._register(Ny(this.bgDomNode,ri.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Ny(this.domNode,ri.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Y2),this._pointerdownScheduleRepeatTimer=this._register(new Yp)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,As(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Q2=class jf{constructor(t,n,a,o,c,d,p){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,a=a|0,o=o|0,c=c|0,d=d|0,p=p|0),this.rawScrollLeft=o,this.rawScrollTop=p,n<0&&(n=0),o+n>a&&(o=a-n),o<0&&(o=0),c<0&&(c=0),p+c>d&&(p=d-c),p<0&&(p=0),this.width=n,this.scrollWidth=a,this.scrollLeft=o,this.height=c,this.scrollHeight=d,this.scrollTop=p}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new jf(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new jf(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let a=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,c=this.scrollLeft!==t.scrollLeft,d=this.height!==t.height,p=this.scrollHeight!==t.scrollHeight,_=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:a,scrollWidthChanged:o,scrollLeftChanged:c,heightChanged:d,scrollHeightChanged:p,scrollTopChanged:_}}},J2=class extends Ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Q2(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let a;t?a=new zy(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):a=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=a}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=zy.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Oy=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Id(e,t){let n=t-e;return function(a){return e+n*iT(a)}}function eT(e,t,n){return function(a){return a<n?e(a/n):t((a-n)/(1-n))}}var zy=class Uf{constructor(t,n,a,o){this.from=t,this.to=n,this.duration=o,this.startTime=a,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,a){if(Math.abs(t-n)>2.5*a){let o,c;return t<n?(o=t+.75*a,c=n-.75*a):(o=t-.75*a,c=n+.75*a),eT(Id(t,o),Id(c,n),.33)}return Id(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let a=this.scrollLeft(n),o=this.scrollTop(n);return new Oy(a,o,!1)}return new Oy(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,a){return Uf.start(t,n,a)}static start(t,n,a){a=a+10;let o=Date.now()-10;return new Uf(t,n,o,a)}};function tT(e){return Math.pow(e,3)}function iT(e){return 1-tT(1-e)}var sT=class extends Ie{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Yp)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},nT=140,s0=class extends $p{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new sT(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new i0),this._shouldRender=!0,this.domNode=Ll(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Be(this.domNode.domNode,ri.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Z2(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,a){this.slider=Ll(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof a=="number"&&this.slider.setHeight(a),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Be(this.slider.domNode,ri.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),a=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);n<=o&&o<=a?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let o=V2(this.domNode.domNode);t=e.pageX-o.left,n=e.pageY-o.top}let a=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(a):this._scrollbarState.getDesiredScrollPositionFromOffset(a)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),a=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let c=this._sliderOrthogonalPointerPosition(o),d=Math.abs(c-n);if(Qb&&d>nT){this._setDesiredScrollPositionNow(a.getScrollPosition());return}let p=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(a.getDesiredScrollPositionFromDelta(p))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},n0=class Pf{constructor(t,n,a,o,c,d){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(a),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=c,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Pf(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,a,o,c){let d=Math.max(0,a-t),p=Math.max(0,d-2*n),_=o>0&&o>a;if(!_)return{computedAvailableSize:Math.round(d),computedIsNeeded:_,computedSliderSize:Math.round(p),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(a*p/o))),b=(p-f)/(o-a),v=c*b;return{computedAvailableSize:Math.round(d),computedIsNeeded:_,computedSliderSize:Math.round(f),computedSliderRatio:b,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let t=Pf._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,a=this._scrollPosition;return n<this._computedSliderPosition?a-=this._visibleSize:a+=this._visibleSize,a}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},rT=class extends s0{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new n0(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,a.width,a.scrollWidth,o.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},aT=class extends s0{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new n0(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,a.height,a.scrollHeight,o.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},lT=500,Hy=50,oT=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Kf=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,a=1,o=this._rear;do{let c=o===this._front?t:Math.pow(2,-a);if(t-=c,n+=this._memory[o].score*c,o===this._front)break;o=(this._capacity+o-1)%this._capacity,a++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(qp){let n=As(t.browserEvent),a=y2(n);this.accept(Date.now(),t.deltaX*a,t.deltaY*a)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,a){let o=null,c=new oT(t,n,a);this._front===-1&&this._rear===-1?(this._memory[0]=c,this._front=0,this._rear=0):(o=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=c),c.score=this._computeScore(c,o)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let a=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(a+=.25),n){let o=Math.abs(t.deltaX),c=Math.abs(t.deltaY),d=Math.abs(n.deltaX),p=Math.abs(n.deltaY),_=Math.max(Math.min(o,d),1),f=Math.max(Math.min(c,p),1),b=Math.max(o,d),v=Math.max(c,p);b%_===0&&v%f===0&&(a-=.5)}return Math.min(Math.max(a,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Kf.INSTANCE=new Kf;var cT=Kf,uT=class extends $p{constructor(e,t,n){super(),this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new he),this.onWillScroll=this._onWillScroll.event,this._options=dT(t),this._scrollable=n,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let a={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new aT(this._scrollable,this._options,a)),this._horizontalScrollbar=this._register(new rT(this._scrollable,this._options,a)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ll(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ll(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ll(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new Yp),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Sr(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Ns&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new My(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Sr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new My(n))};this._mouseWheelToDispose.push(Be(this._listenOnDomNode,ri.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=cT.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let d=!Ns&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),_={};if(o){let f=Hy*o,b=p.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(_,b)}if(c){let f=Hy*c,b=p.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(_,b)}_=this._scrollable.validateScrollPosition(_),(p.scrollLeft!==_.scrollLeft||p.scrollTop!==_.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(_):this._scrollable.setScrollPositionNow(_),n=!0)}let a=n;!a&&this._options.alwaysConsumeMouseWheel&&(a=!0),!a&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(a=!0),a&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,a=n?" left":"",o=t?" top":"",c=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${a}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${c}${o}${a}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),lT)}},hT=class extends uT{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function dT(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Ns&&(t.className+=" mac"),t}var If=class extends Ie{constructor(e,t,n,a,o,c,d,p){super(),this._bufferService=n,this._optionsService=d,this._renderService=p,this._onRequestScrollLines=this._register(new he),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let _=this._register(new J2({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>Vp(a.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{_.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new hT(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},_)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(vi.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(kt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=a.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(kt(()=>this._styleElement.remove())),this._register(vi.runAndSubscribe(c.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${c.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${c.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${c.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
22
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};If=Ht([me(2,ki),me(3,on),me(4,jb),me(5,ga),me(6,Di),me(7,cn)],If);var Ff=class extends Ie{constructor(e,t,n,a,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=a,this._renderService=o,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(c=>this._removeDecoration(c))),this._register(kt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Ff=Ht([me(1,ki),me(2,on),me(3,Jl),me(4,cn)],Ff);var fT=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ds={full:0,left:0,center:0,right:0},Hn={full:0,left:0,center:0,right:0},fl={full:0,left:0,center:0,right:0},qc=class extends Ie{constructor(e,t,n,a,o,c,d,p){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=a,this._renderService=o,this._optionsService=c,this._themeService=d,this._coreBrowserService=p,this._colorZoneStore=new fT,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(kt(()=>this._canvas?.remove()));let _=this._canvas.getContext("2d");if(_)this._ctx=_;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Hn.full=this._canvas.width,Hn.left=e,Hn.center=t,Hn.right=e,this._refreshDrawHeightConstants(),fl.full=1,fl.left=1,fl.center=1+Hn.left,fl.right=1+Hn.left+Hn.center}_refreshDrawHeightConstants(){Ds.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Ds.left=t,Ds.center=t,Ds.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ds.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ds.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ds.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ds.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(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(fl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ds[e.position||"full"]/2),Hn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ds[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};qc=Ht([me(2,ki),me(3,Jl),me(4,cn),me(5,Di),me(6,ga),me(7,on)],qc);var ie;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
23
- `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ie||={});var Bc;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(Bc||={});var r0;(e=>e.ST=`${ie.ESC}\\`)(r0||={});var qf=class{constructor(e,t,n,a,o,c){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=a,this._coreService=o,this._renderService=c,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ie.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,a=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=a+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let c=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=a+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};qf=Ht([me(2,ki),me(3,Di),me(4,wr),me(5,cn)],qf);var li=0,oi=0,ci=0,zt=0,jy={css:"#00000000",rgba:0},Yt;(e=>{function t(o,c,d,p){return p!==void 0?`#${dr(o)}${dr(c)}${dr(d)}${dr(p)}`:`#${dr(o)}${dr(c)}${dr(d)}`}e.toCss=t;function n(o,c,d,p=255){return(o<<24|c<<16|d<<8|p)>>>0}e.toRgba=n;function a(o,c,d,p){return{css:e.toCss(o,c,d,p),rgba:e.toRgba(o,c,d,p)}}e.toColor=a})(Yt||={});var Et;(e=>{function t(_,f){if(zt=(f.rgba&255)/255,zt===1)return{css:f.css,rgba:f.rgba};let b=f.rgba>>24&255,v=f.rgba>>16&255,w=f.rgba>>8&255,x=_.rgba>>24&255,C=_.rgba>>16&255,E=_.rgba>>8&255;li=x+Math.round((b-x)*zt),oi=C+Math.round((v-C)*zt),ci=E+Math.round((w-E)*zt);let B=Yt.toCss(li,oi,ci),D=Yt.toRgba(li,oi,ci);return{css:B,rgba:D}}e.blend=t;function n(_){return(_.rgba&255)===255}e.isOpaque=n;function a(_,f,b){let v=Lc.ensureContrastRatio(_.rgba,f.rgba,b);if(v)return Yt.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=a;function o(_){let f=(_.rgba|255)>>>0;return[li,oi,ci]=Lc.toChannels(f),{css:Yt.toCss(li,oi,ci),rgba:f}}e.opaque=o;function c(_,f){return zt=Math.round(f*255),[li,oi,ci]=Lc.toChannels(_.rgba),{css:Yt.toCss(li,oi,ci,zt),rgba:Yt.toRgba(li,oi,ci,zt)}}e.opacity=c;function d(_,f){return zt=_.rgba&255,c(_,zt*f/255)}e.multiplyOpacity=d;function p(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=p})(Et||={});var At;(e=>{let t,n;try{let o=document.createElement("canvas");o.width=1,o.height=1;let c=o.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function a(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return li=parseInt(o.slice(1,2).repeat(2),16),oi=parseInt(o.slice(2,3).repeat(2),16),ci=parseInt(o.slice(3,4).repeat(2),16),Yt.toColor(li,oi,ci);case 5:return li=parseInt(o.slice(1,2).repeat(2),16),oi=parseInt(o.slice(2,3).repeat(2),16),ci=parseInt(o.slice(3,4).repeat(2),16),zt=parseInt(o.slice(4,5).repeat(2),16),Yt.toColor(li,oi,ci,zt);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let c=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return li=parseInt(c[1]),oi=parseInt(c[2]),ci=parseInt(c[3]),zt=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Yt.toColor(li,oi,ci,zt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[li,oi,ci,zt]=t.getImageData(0,0,1,1).data,zt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Yt.toRgba(li,oi,ci,zt),css:o}}e.toColor=a})(At||={});var Ti;(e=>{function t(a){return n(a>>16&255,a>>8&255,a&255)}e.relativeLuminance=t;function n(a,o,c){let d=a/255,p=o/255,_=c/255,f=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),b=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),v=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return f*.2126+b*.7152+v*.0722}e.relativeLuminance2=n})(Ti||={});var Lc;(e=>{function t(d,p){if(zt=(p&255)/255,zt===1)return p;let _=p>>24&255,f=p>>16&255,b=p>>8&255,v=d>>24&255,w=d>>16&255,x=d>>8&255;return li=v+Math.round((_-v)*zt),oi=w+Math.round((f-w)*zt),ci=x+Math.round((b-x)*zt),Yt.toRgba(li,oi,ci)}e.blend=t;function n(d,p,_){let f=Ti.relativeLuminance(d>>8),b=Ti.relativeLuminance(p>>8);if(sn(f,b)<_){if(b<f){let x=a(d,p,_),C=sn(f,Ti.relativeLuminance(x>>8));if(C<_){let E=o(d,p,_),B=sn(f,Ti.relativeLuminance(E>>8));return C>B?x:E}return x}let v=o(d,p,_),w=sn(f,Ti.relativeLuminance(v>>8));if(w<_){let x=a(d,p,_),C=sn(f,Ti.relativeLuminance(x>>8));return w>C?v:x}return v}}e.ensureContrastRatio=n;function a(d,p,_){let f=d>>24&255,b=d>>16&255,v=d>>8&255,w=p>>24&255,x=p>>16&255,C=p>>8&255,E=sn(Ti.relativeLuminance2(w,x,C),Ti.relativeLuminance2(f,b,v));for(;E<_&&(w>0||x>0||C>0);)w-=Math.max(0,Math.ceil(w*.1)),x-=Math.max(0,Math.ceil(x*.1)),C-=Math.max(0,Math.ceil(C*.1)),E=sn(Ti.relativeLuminance2(w,x,C),Ti.relativeLuminance2(f,b,v));return(w<<24|x<<16|C<<8|255)>>>0}e.reduceLuminance=a;function o(d,p,_){let f=d>>24&255,b=d>>16&255,v=d>>8&255,w=p>>24&255,x=p>>16&255,C=p>>8&255,E=sn(Ti.relativeLuminance2(w,x,C),Ti.relativeLuminance2(f,b,v));for(;E<_&&(w<255||x<255||C<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),E=sn(Ti.relativeLuminance2(w,x,C),Ti.relativeLuminance2(f,b,v));return(w<<24|x<<16|C<<8|255)>>>0}e.increaseLuminance=o;function c(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=c})(Lc||={});function dr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function sn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var pT=class extends Ql{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Wc=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new hs}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],a=t.translateToString(!0),o=0,c=0,d=0,p=t.getFg(0),_=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==_){if(f-o>1){let b=this._getJoinedRanges(a,d,c,t,o);for(let v=0;v<b.length;v++)n.push(b[v])}o=f,d=c,p=this._workCell.fg,_=this._workCell.bg}c+=this._workCell.getChars().length||In.length}if(this._bufferService.cols-o>1){let f=this._getJoinedRanges(a,d,c,t,o);for(let b=0;b<f.length;b++)n.push(f[b])}return n}_getJoinedRanges(e,t,n,a,o){let c=e.substring(t,n),d=[];try{d=this._characterJoiners[0].handler(c)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{let _=this._characterJoiners[p].handler(c);for(let f=0;f<_.length;f++)Wc._mergeRanges(d,_[f])}catch(_){console.error(_)}return this._stringRangesToCellRanges(d,a,o),d}_stringRangesToCellRanges(e,t,n){let a=0,o=!1,c=0,d=e[a];if(d){for(let p=n;p<this._bufferService.cols;p++){let _=t.getWidth(p),f=t.getString(p).length||In.length;if(_!==0){if(!o&&d[0]<=c&&(d[0]=p,o=!0),d[1]<=c){if(d[1]=p,d=e[++a],!d)break;d[0]<=c?(d[0]=p,o=!0):o=!1}c+=f}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let a=0;a<e.length;a++){let o=e[a];if(n){if(t[1]<=o[0])return e[a-1][1]=t[1],e;if(t[1]<=o[1])return e[a-1][1]=Math.max(t[1],o[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(t[1]<=o[0])return e.splice(a,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Wc=Ht([me(0,ki)],Wc);function _T(e){return 57508<=e&&e<=57558}function mT(e){return 9472<=e&&e<=9631}function gT(e){return _T(e)||mT(e)}function vT(){return{css:{canvas:wc(),cell:wc()},device:{canvas:wc(),cell:wc(),char:{width:0,height:0,left:0,top:0}}}}function wc(){return{width:0,height:0}}var Wf=class{constructor(e,t,n,a,o,c,d){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=a,this._coreService=o,this._decorationService=c,this._themeService=d,this._workCell=new hs,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,a,o,c,d,p,_,f,b){let v=[],w=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,C=e.getNoBgTrimmedLength();n&&C<c+1&&(C=c+1);let E,B=0,D="",Z=0,A=0,P=0,z=0,K=!1,N=0,ae=!1,de=0,Te=0,ce=[],Q=f!==-1&&b!==-1;for(let X=0;X<C;X++){e.loadCell(X,this._workCell);let se=this._workCell.getWidth();if(se===0)continue;let le=!1,R=X>=Te,q=X,$=this._workCell;if(w.length>0&&X===w[0][0]&&R){let Re=w.shift(),te=this._isCellInSelection(Re[0],t);for(Z=Re[0]+1;Z<Re[1];Z++)R&&=te===this._isCellInSelection(Z,t);R&&=!n||c<Re[0]||c>=Re[1],R?(le=!0,$=new pT(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),q=Re[1]-1,se=$.getWidth()):Te=Re[1]}let ue=this._isCellInSelection(X,t),be=n&&X===c,T=Q&&X>=f&&X<=b,W=!1;this._decorationService.forEachDecorationAtCell(X,t,void 0,Re=>{W=!0});let oe=$.getChars()||In;if(oe===" "&&($.isUnderline()||$.isOverline())&&(oe=" "),de=se*p-_.get(oe,$.isBold(),$.isItalic()),!E)E=this._document.createElement("span");else if(B&&(ue&&ae||!ue&&!ae&&$.bg===A)&&(ue&&ae&&x.selectionForeground||$.fg===P)&&$.extended.ext===z&&T===K&&de===N&&!be&&!le&&!W&&R){$.isInvisible()?D+=In:D+=oe,B++;continue}else B&&(E.textContent=D),E=this._document.createElement("span"),B=0,D="";if(A=$.bg,P=$.fg,z=$.extended.ext,K=T,N=de,ae=ue,le&&c>=X&&c<=q&&(c=X),!this._coreService.isCursorHidden&&be&&this._coreService.isCursorInitialized){if(ce.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&ce.push("xterm-cursor-blink"),ce.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":ce.push("xterm-cursor-outline");break;case"block":ce.push("xterm-cursor-block");break;case"bar":ce.push("xterm-cursor-bar");break;case"underline":ce.push("xterm-cursor-underline");break}}if($.isBold()&&ce.push("xterm-bold"),$.isItalic()&&ce.push("xterm-italic"),$.isDim()&&ce.push("xterm-dim"),$.isInvisible()?D=In:D=$.getChars()||In,$.isUnderline()&&(ce.push(`xterm-underline-${$.extended.underlineStyle}`),D===" "&&(D=" "),!$.isUnderlineColorDefault()))if($.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${Ql.toColorRGB($.getUnderlineColor()).join(",")})`;else{let Re=$.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$.isBold()&&Re<8&&(Re+=8),E.style.textDecorationColor=x.ansi[Re].css}$.isOverline()&&(ce.push("xterm-overline"),D===" "&&(D=" ")),$.isStrikethrough()&&ce.push("xterm-strikethrough"),T&&(E.style.textDecoration="underline");let ne=$.getFgColor(),_e=$.getFgColorMode(),fe=$.getBgColor(),xe=$.getBgColorMode(),qe=!!$.isInverse();if(qe){let Re=ne;ne=fe,fe=Re;let te=_e;_e=xe,xe=te}let Me,Ae,Ze=!1;this._decorationService.forEachDecorationAtCell(X,t,void 0,Re=>{Re.options.layer!=="top"&&Ze||(Re.backgroundColorRGB&&(xe=50331648,fe=Re.backgroundColorRGB.rgba>>8&16777215,Me=Re.backgroundColorRGB),Re.foregroundColorRGB&&(_e=50331648,ne=Re.foregroundColorRGB.rgba>>8&16777215,Ae=Re.foregroundColorRGB),Ze=Re.options.layer==="top")}),!Ze&&ue&&(Me=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,fe=Me.rgba>>8&16777215,xe=50331648,Ze=!0,x.selectionForeground&&(_e=50331648,ne=x.selectionForeground.rgba>>8&16777215,Ae=x.selectionForeground)),Ze&&ce.push("xterm-decoration-top");let nt;switch(xe){case 16777216:case 33554432:nt=x.ansi[fe],ce.push(`xterm-bg-${fe}`);break;case 50331648:nt=Yt.toColor(fe>>16,fe>>8&255,fe&255),this._addStyle(E,`background-color:#${Uy((fe>>>0).toString(16),"0",6)}`);break;default:qe?(nt=x.foreground,ce.push("xterm-bg-257")):nt=x.background}switch(Me||$.isDim()&&(Me=Et.multiplyOpacity(nt,.5)),_e){case 16777216:case 33554432:$.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(E,nt,x.ansi[ne],$,Me,void 0)||ce.push(`xterm-fg-${ne}`);break;case 50331648:let Re=Yt.toColor(ne>>16&255,ne>>8&255,ne&255);this._applyMinimumContrast(E,nt,Re,$,Me,Ae)||this._addStyle(E,`color:#${Uy(ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,nt,x.foreground,$,Me,Ae)||qe&&ce.push("xterm-fg-257")}ce.length&&(E.className=ce.join(" "),ce.length=0),!be&&!le&&!W&&R?B++:E.textContent=D,de!==this.defaultSpacing&&(E.style.letterSpacing=`${de}px`),v.push(E),X=q}return E&&B&&(E.textContent=D),v}_applyMinimumContrast(e,t,n,a,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||gT(a.getCode()))return!1;let d=this._getContrastCache(a),p;if(!o&&!c&&(p=d.getColor(t.rgba,n.rgba)),p===void 0){let _=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);p=Et.ensureContrastRatio(o||t,c||n,_),d.setColor((o||t).rgba,(c||n).rgba,p??null)}return p?(this._addStyle(e,`color:${p.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,a=this._selectionEnd;return!n||!a?!1:this._columnSelectMode?n[0]<=a[0]?e>=n[0]&&t>=n[1]&&e<a[0]&&t<=a[1]:e<n[0]&&t>=n[1]&&e>=a[0]&&t<=a[1]:t>n[1]&&t<a[1]||n[1]===a[1]&&t===n[1]&&e>=n[0]&&e<a[0]||n[1]<a[1]&&t===a[1]&&e<a[0]||n[1]<a[1]&&t===n[1]&&e>=n[0]}};Wf=Ht([me(1,Kb),me(2,Di),me(3,on),me(4,wr),me(5,Jl),me(6,ga)],Wf);function Uy(e,t,n){for(;e.length<n;)e=t+e;return e}var yT=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let c=e.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[n,a,o,c],this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(o),this._container.appendChild(c),t.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(e,t,n,a){e===this._font&&t===this._fontSize&&n===this._weight&&a===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(e,t,n){let a=0;if(!t&&!n&&e.length===1&&(a=e.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];let d=this._measure(e,0);return d>0&&(this._flat[a]=d),d}let o=e;t&&(o+="B"),n&&(o+="I");let c=this._holey.get(o);if(c===void 0){let d=0;t&&(d|=1),n&&(d|=2),c=this._measure(e,d),c>0&&this._holey.set(o,c)}return c}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},ST=class{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(e,t,n,a=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let o=e.buffers.active.ydisp,c=t[1]-o,d=n[1]-o,p=Math.max(c,0),_=Math.min(d,e.rows-1);if(p>=e.rows||_<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=p,this.viewportCappedEndRow=_,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function bT(){return new ST}var Fd="xterm-dom-renderer-owner-",ls="xterm-rows",Cc="xterm-fg-",Py="xterm-bg-",pl="xterm-focus",xc="xterm-selection",wT=1,Yf=class extends Ie{constructor(e,t,n,a,o,c,d,p,_,f,b,v,w,x){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=a,this._viewportElement=o,this._helperContainer=c,this._linkifier2=d,this._charSizeService=_,this._optionsService=f,this._bufferService=b,this._coreService=v,this._coreBrowserService=w,this._themeService=x,this._terminalClass=wT++,this._rowElements=[],this._selectionRenderModel=bT(),this.onRequestRedraw=this._register(new he).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ls),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(xc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=vT(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(C=>this._injectCss(C))),this._injectCss(this._themeService.colors),this._rowFactory=p.createInstance(Wf,document),this._element.classList.add(Fd+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(C=>this._handleLinkHover(C))),this._register(this._linkifier2.onHideLinkUnderline(C=>this._handleLinkLeave(C))),this._register(kt(()=>{this._element.classList.remove(Fd+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new yT(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ls} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${ls} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${ls} .xterm-dim { color: ${Et.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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;}`;let n=`blink_underline_${this._terminalClass}`,a=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${a} { 50% { box-shadow: none; }}`,t+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ls}.${pl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ls}.${pl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${ls}.${pl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${ls} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ls} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ls} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ls} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ls} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${xc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${xc} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${xc} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,d]of e.ansi.entries())t+=`${this._terminalSelector} .${Cc}${c} { color: ${d.css}; }${this._terminalSelector} .${Cc}${c}.xterm-dim { color: ${Et.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${Py}${c} { background-color: ${d.css}; }`;t+=`${this._terminalSelector} .${Cc}257 { color: ${Et.opaque(e.background).css}; }${this._terminalSelector} .${Cc}257.xterm-dim { color: ${Et.multiplyOpacity(Et.opaque(e.background),.5).css}; }${this._terminalSelector} .${Py}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let a=this._document.createElement("div");this._rowContainer.appendChild(a),this._rowElements.push(a)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(pl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(pl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let a=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,c=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,p=this._document.createDocumentFragment();if(n){let _=e[0]>t[0];p.appendChild(this._createSelectionElement(c,_?t[0]:e[0],_?e[0]:t[0],d-c+1))}else{let _=a===c?e[0]:0,f=c===o?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(c,_,f));let b=d-c-1;if(p.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,b)),c!==d){let v=o===d?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(d,0,v))}}this._selectionContainer.appendChild(p)}_createSelectionElement(e,t,n,a=1){let o=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-t);return c+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-c),o.style.height=`${a*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${c}px`,o.style.width=`${d}px`,o}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,a=n.ybase+n.y,o=Math.min(n.x,this._bufferService.cols-1),c=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=e;_<=t;_++){let f=_+n.ydisp,b=this._rowElements[_],v=n.lines.get(f);if(!b||!v)break;b.replaceChildren(...this._rowFactory.createRow(v,f,f===a,d,p,o,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Fd}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,a,o,c){n<0&&(e=0),a<0&&(t=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),a=Math.max(Math.min(a,d),0),o=Math.min(o,this._bufferService.cols);let p=this._bufferService.buffer,_=p.ybase+p.y,f=Math.min(p.x,o-1),b=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=n;x<=a;++x){let C=x+p.ydisp,E=this._rowElements[x],B=p.lines.get(C);if(!E||!B)break;E.replaceChildren(...this._rowFactory.createRow(B,C,C===_,v,w,f,b,this.dimensions.css.cell.width,this._widthCache,c?x===n?e:0:-1,c?(x===a?t:o)-1:-1))}}};Yf=Ht([me(7,Kp),me(8,ou),me(9,Di),me(10,ki),me(11,wr),me(12,on),me(13,ga)],Yf);var Vf=class extends Ie{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new he),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new xT(this._optionsService))}catch{this._measureStrategy=this._register(new CT(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Vf=Ht([me(2,Di)],Vf);var a0=class extends Ie{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},CT=class extends a0{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},xT=class extends a0{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},ET=class extends Ie{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new TT(this._window)),this._onDprChange=this._register(new he),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new he),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(vi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Be(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Be(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},TT=class extends Ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new fa),this._onDprChange=this._register(new he),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(kt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Be(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},kT=class extends Ie{constructor(){super(),this.linkProviders=[],this._register(kt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Xp(e,t,n){let a=n.getBoundingClientRect(),o=e.getComputedStyle(n),c=parseInt(o.getPropertyValue("padding-left")),d=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-a.left-c,t.clientY-a.top-d]}function DT(e,t,n,a,o,c,d,p,_){if(!c)return;let f=Xp(e,t,n);if(f)return f[0]=Math.ceil((f[0]+(_?d/2:0))/d),f[1]=Math.ceil(f[1]/p),f[0]=Math.min(Math.max(f[0],1),a+(_?1:0)),f[1]=Math.min(Math.max(f[1],1),o),f}var $f=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,a,o){return DT(window,e,t,n,a,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let n=Xp(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};$f=Ht([me(0,cn),me(1,ou)],$f);var RT=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},l0={};UE(l0,{getSafariVersion:()=>AT,isChromeOS:()=>h0,isFirefox:()=>o0,isIpad:()=>NT,isIphone:()=>BT,isLegacyEdge:()=>MT,isLinux:()=>Gp,isMac:()=>Yc,isNode:()=>cu,isSafari:()=>c0,isWindows:()=>u0});var cu=typeof process<"u"&&"title"in process,eo=cu?"node":navigator.userAgent,to=cu?"node":navigator.platform,o0=eo.includes("Firefox"),MT=eo.includes("Edge"),c0=/^((?!chrome|android).)*safari/i.test(eo);function AT(){if(!c0)return 0;let e=eo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Yc=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(to),NT=to==="iPad",BT=to==="iPhone",u0=["Windows","Win16","Win32","WinCE"].includes(to),Gp=to.indexOf("Linux")>=0,h0=/\bCrOS\b/.test(eo),d0=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,a=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),o=e.timeRemaining(),n*1.5>o){a-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-t))}ms`),this._start();return}a=o}this.clear()}},LT=class extends d0{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},OT=class extends d0{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Vc=!cu&&"requestIdleCallback"in window?OT:LT,zT=class{constructor(){this._queue=new Vc}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Xf=class extends Ie{constructor(e,t,n,a,o,c,d,p,_){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=a,this._coreService=o,this._coreBrowserService=p,this._renderer=this._register(new fa),this._pausedResizeTask=new zT,this._observerDisposable=this._register(new fa),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 he),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new he),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new he),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new he),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new RT((f,b)=>this._renderRows(f,b),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new HT(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(kt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(c.onDecorationRegistered(()=>this._fullRefresh())),this._register(c.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(_.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(a=>this._handleIntersectionChange(a[a.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=kt(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.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(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let a=this._syncOutputHandler.flush();a&&(e=Math.min(e,a.start),t=Math.max(t,a.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Xf=Ht([me(2,Di),me(3,ou),me(4,wr),me(5,Jl),me(6,ki),me(7,on),me(8,ga)],Xf);var HT=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function jT(e,t,n,a){let o=n.buffer.x,c=n.buffer.y;if(!n.buffer.hasScrollback)return KT(o,c,e,t,n,a)+uu(c,t,n,a)+IT(o,c,e,t,n,a);let d;if(c===t)return d=o>e?"D":"C",Pl(Math.abs(o-e),Ul(d,a));d=c>t?"D":"C";let p=Math.abs(c-t),_=PT(c>t?e:o,n)+(p-1)*n.cols+1+UT(c>t?o:e);return Pl(_,Ul(d,a))}function UT(e,t){return e-1}function PT(e,t){return t.cols-e}function KT(e,t,n,a,o,c){return uu(t,a,o,c).length===0?"":Pl(p0(e,t,e,t-br(t,o),!1,o).length,Ul("D",c))}function uu(e,t,n,a){let o=e-br(e,n),c=t-br(t,n),d=Math.abs(o-c)-FT(e,t,n);return Pl(d,Ul(f0(e,t),a))}function IT(e,t,n,a,o,c){let d;uu(t,a,o,c).length>0?d=a-br(a,o):d=t;let p=a,_=qT(e,t,n,a,o,c);return Pl(p0(e,d,n,p,_==="C",o).length,Ul(_,c))}function FT(e,t,n){let a=0,o=e-br(e,n),c=t-br(t,n);for(let d=0;d<Math.abs(o-c);d++){let p=f0(e,t)==="A"?-1:1;n.buffer.lines.get(o+p*d)?.isWrapped&&a++}return a}function br(e,t){let n=0,a=t.buffer.lines.get(e),o=a?.isWrapped;for(;o&&e>=0&&e<t.rows;)n++,a=t.buffer.lines.get(--e),o=a?.isWrapped;return n}function qT(e,t,n,a,o,c){let d;return uu(n,a,o,c).length>0?d=a-br(a,o):d=t,e<n&&d<=a||e>=n&&d<a?"C":"D"}function f0(e,t){return e>t?"A":"B"}function p0(e,t,n,a,o,c){let d=e,p=t,_="";for(;(d!==n||p!==a)&&p>=0&&p<c.buffer.lines.length;)d+=o?1:-1,o&&d>c.cols-1?(_+=c.buffer.translateBufferLineToString(p,!1,e,d),d=0,e=0,p++):!o&&d<0&&(_+=c.buffer.translateBufferLineToString(p,!1,0,e+1),d=c.cols-1,e=d,p--);return _+c.buffer.translateBufferLineToString(p,!1,e,d)}function Ul(e,t){let n=t?"O":"[";return ie.ESC+n+e}function Pl(e,t){e=Math.floor(e);let n="";for(let a=0;a<e;a++)n+=t;return n}var WT=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Ky(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var qd=50,YT=15,VT=50,$T=500,XT=" ",GT=new RegExp(XT,"g"),Gf=class extends Ie{constructor(e,t,n,a,o,c,d,p,_){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=a,this._coreService=o,this._mouseService=c,this._optionsService=d,this._renderService=p,this._coreBrowserService=_,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new hs,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new he),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new he),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new he),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new he),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new WT(this._bufferService),this._activeSelectionMode=0,this._register(kt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,a=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],c=e[0]<t[0]?t[0]:e[0];for(let d=e[1];d<=t[1];d++){let p=n.translateBufferLineToString(d,!0,o,c);a.push(p)}}else{let o=e[1]===t[1]?t[0]:void 0;a.push(n.translateBufferLineToString(e[1],!0,e[0],o));for(let c=e[1]+1;c<=t[1]-1;c++){let d=n.lines.get(c),p=n.translateBufferLineToString(c,!0);d?.isWrapped?a[a.length-1]+=p:a.push(p)}if(e[1]!==t[1]){let c=n.lines.get(t[1]),d=n.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?a[a.length-1]+=d:a.push(d)}}return a.map(o=>o.replace(GT," ")).join(u0?`\r
24
- `:`
25
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Gp&&e&&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(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!n||!a||!t?!1:this._areCoordsInSelection(t,n,a)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!n||!a?!1:this._areCoordsInSelection([e,t],n,a)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Ky(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let a=this._getMouseBufferCoords(e);return a?(this._selectWordAt(a,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Xp(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-qd),qd),t/=qd,t/Math.abs(t)+Math.round(t*(YT-1)))}shouldForceSelection(e){return Yc?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),VT)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Yc&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let a=n.lines.get(this._model.selectionEnd[1]);a&&a.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<$T&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let a=jT(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(a,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let a=0;t>=a;a++){let o=e.loadCell(a,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:o>1&&t!==a&&(n+=o-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,a=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,c=o.lines.get(e[1]);if(!c)return;let d=o.translateBufferLineToString(e[1],!1),p=this._convertViewportColToCharacterIndex(c,e[0]),_=p,f=e[0]-p,b=0,v=0,w=0,x=0;if(d.charAt(p)===" "){for(;p>0&&d.charAt(p-1)===" ";)p--;for(;_<d.length&&d.charAt(_+1)===" ";)_++}else{let B=e[0],D=e[0];c.getWidth(B)===0&&(b++,B--),c.getWidth(D)===2&&(v++,D++);let Z=c.getString(D).length;for(Z>1&&(x+=Z-1,_+=Z-1);B>0&&p>0&&!this._isCharWordSeparator(c.loadCell(B-1,this._workCell));){c.loadCell(B-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(b++,B--):A>1&&(w+=A-1,p-=A-1),p--,B--}for(;D<c.length&&_+1<d.length&&!this._isCharWordSeparator(c.loadCell(D+1,this._workCell));){c.loadCell(D+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,D++):A>1&&(x+=A-1,_+=A-1),_++,D++}}_++;let C=p+f-b+w,E=Math.min(this._bufferService.cols,_-p+b+v-w-x);if(!(!t&&d.slice(p,_).trim()==="")){if(n&&C===0&&c.getCodePoint(0)!==32){let B=o.lines.get(e[1]-1);if(B&&c.isWrapped&&B.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let Z=this._bufferService.cols-D.start;C-=Z,E+=Z}}}if(a&&C+E===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let B=o.lines.get(e[1]+1);if(B?.isWrapped&&B.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(E+=D.length)}}return{start:C,length:E}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Ky(n,this._bufferService.cols)}};Gf=Ht([me(3,ki),me(4,wr),me(5,Ip),me(6,Di),me(7,cn),me(8,on)],Gf);var Iy=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Fy=class{constructor(){this._color=new Iy,this._css=new Iy}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Gt=Object.freeze((()=>{let e=[At.toColor("#2e3436"),At.toColor("#cc0000"),At.toColor("#4e9a06"),At.toColor("#c4a000"),At.toColor("#3465a4"),At.toColor("#75507b"),At.toColor("#06989a"),At.toColor("#d3d7cf"),At.toColor("#555753"),At.toColor("#ef2929"),At.toColor("#8ae234"),At.toColor("#fce94f"),At.toColor("#729fcf"),At.toColor("#ad7fa8"),At.toColor("#34e2e2"),At.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let a=t[n/36%6|0],o=t[n/6%6|0],c=t[n%6];e.push({css:Yt.toCss(a,o,c),rgba:Yt.toRgba(a,o,c)})}for(let n=0;n<24;n++){let a=8+n*10;e.push({css:Yt.toCss(a,a,a),rgba:Yt.toRgba(a,a,a)})}return e})()),fr=At.toColor("#ffffff"),xl=At.toColor("#000000"),qy=At.toColor("#ffffff"),Wy=xl,_l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},ZT=fr,Zf=class extends Ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new Fy,this._halfContrastCache=new Fy,this._onChangeColors=this._register(new he),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:fr,background:xl,cursor:qy,cursorAccent:Wy,selectionForeground:void 0,selectionBackgroundTransparent:_l,selectionBackgroundOpaque:Et.blend(xl,_l),selectionInactiveBackgroundTransparent:_l,selectionInactiveBackgroundOpaque:Et.blend(xl,_l),scrollbarSliderBackground:Et.opacity(fr,.2),scrollbarSliderHoverBackground:Et.opacity(fr,.4),scrollbarSliderActiveBackground:Et.opacity(fr,.5),overviewRulerBorder:fr,ansi:Gt.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=gt(e.foreground,fr),t.background=gt(e.background,xl),t.cursor=Et.blend(t.background,gt(e.cursor,qy)),t.cursorAccent=Et.blend(t.background,gt(e.cursorAccent,Wy)),t.selectionBackgroundTransparent=gt(e.selectionBackground,_l),t.selectionBackgroundOpaque=Et.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=gt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Et.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?gt(e.selectionForeground,jy):void 0,t.selectionForeground===jy&&(t.selectionForeground=void 0),Et.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Et.opacity(t.selectionBackgroundTransparent,.3)),Et.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Et.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=gt(e.scrollbarSliderBackground,Et.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=gt(e.scrollbarSliderHoverBackground,Et.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=gt(e.scrollbarSliderActiveBackground,Et.opacity(t.foreground,.5)),t.overviewRulerBorder=gt(e.overviewRulerBorder,ZT),t.ansi=Gt.slice(),t.ansi[0]=gt(e.black,Gt[0]),t.ansi[1]=gt(e.red,Gt[1]),t.ansi[2]=gt(e.green,Gt[2]),t.ansi[3]=gt(e.yellow,Gt[3]),t.ansi[4]=gt(e.blue,Gt[4]),t.ansi[5]=gt(e.magenta,Gt[5]),t.ansi[6]=gt(e.cyan,Gt[6]),t.ansi[7]=gt(e.white,Gt[7]),t.ansi[8]=gt(e.brightBlack,Gt[8]),t.ansi[9]=gt(e.brightRed,Gt[9]),t.ansi[10]=gt(e.brightGreen,Gt[10]),t.ansi[11]=gt(e.brightYellow,Gt[11]),t.ansi[12]=gt(e.brightBlue,Gt[12]),t.ansi[13]=gt(e.brightMagenta,Gt[13]),t.ansi[14]=gt(e.brightCyan,Gt[14]),t.ansi[15]=gt(e.brightWhite,Gt[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let a=0;a<n;a++)t.ansi[a+16]=gt(e.extendedAnsi[a],Gt[a+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};Zf=Ht([me(0,Di)],Zf);function gt(e,t){if(e!==void 0)try{return At.toColor(e)}catch{}return t}var QT=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},JT=class{constructor(){this._services=new QT,this._services.set(Kp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=YE(e).sort((c,d)=>c.index-d.index),a=[];for(let c of n){let d=this._services.get(c.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);a.push(d)}let o=n.length>0?n[0].index:t.length;if(t.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);return new e(...t,...a)}},ek={trace:0,debug:1,info:2,warn:3,error:4,off:5},tk="xterm.js: ",Qf=class extends Ie{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=ek[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":tk)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Qf=Ht([me(0,Di)],Qf);var Yy=class extends Ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new he),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new he),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new he),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let a=e;a<this._length-t;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let a=this._length-1;a>=e;a--)this._array[this._getCyclicIndex(a+n.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<n.length;a++)this._array[this._getCyclicIndex(e+a)]=n[a];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let a=this._length+n.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let o=t-1;o>=0;o--)this.set(e+o+n,this.get(e+o));let a=e+t+n-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<t;a++)this.set(e+a+n,this.get(e+a))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ke=3,Wt=Object.freeze(new Ql),Ec=0,Wd=2,El=class _0{constructor(t,n,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ke);let o=n||hs.fromCharData([0,Lb,1,0]);for(let c=0;c<t;++c)this.setCell(c,o);this.length=t}get(t){let n=this._data[t*Ke+0],a=n&2097151;return[this._data[t*Ke+1],n&2097152?this._combined[t]:a?Kn(a):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):a]}set(t,n){this._data[t*Ke+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ke+0]=t|2097152|n[2]<<22):this._data[t*Ke+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ke+0]>>22}hasWidth(t){return this._data[t*Ke+0]&12582912}getFg(t){return this._data[t*Ke+1]}getBg(t){return this._data[t*Ke+2]}hasContent(t){return this._data[t*Ke+0]&4194303}getCodePoint(t){let n=this._data[t*Ke+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ke+0]&2097152}getString(t){let n=this._data[t*Ke+0];return n&2097152?this._combined[t]:n&2097151?Kn(n&2097151):""}isProtected(t){return this._data[t*Ke+2]&536870912}loadCell(t,n){return Ec=t*Ke,n.content=this._data[Ec+0],n.fg=this._data[Ec+1],n.bg=this._data[Ec+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Ke+0]=n.content,this._data[t*Ke+1]=n.fg,this._data[t*Ke+2]=n.bg}setCellFromCodepoint(t,n,a,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Ke+0]=n|a<<22,this._data[t*Ke+1]=o.fg,this._data[t*Ke+2]=o.bg}addCodepointToCell(t,n,a){let o=this._data[t*Ke+0];o&2097152?this._combined[t]+=Kn(n):o&2097151?(this._combined[t]=Kn(o&2097151)+Kn(n),o&=-2097152,o|=2097152):o=n|1<<22,a&&(o&=-12582913,o|=a<<22),this._data[t*Ke+0]=o}insertCells(t,n,a){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),n<this.length-t){let o=new hs;for(let c=this.length-t-n-1;c>=0;--c)this.setCell(t+n+c,this.loadCell(t+c,o));for(let c=0;c<n;++c)this.setCell(t+c,a)}else for(let o=t;o<this.length;++o)this.setCell(o,a);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,a)}deleteCells(t,n,a){if(t%=this.length,n<this.length-t){let o=new hs;for(let c=0;c<this.length-t-n;++c)this.setCell(t+c,this.loadCell(t+n+c,o));for(let c=this.length-n;c<this.length;++c)this.setCell(c,a)}else for(let o=t;o<this.length;++o)this.setCell(o,a);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,a)}replaceCells(t,n,a,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,a),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,a);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,a),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,a);t<n&&t<this.length;)this.setCell(t++,a)}resize(t,n){if(t===this.length)return this._data.length*4*Wd<this._data.buffer.byteLength;let a=t*Ke;if(t>this.length){if(this._data.buffer.byteLength>=a*4)this._data=new Uint32Array(this._data.buffer,0,a);else{let o=new Uint32Array(a);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,n)}else{this._data=this._data.subarray(0,a);let o=Object.keys(this._combined);for(let d=0;d<o.length;d++){let p=parseInt(o[d],10);p>=t&&delete this._combined[p]}let c=Object.keys(this._extendedAttrs);for(let d=0;d<c.length;d++){let p=parseInt(c[d],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,a*4*Wd<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Wd<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let a=0;a<this.length;++a)this.isProtected(a)||this.setCell(a,t);return}this._combined={},this._extendedAttrs={};for(let a=0;a<this.length;++a)this.setCell(a,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new _0(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ke+0]&4194303)return t+(this._data[t*Ke+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ke+0]&4194303||this._data[t*Ke+2]&50331648)return t+(this._data[t*Ke+0]>>22);return 0}copyCellsFrom(t,n,a,o,c){let d=t._data;if(c)for(let _=o-1;_>=0;_--){for(let f=0;f<Ke;f++)this._data[(a+_)*Ke+f]=d[(n+_)*Ke+f];d[(n+_)*Ke+2]&268435456&&(this._extendedAttrs[a+_]=t._extendedAttrs[n+_])}else for(let _=0;_<o;_++){for(let f=0;f<Ke;f++)this._data[(a+_)*Ke+f]=d[(n+_)*Ke+f];d[(n+_)*Ke+2]&268435456&&(this._extendedAttrs[a+_]=t._extendedAttrs[n+_])}let p=Object.keys(t._combined);for(let _=0;_<p.length;_++){let f=parseInt(p[_],10);f>=n&&(this._combined[f-n+a]=t._combined[f])}}translateToString(t,n,a,o){n=n??0,a=a??this.length,t&&(a=Math.min(a,this.getTrimmedLength())),o&&(o.length=0);let c="";for(;n<a;){let d=this._data[n*Ke+0],p=d&2097151,_=d&2097152?this._combined[n]:p?Kn(p):In;if(c+=_,o)for(let f=0;f<_.length;++f)o.push(n);n+=d>>22||1}return o&&o.push(n),c}};function ik(e,t,n,a,o,c){let d=[];for(let p=0;p<e.length-1;p++){let _=p,f=e.get(++_);if(!f.isWrapped)continue;let b=[e.get(p)];for(;_<e.length&&f.isWrapped;)b.push(f),f=e.get(++_);if(!c&&a>=p&&a<_){p+=b.length-1;continue}let v=0,w=Kl(b,v,t),x=1,C=0;for(;x<b.length;){let B=Kl(b,x,t),D=B-C,Z=n-w,A=Math.min(D,Z);b[v].copyCellsFrom(b[x],C,w,A,!1),w+=A,w===n&&(v++,w=0),C+=A,C===B&&(x++,C=0),w===0&&v!==0&&b[v-1].getWidth(n-1)===2&&(b[v].copyCellsFrom(b[v-1],n-1,w++,1,!1),b[v-1].setCell(n-1,o))}b[v].replaceCells(w,n,o);let E=0;for(let B=b.length-1;B>0&&(B>v||b[B].getTrimmedLength()===0);B--)E++;E>0&&(d.push(p+b.length-E),d.push(E)),p+=b.length-1}return d}function sk(e,t){let n=[],a=0,o=t[a],c=0;for(let d=0;d<e.length;d++)if(o===d){let p=t[++a];e.onDeleteEmitter.fire({index:d-c,amount:p}),d+=p-1,c+=p,o=t[++a]}else n.push(d);return{layout:n,countRemoved:c}}function nk(e,t){let n=[];for(let a=0;a<t.length;a++)n.push(e.get(t[a]));for(let a=0;a<n.length;a++)e.set(a,n[a]);e.length=t.length}function rk(e,t,n){let a=[],o=e.map((_,f)=>Kl(e,f,t)).reduce((_,f)=>_+f),c=0,d=0,p=0;for(;p<o;){if(o-p<n){a.push(o-p);break}c+=n;let _=Kl(e,d,t);c>_&&(c-=_,d++);let f=e[d].getWidth(c-1)===2;f&&c--;let b=f?n-1:n;a.push(b),p+=b}return a}function Kl(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let a=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,o=e[t+1].getWidth(0)===2;return a&&o?n-1:n}var m0=class g0{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=g0._nextId++,this._onDispose=this.register(new he),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Sr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};m0._nextId=1;var ak=m0,ei={},pr=ei.B;ei[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ei.A={"#":"£"};ei.B=void 0;ei[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ei.C=ei[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ei.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ei.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ei.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ei.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ei.E=ei[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ei.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ei.H=ei[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ei["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Vy=4294967295,$y=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Wt.clone(),this.savedCharset=pr,this.markers=[],this._nullCell=hs.fromCharData([0,Lb,1,0]),this._whitespaceCell=hs.fromCharData([0,In,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Vc,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Yy(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Fc),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Fc),this._whitespaceCell}getBlankLine(e,t){return new El(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Vy?Vy:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Wt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Yy(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Wt),a=0,o=this._getCorrectBufferLength(t);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)a+=+this.lines.get(d).resize(e,n);let c=0;if(this._rows<t)for(let d=this._rows;d<t;d++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new El(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+c+1?(this.ybase--,c++,this.ydisp>0&&this.ydisp--):this.lines.push(new El(e,n)));else for(let d=this._rows;d>t;d--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let d=this.lines.length-o;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),c&&(this.y+=c),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let c=0;c<this.lines.length;c++)a+=+this.lines.get(c).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),a>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,a=ik(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Wt),n);if(a.length>0){let o=sk(this.lines,a);nk(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let a=this.getNullCell(Wt),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new El(e,a))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,a=this.getNullCell(Wt),o=[],c=0;for(let d=this.lines.length-1;d>=0;d--){let p=this.lines.get(d);if(!p||!p.isWrapped&&p.getTrimmedLength()<=e)continue;let _=[p];for(;p.isWrapped&&d>0;)p=this.lines.get(--d),_.unshift(p);if(!n){let A=this.ybase+this.y;if(A>=d&&A<d+_.length)continue}let f=_[_.length-1].getTrimmedLength(),b=rk(_,this._cols,e),v=b.length-_.length,w;this.ybase===0&&this.y!==this.lines.length-1?w=Math.max(0,this.y-this.lines.maxLength+v):w=Math.max(0,this.lines.length-this.lines.maxLength+v);let x=[];for(let A=0;A<v;A++){let P=this.getBlankLine(Wt,!0);x.push(P)}x.length>0&&(o.push({start:d+_.length+c,newLines:x}),c+=x.length),_.push(...x);let C=b.length-1,E=b[C];E===0&&(C--,E=b[C]);let B=_.length-v-1,D=f;for(;B>=0;){let A=Math.min(D,E);if(_[C]===void 0)break;if(_[C].copyCellsFrom(_[B],D-A,E-A,A,!0),E-=A,E===0&&(C--,E=b[C]),D-=A,D===0){B--;let P=Math.max(B,0);D=Kl(_,P,this._cols)}}for(let A=0;A<_.length;A++)b[A]<e&&_[A].setCell(b[A],a);let Z=v-w;for(;Z-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+c)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+v,this.ybase+t-1)}if(o.length>0){let d=[],p=[];for(let E=0;E<this.lines.length;E++)p.push(this.lines.get(E));let _=this.lines.length,f=_-1,b=0,v=o[b];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let w=0;for(let E=Math.min(this.lines.maxLength-1,_+c-1);E>=0;E--)if(v&&v.start>f+w){for(let B=v.newLines.length-1;B>=0;B--)this.lines.set(E--,v.newLines[B]);E++,d.push({index:f+1,amount:v.newLines.length}),w+=v.newLines.length,v=o[++b]}else this.lines.set(E,p[f--]);let x=0;for(let E=d.length-1;E>=0;E--)d[E].index+=x,this.lines.onInsertEmitter.fire(d[E]),x+=d[E].amount;let C=Math.max(0,_+c-this.lines.maxLength);C>0&&this.lines.onTrimEmitter.fire(C)}}translateBufferLineToString(e,t,n=0,a){let o=this.lines.get(e);return o?o.translateToString(t,n,a):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new ak(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},lk=class extends Ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new he),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 $y(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new $y(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},v0=2,y0=1,Jf=class extends Ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new he),this.onResize=this._onResize.event,this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,v0),this.rows=Math.max(e.rawOptions.rows||0,y0),this.buffers=this._register(new lk(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,a=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:a})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,a;a=this._cachedBlankLine,(!a||a.length!==this.cols||a.getFg(0)!==e.fg||a.getBg(0)!==e.bg)&&(a=n.getBlankLine(e,t),this._cachedBlankLine=a),a.isWrapped=t;let o=n.ybase+n.scrollTop,c=n.ybase+n.scrollBottom;if(n.scrollTop===0){let d=n.lines.isFull;c===n.lines.length-1?d?n.lines.recycle().copyFrom(a):n.lines.push(a.clone()):n.lines.splice(c+1,0,a.clone()),d?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let d=c-o+1;n.lines.shiftElements(o+1,d-1,-1),n.lines.set(c,a.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let a=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),a!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Jf=Ht([me(0,Di)],Jf);var na={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Yc,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},ok=["normal","bold","100","200","300","400","500","600","700","800","900"],ck=class extends Ie{constructor(e){super(),this._onOptionChange=this._register(new he),this.onOptionChange=this._onOptionChange.event;let t={...na};for(let n in e)if(n in t)try{let a=e[n];t[n]=this._sanitizeAndValidateOption(n,a)}catch(a){console.error(a)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(kt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in na))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,a)=>{if(!(n in na))throw new Error(`No option with key "${n}"`);a=this._sanitizeAndValidateOption(n,a),this.rawOptions[n]!==a&&(this.rawOptions[n]=a,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let a={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,a)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=na[e]),!uk(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=na[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=ok.includes(t)?t:na[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function uk(e){return e==="block"||e==="underline"||e==="bar"}function Tl(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let a in e)n[a]=t<=1?e[a]:e[a]&&Tl(e[a],t-1);return n}var Xy=Object.freeze({insertMode:!1}),Gy=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ep=class extends Ie{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new he),this.onData=this._onData.event,this._onUserInput=this._register(new he),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new he),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new he),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Tl(Xy),this.decPrivateModes=Tl(Gy)}reset(){this.modes=Tl(Xy),this.decPrivateModes=Tl(Gy)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(a=>a.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};ep=Ht([me(0,ki),me(1,Ub),me(2,Di)],ep);var Zy={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Yd(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Vd=String.fromCharCode,Qy={DEFAULT:e=>{let t=[Yd(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Vd(t[0])}${Vd(t[1])}${Vd(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Yd(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Yd(e,!0)};${e.x};${e.y}${t}`}},tp=class extends Ie{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new he),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(Zy))this.addProtocol(a,Zy[a]);for(let a of Object.keys(Qy))this.addEncoding(a,Qy[a]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let a=t/n,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=a+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};tp=Ht([me(0,ki),me(1,wr),me(2,Di)],tp);var $d=[[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]],hk=[[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]],Zt;function dk(e,t){let n=0,a=t.length-1,o;if(e<t[0][0]||e>t[a][1])return!1;for(;a>=n;)if(o=n+a>>1,e>t[o][1])n=o+1;else if(e<t[o][0])a=o-1;else return!0;return!1}var fk=class{constructor(){if(this.version="6",!Zt){Zt=new Uint8Array(65536),Zt.fill(1),Zt[0]=0,Zt.fill(0,1,32),Zt.fill(0,127,160),Zt.fill(2,4352,4448),Zt[9001]=2,Zt[9002]=2,Zt.fill(2,11904,42192),Zt[12351]=1,Zt.fill(2,44032,55204),Zt.fill(2,63744,64256),Zt.fill(2,65040,65050),Zt.fill(2,65072,65136),Zt.fill(2,65280,65377),Zt.fill(2,65504,65511);for(let e=0;e<$d.length;++e)Zt.fill(0,$d[e][0],$d[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Zt[e]:dk(e,hk)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),a=n===0&&t!==0;if(a){let o=_r.extractWidth(t);o===0?a=!1:o>n&&(n=o)}return _r.createPropertyValue(0,n,a)}},_r=class Oc{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new he,this.onChange=this._onChange.event;let t=new fk;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,a=!1){return(t&16777215)<<3|(n&3)<<1|(a?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,a=0,o=t.length;for(let c=0;c<o;++c){let d=t.charCodeAt(c);if(55296<=d&&d<=56319){if(++c>=o)return n+this.wcwidth(d);let f=t.charCodeAt(c);56320<=f&&f<=57343?d=(d-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let p=this.charProperties(d,a),_=Oc.extractWidth(p);Oc.extractShouldJoin(p)&&(_-=Oc.extractWidth(a)),n+=_,a=p}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},pk=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Jy(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var ml=2147483647,_k=256,S0=class ip{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>_k)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new ip;if(!t.length)return n;for(let a=Array.isArray(t[0])?1:0;a<t.length;++a){let o=t[a];if(Array.isArray(o))for(let c=0;c<o.length;++c)n.addSubParam(o[c]);else n.addParam(o)}return n}clone(){let t=new ip(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let a=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-a>0&&t.push(Array.prototype.slice.call(this._subParams,a,o))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>ml?ml:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>ml?ml:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,a=this._subParamsIdx[t]&255;return a-n>0?this._subParams.subarray(n,a):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let a=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-a>0&&(t[n]=this._subParams.slice(a,o))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let a=this._digitIsSub?this._subParams:this.params,o=a[n-1];a[n-1]=~o?Math.min(o*10+t,ml):t}},gl=[],mk=class{constructor(){this._state=0,this._active=gl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=gl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=gl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||gl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",lu(e,t,n));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let a=e[t++];if(a===59){this._state=2,this._start();break}if(a<48||57<a){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+a-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,a=this._active.length-1,o=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,n=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;a>=0&&(n=this._active[a].end(e),n!==!0);a--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,n;a--}for(;a>=0;a--)if(n=this._active[a].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,n}this._active=gl,this._id=-1,this._state=0}}},Vi=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=lu(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},vl=[],gk=class{constructor(){this._handlers=Object.create(null),this._active=vl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=vl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=vl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||vl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",lu(e,t,n));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,a=this._active.length-1,o=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,n=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;a>=0&&(n=this._active[a].unhook(e),n!==!0);a--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,n;a--}for(;a>=0;a--)if(n=this._active[a].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,n}this._active=vl,this._ident=0}},kl=new S0;kl.addParam(0);var eS=class{constructor(e){this._handler=e,this._data="",this._params=kl,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():kl,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=lu(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=kl,this._data="",this._hitLimit=!1,n));return this._params=kl,this._data="",this._hitLimit=!1,t}},vk=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,a){this.table[t<<8|e]=n<<4|a}addMany(e,t,n,a){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=n<<4|a}},us=160,yk=(function(){let e=new vk(4095),t=Array.apply(null,Array(256)).map((p,_)=>_),n=(p,_)=>t.slice(p,_),a=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let c=n(0,14),d;e.setDefault(1,0),e.addMany(a,0,2,0);for(d in c)e.addMany([24,26,153,154],d,3,0),e.addMany(n(128,144),d,3,0),e.addMany(n(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(a,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(a,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(a,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(us,0,2,0),e.add(us,8,5,8),e.add(us,6,0,6),e.add(us,11,0,11),e.add(us,13,13,13),e})(),Sk=class extends Ie{constructor(e=yk){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new S0,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,a)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(kt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new mk),this._dcsParser=this._register(new gk),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let c=e.intermediates.charCodeAt(o);if(32>c||c>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=c}}if(e.final.length!==1)throw new Error("final must be a single byte");let a=e.final.charCodeAt(0);if(t[0]>a||a>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=a,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let a=this._escHandlers[n];return a.push(t),{dispose:()=>{let o=a.indexOf(t);o!==-1&&a.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let a=this._csiHandlers[n];return a.push(t),{dispose:()=>{let o=a.indexOf(t);o!==-1&&a.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,n,a,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=a,this._parseStack.chunkPos=o}parse(e,t,n){let a=0,o=0,c=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,c=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let p=this._parseStack.handlers,_=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&_>-1){for(;_>=0&&(d=p[_](this._params),d!==!0);_--)if(d instanceof Promise)return this._parseStack.handlerPos=_,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&_>-1){for(;_>=0&&(d=p[_](),d!==!0);_--)if(d instanceof Promise)return this._parseStack.handlerPos=_,d}this._parseStack.handlers=[];break;case 6:if(a=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(a!==24&&a!==26,n),d)return d;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(a=e[this._parseStack.chunkPos],d=this._oscParser.end(a!==24&&a!==26,n),d)return d;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,c=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let p=c;p<t;++p){switch(a=e[p],o=this._transitions.table[this.currentState<<8|(a<160?a:us)],o>>4){case 2:for(let w=p+1;;++w){if(w>=t||(a=e[w])<32||a>126&&a<us){this._printHandler(e,p,w),p=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<us){this._printHandler(e,p,w),p=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<us){this._printHandler(e,p,w),p=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<us){this._printHandler(e,p,w),p=w-1;break}}break;case 3:this._executeHandlers[a]?this._executeHandlers[a]():this._executeHandlerFb(a),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:p,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let _=this._csiHandlers[this._collect<<8|a],f=_?_.length-1:-1;for(;f>=0&&(d=_[f](this._params),d!==!0);f--)if(d instanceof Promise)return this._preserveStack(3,_,f,o,p),d;f<0&&this._csiHandlerFb(this._collect<<8|a,this._params),this.precedingJoinState=0;break;case 8:do switch(a){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(a-48)}while(++p<t&&(a=e[p])>47&&a<60);p--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let b=this._escHandlers[this._collect<<8|a],v=b?b.length-1:-1;for(;v>=0&&(d=b[v](),d!==!0);v--)if(d instanceof Promise)return this._preserveStack(4,b,v,o,p),d;v<0&&this._escHandlerFb(this._collect<<8|a),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|a,this._params);break;case 13:for(let w=p+1;;++w)if(w>=t||(a=e[w])===24||a===26||a===27||a>127&&a<us){this._dcsParser.put(e,p,w),p=w-1;break}break;case 14:if(d=this._dcsParser.unhook(a!==24&&a!==26),d)return this._preserveStack(6,[],0,o,p),d;a===27&&(o|=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 w=p+1;;w++)if(w>=t||(a=e[w])<32||a>127&&a<us){this._oscParser.put(e,p,w),p=w-1;break}break;case 6:if(d=this._oscParser.end(a!==24&&a!==26),d)return this._preserveStack(5,[],0,o,p),d;a===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},bk=/^([\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})$/,wk=/^[\da-f]+$/;function tS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=bk.exec(t);if(n){let a=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/a*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/a*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/a*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),wk.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,a=[0,0,0];for(let o=0;o<3;++o){let c=parseInt(t.slice(n*o,n*o+n),16);a[o]=n===1?c<<4:n===2?c:n===3?c>>4:c>>8}return a}}function Xd(e,t){let n=e.toString(16),a=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return a;case 12:return(a+a).slice(0,3);default:return a+a}}function Ck(e,t=16){let[n,a,o]=e;return`rgb:${Xd(n,t)}/${Xd(a,t)}/${Xd(o,t)}`}var xk={"(":0,")":1,"*":2,"+":3,"-":1,".":2},jn=131072,iS=10;function sS(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var nS=5e3,rS=0,Ek=class extends Ie{constructor(e,t,n,a,o,c,d,p,_=new Sk){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=a,this._optionsService=o,this._oscLinkService=c,this._coreMouseService=d,this._unicodeService=p,this._parser=_,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new qE,this._utf8Decoder=new WE,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Wt.clone(),this._eraseAttrDataInternal=Wt.clone(),this._onRequestBell=this._register(new he),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new he),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new he),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new he),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new he),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new he),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new he),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new he),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new he),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new he),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new he),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new he),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 sp(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,b)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:b.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,b,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:b,data:v})}),this._parser.setDcsHandlerFallback((f,b,v)=>{b==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:b,payload:v})}),this._parser.setPrintHandler((f,b,v)=>this.print(f,b,v)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(ie.BEL,()=>this.bell()),this._parser.setExecuteHandler(ie.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ie.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ie.BS,()=>this.backspace()),this._parser.setExecuteHandler(ie.HT,()=>this.tab()),this._parser.setExecuteHandler(ie.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ie.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Bc.IND,()=>this.index()),this._parser.setExecuteHandler(Bc.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Bc.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Vi(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new Vi(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new Vi(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new Vi(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new Vi(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new Vi(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new Vi(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new Vi(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new Vi(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new Vi(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new Vi(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new Vi(f=>this.restoreCursorColor(f))),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(let f in ei)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new eS((f,b)=>this.requestStatusString(f,b)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,a){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=a}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),nS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${nS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,a=this._activeBuffer.x,o=this._activeBuffer.y,c=0,d=this._parseStack.paused;if(d){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;a=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>jn&&(c=this._parseStack.position+jn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<jn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,jn))),d||this._dirtyRowTracker.clearRange(),e.length>jn)for(let f=c;f<e.length;f+=jn){let b=f+jn<e.length?f+jn:e.length,v=typeof e=="string"?this._stringDecoder.decode(e.substring(f,b),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,b),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,v))return this._preserveStack(a,o,v,f),this._logSlowResolvingAsync(n),n}else if(!d){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(a,o,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==a||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let p=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),_=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);_<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(_,this._bufferService.rows-1),end:Math.min(p,this._bufferService.rows-1)})}print(e,t,n){let a,o,c=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,p=this._bufferService.cols,_=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,b=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,b);let w=this._parser.precedingJoinState;for(let x=t;x<n;++x){if(a=e[x],a<127&&c){let D=c[String.fromCharCode(a)];D&&(a=D.charCodeAt(0))}let C=this._unicodeService.charProperties(a,w);o=_r.extractWidth(C);let E=_r.extractShouldJoin(C),B=E?_r.extractWidth(w):0;if(w=C,d&&this._onA11yChar.fire(Kn(a)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-B>p){if(_){let D=v,Z=this._activeBuffer.x-B;for(this._activeBuffer.x=B,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),v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),B>0&&v instanceof El&&v.copyCellsFrom(D,Z,0,B,!1);Z<p;)D.setCellFromCodepoint(Z++,0,1,b)}else if(this._activeBuffer.x=p-1,o===2)continue}if(E&&this._activeBuffer.x){let D=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-D,a,o);for(let Z=o-B;--Z>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,b);continue}if(f&&(v.insertCells(this._activeBuffer.x,o-B,this._activeBuffer.getNullCell(b)),v.getWidth(p-1)===2&&v.setCellFromCodepoint(p-1,0,1,b)),v.setCellFromCodepoint(this._activeBuffer.x++,a,o,b),o>0)for(;--o;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,b)}this._parser.precedingJoinState=w,this._activeBuffer.x<p&&n-t>0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,b),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>sS(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new eS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Vi(t))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,a=!1,o=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);c.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),o),a&&(c.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,a=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-a+1;for(;t--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,a;for(a=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-a;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(a,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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(e){let t=e.params[0]||1;for(;t--;)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(Wt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,a=_r.extractWidth(t),o=this._activeBuffer.x-a,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),d=new Uint32Array(c.length*n),p=0;for(let f=0;f<c.length;){let b=c.codePointAt(f)||0;d[p++]=b,f+=b>65535?2:1}let _=p;for(let f=1;f<n;++f)d.copyWithin(_,0,p),_+=p;return this.print(d,0,_),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ie.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ie.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ie.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ie.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ie.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,pr),this._charsetService.setgCharset(1,pr),this._charsetService.setgCharset(2,pr),this._charsetService.setgCharset(3,pr);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(E=>(E[E.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",E[E.SET=1]="SET",E[E.RESET=2]="RESET",E[E.PERMANENTLY_SET=3]="PERMANENTLY_SET",E[E.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let a=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:c}=this._coreMouseService,d=this._coreService,{buffers:p,cols:_}=this._bufferService,{active:f,alt:b}=p,v=this._optionsService.rawOptions,w=(E,B)=>(d.triggerDataEvent(`${ie.ESC}[${t?"":"?"}${E};${B}$y`),!0),x=E=>E?1:2,C=e.params[0];return t?C===2?w(C,4):C===4?w(C,x(d.modes.insertMode)):C===12?w(C,3):C===20?w(C,x(v.convertEol)):w(C,0):C===1?w(C,x(a.applicationCursorKeys)):C===3?w(C,v.windowOptions.setWinLines?_===80?2:_===132?1:0:0):C===6?w(C,x(a.origin)):C===7?w(C,x(a.wraparound)):C===8?w(C,3):C===9?w(C,x(o==="X10")):C===12?w(C,x(v.cursorBlink)):C===25?w(C,x(!d.isCursorHidden)):C===45?w(C,x(a.reverseWraparound)):C===66?w(C,x(a.applicationKeypad)):C===67?w(C,4):C===1e3?w(C,x(o==="VT200")):C===1002?w(C,x(o==="DRAG")):C===1003?w(C,x(o==="ANY")):C===1004?w(C,x(a.sendFocus)):C===1005?w(C,4):C===1006?w(C,x(c==="SGR")):C===1015?w(C,4):C===1016?w(C,x(c==="SGR_PIXELS")):C===1048?w(C,1):C===47||C===1047||C===1049?w(C,x(f===b)):C===2004?w(C,x(a.bracketedPasteMode)):C===2026?w(C,x(a.synchronizedOutput)):w(C,0)}_updateAttrColor(e,t,n,a,o){return t===2?(e|=50331648,e&=-16777216,e|=Ql.fromColorRGB([n,a,o])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let a=[0,0,-1,0,0,0],o=0,c=0;do{if(a[c+o]=e.params[t+c],e.hasSubParams(t+c)){let d=e.getSubParams(t+c),p=0;do a[1]===5&&(o=1),a[c+p+1+o]=d[p];while(++p<d.length&&p+c+1+o<a.length);break}if(a[1]===5&&c+o>=2||a[1]===2&&c+o>=5)break;a[1]&&(o=1)}while(++c+t<e.length&&c+o<a.length);for(let d=2;d<a.length;++d)a[d]===-1&&(a[d]=0);switch(a[0]){case 38:n.fg=this._updateAttrColor(n.fg,a[1],a[3],a[4],a[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,a[1],a[3],a[4],a[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,a[1],a[3],a[4],a[5])}return c}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Wt.fg,e.bg=Wt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,a=this._curAttrData;for(let o=0;o<t;o++)n=e.params[o],n>=30&&n<=37?(a.fg&=-50331904,a.fg|=16777216|n-30):n>=40&&n<=47?(a.bg&=-50331904,a.bg|=16777216|n-40):n>=90&&n<=97?(a.fg&=-50331904,a.fg|=16777216|n-90|8):n>=100&&n<=107?(a.bg&=-50331904,a.bg|=16777216|n-100|8):n===0?this._processSGR0(a):n===1?a.fg|=134217728:n===3?a.bg|=67108864:n===4?(a.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,a)):n===5?a.fg|=536870912:n===7?a.fg|=67108864:n===8?a.fg|=1073741824:n===9?a.fg|=2147483648:n===2?a.bg|=134217728:n===21?this._processUnderline(2,a):n===22?(a.fg&=-134217729,a.bg&=-134217729):n===23?a.bg&=-67108865:n===24?(a.fg&=-268435457,this._processUnderline(0,a)):n===25?a.fg&=-536870913:n===27?a.fg&=-67108865:n===28?a.fg&=-1073741825:n===29?a.fg&=2147483647:n===39?(a.fg&=-67108864,a.fg|=Wt.fg&16777215):n===49?(a.bg&=-67108864,a.bg|=Wt.bg&16777215):n===38||n===48||n===58?o+=this._extractColor(e,o,a):n===53?a.bg|=1073741824:n===55?a.bg&=-1073741825:n===59?(a.extended=a.extended.clone(),a.extended.underlineColor=-1,a.updateExtended()):n===100?(a.fg&=-67108864,a.fg|=Wt.fg&16777215,a.bg&=-67108864,a.bg|=Wt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ie.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ie.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Wt.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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!sS(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${ie.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>iS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>iS&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let a=n.shift(),o=n.shift();if(/^\d+$/.exec(a)){let c=parseInt(a);if(aS(c))if(o==="?")t.push({type:0,index:c});else{let d=tS(o);d&&t.push({type:1,index:c,color:d})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),a=e.slice(t+1);return a?this._createHyperlink(n,a):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),a,o=n.findIndex(c=>c.startsWith("id="));return o!==-1&&(a=n[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:a,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let a=0;a<n.length&&!(t>=this._specialColors.length);++a,++t)if(n[a]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=tS(n[a]);o&&this._onColor.fire([{type:1,index:this._specialColors[t],color:o}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let a=0;a<n.length;++a)if(/^\d+$/.exec(n[a])){let o=parseInt(n[a]);aS(o)&&t.push({type:2,index:o})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,pr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(xk[e[0]],ei[e[1]]||pr),!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){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=Wt.clone(),this._eraseAttrDataInternal=Wt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new hs;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,a=this._activeBuffer.lines.get(n);a&&(a.fill(e),a.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=d=>(this._coreService.triggerDataEvent(`${ie.ESC}${d}${ie.ESC}\\`),!0),a=this._bufferService.buffer,o=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${a.scrollTop+1};${a.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},sp=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(rS=e,e=t,t=rS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};sp=Ht([me(0,ki)],sp);function aS(e){return 0<=e&&e<256}var Tk=5e7,lS=12,kk=50,Dk=class extends Ie{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new he),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Tk)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let a=this._writeBuffer[this._bufferOffset],o=this._action(a,t);if(o){let d=p=>performance.now()-n>=lS?setTimeout(()=>this._innerWrite(0,p)):this._innerWrite(n,p);o.catch(p=>(queueMicrotask(()=>{throw p}),Promise.resolve(!1))).then(d);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=a.length,performance.now()-n>=lS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>kk&&(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()}},np=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let p=t.addMarker(t.ybase+t.y),_={data:e,id:this._nextId++,lines:[p]};return p.onDispose(()=>this._removeMarkerFromLink(_,p)),this._dataByLinkId.set(_.id,_),_.id}let n=e,a=this._getEntryIdKey(n),o=this._entriesWithId.get(a);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let c=t.addMarker(t.ybase+t.y),d={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(d,c)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(a=>a.line!==t)){let a=this._bufferService.buffer.addMarker(t);n.lines.push(a),a.onDispose(()=>this._removeMarkerFromLink(n,a))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};np=Ht([me(0,ki)],np);var oS=!1,Rk=class extends Ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new fa),this._onBinary=this._register(new he),this.onBinary=this._onBinary.event,this._onData=this._register(new he),this.onData=this._onData.event,this._onLineFeed=this._register(new he),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new he),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new he),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new he),this._instantiationService=new JT,this.optionsService=this._register(new ck(e)),this._instantiationService.setService(Di,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Jf)),this._instantiationService.setService(ki,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Qf)),this._instantiationService.setService(Ub,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ep)),this._instantiationService.setService(wr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(tp)),this._instantiationService.setService(jb,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(_r)),this._instantiationService.setService(XE,this.unicodeService),this._charsetService=this._instantiationService.createInstance(pk),this._instantiationService.setService($E,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(np),this._instantiationService.setService(Pb,this._oscLinkService),this._inputHandler=this._register(new Ek(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(vi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(vi.forward(this._bufferService.onResize,this._onResize)),this._register(vi.forward(this.coreService.onData,this._onData)),this._register(vi.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Dk((t,n)=>this._inputHandler.parse(t,n))),this._register(vi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new he),this._onScroll.event(e=>{this._onScrollApi?.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!oS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),oS=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,v0),t=Math.max(t,y0),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Jy.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Jy(this._bufferService),!1))),this._windowsWrappingHeuristics.value=kt(()=>{for(let t of e)t.dispose()})}}},Mk={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:["'",'"']};function Ak(e,t,n,a){let o={type:0,cancel:!1,key:void 0},c=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?o.key=ie.ESC+"OA":o.key=ie.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ie.ESC+"OD":o.key=ie.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ie.ESC+"OC":o.key=ie.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ie.ESC+"OB":o.key=ie.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ie.DEL,e.altKey&&(o.key=ie.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ie.ESC+"[Z";break}o.key=ie.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ie.ESC+ie.CR:ie.CR,o.cancel=!0;break;case 27:o.key=ie.ESC,e.altKey&&(o.key=ie.ESC+ie.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;c?o.key=ie.ESC+"[1;"+(c+1)+"D":t?o.key=ie.ESC+"OD":o.key=ie.ESC+"[D";break;case 39:if(e.metaKey)break;c?o.key=ie.ESC+"[1;"+(c+1)+"C":t?o.key=ie.ESC+"OC":o.key=ie.ESC+"[C";break;case 38:if(e.metaKey)break;c?o.key=ie.ESC+"[1;"+(c+1)+"A":t?o.key=ie.ESC+"OA":o.key=ie.ESC+"[A";break;case 40:if(e.metaKey)break;c?o.key=ie.ESC+"[1;"+(c+1)+"B":t?o.key=ie.ESC+"OB":o.key=ie.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ie.ESC+"[2~");break;case 46:c?o.key=ie.ESC+"[3;"+(c+1)+"~":o.key=ie.ESC+"[3~";break;case 36:c?o.key=ie.ESC+"[1;"+(c+1)+"H":t?o.key=ie.ESC+"OH":o.key=ie.ESC+"[H";break;case 35:c?o.key=ie.ESC+"[1;"+(c+1)+"F":t?o.key=ie.ESC+"OF":o.key=ie.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ie.ESC+"[5;"+(c+1)+"~":o.key=ie.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ie.ESC+"[6;"+(c+1)+"~":o.key=ie.ESC+"[6~";break;case 112:c?o.key=ie.ESC+"[1;"+(c+1)+"P":o.key=ie.ESC+"OP";break;case 113:c?o.key=ie.ESC+"[1;"+(c+1)+"Q":o.key=ie.ESC+"OQ";break;case 114:c?o.key=ie.ESC+"[1;"+(c+1)+"R":o.key=ie.ESC+"OR";break;case 115:c?o.key=ie.ESC+"[1;"+(c+1)+"S":o.key=ie.ESC+"OS";break;case 116:c?o.key=ie.ESC+"[15;"+(c+1)+"~":o.key=ie.ESC+"[15~";break;case 117:c?o.key=ie.ESC+"[17;"+(c+1)+"~":o.key=ie.ESC+"[17~";break;case 118:c?o.key=ie.ESC+"[18;"+(c+1)+"~":o.key=ie.ESC+"[18~";break;case 119:c?o.key=ie.ESC+"[19;"+(c+1)+"~":o.key=ie.ESC+"[19~";break;case 120:c?o.key=ie.ESC+"[20;"+(c+1)+"~":o.key=ie.ESC+"[20~";break;case 121:c?o.key=ie.ESC+"[21;"+(c+1)+"~":o.key=ie.ESC+"[21~";break;case 122:c?o.key=ie.ESC+"[23;"+(c+1)+"~":o.key=ie.ESC+"[23~";break;case 123:c?o.key=ie.ESC+"[24;"+(c+1)+"~":o.key=ie.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=ie.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ie.DEL:e.keyCode===219?o.key=ie.ESC:e.keyCode===220?o.key=ie.FS:e.keyCode===221&&(o.key=ie.GS);else if((!n||a)&&e.altKey&&!e.metaKey){let d=Mk[e.keyCode]?.[e.shiftKey?1:0];if(d)o.key=ie.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,_=String.fromCharCode(p);e.shiftKey&&(_=_.toUpperCase()),o.key=ie.ESC+_}else if(e.keyCode===32)o.key=ie.ESC+(e.ctrlKey?ie.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),o.key=ie.ESC+p,o.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=ie.US),e.key==="@"&&(o.key=ie.NUL));break}return o}var Pt=0,Nk=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Vc,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Vc,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((o,c)=>this._getKey(o)-this._getKey(c)),t=0,n=0,a=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<a.length;o++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(a[o]=e[t],t++):a[o]=this._array[n++];this._array=a,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Pt=this._search(t),Pt===-1)||this._getKey(this._array[Pt])!==t)return!1;do if(this._array[Pt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Pt),!0;while(++Pt<this._array.length&&this._getKey(this._array[Pt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,c)=>o-c),t=0,n=new Array(this._array.length-e.length),a=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:n[a++]=this._array[o];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Pt=this._search(e),!(Pt<0||Pt>=this._array.length)&&this._getKey(this._array[Pt])===e))do yield this._array[Pt];while(++Pt<this._array.length&&this._getKey(this._array[Pt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Pt=this._search(e),!(Pt<0||Pt>=this._array.length)&&this._getKey(this._array[Pt])===e))do t(this._array[Pt]);while(++Pt<this._array.length&&this._getKey(this._array[Pt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let a=t+n>>1,o=this._getKey(this._array[a]);if(o>e)n=a-1;else if(o<e)t=a+1;else{for(;a>0&&this._getKey(this._array[a-1])===e;)a--;return a}}return t}},Gd=0,cS=0,Bk=class extends Ie{constructor(){super(),this._decorations=new Nk(e=>e?.marker.line),this._onDecorationRegistered=this._register(new he),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new he),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(kt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Lk(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),a=t.onDispose(()=>{a.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let a=0,o=0;for(let c of this._decorations.getKeyIterator(t))a=c.options.x??0,o=a+(c.options.width??1),e>=a&&e<o&&(!n||(c.options.layer??"bottom")===n)&&(yield c)}forEachDecorationAtCell(e,t,n,a){this._decorations.forEachByKey(t,o=>{Gd=o.options.x??0,cS=Gd+(o.options.width??1),e>=Gd&&e<cS&&(!n||(o.options.layer??"bottom")===n)&&a(o)})}},Lk=class extends Fn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new he),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new he),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=At.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=At.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Ok=1e3,zk=class{constructor(e,t=Ok){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let a=performance.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=a-this._lastRefreshMs,c=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},c)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},uS=20,$c=class extends Ie{constructor(e,t,n,a){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=a,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let c=0;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);if(this._topBoundaryFocusListener=c=>this._handleBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._handleBoundaryFocus(c,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new zk(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(c=>this._handleResize(c.rows))),this._register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(c=>this._handleChar(c))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
26
- `))),this._register(this._terminal.onA11yTab(c=>this._handleTab(c))),this._register(this._terminal.onKey(c=>this._handleKey(c.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Be(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(kt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<uS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
27
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===uS+1&&(this._liveRegion.textContent+=xf.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,a=n.lines.length.toString();for(let o=e;o<=t;o++){let c=n.lines.get(n.ydisp+o),d=[],p=c?.translateToString(!0,void 0,void 0,d)||"",_=(n.ydisp+o+1).toString(),f=this._rowElements[o];f&&(p.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=p,this._rowColumns.set(f,d)),f.setAttribute("aria-posinset",_),f.setAttribute("aria-setsize",a),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,a=this._rowElements[t===0?1:this._rowElements.length-2],o=n.getAttribute("aria-posinset"),c=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===c||e.relatedTarget!==a)return;let d,p;if(t===0?(d=n,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(d=this._rowElements.shift(),p=n,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{let _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let a=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(a)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:a,offset:a.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let o=({node:p,offset:_})=>{let f=p instanceof Text?p.parentNode:p,b=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(b))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(f);if(!v)return console.warn("columns is null. Race condition?"),null;let w=_<v.length?v[_]:v.slice(-1)[0]+1;return w>=this._terminal.cols&&(++b,w=0),{row:b,column:w}},c=o(t),d=o(n);if(!(!c||!d)){if(c.row>d.row||c.row===d.row&&c.column>=d.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(d.row-c.row)*this._terminal.cols-c.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let a=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${a/t})`}};$c=Ht([me(1,Kp),me(2,on),me(3,cn)],$c);var rp=class extends Ie{constructor(e,t,n,a,o){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=a,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new he),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new he),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(kt(()=>{Sr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Be(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Be(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Be(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Be(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let a=0;a<n.length;a++){let o=n[a];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(a=>{a?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[a,o]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(a)&&(n=this._checkLinkProviderResult(a,e,n)):o.provideLinks(e.y,c=>{if(this._isMouseOut)return;let d=c?.map(p=>({link:p}));this._activeProviderReplies?.set(a,d),n=this._checkLinkProviderResult(a,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let a=0;a<t.size;a++){let o=t.get(a);if(o)for(let c=0;c<o.length;c++){let d=o[c],p=d.link.range.start.y<e?0:d.link.range.start.x,_=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let f=p;f<=_;f++){if(n.has(f)){o.splice(c--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let a=this._activeProviderReplies.get(e),o=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(o=!0);if(!o&&a){let c=a.find(d=>this._linkAtPosition(d.link,t));c&&(n=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let c=0;c<this._activeProviderReplies.size;c++){let d=this._activeProviderReplies.get(c)?.find(p=>this._linkAtPosition(p.link,t));if(d){n=!0,this._handleNewLink(d);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Hk(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Sr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let a=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(a,o),this._lastMouseEvent)){let c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._askForLink(c,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,a=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-a-1,n.end.x,n.end.y-a-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,a=e.range.end.y*this._bufferService.cols+e.range.end.x,o=t.y*this._bufferService.cols+t.x;return n<=o&&o<=a}_positionFromMouseEvent(e,t,n){let a=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,a,o){return{x1:e,y1:t,x2:n,y2:a,cols:this._bufferService.cols,fg:o}}};rp=Ht([me(1,Ip),me(2,cn),me(3,ki),me(4,Ib)],rp);function Hk(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var jk=class extends Rk{constructor(e={}){super(e),this._linkifier=this._register(new fa),this.browser=l0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new fa),this._onCursorMove=this._register(new he),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new he),this.onKey=this._onKey.event,this._onRender=this._register(new he),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new he),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new he),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new he),this.onBell=this._onBell.event,this._onFocus=this._register(new he),this._onBlur=this._register(new he),this._onA11yCharEmitter=this._register(new he),this._onA11yTabEmitter=this._register(new he),this._onWillOpen=this._register(new he),this._setup(),this._decorationService=this._instantiationService.createInstance(Bk),this._instantiationService.setService(Jl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(kT),this._instantiationService.setService(Ib,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Tf)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(vi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(vi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(vi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(vi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(kt(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,a="";switch(t.index){case 256:n="foreground",a="10";break;case 257:n="background",a="11";break;case 258:n="cursor",a="12";break;default:n="ansi",a="4;"+t.index}switch(t.type){case 0:let o=Et.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ie.ESC}]${a};${Ck(o)}${r0.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=Yt.toColor(...t.color));else{let c=n;this._themeService.modifyColors(d=>d[c]=Yt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($c,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),a=this._renderService.dimensions.css.cell.height,o=t.getWidth(n),c=this._renderService.dimensions.css.cell.width*o,d=this.buffer.y*this._renderService.dimensions.css.cell.height,p=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=p+"px",this.textarea.style.top=d+"px",this.textarea.style.width=c+"px",this.textarea.style.height=a+"px",this.textarea.style.lineHeight=a+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Be(this.element,"copy",t=>{this.hasSelection()&&IE(t,this._selectionService)}));let e=t=>FE(t,this.textarea,this.coreService,this.optionsService);this._register(Be(this.textarea,"paste",e)),this._register(Be(this.element,"paste",e)),o0?this._register(Be(this.element,"mousedown",t=>{t.button===2&&Sy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Be(this.element,"contextmenu",t=>{Sy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Gp&&this._register(Be(this.element,"auxclick",t=>{t.button===1&&Bb(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Be(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Be(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Be(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Be(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Be(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Be(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Be(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Be(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Cf.get()),h0||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(ET,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(on,this._coreBrowserService),this._register(Be(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Be(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Vf,this._document,this._helperContainer),this._instantiationService.setService(ou,this._charSizeService),this._themeService=this._instantiationService.createInstance(Zf),this._instantiationService.setService(ga,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Wc),this._instantiationService.setService(Kb,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Xf,this.rows,this.screenElement)),this._instantiationService.setService(cn,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(qf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance($f),this._instantiationService.setService(Ip,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(rp,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(If,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Gf,this.element,this.screenElement,a)),this._instantiationService.setService(ZE,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(vi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Ff,this.screenElement)),this._register(Be(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),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($c,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(qc,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(qc,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Yf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(c){let d=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!d)return!1;let p,_;switch(c.overrideType||c.type){case"mousemove":_=32,c.buttons===void 0?(p=3,c.button!==void 0&&(p=c.button<3?c.button:3)):p=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":_=0,p=c.button<3?c.button:3;break;case"mousedown":_=1,p=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let f=c.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;_=f<0?0:1,p=4;break;default:return!1}return _===void 0||p===void 0||p>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:p,action:_,ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey})}let a={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:c=>(n(c),c.buttons||(this._document.removeEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.removeEventListener("mousemove",a.mousedrag)),this.cancel(c)),wheel:c=>(n(c),this.cancel(c,!0)),mousedrag:c=>{c.buttons&&n(c)},mousemove:c=>{c.buttons||n(c)}};this._register(this.coreMouseService.onProtocolChange(c=>{c?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(c)),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()),c&8?a.mousemove||(t.addEventListener("mousemove",o.mousemove),a.mousemove=o.mousemove):(t.removeEventListener("mousemove",a.mousemove),a.mousemove=null),c&16?a.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),a.wheel=o.wheel):(t.removeEventListener("wheel",a.wheel),a.wheel=null),c&2?a.mouseup||(a.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",a.mouseup),a.mouseup=null),c&4?a.mousedrag||(a.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",a.mousedrag),a.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Be(t,"mousedown",c=>{if(c.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(c)))return n(c),a.mouseup&&this._document.addEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.addEventListener("mousemove",a.mousedrag),this.cancel(c)})),this._register(Be(t,"wheel",c=>{if(!a.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(c)===!1)return!1;if(!this.buffer.hasScrollback){if(c.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(c,!0);let d=ie.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(c,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Nb(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=Ak(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let a=this.rows-1;return this.scrollLines(n.type===2?-a:a),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===ie.ETX||n.key===ie.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Uk(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Wt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(ie.ESC+"[I"):this.coreService.triggerDataEvent(ie.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[4;${n};${t}t`);break;case 1:let a=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.ESC}[6;${o};${a}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Uk(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Pk=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Kk=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new hs)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},hS=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new Kk(t)}getNullCell(){return new hs}},Ik=class extends Ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new he),this.onBufferChange=this._onBufferChange.event,this._normal=new hS(this._core.buffers.normal,"normal"),this._alternate=new hS(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)}},Fk=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,a)=>t(n,a.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},qk=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Wk=["cols","rows"],Rs=0,Yk=class extends Ie{constructor(e){super(),this._core=this._register(new jk(e)),this._addonManager=this._register(new Pk),this._publicOptions={...this._core.options};let t=a=>this._core.options[a],n=(a,o)=>{this._checkReadonlyOptions(a),this._core.options[a]=o};for(let a in this._core.options){let o={get:t.bind(this,a),set:n.bind(this,a)};Object.defineProperty(this._publicOptions,a,o)}}_checkReadonlyOptions(e){if(Wk.includes(e))throw new Error(`Option "${e}" 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 Fk(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new qk(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 Ik(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
28
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Cf.get()},set promptLabel(e){Cf.set(e)},get tooMuchOutput(){return xf.get()},set tooMuchOutput(e){xf.set(e)}}}_verifyIntegers(...e){for(Rs of e)if(Rs===1/0||isNaN(Rs)||Rs%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Rs of e)if(Rs&&(Rs===1/0||isNaN(Rs)||Rs%1!==0||Rs<0))throw new Error("This API only accepts positive integers")}};class Vk{pending=null;accept(t){let n="";for(const a of t)n+=this.acceptChar(a);return n}acceptChar(t){return t===""?this.acceptBackspace():x0.has(t)?this.acceptConsonant(t):E0.has(t)?this.acceptVowel(t):Zk(t)&&this.canReplacePendingWith(t)?(this.pending=fS(t),""):this.flushPending()+t}acceptConsonant(t){if(!this.pending)return this.pending={initial:t},"";if(!this.pending.vowel){const o=this.flushPending();return this.pending={initial:t},o}if(!this.pending.final){if(T0.has(t))return this.pending.final=t,"";const o=this.flushPending();return this.pending={initial:t},o}const n=Gk.get(`${this.pending.final}${t}`);if(n)return this.pending.final=n,"";const a=this.flushPending();return this.pending={initial:t},a}acceptVowel(t){if(!this.pending)return t;if(!this.pending.vowel)return this.pending.vowel=t,"";if(!this.pending.final){const c=Xk.get(`${this.pending.vowel}${t}`);return c?(this.pending.vowel=c,""):this.flushPending()+t}const n=dS.get(this.pending.final);if(n){this.pending.final=n[0];const c=this.flushPending();return this.pending={initial:n[1],vowel:t},c}const a=this.pending.final,o=pS({initial:this.pending.initial,vowel:this.pending.vowel});return this.pending={initial:a,vowel:t},o}acceptBackspace(){if(!this.pending)return"";if(this.pending.final){const t=dS.get(this.pending.final);return t?this.pending.final=t[0]:delete this.pending.final,""}return this.pending.vowel?(delete this.pending.vowel,""):(this.pending=null,"")}canReplacePendingWith(t){if(!this.pending?.initial)return!1;const n=fS(t);return n.initial===this.pending.initial&&(!this.pending.vowel||n.vowel===this.pending.vowel)&&(!this.pending.final||n.final===this.pending.final)}flushPending(){if(!this.pending)return"";const t=pS(this.pending);return this.pending=null,t}}const Xc=44032,Gc=21,oa=28,$k=19*Gc*oa,b0=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],w0=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],C0=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],x0=Zp(b0),E0=Zp(w0),T0=Zp(C0),Xk=new Map([["ㅗㅏ","ㅘ"],["ㅗㅐ","ㅙ"],["ㅗㅣ","ㅚ"],["ㅜㅓ","ㅝ"],["ㅜㅔ","ㅞ"],["ㅜㅣ","ㅟ"],["ㅡㅣ","ㅢ"]]),k0=[["ㄱㅅ","ㄳ"],["ㄴㅈ","ㄵ"],["ㄴㅎ","ㄶ"],["ㄹㄱ","ㄺ"],["ㄹㅁ","ㄻ"],["ㄹㅂ","ㄼ"],["ㄹㅅ","ㄽ"],["ㄹㅌ","ㄾ"],["ㄹㅍ","ㄿ"],["ㄹㅎ","ㅀ"],["ㅂㅅ","ㅄ"]],Gk=new Map(k0),dS=new Map(k0.map(([e,t])=>[t,[e[0],e[1]]]));function Zp(e){return new Map(e.map((t,n)=>[t,n]))}function Zk(e){const t=e.codePointAt(0);return t!==void 0&&t>=Xc&&t<Xc+$k}function fS(e){const t=e.codePointAt(0)-Xc,n=Math.floor(t/(Gc*oa)),a=Math.floor(t%(Gc*oa)/oa),o=t%oa,c={initial:b0[n],vowel:w0[a]};return o===0?c:{...c,final:C0[o]}}function pS(e){if(!e.vowel)return e.initial;const t=x0.get(e.initial),n=E0.get(e.vowel),a=e.final?T0.get(e.final):0;return t===void 0||n===void 0||a===void 0?`${e.initial}${e.vowel}${e.final??""}`:String.fromCodePoint(Xc+(t*Gc+n)*oa+a)}const Qk=[{key:"escape",label:"Esc",ariaLabel:"Send Escape"},{key:"tab",label:"Tab",ariaLabel:"Send Tab"},{key:"arrowLeft",label:"←",ariaLabel:"Send Arrow Left"},{key:"arrowDown",label:"↓",ariaLabel:"Send Arrow Down"},{key:"arrowUp",label:"↑",ariaLabel:"Send Arrow Up"},{key:"arrowRight",label:"→",ariaLabel:"Send Arrow Right"}];function Jk({ctrlActive:e,onCtrl:t,onStandaloneKey:n,onPreserveFocus:a,onHide:o}){function c(d){d.stopPropagation(),a()}return g.jsxs("div",{className:"mobile-terminal-key-bar",role:"toolbar","aria-label":"Mobile terminal keys",onMouseDown:c,onPointerDown:c,children:[g.jsx("button",{type:"button",className:"mobile-terminal-key mobile-terminal-key-ctrl","aria-label":"Arm Control modifier","aria-pressed":e,"data-active":e,onClick:t,children:"Ctrl"}),Qk.map(d=>g.jsx("button",{type:"button",className:"mobile-terminal-key","aria-label":d.ariaLabel,onClick:()=>n(d.key),children:d.label},d.key)),g.jsx("button",{type:"button",className:"mobile-terminal-key mobile-terminal-key-hide","aria-label":"Hide terminal control keys",title:"Hide",onClick:o,children:"×"})]})}const eD={escape:"\x1B",tab:" ",arrowUp:"\x1B[A",arrowDown:"\x1B[B",arrowRight:"\x1B[C",arrowLeft:"\x1B[D"};function tD(e){return eD[e]}function iD(e){return/^[a-z]$/i.test(e)?String.fromCharCode(e.toUpperCase().charCodeAt(0)-64):null}const io=new Map,Il=new Map,sD=Object.freeze({open:!1,text:""});function nD(e){let t=Il.get(e);return t||(t=new Set,Il.set(e,t)),t}function D0(e){const t=Il.get(e);if(t)for(const n of Array.from(t))n()}function Qp(e){return io.get(e)??sD}function rD(e,t){const n=nD(e);return n.add(t),()=>{n.delete(t)}}function aD(e,t){const n=Qp(e);n.open!==t&&(io.set(e,{...n,open:t}),D0(e))}function lD(e,t){const n=Qp(e);n.text!==t&&(io.set(e,{...n,text:t}),D0(e))}function oD(e){io.delete(e),Il.delete(e)}function cD(){io.clear(),Il.clear()}const uD=20;function hD({terminalId:e,onSubmit:t,disabled:n=!1}){const a=S.useMemo(()=>w=>rD(e,w),[e]),o=S.useMemo(()=>()=>Qp(e),[e]),c=S.useSyncExternalStore(a,o,o),{open:d,text:p}=c,_=S.useRef(null);S.useEffect(()=>{d&&_.current?.focus()},[d]);function f(w){aD(e,w)}function b(w){lD(e,w)}function v(){if(n||!p)return;const w=p.replace(/\r\n/g,`
29
- `).replace(/\n/g,"\r");w&&t(w),window.setTimeout(()=>t("\r"),uD),b(""),_.current?.focus()}return d?g.jsxs("div",{className:"compose-drawer compose-drawer--open",children:[g.jsxs("button",{type:"button",className:"compose-drawer-header","aria-label":"Collapse compose drawer",title:"Click to collapse — Esc also closes when focus is in the textarea",onClick:()=>f(!1),children:[g.jsx("span",{"aria-hidden":"true",children:"▾"}),g.jsx("span",{className:"compose-drawer-title",children:"compose"}),g.jsx("span",{className:"compose-drawer-hint","aria-hidden":"true",children:"Cmd/Ctrl+Enter to send · Enter for newline · Esc to close"}),g.jsx("span",{className:"compose-drawer-close","aria-hidden":"true",children:"×"})]}),g.jsx("textarea",{ref:_,className:"compose-drawer-input","aria-label":"Compose input",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",value:p,onChange:w=>b(w.target.value),onKeyDown:w=>{if(w.key==="Enter"&&(w.metaKey||w.ctrlKey)){w.preventDefault(),v();return}w.key==="Escape"&&(w.preventDefault(),f(!1))},placeholder:"Type a longer command here, then Cmd/Ctrl+Enter to send."}),g.jsxs("div",{className:"compose-drawer-actions",children:[g.jsx("button",{type:"button",className:"compose-drawer-clear",onClick:()=>{b(""),_.current?.focus()},disabled:!p,children:"Clear"}),g.jsx("button",{type:"button",className:"compose-drawer-send",onClick:v,disabled:n||!p,children:"Send"})]})]}):g.jsx("div",{className:"compose-drawer compose-drawer--closed",children:g.jsxs("button",{type:"button",className:"compose-drawer-handle","aria-label":"Open compose drawer",title:"Compose long input — type without per-keystroke latency, send with Cmd/Ctrl+Enter",onClick:()=>f(!0),children:[g.jsx("span",{"aria-hidden":"true",children:"▴"}),g.jsx("span",{children:"compose"}),p?g.jsx("span",{className:"compose-drawer-handle-dot","aria-label":"draft saved"}):null]})})}function dD(e){e.attachCustomKeyEventHandler(o=>{if(fD(o)){const c=_S(e);return c?(o.preventDefault(),o.stopPropagation(),mS(c),!1):!0}return pD(o)?(o.preventDefault(),o.stopPropagation(),_D(e),!1):!0});const t=e.element;if(!t)return{dispose(){e.attachCustomKeyEventHandler(()=>!0)}};const n=o=>{const c=_S(e);if(c){if(o.clipboardData){o.clipboardData.setData("text/plain",c),o.preventDefault();return}o.preventDefault(),mS(c)}},a=o=>{const c=o.clipboardData?.getData("text/plain");if(c===void 0)return;const d=R0(c);d!==c&&(o.preventDefault(),o.stopImmediatePropagation(),e.paste(d))};return t.addEventListener("copy",n,!0),t.addEventListener("paste",a,!0),{dispose(){t.removeEventListener("copy",n,!0),t.removeEventListener("paste",a,!0),e.attachCustomKeyEventHandler(()=>!0)}}}function fD(e){return e.type!=="keydown"||e.altKey||e.key.toLowerCase()!=="c"?!1:e.metaKey&&!e.ctrlKey&&!e.shiftKey||e.ctrlKey&&e.shiftKey&&!e.metaKey?!0:e.ctrlKey&&!e.shiftKey&&!e.metaKey}function pD(e){return e.type!=="keydown"||e.altKey||e.key.toLowerCase()!=="v"?!1:e.metaKey&&!e.ctrlKey&&!e.shiftKey||e.ctrlKey&&e.shiftKey&&!e.metaKey?!0:e.ctrlKey&&!e.shiftKey&&!e.metaKey}async function _D(e){if(navigator.clipboard?.readText)try{const t=await navigator.clipboard.readText();if(!t)return;e.paste(R0(t))}catch{}}function _S(e){return e.hasSelection()?e.getSelection():""}function R0(e){return e.replace(/(?:\r\n|\r|\n)+$/,"")}async function mS(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}mD(e)}function mD(e){const t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=document.createElement("textarea");n.value=e,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.style.opacity="0",document.body.appendChild(n),n.focus({preventScroll:!0}),n.select();try{typeof document.execCommand=="function"&&document.execCommand("copy")}finally{n.remove(),t?.focus({preventScroll:!0})}}const gD=[4,10,11,12];function vD(e,t){const n=[e.parser.registerCsiHandler({final:"c"},a=>gS(a)),e.parser.registerCsiHandler({prefix:">",final:"c"},a=>gS(a)),e.parser.registerCsiHandler({final:"n"},a=>yD(a)),e.parser.registerCsiHandler({prefix:"?",final:"n"},a=>SD(a)),e.parser.registerCsiHandler({final:"t"},a=>bD(a)),e.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...gD.map(a=>e.parser.registerOscHandler(a,o=>wD(o)))];return{dispose(){for(const a of n)a.dispose()}}}function gS(e){return hu(e)===0}function yD(e){const t=hu(e);return t===5||t===6}function SD(e){return hu(e)===6}function bD(e){const t=hu(e);return t===14||t===16||t===18}function wD(e){return e.split(";").some(t=>t==="?")}function hu(e){const t=e[0];return typeof t=="number"?t:0}const Fl=new Map,CD=2*1024*1024,xD=1500,ED=25e3;function TD(e,t){let n=Fl.get(e);n||(n=kD(e),Fl.set(e,n),A0(n)),n.listeners.add(t);const a=c=>MD(n,c),o=()=>{n.listeners.delete(t)};return{status:n.status,snapshot:n.snapshot,output:n.output.slice(),history:n.history,send:a,detach:o}}function M0(e){const t=Fl.get(e);t&&(AD(t),Fl.delete(e))}function vS(){for(const e of Array.from(Fl.keys()))M0(e)}function kD(e){return{url:e,socket:null,status:"connecting",snapshot:null,output:[],history:null,outputBytes:0,pendingOut:[],listeners:new Set,reconnectTimer:null,reconnectEnabled:!0,heartbeat:null,isAlive:!1,exited:!1}}function A0(e){if(!e.reconnectEnabled)return;yl(e,e.socket===null&&e.status!=="reconnecting"?"connecting":"reconnecting");const t=new WebSocket(e.url);e.socket=t,e.isAlive=!1,t.addEventListener("open",()=>{if(e.socket===t){yl(e,"connected");for(const n of e.pendingOut)t.send(JSON.stringify(n));e.pendingOut.length=0,e.isAlive=!0,DD(e)}}),t.addEventListener("message",n=>{if(e.socket!==t)return;const a=typeof n.data=="string"?n.data:"";if(!a)return;let o=null;try{o=JSON.parse(a)}catch{return}if(!(!o||typeof o.type!="string")){if(o.type==="pong"){e.isAlive=!0;return}RD(e,o),N0(e,{type:"message",message:o})}}),t.addEventListener("close",n=>{if(e.socket===t){if(e.socket=null,Jp(e),n.code===1008){e.reconnectEnabled=!1,yl(e,"unauthorized");return}if(e.exited||!e.reconnectEnabled){yl(e,"closed");return}yl(e,"reconnecting"),e.reconnectTimer=window.setTimeout(()=>{e.reconnectTimer=null,A0(e)},xD)}}),t.addEventListener("error",()=>{})}function DD(e){Jp(e),e.heartbeat=window.setInterval(()=>{const t=e.socket;if(!(!t||t.readyState!==WebSocket.OPEN)){if(!e.isAlive){t.close();return}e.isAlive=!1,t.send(JSON.stringify({type:"ping",nonce:Date.now().toString(36)}))}},ED)}function Jp(e){e.heartbeat!==null&&(window.clearInterval(e.heartbeat),e.heartbeat=null)}function RD(e,t){if(t.type==="snapshot"){e.snapshot=t.terminal,e.output=t.output.slice(),e.history=t.history??null,e.outputBytes=e.output.reduce((n,a)=>n+a.length,0),e.exited=t.terminal.status==="exited",yS(e);return}if(t.type==="output"){e.output.push(t.data),e.outputBytes+=t.data.length,yS(e);return}if(t.type==="terminal_updated"){e.snapshot=t.terminal,t.terminal.status==="exited"&&(e.exited=!0);return}if(t.type==="exit"){e.exited=!0,e.snapshot&&e.snapshot.id===t.terminalId&&(e.snapshot={...e.snapshot,status:"exited",exitCode:t.exitCode});return}}function yS(e){for(;e.outputBytes>CD&&e.output.length>1;){const t=e.output.shift();e.outputBytes-=t.length}}function yl(e,t){e.status!==t&&(e.status=t,N0(e,{type:"status",status:t}))}function N0(e,t){for(const n of Array.from(e.listeners))n(t)}function MD(e,t){const n=e.socket;return n&&n.readyState===WebSocket.OPEN?(n.send(JSON.stringify(t)),!0):(t.type==="input"&&e.pendingOut.push(t),!1)}function AD(e){e.reconnectEnabled=!1,e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),Jp(e);const t=e.socket;e.socket=null,t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),e.listeners.clear()}const ND=[0,50,150,350],BD=[300,1200,2500],LD=1e3,OD=1e5,ap="\x1B[?1049l\x1B[?1047l\x1B[?47l",zD=new Set(["47","1047","1049"]);function HD({terminal:e,serverApi:t,active:n,visible:a=!0,canClose:o,refreshCwdOnEnter:c=!1,tabId:d,onSelect:p,onClose:_,onExit:f,onSnapshot:b,onAuthClose:v}){const w=S.useSyncExternalStore(yb,gf,()=>mr),x=S.useSyncExternalStore(Sb,vf,()=>da),C=S.useSyncExternalStore(bb,Sf,()=>!0),E=S.useSyncExternalStore(Rb,Wn,()=>Ic),B=S.useRef(null),D=S.useRef(null),Z=S.useRef(null),A=S.useRef(null),P=S.useRef({onExit:f,onSnapshot:b}),z=S.useRef(t.createWebSocketUrl),K=S.useRef(v),N=S.useRef(null),ae=S.useRef(new Map),de=S.useRef([]),Te=S.useRef([]),ce=S.useRef([]),Q=S.useRef(null),X=S.useRef(null),se=S.useRef(!1),le=S.useRef(!1),R=S.useRef(!1),q=S.useRef(null),$=S.useRef(null),ue=S.useRef(!1),be=S.useRef(!1),T=S.useRef(!1),W=S.useRef(!1),oe=S.useRef(!1),ne=S.useRef(!1),_e=S.useRef(!1),fe=S.useRef(n),xe=S.useRef(a),qe=S.useRef(c),Me=S.useRef(w),Ae=S.useRef(x),[,Ze]=S.useState("connecting"),[nt,Re]=S.useState(!1),[te,we]=S.useState(null),[Ce,Le]=S.useState(!1),[$e,St]=S.useState(null),[V,He]=S.useState(!1),[st,yi]=S.useState(!1),[bt,fs]=S.useState(!1),[ps,ti]=S.useState(null),[ii,Ci]=S.useState(!1);S.useLayoutEffect(()=>{fe.current=n},[n]),S.useLayoutEffect(()=>{xe.current=a},[a]),S.useLayoutEffect(()=>{qe.current=c},[c]),S.useLayoutEffect(()=>{Me.current=w},[w]),S.useLayoutEffect(()=>{Ae.current=x},[x]),S.useEffect(()=>{a&&n&&e.status==="running"&&(We(),ws())},[n,a,e.status]),S.useEffect(()=>{P.current={onExit:f,onSnapshot:b}},[f,b]),S.useEffect(()=>{z.current=t.createWebSocketUrl,K.current=v},[t,v]),S.useEffect(()=>{let H=!1;return ti(null),e.status!=="running"?()=>{H=!0}:(t.getTerminalTranscriptSource(e.id).then(pe=>{H||ti(pe.source)}).catch(pe=>{!H&&!Zd(pe)&&ti(null)}),()=>{H=!0})},[t,e.currentCommand,e.id,e.status]),S.useEffect(()=>{const H=D.current;H&&(H.options.disableStdin=e.status==="exited"),e.status==="exited"&&Ze("closed")},[e.status]),S.useEffect(()=>{const H=D.current;H&&(H.options.fontSize=w,Ld(w,Ae.current).then(()=>{Me.current===w&&We()}))},[w]),S.useEffect(()=>{const H=D.current;H&&(H.options.fontFamily=mf(x),Ld(Me.current,x).then(()=>{Ae.current===x&&We()}))},[x]),S.useEffect(()=>{const H=D.current;H&&(H.options.theme=SS(E))},[E]),S.useEffect(()=>{const H=B.current;if(!H)return;let pe=!1,Qe=null,Oe=null,it=null,Fe=null,Cs=null,hn=null,gs=null;N.current=null,oe.current=!1,ne.current=!1,ut(),xi();const js=Me.current,ro=Ae.current,Hi=new Yk({cursorBlink:!0,convertEol:!1,disableStdin:e.status==="exited",fontFamily:mf(ro),fontSize:js,fontWeight:400,fontWeightBold:700,macOptionClickForcesSelection:!0,scrollback:OD,theme:{...SS(Wn())}}),ba=new HE;return Hi.loadAddon(ba),Fe=vD(Hi),D.current=Hi,Z.current=ba,Ld(js,ro).then(()=>{if(pe)return;Hi.open(H),oe.current=!0,Qe=dD(Hi),xe.current&&fe.current&&e.status==="running"&&ws(),We(),Cs=VD(H,Hi,()=>Me.current*1.2,Nt,ji=>{Pe(ji)},lt,$t),hn=qD(H,Hi,Nt,ji=>{Pe(ji)},lt,$t);const _u=new Vk;Oe=Hi.onData(ji=>{if(_e.current){const Gi=iD(ji);if(Gi){Sa(!1),di(Gi);return}}const $n=_u.accept(ji);$n&&di($n)}),it=Hi.onScroll(ji=>{if(be.current||W.current||T.current){wt();return}hi(),Nt(),ji<=3&&Pe()}),gs=new ResizeObserver(()=>{ms()}),gs.observe(H),ne.current&&(Dt(),ne.current=!1,We()),Xi()}),()=>{pe=!0,oe.current=!1,ne.current=!1,ut(),Rt(),Vt(),T.current=!1,Cs?.(),hn?.(),gs?.disconnect(),Qe?.dispose(),Oe?.dispose(),it?.dispose(),Fe?.dispose(),Hi.dispose(),D.current=null,Z.current=null}},[e.id]),S.useEffect(()=>{const H=z.current(e.id),pe=TD(H,Ls);return A.current=pe.send,Ze(pe.status),pe.status==="connected"&&We(),pe.snapshot&&(P.current.onSnapshot(pe.snapshot,{notifyCompletion:!1}),D.current&&(We(),Os(pe.output,pe.history),We())),()=>{pe.detach(),A.current=null}},[e.id]);function Ls(H){if(H.type==="status"){Ze(H.status),H.status==="unauthorized"&&K.current?.(),H.status==="connected"&&We();return}Yn(H.message)}function xi(H=[],pe=null){Te.current=[],ce.current=H.slice(),Q.current=pe,X.current=null,se.current=!1,le.current=!1,R.current=!1,ne.current=!1,q.current=null,ue.current=!1,Re(!1),we(null),Le(!1),St(null),He(!1),yi(!1)}function Os(H=[],pe=null){xi(H,pe),_s()}function _s(){if(!D.current||!oe.current){ne.current=!0;return}ne.current=!1,Dt()}async function Dt(){const H=D.current;if(!H)return;const pe=Qd(H,ue.current);await si(H,{scrollToBottom:pe}),D.current===H&&wt()}function si(H,pe={}){return new Promise(Qe=>{T.current=!0;const Oe=()=>{try{pe.scrollToBottom&&O(H)}finally{T.current=!1,Qe()}},it=()=>{H.clear();const Fe=ID([...Te.current,...ce.current]);if(Fe.length===0){Oe();return}for(let Cs=0;Cs<Fe.length;Cs+=1){const hn=Fe[Cs];Cs===Fe.length-1?H.write(hn,Oe):H.write(hn)}};if(H.buffer.active.type==="alternate"){H.write(ap,it);return}it()})}async function Pe(H=0){const pe=D.current;if(R.current||!pe)return;const Qe=Q.current;R.current=!0,Re(!0);const Oe=pe.buffer.active.viewportY;try{let it=!!(Qe&&!Qe.hasMore);if(!it)try{const Fe=await t.getTerminalHistory(e.id,{beforeLine:Qe?.startLine??0,limit:LD});if(Q.current={startLine:Fe.startLine,endLine:Fe.endLine,hasMore:Fe.hasMore},Fe.output.length>0){await Hs(pe,Fe.output,Oe,H);return}it=!Fe.hasMore}catch(Fe){it=Zd(Fe)}it&&await zs(pe,Oe,H)}catch{}finally{R.current=!1,Re(!1)}}async function zs(H,pe,Qe){if(!(se.current||le.current))try{const Oe=X.current,it=await t.getTerminalTranscriptHistory(e.id,{...Oe?{cursor:Oe}:{},limit:80});if(ti(it.source),X.current=it.cursor,le.current=!it.hasMore||!it.cursor,it.output.length===0)return;await Hs(H,it.output,pe,Qe)}catch(Oe){Zd(Oe)&&(se.current=!0)}}async function Hs(H,pe,Qe,Oe){Te.current=[...pe,...Te.current];const it=KD(pe);await si(H,{scrollToBottom:!1}),D.current===H&&(F(H,Math.max(0,Qe+it+Math.min(0,Oe))),ue.current=!ca(H),Nt())}S.useEffect(()=>{const H=window.visualViewport;function pe(){document.visibilityState==="visible"&&We()}function Qe(){We()}function Oe(){Xi()}return document.addEventListener("visibilitychange",pe),window.addEventListener("pageshow",Qe),window.addEventListener("resize",Oe),H?.addEventListener("resize",Oe),H?.addEventListener("scroll",Oe),()=>{document.removeEventListener("visibilitychange",pe),window.removeEventListener("pageshow",Qe),window.removeEventListener("resize",Oe),H?.removeEventListener("resize",Oe),H?.removeEventListener("scroll",Oe)}},[e.id]);function Yn(H){if(H.type==="snapshot"&&H.terminal.id===e.id){if(P.current.onSnapshot(H.terminal,{notifyCompletion:!1}),!D.current)return;We(),Os(H.output,H.history??null),We();return}if(H.type==="terminal_updated"&&H.terminal.id===e.id){P.current.onSnapshot(H.terminal,{notifyCompletion:!0});return}if(H.type==="output"&&H.terminalId===e.id){const Qe=B0(H.data);if(!Qe)return;ce.current.push(Qe);const Oe=D.current;if(Oe&&oe.current){const it=Qd(Oe,ue.current);Oe.write(Qe,()=>{D.current===Oe&&(it&&O(Oe),wt())})}else ne.current=!0;return}const pe=D.current;if(pe){if(H.type==="exit"&&H.terminalId===e.id){P.current.onExit(H.exitCode),Ze("closed");return}H.type==="error"&&pe.writeln(`\r
30
- [nterminal] ${H.message}`)}}function ms(H=25){if(document.visibilityState==="hidden"||!xe.current||ae.current.has(H))return;const pe=window.setTimeout(()=>{ae.current.delete(H),ct()},H);ae.current.set(H,pe)}function Xi(){for(const H of ND)ms(H)}function We(){N.current=null,Xi()}function ut(){for(const H of ae.current.values())window.clearTimeout(H);ae.current.clear()}function Rt(){for(const H of de.current)window.clearTimeout(H);de.current=[]}function Nt(){if(wt(),!q.current){Le(!1);return}Le(!0),Vt(),$.current=window.setTimeout(()=>{$.current=null,Le(!1)},1200)}function wt(){const H=D.current,pe=H?FD(H):null;if(q.current=pe,we(pe),yi(!!(H&&pe)),He(!!(H&&pe&&!ca(H))),pe||!H||!Bt()){St(null);return}St({alternate:H.buffer.active.type==="alternate"})}function Bt(){const H=Q.current;return Te.current.length>0||!!H?.hasMore}function Vt(){$.current!==null&&(window.clearTimeout($.current),$.current=null)}function hi(){const H=D.current;H&&(ue.current=!ca(H),wt())}function lt(){W.current=!0}function $t(){hi(),W.current=!1}function O(H){re(()=>bS(H))&&(ue.current=!1)}function F(H,pe){re(()=>(H.scrollToLine(pe),!0))}function re(H){be.current=!0;try{return H()}finally{be.current=!1}}function ge(){const H=D.current;if(!H)return;const pe=()=>{bS(H),ue.current=!1,wt(),ws()};if(H.buffer.active.type==="alternate"){H.write(ap,pe);return}pe()}function ke(H){const pe=D.current,Qe=B.current;if(!pe||!Qe)return;const Oe=Qe.getBoundingClientRect();if(Oe.height<=0)return;const it=Math.max(0,Math.min(1,(H-Oe.top)/Oe.height)),Fe=Math.round(pe.buffer.active.baseY*it);lt();try{pe.scrollToLine(Fe)}finally{$t()}ue.current=!ca(pe),wt(),Nt(),Fe<=3&&Pe()}function tt(H){H.preventDefault(),H.stopPropagation(),H.currentTarget.setPointerCapture?.(H.pointerId),ke(H.clientY)}function Ne(H){(H.buttons&1)!==0&&(H.preventDefault(),H.stopPropagation(),ke(H.clientY))}function ct(){const H=D.current,pe=Z.current;if(!(!H||!pe)&&!(document.visibilityState==="hidden"||!xe.current||B.current?.isConnected===!1))try{const Qe=Qd(H,ue.current);pe.fit(),Qe&&O(H),H.refresh(0,Math.max(0,H.rows-1)),wt();const Oe={cols:H.cols,rows:H.rows},it=N.current;if(it&&it.cols===Oe.cols&&it.rows===Oe.rows)return;ht({type:"resize",terminalId:e.id,cols:Oe.cols,rows:Oe.rows})&&(N.current=Oe)}catch{}}function ht(H){const pe=A.current;return pe?pe(H):!1}function di(H){ht({type:"input",terminalId:e.id,data:H})&&UD(H)&&un()}function un(){!qe.current||!fe.current||(Rt(),de.current=BD.map(H=>{const pe=window.setTimeout(()=>{de.current=de.current.filter(Qe=>Qe!==pe),qe.current&&fe.current&&ht({type:"refresh_cwd",terminalId:e.id})},H);return pe}))}function ws(){D.current?.focus()}function pu(){fs(H=>{const pe=!H;return _e.current=pe,pe}),ws()}function Sa(H){_e.current=H,fs(H)}function Vn(H){_e.current&&Sa(!1),di(tD(H)),ws()}return g.jsxs("section",{className:"terminal-pane","data-active":n,onMouseDown:()=>{n||p()},children:[g.jsx(jD,{terminal:e,canClose:o,tabId:d,transcriptSource:ps,onClose:_}),g.jsx("div",{className:"xterm-container",ref:B}),nt?g.jsx("div",{className:"terminal-history-loader",role:"status","aria-label":"Loading older terminal output",children:g.jsx("span",{"aria-hidden":"true"})}):null,C&&te?g.jsxs("div",{className:"terminal-scroll-progress","data-active":Ce,"aria-hidden":"true",children:[te.current,"/",te.total]}):C&&$e?g.jsxs("div",{className:"terminal-scroll-progress","data-active":!1,"data-pending":"true","data-buffer":$e.alternate?"alternate":"normal","aria-hidden":"true",children:[$e.alternate?"alt ":"","0/?"]}):null,V?g.jsx("button",{type:"button",className:"terminal-scroll-bottom-button","aria-label":"Scroll terminal to bottom",title:"Scroll to bottom",onPointerDown:H=>H.stopPropagation(),onMouseDown:H=>H.stopPropagation(),onClick:H=>{H.stopPropagation(),ge()},children:"↓"}):null,st?g.jsx("button",{type:"button",className:"terminal-scroll-handle","aria-label":"Drag terminal scroll handle",title:"Drag to scroll",onPointerDown:tt,onPointerMove:Ne,children:g.jsx("span",{"aria-hidden":"true"})}):null,n&&e.status==="running"?ii?g.jsx(Jk,{ctrlActive:bt,onCtrl:pu,onStandaloneKey:Vn,onPreserveFocus:ws,onHide:()=>Ci(!1)}):g.jsx("button",{type:"button",className:"mobile-terminal-key-toggle","aria-label":"Show terminal control keys",title:"Show Ctrl / Esc / Tab / arrows",onMouseDown:H=>{H.stopPropagation(),ws()},onPointerDown:H=>{H.stopPropagation(),ws()},onClick:()=>Ci(!0),children:"⌨"}):null,g.jsx(hD,{terminalId:e.id,onSubmit:di,disabled:e.status!=="running"})]})}function SS(e){return{background:"#0a0d10",foreground:"#e2e8ee",cursor:gE(e),selectionBackground:vE(e)}}function jD({terminal:e,canClose:t,tabId:n,transcriptSource:a,onClose:o}){const c=lb({id:`pane-${e.id}`,disabled:!n,...n?{data:{kind:"pane",sourceTabId:n,terminalId:e.id}}:{}}),d={cursor:n?"grab":"default",opacity:c.isDragging?.5:void 0};return g.jsxs("header",{ref:c.setNodeRef,className:"terminal-pane-header",style:d,"data-dragging":c.isDragging,...c.attributes,...c.listeners,children:[g.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),g.jsx("span",{className:"terminal-pane-cwd",title:e.cwd,children:e.cwd}),g.jsx("span",{className:"terminal-pane-spacer"}),a?g.jsx("span",{className:"terminal-pane-transcript","data-provider":a.provider,title:`${PD(a.provider)} JSONL history available`,children:"JSONL"}):null,g.jsx("span",{className:`terminal-pane-state terminal-pane-state-${e.status}`,children:e.status}),t?g.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close pane ${e.title}`,title:"Close pane",onPointerDown:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),onClick:p=>{p.stopPropagation(),o()},children:"x"}):null]})}function UD(e){return e.includes("\r")||e.includes(`
31
- `)}function Zd(e){return e instanceof ln&&e.status===404}function PD(e){return e==="codex"?"Codex":"Claude"}function KD(e){let t=0;for(const n of e){if(!n)continue;const a=n.match(/\r\n|\r|\n/g);t+=a?.length??1}return Math.max(1,t)}function ID(e){const t=[];for(const n of e){const a=B0(n);a&&t.push(a)}return t}function B0(e){return e.replace(/\x1b\[\?([0-9;:]*)([hl])/g,(t,n,a)=>{const o=n.split(";").filter(Boolean).filter(c=>!zD.has(c.split(":")[0]??""));return o.length>0?`\x1B[?${o.join(";")}${a}`:""})}function FD(e){const t=e.buffer.active,n=t.baseY+e.rows;return n<=e.rows?null:{current:Math.max(1,Math.min(n,t.viewportY+1)),total:n}}function ca(e){return e.buffer.active.viewportY>=Math.max(0,e.buffer.active.baseY-1)}function Qd(e,t){return!t||ca(e)}function bS(e){return ca(e)?!1:(e.scrollToLine(Math.max(0,e.buffer.active.baseY)),!0)}function qD(e,t,n,a,o,c){const d=p=>{const _=YD(p);_!==0&&(p.cancelable&&p.preventDefault(),p.stopPropagation(),WD(t,_,n,a,o,c))};return e.addEventListener("wheel",d,{capture:!0,passive:!1}),()=>{e.removeEventListener("wheel",d,{capture:!0})}}function WD(e,t,n,a,o,c){const d=()=>{o();try{e.scrollLines(t)}finally{c()}n(),t<0&&e.buffer.active.viewportY<=3&&a(t)};if(e.buffer.active.type==="alternate"){e.write(ap,d);return}d()}function YD(e){const n=e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?e.deltaY/24:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*24:e.deltaY;if(n===0)return 0;const a=n<0?Math.floor(n):Math.ceil(n);return Math.max(-30,Math.min(30,a))}function VD(e,t,n,a,o,c,d){let p=null,_=0;const f={passive:!1};function b(x){p=Jd(x),_=0}function v(x){const C=Jd(x);if(C===null){p=null,_=0;return}if(p===null){p=C;return}const E=C.clientY-p.clientY;if(p=C,x.cancelable&&x.preventDefault(),E===0)return;if($D(t)&&XD(t,C,-E)){_=0;return}_-=E/n();const B=_<0?Math.ceil(_):Math.floor(_);if(B!==0){_-=B,c();try{t.scrollLines(B)}finally{d()}a(),B<0&&t.buffer.active.viewportY<=3&&o(B)}}function w(x){if(x.touches.length>0){p=Jd(x);return}p=null,_=0}return e.addEventListener("touchstart",b,f),e.addEventListener("touchmove",v,f),e.addEventListener("touchend",w),e.addEventListener("touchcancel",w),()=>{e.removeEventListener("touchstart",b,f),e.removeEventListener("touchmove",v,f),e.removeEventListener("touchend",w),e.removeEventListener("touchcancel",w)}}function Jd(e){if(e.touches.length!==1)return null;const t=e.touches[0];return t?{clientX:t.clientX,clientY:t.clientY}:null}function $D(e){return e.buffer.active.type==="alternate"||e.modes.mouseTrackingMode!=="none"}function XD(e,t,n){const a=e.element;return a?(a.dispatchEvent(GD(t,n)),!0):!1}function GD(e,t){const n=typeof WheelEvent=="function"?WheelEvent.DOM_DELTA_PIXEL:0,a={bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:t,deltaMode:n};if(typeof WheelEvent=="function")return new WheelEvent("wheel",a);const o=new Event("wheel",a);return Object.defineProperties(o,{clientX:{value:e.clientX},clientY:{value:e.clientY},deltaX:{value:0},deltaY:{value:t},deltaMode:{value:0}}),o}function lp({node:e,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c=!0,refreshCwdOnEnter:d=!1,tabId:p,dropZoneActive:_=!1,draggingTerminalId:f=null,path:b=[],totalPanes:v,onSelect:w,onClose:x,onResize:C,onExit:E,onSnapshot:B,onCloseEditor:D,onAuthClose:Z}){const A=v??op(e);if(e.type==="pane"){const N=t[e.terminalId];if(!N)return g.jsx("div",{className:"missing-pane",children:"Terminal unavailable"});const ae=g.jsx(HD,{terminal:N,serverApi:a,active:e.terminalId===o,visible:c,canClose:A>1,refreshCwdOnEnter:d&&e.terminalId===o,tabId:p,onSelect:()=>w(e.terminalId),onClose:()=>x(e.terminalId),onExit:Te=>E(e.terminalId,Te),onSnapshot:B,...Z?{onAuthClose:Z}:{}});return _&&f!==e.terminalId?g.jsxs("div",{className:"pane-drop-host",children:[ae,g.jsx(Tc,{terminalId:e.terminalId,side:"top"}),g.jsx(Tc,{terminalId:e.terminalId,side:"right"}),g.jsx(Tc,{terminalId:e.terminalId,side:"bottom"}),g.jsx(Tc,{terminalId:e.terminalId,side:"left"})]}):ae}if(e.type==="editor"){const N=n[e.editorId];return N?g.jsx(BE,{api:a,editor:N,canClose:A>1,onClose:()=>D(e.editorId)}):g.jsx("div",{className:"missing-pane",children:"Editor unavailable"})}const P=`${e.ratio*100}%`,z=`${(1-e.ratio)*100}%`,K=e.direction==="vertical"?{gridTemplateColumns:`${P} 1px ${z}`}:{gridTemplateRows:`${P} 1px ${z}`};return g.jsxs("div",{className:"split-pane","data-direction":e.direction,style:K,children:[g.jsx("div",{className:"split-cell",children:g.jsx(lp,{node:e.first,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:d,tabId:p,dropZoneActive:_,draggingTerminalId:f,path:[...b,0],totalPanes:A,onSelect:w,onClose:x,onResize:C,onExit:E,onSnapshot:B,onCloseEditor:D,...Z?{onAuthClose:Z}:{}})}),g.jsx(ZD,{direction:e.direction,path:b,onResize:C}),g.jsx("div",{className:"split-cell",children:g.jsx(lp,{node:e.second,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:d,tabId:p,dropZoneActive:_,draggingTerminalId:f,path:[...b,1],totalPanes:A,onSelect:w,onClose:x,onResize:C,onExit:E,onSnapshot:B,onCloseEditor:D,...Z?{onAuthClose:Z}:{}})})]})}function Tc({terminalId:e,side:t}){const{setNodeRef:n,isOver:a}=ob({id:`pane-${e}-${t}`,data:{kind:"pane-zone",terminalId:e,side:t}});return g.jsx("div",{ref:n,className:`pane-drop-zone pane-drop-zone--${t}`,"data-over":a,"aria-hidden":"true"})}function ZD({direction:e,path:t,onResize:n}){function a(o){o.preventDefault(),o.stopPropagation();const c=o.currentTarget;c.setPointerCapture?.(o.pointerId),c.classList.add("is-dragging"),document.body.style.cursor=e==="vertical"?"col-resize":"row-resize";const d=c.parentElement;if(!d)return;const p=d.getBoundingClientRect();function _(b){const v=e==="vertical"?(b.clientX-p.left)/p.width:(b.clientY-p.top)/p.height;n(t,Math.min(.9,Math.max(.1,v)))}function f(){window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",f),c.classList.remove("is-dragging"),document.body.style.cursor=""}window.addEventListener("pointermove",_),window.addEventListener("pointerup",f)}return g.jsx("div",{"aria-label":"Resize panes","aria-orientation":e==="vertical"?"vertical":"horizontal",className:"split-divider","data-direction":e,onPointerDown:a,role:"separator",children:g.jsx("span",{className:"split-divider-handle","aria-hidden":"true"})})}function op(e){return e.type==="pane"||e.type==="editor"?1:op(e.first)+op(e.second)}const e_="workspace-default",QD="NTerminal";function JD(){return{workspaces:[],activeWorkspaceId:null,terminals:{}}}function eR(e,t){switch(t.type){case"workspace.hydrated":return cp(t.terminals,t.savedTabs,t.savedWorkspaces,t.savedActiveWorkspaceId);case"workspace.created":return tR(e,{id:t.workspaceId,title:t.title});case"workspace.closed":return sR(e,t.workspaceId);case"workspace.selected":return L0(e,t.workspaceId);case"workspace.renamed":return iR(e,t.workspaceId,t.title);case"terminal.created":return O0(e,t.terminal);case"terminal.split":return nR(e,t.terminal,t.direction);case"terminal.updated":return mR(e,t.terminal);case"terminal.exited":return gR(e,t.terminalId,t.exitCode);case"terminal.closed":return H0(e,t.terminalId);case"terminal.detached":return vR(e,t.terminalId);case"editor.split":return rR(e,t.editorId,t.title,t.direction);case"editor.closed":return yR(e,t.editorId);case"pane.selected":return dR(e,t.terminalId);case"pane.resized":return fR(e,t.path,t.ratio);case"tab.selected":return lR(e,t.tabId);case"tab.renamed":return hR(e,t.tabId,t.title);case"tab.reordered":return z0(e,t.sourceTabId,t.targetIndex);case"tab.dropped_into_pane":return oR(e,t.sourceTabId,t.sourceTerminalId,t.targetTerminalId,t.side);case"terminal.extracted_to_tab":return cR(e,t.sourceTabId,t.sourceTerminalId,t.targetIndex);case"activePane.closed":return aR(e);default:return e}}function tR(e,t){if(e.workspaces.some(a=>a.id===t.id))return L0(e,t.id);const n={id:t.id,title:t.title,tabs:[],activeTabId:null};return{...e,workspaces:[...e.workspaces,n],activeWorkspaceId:n.id}}function L0(e,t){return e.workspaces.some(n=>n.id===t)?{...e,activeWorkspaceId:t}:e}function iR(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(d=>d.id!==t||d.title===a?d:(o=!0,{...d,title:a}));return o?{...e,workspaces:c}:e}function sR(e,t){if(e.workspaces.length<=1||!e.workspaces.some(p=>p.id===t))return e;const n=e.workspaces.find(p=>p.id===t),a=new Set(n?_R(n):[]),o={...e.terminals};for(const p of a)delete o[p];const c=e.workspaces.filter(p=>p.id!==t),d=e.activeWorkspaceId===t?c[0]?.id??null:e.activeWorkspaceId;return{workspaces:c,activeWorkspaceId:d,terminals:o}}function O0(e,t){const n=U0(e),a=Cr(n)??fu(),o=P0(t);return{...n,activeWorkspaceId:a.id,terminals:{...n.terminals,[t.id]:t},workspaces:n.workspaces.map(c=>c.id===a.id?{...c,tabs:[...c.tabs,o],activeTabId:o.id}:c)}}function nR(e,t,n){const a=Cr(e),o=a?du(a):void 0;if(!a||!o)return O0(e,t);const c=o.activeTerminalId,d=ql(o.root,c,{type:"split",direction:n,ratio:.5,first:{type:"pane",terminalId:c},second:{type:"pane",terminalId:t.id}});return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(p=>p.id===a.id?{...p,tabs:p.tabs.map(_=>_.id===o.id?{..._,root:d,activeTerminalId:t.id}:_)}:p)}}function rR(e,t,n,a){const o=Cr(e),c=o?du(o):void 0;if(!o||!c)return e;const d=c.activeTerminalId,p=ql(c.root,d,{type:"split",direction:a,ratio:.5,first:{type:"pane",terminalId:d},second:{type:"editor",editorId:t,title:n}});return{...e,workspaces:e.workspaces.map(_=>_.id===o.id?{..._,tabs:_.tabs.map(f=>f.id===c.id?{...f,root:p,activeTerminalId:d}:f)}:_)}}function aR(e){const t=Cr(e),n=t?du(t):void 0;return n?H0(e,n.activeTerminalId):e}function lR(e,t){const n=Cr(e);return!n||!n.tabs.some(a=>a.id===t)?e:{...e,workspaces:e.workspaces.map(a=>a.id===n.id?{...a,activeTabId:t}:a)}}function z0(e,t,n){const a=e.workspaces.map(o=>{const c=o.tabs.findIndex(b=>b.id===t);if(c<0)return o;const d=o.tabs.slice(),[p]=d.splice(c,1);if(!p)return o;const _=Math.max(0,Math.min(d.length,n)),f=d.slice();return f.splice(_,0,p),uR(o.tabs,f)?o:{...o,tabs:f}});return a.every((o,c)=>o===e.workspaces[c])?e:{...e,workspaces:a}}function oR(e,t,n,a,o){if(n===a||!e.terminals[n]||!e.terminals[a])return e;let c=e.workspaces.map(_=>{const f=_.tabs.findIndex(C=>C.id===t);if(f<0)return _;const b=_.tabs[f];if(!b)return _;const v=Wl(b.root,n);if(!v){const C=_.tabs.filter((E,B)=>B!==f);return{..._,tabs:C}}const w={...b,root:v,activeTerminalId:ds(v)[0]??b.activeTerminalId},x=_.tabs.slice();return x[f]=w,{..._,tabs:x}});const d=o==="left"||o==="right"?"vertical":"horizontal",p=o==="left"||o==="top";return c=c.map(_=>{const f=_.tabs.findIndex(E=>ds(E.root).includes(a));if(f<0)return _;const b=_.tabs[f];if(!b)return _;const v={type:"pane",terminalId:n},w={type:"split",direction:d,ratio:.5,first:p?v:{type:"pane",terminalId:a},second:p?{type:"pane",terminalId:a}:v},x=ql(b.root,a,w),C=_.tabs.slice();return C[f]={...b,root:x,activeTerminalId:n},{..._,tabs:C,activeTabId:b.id}}),U0({...e,workspaces:c})}function cR(e,t,n,a){let o=-1,c=-1;for(let B=0;B<e.workspaces.length;B+=1){const D=e.workspaces[B].tabs.findIndex(Z=>Z.id===t);if(D>=0){o=B,c=D;break}}if(o<0)return e;const d=e.workspaces[o],p=d.tabs[c],_=ds(p.root);if(!_.includes(n))return e;if(_.length===1)return z0(e,t,a);const f=Wl(p.root,n);if(!f)return e;const b={...p,root:f,activeTerminalId:ds(f)[0]??p.activeTerminalId},v=e.terminals[n],w={id:`tab-${Date.now().toString(36)}-${n.slice(0,8)}`,title:v?.title??"",activeTerminalId:n,root:{type:"pane",terminalId:n}},x=d.tabs.slice();x[c]=b;const C=Math.max(0,Math.min(x.length,a));x.splice(C,0,w);const E=e.workspaces.slice();return E[o]={...d,tabs:x,activeTabId:w.id},{...e,workspaces:E}}function uR(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.id!==t[n]?.id)return!1;return!0}function hR(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(d=>{let p=!1;const _=d.tabs.map(f=>f.id!==t||f.title===a?f:(o=!0,p=!0,{...f,title:a}));return p?{...d,tabs:_}:d});return o?{...e,workspaces:c}:e}function dR(e,t){const n=e.workspaces.find(o=>o.tabs.some(c=>Yl(c.root,t))),a=n?.tabs.find(o=>Yl(o.root,t));return!n||!a?e:{...e,activeWorkspaceId:n.id,workspaces:e.workspaces.map(o=>o.id===n.id?{...o,activeTabId:a.id,tabs:o.tabs.map(c=>c.id===a.id?{...c,activeTerminalId:t}:c)}:o)}}function fR(e,t,n){const a=Cr(e),o=a?du(a):void 0;if(!a||!o)return e;const c=pp(o.root,t,K0(n));return c===o.root?e:{...e,workspaces:e.workspaces.map(d=>d.id===a.id?{...d,tabs:d.tabs.map(p=>p.id===o.id?{...p,root:c}:p)}:d)}}function cp(e,t,n,a){const o=Object.fromEntries(e.map(b=>[b.id,b])),c=new Set(e.map(b=>b.id)),d=new Set;let p=SR(t,n,c,d);p.length===0&&(p=[fu()]);const _=typeof a=="string"&&p.some(b=>b.id===a)?a:p[0]?.id??null,f=_??p[0]?.id??e_;for(const b of e){if(d.has(b.id))continue;const v=P0(b);p=bR(p,f,v),d.add(b.id)}return{workspaces:p.map(so),activeWorkspaceId:_,terminals:o}}function t_(e){return ds(e.root)}function pR(e){return _p(e.root)}function _R(e){return e.tabs.flatMap(t=>ds(t.root))}function ef(e){const t=e.workspaces.map(n=>{const a=n.tabs.flatMap(o=>{const c=dp(o.root);return c?[{...o,root:c}]:[]});return so({...n,tabs:a})});return{activeWorkspaceId:t.some(n=>n.id===e.activeWorkspaceId)?e.activeWorkspaceId:t[0]?.id??null,workspaces:t}}function mR(e,t){return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(n=>({...n,tabs:n.tabs.map(a=>Yl(a.root,t.id)?{...a,title:a.title||t.title}:a)}))}}function gR(e,t,n){const a=e.terminals[t];return a?{...e,terminals:{...e.terminals,[t]:{...a,status:"exited",exitCode:n}}}:e}function H0(e,t){const n={...e.terminals};return delete n[t],j0(e,t,n)}function vR(e,t){return e.terminals[t]?j0(e,t,{...e.terminals}):e}function j0(e,t,n){const a=e.workspaces.map(c=>{const d=[];for(const p of c.tabs){const _=Wl(p.root,t);if(!_)continue;const f=ds(_),b=f.includes(p.activeTerminalId)?p.activeTerminalId:f[0];b&&d.push({...p,root:_,activeTerminalId:b})}return so({...c,tabs:d})}),o=a.some(c=>c.id===e.activeWorkspaceId);return{workspaces:a,activeWorkspaceId:o?e.activeWorkspaceId:a[0]?.id??null,terminals:n}}function yR(e,t){const n=e.workspaces.map(o=>{const c=[];for(const d of o.tabs){const p=up(d.root,t);if(!p)continue;const _=ds(p),f=_.includes(d.activeTerminalId)?d.activeTerminalId:_[0];f&&c.push({...d,root:p,activeTerminalId:f})}return so({...o,tabs:c})}),a=n.some(o=>o.id===e.activeWorkspaceId);return{...e,workspaces:n,activeWorkspaceId:a?e.activeWorkspaceId:n[0]?.id??null}}function SR(e,t,n,a){if(t&&t.length>0){const o=[];for(const c of t)wR(c)&&o.push(wS(c,n,a));if(o.length>0)return o}return[wS({...fu(),tabs:e??[]},n,a)]}function wS(e,t,n){const a=[];for(const o of e.tabs){if(!CR(o))continue;const c=hp(o.root,t);if(!c)continue;const d=ds(c);for(const _ of d)n.add(_);const p=d.includes(o.activeTerminalId)?o.activeTerminalId:d[0];p&&a.push({...o,root:c,activeTerminalId:p})}return so({...e,tabs:a})}function U0(e){return Cr(e)?e:{...e,workspaces:[fu()],activeWorkspaceId:e_}}function Cr(e){return e.workspaces.find(t=>t.id===e.activeWorkspaceId)??e.workspaces[0]}function du(e){return e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]}function fu(){return{id:e_,title:QD,tabs:[],activeTabId:null}}function so(e){const t=e.tabs.some(n=>n.id===e.activeTabId);return{...e,activeTabId:t?e.activeTabId:e.tabs[0]?.id??null}}function bR(e,t,n){return e.map(a=>a.id===t?{...a,tabs:[...a.tabs,n],activeTabId:a.activeTabId??n.id}:a)}function P0(e){return{id:`tab-${e.id}`,title:e.title||e.id,root:{type:"pane",terminalId:e.id},activeTerminalId:e.id}}function ql(e,t,n){return e.type==="pane"?e.terminalId===t?n:e:e.type==="editor"?e:{...e,first:ql(e.first,t,n),second:ql(e.second,t,n)}}function Wl(e,t){if(e.type==="pane")return e.terminalId===t?null:e;if(e.type==="editor")return e;const n=Wl(e.first,t),a=Wl(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function up(e,t){if(e.type==="editor")return e.editorId===t?null:e;if(e.type==="pane")return e;const n=up(e.first,t),a=up(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function hp(e,t){if(e.type==="pane")return t.has(e.terminalId)?e:null;if(e.type==="editor")return null;const n=hp(e.first,t),a=hp(e.second,t);return n&&a?{...e,ratio:K0(e.ratio),first:n,second:a}:n??a}function dp(e){if(e.type==="editor")return null;if(e.type==="pane")return e;const t=dp(e.first),n=dp(e.second);return t&&n?{...e,first:t,second:n}:t??n}function wR(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&(typeof t.activeTabId=="string"||t.activeTabId===null)&&Array.isArray(t.tabs)}function CR(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&typeof t.activeTerminalId=="string"&&fp(t.root)}function fp(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="pane"?typeof t.terminalId=="string":t.type==="editor"?typeof t.editorId=="string"&&typeof t.title=="string":t.type==="split"?(t.direction==="horizontal"||t.direction==="vertical")&&fp(t.first)&&fp(t.second):!1}function pp(e,t,n){if(e.type==="pane"||e.type==="editor")return e;if(t.length===0)return e.ratio===n?e:{...e,ratio:n};const[a,...o]=t;if(a===0){const c=pp(e.first,o,n);return c===e.first?e:{...e,first:c}}if(a===1){const c=pp(e.second,o,n);return c===e.second?e:{...e,second:c}}return e}function K0(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}function Yl(e,t){return e.type==="pane"?e.terminalId===t:e.type==="editor"?!1:Yl(e.first,t)||Yl(e.second,t)}function ds(e){return e.type==="pane"?[e.terminalId]:e.type==="editor"?[]:[...ds(e.first),...ds(e.second)]}function _p(e){return e.type==="pane"||e.type==="editor"?1:_p(e.first)+_p(e.second)}const pa=new Map,Zc=new Map,Qc=new Map;function no(e){return e??"__local__"}function xR(e){return{agentId:e,state:JD(),editors:{},loaded:!1,error:null,layoutRevision:null,lastPersistedLayoutJson:null,unreadCompletions:new Set,mutable:{editorIdCounter:0,saveCoord:{pendingLayoutSave:null,saveTimer:null,persistChain:Promise.resolve(),nextPersistQueued:!1,nextPersistLayout:null,queuedBaseRevision:void 0}}}}function Qt(e){const t=no(e);let n=pa.get(t);return n||(n=xR(e),pa.set(t,n)),n}function I0(e,t){const n=no(e);let a=Zc.get(n);return a||(a=new Set,Zc.set(n,a)),a.add(t),()=>{a.delete(t)}}function ER(e){const t=no(e),n=Zc.get(t);if(n)for(const a of Array.from(n))a()}function ya(e,t){pa.set(no(e),t),ER(e)}const mp=new Set;function TR(e){return mp.add(e),()=>{mp.delete(e)}}function Sl(e,t){const n=Qt(e),a=no(e);t.type==="workspace.hydrated"&&Qc.delete(a);const o=eR(n.state,t);let c=n.unreadCompletions,d=null;if(t.type==="terminal.updated"){const f=n.state.terminals[t.terminal.id],b=f?.activity==="busy",v=t.terminal.activity==="busy",w=t.terminal.activity==="idle",x=NR(a);if(t.notifyCompletion===!0&&v&&x.add(t.terminal.id),t.notifyCompletion===!0&&b&&w&&x.has(t.terminal.id)){const C=kR(o,t.terminal.id);C&&(d={terminalId:t.terminal.id,tabId:C.tab.id,commandName:f?.currentCommand??null},C.workspace.activeTabId!==C.tab.id&&(c.has(C.tab.id)||(c=new Set(c),c.add(C.tab.id))))}(w||t.terminal.status==="exited")&&x.delete(t.terminal.id)}t.type==="tab.selected"&&c.has(t.tabId)&&(c=new Set(c),c.delete(t.tabId));const p=o!==n.state,_=c!==n.unreadCompletions;if((p||_)&&ya(e,{...n,state:o,unreadCompletions:c}),_&&F0(),d)for(const f of Array.from(mp))f({agentId:e,...d})}function kR(e,t){for(const n of e.workspaces)for(const a of n.tabs)if(ds(a.root).includes(t))return{workspace:n,tab:a};return null}const gp=new Set;function DR(e){return gp.add(e),()=>{gp.delete(e)}}function RR(){let e=0;for(const t of pa.values())e+=t.unreadCompletions.size;return e}function F0(){for(const e of Array.from(gp))e()}function MR(e,t){const n=Qt(e);if(!n.unreadCompletions.has(t))return;const a=new Set(n.unreadCompletions);a.delete(t),ya(e,{...n,unreadCompletions:a}),F0()}function CS(e,t){const n=Qt(e);t!==n.state&&ya(e,{...n,state:t})}function xS(e,t){const n=Qt(e),a=t(n.editors);a!==n.editors&&ya(e,{...n,editors:a})}function ra(e,t,n){const a=Qt(e);a.loaded===t&&a.error===n||ya(e,{...a,loaded:t,error:n})}function kc(e,t,n){const a=Qt(e);a.layoutRevision===t&&a.lastPersistedLayoutJson===n||ya(e,{...a,layoutRevision:t,lastPersistedLayoutJson:n})}function AR(e){const t=Qt(e);return t.mutable.editorIdCounter+=1,t.mutable.editorIdCounter}function ES(){for(const e of pa.values()){const t=e.mutable.saveCoord.saveTimer;t!==null&&window.clearTimeout(t),e.unreadCompletions.size>0}pa.clear(),Zc.clear(),Qc.clear()}function NR(e){let t=Qc.get(e);return t||(t=new Set,Qc.set(e,t)),t}function BR(e,t){let n=!1,a=!1,o=null,c=!1;for(const d of t_(e)){const p=t[d];if(p){if(p.status==="exited"){c=!0,n=!0;continue}p.activity==="busy"?(a=!0,n=!0,!o&&p.currentCommand&&(o=p.currentCommand)):p.activity==="idle"&&(n=!0)}}return n?c?{state:"exited",commandName:null}:a?{state:"busy",commandName:o}:{state:"idle",commandName:null}:null}function LR(e){return e?e.state==="busy"?e.commandName?`running: ${e.commandName}`:"running":e.state==="exited"?"exited":"idle":""}function OR({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,onSelectTab:c,onCreateTab:d,onToggleWorkspaces:p,onCloseTerminals:_,onReattachTerminal:f,onDeleteTerminal:b,onSplitVertical:v,onSplitHorizontal:w,onRenameTab:x,activePaneAvailable:C}){const[E,B]=S.useState(null),[D,Z]=S.useState(null),A=S.useRef(null);S.useEffect(()=>{A.current?.focus(),A.current?.select()},[E?.tabId]);function P(N,ae){B({tabId:N,title:ae})}function z(){if(!E)return;const N=E.title.trim();N&&x(E.tabId,N),B(null)}function K(){return g.jsxs("div",{className:"terminal-pane-actions","aria-label":"Pane actions",children:[g.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split right",title:`Split right - ${cE()}`,onClick:v,disabled:!C,children:g.jsx("span",{className:"split-icon split-icon-right","aria-hidden":"true"})}),g.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split down",title:`Split down - ${uE()}`,onClick:w,disabled:!C,children:g.jsx("span",{className:"split-icon split-icon-down","aria-hidden":"true"})})]})}return g.jsxs(g.Fragment,{children:[g.jsxs("nav",{className:"terminal-tabs","aria-label":"Terminal tabs",children:[g.jsx("button",{type:"button",className:"mobile-menu-button","aria-label":"Toggle workspaces",title:"Workspaces",onClick:p,children:g.jsxs("span",{className:"hamburger-lines","aria-hidden":"true",children:[g.jsx("span",{}),g.jsx("span",{}),g.jsx("span",{})]})}),g.jsxs("div",{className:"terminal-tab-list",children:[e.map((N,ae)=>{const de=t_(N),Te=pR(N),ce=n[N.activeTerminalId],Q=N.title||ce?.title||N.activeTerminalId,X=N.id===t,se=E?.tabId===N.id,le=BR(N,n),R=a?.has(N.id)??!1;return g.jsxs(gi.Fragment,{children:[g.jsx(TS,{index:ae}),g.jsx(zR,{tab:N,active:X,editing:se,title:Q,paneCount:Te,terminalIds:de,canClose:e.length>1,editValue:se?E.title:null,editInputRef:se?A:null,activity:le,unread:R,onSelect:()=>c(N.id),onBeginRename:()=>P(N.id,Q),onCloseAll:()=>_(de),onCommitRename:z,onCancelRename:()=>B(null),onRenameChange:q=>B({tabId:N.id,title:q})})]},N.id)}),g.jsx(TS,{index:e.length}),g.jsx("button",{type:"button",className:"tab-add-button","aria-label":"New tab",title:"New tab",onClick:d,children:"+"}),(o?.length??0)>0?g.jsx("div",{className:"terminal-detached-pills","aria-label":"Detached terminals",children:(o??[]).map(N=>g.jsx(HR,{terminal:N,onReattach:()=>f?.(N.id),onDelete:()=>Z(N)},N.id))}):null]}),C?K():null]}),D?g.jsx(jR,{terminal:D,onCancel:()=>Z(null),onConfirm:()=>{b?.(D.id),Z(null)}}):null]})}function zR({tab:e,active:t,editing:n,title:a,paneCount:o,canClose:c,editValue:d,editInputRef:p,activity:_,unread:f,onSelect:b,onBeginRename:v,onCloseAll:w,onCommitRename:x,onCancelRename:C,onRenameChange:E}){const{attributes:B,listeners:D,setNodeRef:Z,transform:A,isDragging:P}=lb({id:`tab-${e.id}`,data:{kind:"tab",tabId:e.id,terminalId:e.activeTerminalId},disabled:n}),z={transform:nf.Translate.toString(A),opacity:P?.4:void 0,zIndex:P?2:void 0};return g.jsxs("div",{ref:Z,className:"terminal-tab","data-active":t,"data-dragging":P,"data-unread":f?"true":void 0,style:z,...B,...D,children:[_?g.jsx("span",{className:"terminal-tab-status-dot","data-activity":_.state,"aria-hidden":"true",title:LR(_)}):null,n&&p&&d!==null?g.jsxs("form",{className:"terminal-tab-editor",onSubmit:K=>{K.preventDefault(),x()},children:[g.jsx("input",{ref:p,"aria-label":`Rename ${a}`,value:d,onBlur:x,onChange:K=>E(K.target.value),onKeyDown:K=>{if(K.key==="Enter"){K.preventDefault(),x();return}K.key==="Escape"&&(K.preventDefault(),C())}}),g.jsx("small",{children:o})]}):g.jsxs("button",{type:"button",className:"terminal-tab-select","aria-label":`Select ${a}`,title:a,onClick:b,onDoubleClick:K=>{K.preventDefault(),v()},children:[g.jsx("span",{children:a}),g.jsxs("small",{children:[o," pane",o===1?"":"s"]})]}),c&&!n?g.jsx("button",{type:"button",className:"icon-button","aria-label":`Close ${a}`,title:`Close ${a}`,onPointerDown:K=>K.stopPropagation(),onClick:K=>{K.stopPropagation(),w()},children:"x"}):null]})}function TS({index:e}){const{setNodeRef:t,isOver:n}=ob({id:`tab-position-${e}`,data:{kind:"tab-position",index:e}});return g.jsx("div",{ref:t,className:"terminal-tab-drop-slot","data-over":n,"aria-hidden":"true"})}function HR({terminal:e,onReattach:t,onDelete:n}){const a=e.title||e.cwd||e.id.slice(0,8),o=`${e.title||"Terminal"}
32
- ${e.cwd}
33
- (detached — click to re-open, × to delete)`;return g.jsxs("span",{className:"terminal-detached-pill",title:o,children:[g.jsx("button",{type:"button",className:"terminal-detached-pill-open","aria-label":`Re-open ${a}`,onClick:t,children:a}),g.jsx("button",{type:"button",className:"terminal-detached-pill-delete","aria-label":`Delete ${a}`,title:`Delete ${a} — this destroys the underlying shell session.`,onClick:c=>{c.stopPropagation(),n()},children:"×"})]})}function jR({terminal:e,onCancel:t,onConfirm:n}){const a=e.title||e.cwd||e.id.slice(0,8);return g.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"delete-terminal-title",onClick:t,children:g.jsxs("div",{className:"security-panel terminal-delete-dialog",onClick:o=>o.stopPropagation(),children:[g.jsxs("header",{className:"security-panel-header",children:[g.jsx("h2",{id:"delete-terminal-title",children:"Delete Terminal"}),g.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:t,children:"×"})]}),g.jsxs("section",{className:"terminal-delete-dialog-body",children:[g.jsx("p",{children:"Delete this terminal?"}),g.jsx("span",{children:a}),g.jsx("small",{children:"The shell session and scrollback will be destroyed."})]}),g.jsxs("div",{className:"terminal-delete-dialog-actions",children:[g.jsx("button",{type:"button",className:"secondary-button",onClick:t,children:"Cancel"}),g.jsx("button",{type:"button",className:"terminal-delete-confirm",onClick:n,children:"Delete"})]})]})})}function UR({toast:e,onDismiss:t}){if(!e)return null;const n=e.status==="failed"||e.status==="partial"?"alert":"status",a="response"in e?e.response:void 0;return g.jsxs("aside",{className:`upload-toast upload-toast-${e.status}`,role:n,"aria-live":n==="alert"?"assertive":"polite",children:[g.jsxs("header",{className:"upload-toast-header",children:[g.jsx("strong",{children:FR(e)}),g.jsx("button",{type:"button","aria-label":"Dismiss upload status",onClick:t,children:"x"})]}),g.jsxs("div",{className:"upload-toast-body",children:[e.status==="queued"?g.jsx("p",{children:e.message??"Preparing upload..."}):null,e.status==="uploading"?g.jsx(PR,{toast:e}):null,a&&"message"in e&&e.message?g.jsx("p",{className:"upload-toast-muted",children:e.message}):null,a?g.jsx(KR,{response:a}):null,e.status==="failed"&&!a&&e.message?g.jsx("p",{children:e.message}):null]})]})}function PR({toast:e}){const t=e.percent===null?qR(e.loaded):`${e.percent}%`;return g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"upload-progress-row",children:[g.jsxs("span",{children:[e.fileCount," file",e.fileCount===1?"":"s"]}),g.jsx("span",{children:t})]}),g.jsx("div",{className:"upload-progress-track","aria-hidden":"true",children:g.jsx("span",{style:{width:e.percent===null?"100%":`${e.percent}%`}})})]})}function KR({response:e}){const t=e.results.filter(o=>o.status==="failed"),n=e.results.filter(o=>o.status==="uploaded"),a=[...t,...n].slice(0,5);return g.jsxs(g.Fragment,{children:[g.jsx("p",{className:"upload-toast-destination",children:e.destinationCwd}),a.length>0?g.jsx("ul",{className:"upload-result-list",children:a.map((o,c)=>g.jsx(IR,{result:o},`${o.relativePath}-${c}`))}):null,e.results.length>a.length?g.jsxs("p",{className:"upload-toast-muted",children:["+",e.results.length-a.length," more"]}):null]})}function IR({result:e}){const t=e.savedRelativePath??e.relativePath;return g.jsxs("li",{"data-status":e.status,children:[g.jsx("span",{className:"upload-result-path",children:t}),e.status==="failed"&&e.error?g.jsx("span",{className:"upload-result-error",children:e.error}):null]})}function FR(e){if(e.status==="queued")return"Preparing upload";if(e.status==="uploading")return`Uploading ${e.fileCount} file${e.fileCount===1?"":"s"}`;if(e.status==="success"){const t=e.response?.uploaded??e.fileCount;return`Uploaded ${t} file${t===1?"":"s"}`}if(e.status==="partial"){const t=e.response?.uploaded??0,n=(e.response?.uploaded??0)+(e.response?.failed??0)||e.fileCount;return`Uploaded ${t} of ${n} files`}return"Upload failed"}function qR(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`}function WR({toast:e,onActivate:t,onDismiss:n}){if(!e)return null;const a=e,o=a.commandName?`${a.commandName} finished`:"Command finished";function c(p){p.stopPropagation(),n()}function d(p){p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),t(a))}return g.jsxs("aside",{className:"completion-toast",role:"status","aria-live":"polite",tabIndex:0,onClick:()=>t(a),onKeyDown:d,children:[g.jsx("video",{className:"completion-toast-character",src:a.assetSrc,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),g.jsxs("div",{className:"completion-toast-copy",children:[g.jsx("strong",{children:a.tabTitle}),g.jsx("span",{children:o})]}),g.jsx("button",{type:"button","aria-label":"Dismiss completion alert",onClick:c,children:"x"})]})}const YR=Rl(0,0,1,1),rn=1e-6;function VR(e){return q0(e).map(t=>t.terminalId)}function q0(e){return Dl(e,YR).sort(ZR).map((t,n)=>({...t,index:n+1}))}function $R(e,t,n){const a=q0(e),o=a.find(d=>d.terminalId===t);return o?a.filter(d=>d.terminalId!==t).map(d=>GR(o,d,n)).filter(d=>d!==null).sort(QR)[0]?.entry.terminalId??null:null}function XR(e,t){return!Number.isInteger(t)||t<1?null:VR(e)[t-1]??null}function Dl(e,t){if(e.type==="pane")return[{terminalId:e.terminalId,bounds:t}];if(e.type==="editor")return[];const n=JR(e.ratio);if(e.direction==="vertical"){const o=t.left+(t.right-t.left)*n;return[...Dl(e.first,Rl(t.left,t.top,o,t.bottom)),...Dl(e.second,Rl(o,t.top,t.right,t.bottom))]}const a=t.top+(t.bottom-t.top)*n;return[...Dl(e.first,Rl(t.left,t.top,t.right,a)),...Dl(e.second,Rl(t.left,a,t.right,t.bottom))]}function GR(e,t,n){const a=e.bounds,o=t.bounds,c=kS(a.left,a.right,o.left,o.right),d=kS(a.top,a.bottom,o.top,o.bottom);switch(n){case"left":return o.centerX>=a.centerX-rn||d<=rn?null:{entry:t,primaryDistance:Math.max(0,a.left-o.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:d};case"right":return o.centerX<=a.centerX+rn||d<=rn?null:{entry:t,primaryDistance:Math.max(0,o.left-a.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:d};case"up":return o.centerY>=a.centerY-rn||c<=rn?null:{entry:t,primaryDistance:Math.max(0,a.top-o.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};case"down":return o.centerY<=a.centerY+rn||c<=rn?null:{entry:t,primaryDistance:Math.max(0,o.top-a.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};default:return null}}function ZR(e,t){return ua(e.bounds.top,t.bounds.top)||ua(e.bounds.left,t.bounds.left)}function QR(e,t){return ua(e.primaryDistance,t.primaryDistance)||ua(e.perpendicularDistance,t.perpendicularDistance)||ua(t.overlap,e.overlap)||ua(e.entry.index,t.entry.index)}function ua(e,t){const n=e-t;return Math.abs(n)<=rn?0:n}function kS(e,t,n,a){return Math.max(0,Math.min(t,a)-Math.max(e,n))}function Rl(e,t,n,a){return{left:e,top:t,right:n,bottom:a,centerX:e+(n-e)/2,centerY:t+(a-t)/2}}function JR(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}class eM extends Error{constructor(t){super(t),this.name="UploadDropError"}}function DS(e){return e?Array.from(e.types??[]).includes("Files")||$0(e.items).some(n=>n.kind==="file")?!0:X0(e.files).length>0:!1}async function tM(e){const t=$0(e.items).filter(n=>n.kind==="file");return t.length>0?iM(t):sM(e.files)}async function iM(e){const t=[];for(const n of e){const a=lM(n);if(a){await W0(a,"",t);continue}const o=n.getAsFile();if(o){t.push({relativePath:Y0(o),file:o});continue}throw new eM("Folder upload is not supported by this browser.")}return t}function sM(e){return X0(e).map(t=>({relativePath:Y0(t),file:t}))}async function W0(e,t,n){const a=cM(t,e.name);if(e.isFile){const d=await nM(e);n.push({relativePath:a,file:d});return}if(!e.isDirectory)return;const o=e.createReader(),c=await rM(o);for(const d of c)await W0(d,a,n)}function nM(e){return new Promise((t,n)=>{e.file(t,a=>n(a))})}async function rM(e){const t=[];for(;;){const n=await aM(e);if(n.length===0)return t;t.push(...n)}}function aM(e){return new Promise((t,n)=>{e.readEntries(t,a=>n(a))})}function Y0(e){const t=e.webkitRelativePath;return V0(typeof t=="string"&&t?t:e.name)}function lM(e){const t=e.webkitGetAsEntry?.();return oM(t)?t:null}function oM(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.name=="string"&&typeof t.isFile=="boolean"&&typeof t.isDirectory=="boolean"}function cM(e,t){return V0(e?`${e}/${t}`:t)}function V0(e){return e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).join("/")}function $0(e){return e?Array.from(e):[]}function X0(e){return e?Array.from(e):[]}const RS="nterminal.terminalLayout.v1",MS="nterminal.terminalWorkspaces.v2",G0="nterminal.sidebarCollapsed.v1",uM=75,AS=hb.map(e=>e.url),hM=hb[0].url;function dM({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a,sessionExpiresAt:o=null,onLogout:c=async()=>{},onSessionInvalid:d}){const p=S.useMemo(()=>e??eu(),[e]),_=S.useMemo(()=>t??tu(null),[t]),f=S.useMemo(()=>bM(n),[n]),b=S.useMemo(()=>O=>I0(n,O),[n]),v=S.useMemo(()=>()=>Qt(n),[n]),w=S.useSyncExternalStore(b,v,v),x=w.state;w.editors;const C=!w.loaded,E=w.error,[B,D]=S.useState(!1),[Z,A]=S.useState(()=>TM()),[P,z]=S.useState("servers"),[K,N]=S.useState(!1);S.useSyncExternalStore(wb,_y,_y);const[ae,de]=S.useState(()=>[null]),[Te,ce]=S.useState(()=>[n]),[Q,X]=S.useState(()=>new Set),[se,le]=S.useState(null),R=S.useRef(null);S.useRef(!1);const q=S.useRef(0),[$,ue]=S.useState(null),be=NC(Qv(ib,{activationConstraint:{distance:8}}),Qv(sb,{activationConstraint:{delay:250,tolerance:5}}));function T(O){const F=O.active.data.current;if(F){if(F.kind==="tab"&&typeof F.tabId=="string"&&typeof F.terminalId=="string"){ue({tabId:F.tabId,terminalId:F.terminalId});return}F.kind==="pane"&&typeof F.sourceTabId=="string"&&typeof F.terminalId=="string"&&ue({tabId:F.sourceTabId,terminalId:F.terminalId})}}function W(O){ue(null);const F=O.active.data.current,re=O.over?.data.current;if(!(!F||!re||typeof F.terminalId!="string")){if(F.kind==="tab"&&typeof F.tabId=="string"){if(re.kind==="tab-position"&&typeof re.index=="number"){Pe({type:"tab.reordered",sourceTabId:F.tabId,targetIndex:re.index});return}re.kind==="pane-zone"&&typeof re.terminalId=="string"&&(re.side==="top"||re.side==="right"||re.side==="bottom"||re.side==="left")&&Pe({type:"tab.dropped_into_pane",sourceTabId:F.tabId,sourceTerminalId:F.terminalId,targetTerminalId:re.terminalId,side:re.side});return}if(F.kind==="pane"&&typeof F.sourceTabId=="string"){if(re.kind==="tab-position"&&typeof re.index=="number"){Pe({type:"terminal.extracted_to_tab",sourceTabId:F.sourceTabId,sourceTerminalId:F.terminalId,targetIndex:re.index});return}re.kind==="pane-zone"&&typeof re.terminalId=="string"&&(re.side==="top"||re.side==="right"||re.side==="bottom"||re.side==="left")&&Pe({type:"tab.dropped_into_pane",sourceTabId:F.sourceTabId,sourceTerminalId:F.terminalId,targetTerminalId:re.terminalId,side:re.side})}}}function oe(){ue(null)}const ne=x.workspaces.find(O=>O.id===x.activeWorkspaceId)??x.workspaces[0],_e=ne?.tabs.find(O=>O.id===ne.activeTabId)??ne?.tabs[0],fe=_e?.activeTerminalId??null,xe=fe?x.terminals[fe]:void 0,qe=S.useMemo(()=>{const O=new Set;for(const F of x.workspaces)for(const re of F.tabs)for(const ge of t_(re))O.add(ge);return Object.values(x.terminals).filter(F=>!O.has(F.id))},[x.terminals,x.workspaces]),[Me,Ae]=S.useState(null),[Ze,nt]=S.useState(null),[Re,te]=S.useState([]),[we,Ce]=S.useState(()=>vr()),Le=S.useRef(0),$e=S.useRef(n),St=S.useRef(AS),V=S.useRef(we),He=S.useRef(()=>{});He.current=Hs;const st=S.useCallback(async()=>{try{const O=await p.listNotificationAssets();te(O.assets.filter(F=>F.enabled).map(F=>F.url))}catch{te([])}},[p]);S.useEffect(()=>{ce(O=>O.some(F=>Un(F,n))?O:[...O,n])},[n]),S.useEffect(()=>{let O=!1;return p.listAgents().then(F=>{if(!O){const re=[null,...F.agents.map(ge=>ge.id)];re.some(ge=>Un(ge,n))||re.push(n),de(re)}}).catch(()=>{}),()=>{O=!0}},[n,p]),S.useEffect(()=>{de(O=>O.some(F=>Un(F,n))?O:[...O,n])},[n]),S.useEffect(()=>{$e.current=n},[n]),S.useEffect(()=>{st()},[st]),S.useEffect(()=>pb(()=>Ce(vr())),[]),S.useEffect(()=>{const O=F=>{He.current(F)};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[]),S.useEffect(()=>{St.current=Re.length>0?Re:AS},[Re]),S.useEffect(()=>{V.current=we},[we]),S.useEffect(()=>{if(!w.loaded||!ne||!_e)return;const O=Q0(n,ne.id,_e.id);X(F=>{if(F.has(O))return F;const re=new Set(F);return re.add(O),re})},[n,w.loaded,ne?.id,_e?.id]),S.useEffect(()=>()=>{wt()},[]),S.useEffect(()=>TR(O=>{const F=Qt(O.agentId).state,re=F.workspaces.flatMap(Ne=>Ne.tabs).find(Ne=>Ne.id===O.tabId),ge=F.terminals[O.terminalId],ke=re?.title?.trim()||ge?.title||O.commandName||"terminal",tt=document.visibilityState==="visible"&&Un(O.agentId,$e.current)&&O.tabId===SM(F);if(tt||Jx({tabTitle:ke,commandName:O.commandName,terminalId:O.terminalId}),!tt&&document.visibilityState==="visible"&&V.current.enabled){const Ne=Le.current+1;Le.current=Ne;const ct=St.current;nt({id:Ne,agentId:O.agentId,terminalId:O.terminalId,tabId:O.tabId,tabTitle:ke,commandName:O.commandName,assetSrc:ct[Math.floor(Math.random()*ct.length)]??hM})}}),[]),S.useEffect(()=>{if(!Ze||we.persistUntilDismissed)return;const O=window.setTimeout(()=>{nt(F=>F?.id===Ze.id?null:F)},we.durationSeconds*1e3);return()=>window.clearTimeout(O)},[Ze,we]),S.useEffect(()=>{R.current?.focus(),R.current?.select()},[se?.workspaceId]),S.useEffect(()=>{kM(Z),Z&&le(null)},[Z]),S.useEffect(()=>{let O=!1;async function F(){if(!Qt(n).loaded){ra(n,!1,null);try{const ge=wM(f),[ke,tt]=await Promise.all([_.listTerminals(),_.getTerminalLayout()]),Ne=ke.terminals.length>0?ke.terminals:[(await _.createTerminal({cols:80,rows:24})).terminal];if(!O){const ct=tt.layout?J0(tt.layout):null,ht=ct??ge??{},di=cp(Ne,ht.savedTabs,ht.savedWorkspaces,ht.savedActiveWorkspaceId),un=ef(di);CS(n,di),kc(n,tt.revision,JSON.stringify(un)),ra(n,!0,null),!ct&&ge&&Bt(un,{baseRevision:tt.revision})}}catch(ge){!O&&!si(ge)&&ra(n,!0,Dc(ge))}}}return F(),()=>{O=!0}},[n,_]);async function yi(){await Dt(async()=>{const O=await _.createTerminal({cols:80,rows:24});Pe({type:"terminal.created",terminal:O.terminal})})}async function bt(O){await Dt(async()=>{const F=fe?{parentTerminalId:fe,cols:80,rows:24}:{cols:80,rows:24},re=await _.createTerminal(F);Pe({type:"terminal.split",terminal:re.terminal,direction:O})})}async function fs(O){if(!fe)throw new Error("No active pane is available.");const F=await _.readFile(O),re=`editor-${Date.now().toString(36)}-${AR(n)}`,ge=EM(F.path);xS(n,ke=>({...ke,[re]:{id:re,title:ge,rootToken:O.rootToken,path:F.path,read:F}})),Pe({type:"editor.split",editorId:re,title:ge,direction:"vertical"})}function ps(O){xS(n,F=>{const re={...F};return delete re[O],re}),Pe({type:"editor.closed",editorId:O})}function ti(O){ii([O])}function ii(O){for(const F of O)Pe({type:"terminal.detached",terminalId:F})}async function Ci(O){await Dt(async()=>{await Os(O),M0(_.createWebSocketUrl(O)),oD(O),Pe({type:"terminal.closed",terminalId:O})})}async function Ls(O,F){const re=F.trim();if(!re)return;let ge=null;for(const ke of x.workspaces){const tt=ke.tabs.find(Ne=>Ne.id===O);if(tt){ge=tt.activeTerminalId;break}}if(Pe({type:"tab.renamed",tabId:O,title:re}),!!ge)try{const ke=await _.renameTerminal(ge,re);zs({type:"terminal.updated",terminal:ke.terminal})}catch(ke){ra(n,!0,Dc(ke))}}function xi(O){const F=x.terminals[O];F&&Pe({type:"terminal.created",terminal:F})}async function Os(O){try{await _.closeTerminal(O)}catch(F){if(F instanceof ln&&F.status===404)return;throw F}}async function _s(){await Dt(async()=>{await c()})}async function Dt(O){ra(n,!0,null);try{await O()}catch(F){if(si(F))return;ra(n,!0,Dc(F))}}function si(O){return O instanceof ln&&O.status===401&&!_.isAgent&&d?(d(),!0):!1}function Pe(O){Sl(n,O);const F=Qt(n),re=F.state;if(!F.loaded||re.workspaces.length===0)return;const ge=ef(re);JSON.stringify(ge)!==F.lastPersistedLayoutJson&&Nt(ge)}function zs(O){Sl(n,O)}function Hs(O){if(K||O.isComposing||O.key==="Process"||vM(O.target))return;const F=pM(O);if(!F)return;if(O.preventDefault(),O.stopPropagation(),F.type==="server.previous"||F.type==="server.next"){Yn(F.type==="server.next"?1:-1);return}const re=Qt(n).state,ge=re.workspaces.find(Ne=>Ne.id===re.activeWorkspaceId)??re.workspaces[0],ke=ge?.tabs.find(Ne=>Ne.id===ge.activeTabId)??ge?.tabs[0];if(F.type==="split"){if(!ke)return;bt(F.direction);return}if(!ge||!ke)return;if(F.type==="tab.previous"||F.type==="tab.next"){const Ne=gM(ge.tabs,ke.id,F.type==="tab.next"?1:-1);Ne&&Pe({type:"tab.selected",tabId:Ne.id});return}if(F.type==="tab.index"){const Ne=ge.tabs[F.index-1];Ne&&Pe({type:"tab.selected",tabId:Ne.id});return}const tt=_M(ke.root,ke.activeTerminalId,F);tt&&Pe({type:"pane.selected",terminalId:tt})}function Yn(O){if(!a||ae.length===0)return;const F=ae.findIndex(tt=>Un(tt,n)),ge=((F===-1?0:F)+O+ae.length)%ae.length,ke=ae[ge]??null;Un(ke,n)||a(ke)}function ms(O){DS(O.dataTransfer)&&(O.preventDefault(),O.dataTransfer.dropEffect="copy")}function Xi(O){if(!DS(O.dataTransfer))return;O.preventDefault();const F=CM(Qt(n).state),re=q.current+1;if(q.current=re,!F){Ae({id:re,status:"failed",fileCount:0,message:"No active running terminal is available for upload."});return}Ae({id:re,status:"queued",fileCount:0,message:"Preparing upload..."}),We(re,F.id,O.dataTransfer)}async function We(O,F,re){try{const ge=await tM(re);if(ge.length===0)throw new Error("No files were found in the drop.");ut(O,{id:O,status:"uploading",fileCount:ge.length,loaded:0,total:null,percent:null});const ke=await CE({terminalId:F,files:ge,onProgress:ht=>{ut(O,{id:O,status:"uploading",fileCount:ge.length,loaded:ht.loaded,total:ht.total,percent:ht.percent})}}),tt=ke.failed>0?ke.uploaded>0?"partial":"failed":"success",Ne=ke.failed>0?xM(ke):void 0,ct={id:O,status:tt,fileCount:ge.length,response:ke};Ne&&(ct.message=Ne),ut(O,ct)}catch(ge){ut(O,{id:O,status:"failed",fileCount:0,message:Dc(ge)})}}function ut(O,F){Ae(re=>re?.id===O?F:re)}function Rt(O){Sl(O.agentId,{type:"pane.selected",terminalId:O.terminalId}),MR(O.agentId,O.tabId),Un(O.agentId,n)||a?.(O.agentId),nt(null)}function Nt(O){const F=Qt(n).mutable.saveCoord;F.pendingLayoutSave=O,bl(O,f),F.saveTimer!==null&&window.clearTimeout(F.saveTimer),F.saveTimer=window.setTimeout(()=>{F.saveTimer=null;const re=F.pendingLayoutSave;F.pendingLayoutSave=null,re&&Bt(re)},uM)}function wt(){const O=Qt(n).mutable.saveCoord;O.saveTimer!==null&&(window.clearTimeout(O.saveTimer),O.saveTimer=null);const F=O.pendingLayoutSave;O.pendingLayoutSave=null,F&&(bl(F,f),Bt(F))}function Bt(O,F={}){const re=Qt(n).mutable.saveCoord;re.nextPersistLayout=O,F.baseRevision!==void 0&&(re.queuedBaseRevision=F.baseRevision),!re.nextPersistQueued&&(re.nextPersistQueued=!0,re.persistChain=re.persistChain.then(async()=>{re.nextPersistQueued=!1;const ge=re.nextPersistLayout,ke=re.queuedBaseRevision;re.nextPersistLayout=null,re.queuedBaseRevision=void 0,ge&&await Vt(ge,ke!==void 0?{baseRevision:ke}:{})}))}async function Vt(O,F={}){const re=Qt(n),ge=F.baseRevision??re.layoutRevision,ke={layout:O,...typeof ge=="number"?{baseRevision:ge}:{}};try{const tt=await _.saveTerminalLayout(ke),Ne=tt.layout??O;kc(n,tt.revision,JSON.stringify(Ne)),bl(Ne,f);return}catch(tt){if(tt instanceof ln&&tt.status===409)try{const Ne=await _.getTerminalLayout();if(Ne.layout){const ct=Qt(n).state,ht=cp(Object.values(ct.terminals),void 0,Ne.layout.workspaces,Ne.layout.activeWorkspaceId),di=ef(ht);CS(n,ht),kc(n,Ne.revision,JSON.stringify(di)),bl(di,f)}else kc(n,Ne.revision,re.lastPersistedLayoutJson);return}catch{}bl(O,f)}}const hi=DM(o),lt=!Z||B,$t=lt?P:"servers";return g.jsx(Nx,{sensors:be,onDragStart:T,onDragEnd:W,onDragCancel:oe,children:g.jsxs("main",{className:"terminal-shell","data-collapsed":Z,"data-sidebar-open":B,onDragOver:ms,onDrop:Xi,children:[g.jsx("button",{type:"button",className:"workspace-backdrop","aria-label":"Close workspaces",onClick:()=>D(!1)}),g.jsxs("aside",{className:"workspace-sidebar",children:[g.jsxs("header",{className:"workspace-brand",children:[lt?g.jsx(KS,{height:20}):g.jsx(PS,{size:24}),g.jsx("button",{type:"button",className:"sidebar-collapse-button","aria-label":Z?"Expand sidebar":"Collapse sidebar",title:Z?"Expand sidebar":"Collapse sidebar",onClick:()=>A(O=>!O),children:Z?">":"<"}),g.jsx("button",{type:"button",className:"sidebar-drawer-close-button","aria-label":"Close workspaces",title:"Close workspaces",onClick:()=>D(!1),children:"x"})]}),g.jsxs("div",{className:"workspace-sidebar-content",children:[lt?g.jsxs("div",{className:"workspace-sidebar-tabs",role:"tablist","aria-label":"Sidebar mode",children:[g.jsx("button",{type:"button",role:"tab","aria-selected":P==="servers",onClick:()=>{z("servers"),le(null)},children:"Servers"}),g.jsx("button",{type:"button",role:"tab","aria-selected":P==="files",onClick:()=>{z("files"),le(null)},children:"Files"})]}):null,$t==="servers"&&lt?g.jsx("nav",{className:"workspace-nav","aria-label":"Servers",children:g.jsx(Bd,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d})}):null,lt?null:g.jsx("nav",{className:"workspace-nav workspace-nav--collapsed","aria-label":"Servers",children:g.jsx(Bd,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d,compact:!0})}),$t==="files"?g.jsxs(g.Fragment,{children:[lt?g.jsx("nav",{className:"workspace-nav workspace-nav--compact","aria-label":"Servers",children:g.jsx(Bd,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d})}):null,g.jsx(DE,{api:_,activeTerminalId:fe,activeTerminalCwd:xe?.cwd??null,onOpenFile:fs})]}):null]}),lt?g.jsxs("div",{className:"workspace-sidebar-footer",children:[g.jsx("span",{children:hi}),g.jsxs("div",{className:"workspace-sidebar-footer-actions",children:[g.jsx("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"settings",title:"Settings",onClick:()=>N(!0),children:g.jsx(NS,{name:"settings"})}),g.jsx("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"logout",title:"Logout",onClick:()=>{_s()},children:g.jsx(NS,{name:"logout"})})]})]}):null]}),K?g.jsx(bE,{api:p,onClose:()=>N(!1),onNotificationAssetsChanged:()=>{st()}}):null,g.jsxs("section",{className:"terminal-main","aria-label":"Terminal workspace",children:[g.jsx(OR,{tabs:ne?.tabs??[],activeTabId:ne?.activeTabId??null,terminals:x.terminals,unreadCompletionTabIds:w.unreadCompletions,detachedTerminals:qe,onSelectTab:O=>Pe({type:"tab.selected",tabId:O}),onCreateTab:()=>{yi()},onToggleWorkspaces:()=>D(O=>!O),onCloseTerminals:O=>ii(O),onReattachTerminal:O=>xi(O),onDeleteTerminal:O=>{Ci(O)},onSplitVertical:()=>{bt("vertical")},onSplitHorizontal:()=>{bt("horizontal")},onRenameTab:(O,F)=>{Ls(O,F)},activePaneAvailable:!!fe}),E?g.jsx("div",{className:"workspace-error",children:E}):null,g.jsxs("section",{className:"workspace-body","aria-busy":C,children:[C?g.jsx("div",{className:"workspace-placeholder",children:"Opening shell..."}):null,!C&&!_e?g.jsx(yM,{onCreate:()=>{yi()}}):null,Te.map(O=>{const F=Un(O,n);return g.jsx(fM,{agentId:O,active:F,activeServerApi:F?_:void 0,visitedTabKeys:Q,refreshCwdOnEnter:F&&$t==="files",draggingTab:F?$:null,onSelect:re=>{F&&Pe({type:"pane.selected",terminalId:re})},onClose:re=>{F&&ti(re)},onCloseEditor:re=>{F&&ps(re)},onResize:(re,ge)=>{F&&Pe({type:"pane.resized",path:re,ratio:ge})},onExit:(re,ge)=>{F?zs({type:"terminal.exited",terminalId:re,exitCode:ge}):Sl(O,{type:"terminal.exited",terminalId:re,exitCode:ge})},onSnapshot:(re,ge)=>{const ke={type:"terminal.updated",terminal:re,notifyCompletion:ge?.notifyCompletion===!0};F?zs(ke):Sl(O,ke)},...O===null&&d?{onAuthClose:d}:{}},Z0(O))})]}),g.jsx(WR,{toast:Ze,onActivate:Rt,onDismiss:()=>nt(null)}),g.jsx(UR,{toast:Me,onDismiss:()=>Ae(null)})]})]})})}function fM({agentId:e,active:t,activeServerApi:n,visitedTabKeys:a,refreshCwdOnEnter:o,draggingTab:c,onSelect:d,onClose:p,onCloseEditor:_,onResize:f,onExit:b,onSnapshot:v,onAuthClose:w}){const x=S.useMemo(()=>N=>I0(e,N),[e]),C=S.useMemo(()=>()=>Qt(e),[e]),E=S.useSyncExternalStore(x,C,C),B=S.useMemo(()=>tu(e),[e]),D=n??B,Z=E.state,A=Z.workspaces.find(N=>N.id===Z.activeWorkspaceId)??Z.workspaces[0],P=A?.id??null,K=(A?.tabs.find(N=>N.id===A.activeTabId)??A?.tabs[0])?.id??null;return!E.loaded||Z.workspaces.length===0?null:g.jsx("div",{className:"workspace-server-surface","data-active":t,"aria-hidden":!t,children:Z.workspaces.flatMap(N=>N.tabs.map(ae=>{const de=t&&N.id===P&&ae.id===K;return!de&&!a.has(Q0(e,N.id,ae.id))?null:g.jsx("div",{className:"workspace-tab-surface","data-active":de,"aria-hidden":!de,children:g.jsx(lp,{node:ae.root,terminals:Z.terminals,editors:E.editors,api:D,activeTerminalId:ae.activeTerminalId,visible:de,refreshCwdOnEnter:de&&o,tabId:ae.id,dropZoneActive:de&&c!==null,draggingTerminalId:de?c?.terminalId??null:null,onSelect:d,onClose:p,onCloseEditor:_,onResize:f,onExit:b,onSnapshot:v,...w?{onAuthClose:w}:{}})},`${N.id}:${ae.id}`)}))})}function pM(e){const t=oE(e);if(t)switch(t.id){case"server.previous":case"server.next":case"tab.previous":case"tab.next":return{type:t.id};case"tab.index":case"pane.index":return t.index===null?null:{type:t.id,index:t.index};case"split.right":return{type:"split",direction:"vertical"};case"split.down":return{type:"split",direction:"horizontal"};default:return null}if(e.ctrlKey&&e.altKey&&!e.metaKey&&!e.shiftKey){const n=mM(e.key);return n?{type:"pane.direction",direction:n}:null}return null}function _M(e,t,n){switch(n.type){case"pane.direction":return $R(e,t,n.direction);case"pane.index":return XR(e,n.index);default:return null}}function mM(e){switch(e){case"ArrowLeft":return"left";case"ArrowRight":return"right";case"ArrowUp":return"up";case"ArrowDown":return"down";default:return null}}function gM(e,t,n){if(e.length===0)return null;const a=e.findIndex(c=>c.id===t);return e[((a===-1?0:a)+n+e.length)%e.length]??null}function vM(e){if(!(e instanceof HTMLElement)||e.closest(".xterm"))return!1;if(e.closest('input, textarea, select, [role="textbox"]'))return!0;const t=e.closest("[contenteditable]");return t instanceof HTMLElement&&t.getAttribute("contenteditable")?.toLowerCase()!=="false"}function yM({onCreate:e}){return g.jsxs("div",{className:"empty-workspace",children:[g.jsx("span",{children:"No terminal is open."}),g.jsx("button",{type:"button",onClick:e,children:"New tab"})]})}function Un(e,t){return e===t}function SM(e){const t=e.workspaces.find(a=>a.id===e.activeWorkspaceId)??e.workspaces[0];return(t?.tabs.find(a=>a.id===t.activeTabId)??t?.tabs[0])?.id??null}function Z0(e){return e??"__local__"}function Q0(e,t,n){return`${Z0(e)}:${t}:${n}`}function bM(e){return e?{workspaceKey:`${MS}:${e}`,layoutKey:`${RS}:${e}`}:{workspaceKey:MS,layoutKey:RS}}function wM(e){const t=localStorage.getItem(e.workspaceKey);if(t)try{const a=JSON.parse(t),o=cb(a);if(o)return J0(o)}catch{}const n=localStorage.getItem(e.layoutKey);if(!n)return null;try{const a=JSON.parse(n);return!Array.isArray(a)||!a.every(Ix)?null:{savedTabs:a}}catch{return null}}function J0(e){const t=cb(e);return t?{savedWorkspaces:t.workspaces,savedActiveWorkspaceId:t.activeWorkspaceId}:null}function bl(e,t){if(e.workspaces.length>0){localStorage.setItem(t.workspaceKey,JSON.stringify(e)),localStorage.removeItem(t.layoutKey);return}localStorage.removeItem(t.workspaceKey)}function CM(e){const t=e.workspaces.find(o=>o.id===e.activeWorkspaceId)??e.workspaces[0],n=t?.tabs.find(o=>o.id===t.activeTabId)??t?.tabs[0],a=n?e.terminals[n.activeTerminalId]:void 0;return a?.status==="running"?a:null}function xM(e){return e.results.find(t=>t.status==="failed"&&t.error)?.error}function EM(e){return e.split("/").filter(Boolean).pop()??e}function TM(){try{return localStorage.getItem(G0)==="true"}catch{return!1}}function kM(e){try{localStorage.setItem(G0,e?"true":"false")}catch{}}function DM(e){if(!e)return"session · local";const t=Date.parse(e);if(!Number.isFinite(t))return"session · local";const n=t-Date.now();if(n<=0)return"session · expired";const a=Math.max(1,Math.floor(n/6e4));return a<60?`session · ${a}m left`:`session · ${Math.floor(a/60)}h left`}function NS({name:e}){return g.jsxs("svg",{className:"workspace-footer-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[e==="settings"?g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M4 7h9"}),g.jsx("path",{d:"M17 7h3"}),g.jsx("circle",{cx:"15",cy:"7",r:"2"}),g.jsx("path",{d:"M4 12h3"}),g.jsx("path",{d:"M11 12h9"}),g.jsx("circle",{cx:"9",cy:"12",r:"2"}),g.jsx("path",{d:"M4 17h9"}),g.jsx("path",{d:"M17 17h3"}),g.jsx("circle",{cx:"15",cy:"17",r:"2"})]}):null,e==="logout"?g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M10 6H6v12h4"}),g.jsx("path",{d:"M13 8l4 4-4 4"}),g.jsx("path",{d:"M8 12h9"})]}):null]})}function Dc(e){return e instanceof Error?e.message:"Request failed"}function RM({api:e,onDone:t}){const[n,a]=S.useState(null),[o,c]=S.useState(null),[d,p]=S.useState(""),[_,f]=S.useState(!1),[b,v]=S.useState(null),[w,x]=S.useState(null);S.useEffect(()=>{let E=!1;return e.setupTotp().then(B=>{E||(a(B.qrDataUrl),c(B.secret))}).catch(B=>{E||x(B instanceof Error?B.message:"Failed to generate QR code")}),()=>{E=!0}},[e]);async function C(E){if(E.preventDefault(),!!o){f(!0),v(null);try{await e.activateTotp({secret:o,otp:d}),t()}catch(B){v(B instanceof Error?B.message:"Verification failed")}finally{f(!1)}}}return w?g.jsx("p",{className:"form-error",children:w}):!n||!o?g.jsx("p",{className:"muted",children:"Generating authenticator setup..."}):g.jsxs("div",{className:"totp-setup",children:[g.jsx("p",{className:"totp-setup-instructions",children:"Scan this QR code with an authenticator app (Google Authenticator, Authy, 1Password, etc.), then enter the 6-digit code to confirm."}),g.jsx("div",{className:"totp-qr-container",children:g.jsx("img",{src:n,alt:"TOTP QR code",width:192,height:192})}),g.jsxs("details",{className:"totp-secret-details",children:[g.jsx("summary",{children:"Can't scan? Enter manually"}),g.jsx("p",{className:"totp-secret-text",children:o})]}),g.jsxs("form",{className:"auth-form",onSubmit:C,children:[g.jsxs("label",{children:["Verification code",g.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:d,onChange:E=>p(E.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),b?g.jsx("p",{className:"form-error",children:b}):null,g.jsx("button",{type:"submit",disabled:_||d.length!==6,children:"Activate 2FA"})]})]})}function MM({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a}){const o=S.useMemo(()=>e??eu(),[e]),c=S.useMemo(()=>t??tu(null),[t]),[d,p]=S.useState(null),[_,f]=S.useState(null);S.useEffect(()=>{let C=!1;return o.getSession().then(E=>{C||(p(E),f(null))}).catch(E=>{C||(f(Vl(E)),p(null))}),()=>{C=!0}},[o]);const b=LM(d);async function v(){const C=await o.getSession();p(C),f(null)}async function w(){vS(),ES(),cD(),f(null),p(null);try{await v()}catch(C){f(Vl(C))}}if(b==="workspace")return g.jsx(dM,{api:o,serverApi:c,activeAgentId:n,onSelectServer:a,sessionExpiresAt:d?.expiresAt??null,onSessionInvalid:()=>{w()},onLogout:async()=>{vS(),ES();const C=await o.logout();p(C)}});const x={loading:"Terminal",setup_password:"Set password",setup_totp:"Set up 2FA",login:"Unlock terminal",reauth:"Verify it’s you",workspace:"Terminal"};return g.jsxs("main",{className:"auth-screen",children:[g.jsxs("div",{className:"auth-background","aria-hidden":"true",children:[g.jsx("div",{className:"auth-grid"}),g.jsx("div",{className:"auth-glow"})]}),g.jsxs("section",{className:"auth-panel","aria-busy":b==="loading",children:[g.jsxs("header",{className:"auth-header",children:[g.jsxs("div",{className:"auth-brand",children:[g.jsx(PS,{size:26}),g.jsxs("div",{children:[g.jsx(KS,{height:17}),g.jsx("p",{className:"auth-host",children:"local terminal"})]})]}),g.jsx("h1",{children:x[b]})]}),_?g.jsx("p",{className:"form-error",children:_}):null,b==="loading"?g.jsx("p",{className:"muted",children:"Checking session..."}):null,b==="loading"&&_?g.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{w()},children:"Retry"}):null,b==="setup_password"?g.jsx(AM,{api:o,onSession:C=>{p(C)}}):null,b==="setup_totp"?g.jsx(RM,{api:o,onDone:()=>{v()}}):null,b==="login"?g.jsx(NM,{api:o,session:d,onSession:p,onRefresh:v}):null,b==="reauth"?g.jsx(BM,{api:o,session:d,onSession:p,onFullLogin:()=>p(C=>C&&{...C,deviceTrusted:!1})}):null]})]})}function AM({api:e,onSession:t}){const[n,a]=S.useState(""),[o,c]=S.useState(""),[d,p]=S.useState(!1),[_,f]=S.useState(null);async function b(v){v.preventDefault(),p(!0),f(null);try{if(n!==o){f("Passwords do not match");return}t(await e.setupPassword({password:n}))}catch(w){f(Vl(w))}finally{p(!1)}}return g.jsxs("form",{className:"auth-form",onSubmit:b,children:[g.jsxs("label",{children:["Password",g.jsx("input",{autoFocus:!0,value:n,onChange:v=>a(v.currentTarget.value),type:"password",minLength:8,required:!0})]}),g.jsxs("label",{children:["Confirm password",g.jsx("input",{value:o,onChange:v=>c(v.currentTarget.value),type:"password",minLength:8,required:!0})]}),_?g.jsx("p",{className:"form-error",children:_}):null,g.jsx("button",{type:"submit",disabled:d||n.length<8||o.length<8,children:"Set password"})]})}function NM({api:e,session:t,onSession:n,onRefresh:a}){const[o,c]=S.useState(""),[d,p]=S.useState(""),[_,f]=S.useState(!1),[b,v]=S.useState(!1),[w,x]=S.useState(null),C=t?.totpEnabled??!1,E=t?.currentIpWhitelisted??!1;async function B(D){D.preventDefault(),v(!0),x(null);try{n(await e.login({password:o,...C?{otp:d}:{},rememberNetwork:_}))}catch(Z){x(Vl(Z))}finally{v(!1)}}return g.jsxs("form",{className:"auth-form",onSubmit:B,children:[g.jsxs("label",{children:["Password",g.jsx("input",{autoFocus:!0,type:"password",value:o,onChange:D=>c(D.currentTarget.value),required:!0})]}),C?g.jsxs("label",{children:["Authenticator code",g.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:d,onChange:D=>p(D.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}):null,E?null:g.jsxs("label",{className:"auth-checkbox",children:[g.jsx("input",{type:"checkbox",checked:_,onChange:D=>f(D.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),w?g.jsx("p",{className:"form-error",children:w}):null,g.jsxs("div",{className:"button-row",children:[g.jsx("button",{type:"submit",disabled:b||o.length===0||C&&d.length!==6,children:"Unlock"}),g.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a()},disabled:b,children:"Refresh"})]})]})}function BM({api:e,session:t,onSession:n,onFullLogin:a}){const o=t?.currentIpWhitelisted??!1,[c,d]=S.useState(""),[p,_]=S.useState(!1),[f,b]=S.useState(!1),[v,w]=S.useState(null),x=gi.useRef(!1),C=gi.useCallback(async(B,D)=>{b(!0),w(null);try{n(await e.reauth({...B?{otp:B}:{},rememberNetwork:D}))}catch(Z){w(Vl(Z))}finally{b(!1)}},[e,n]);S.useEffect(()=>{o&&!x.current&&(x.current=!0,C(void 0,!1))},[o,C]);async function E(B){B.preventDefault(),await C(c,p)}return o&&!v?g.jsx("p",{className:"muted",children:"Reconnecting from a trusted network…"}):g.jsxs("form",{className:"auth-form",onSubmit:E,children:[g.jsx("p",{className:"muted",children:"This device is remembered. Enter your authenticator code to continue."}),g.jsxs("label",{children:["Authenticator code",g.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:c,onChange:B=>d(B.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),g.jsxs("label",{className:"auth-checkbox",children:[g.jsx("input",{type:"checkbox",checked:p,onChange:B=>_(B.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),v?g.jsx("p",{className:"form-error",children:v}):null,g.jsxs("div",{className:"button-row",children:[g.jsx("button",{type:"submit",disabled:f||c.length!==6,children:"Continue"}),g.jsx("button",{type:"button",className:"secondary-button",onClick:a,disabled:f,children:"Use password instead"})]})]})}function LM(e){return e?e.passwordSet?e.authenticated&&!e.totpEnabled?"setup_totp":e.authenticated?"workspace":e.deviceTrusted&&e.totpEnabled?"reauth":"login":"setup_password":"loading"}function Vl(e){return e instanceof Error?e.message:"Request failed"}const BS="NTerminal",vp="nterminal.activeAgentId";function OM(){const[e,t]=S.useState(()=>zM()),n=S.useMemo(()=>eu(),[]),a=S.useMemo(()=>tu(e),[e]);S.useEffect(()=>{const c=()=>{const d=RR();document.title=d>0?`(${d}) ${BS}`:BS};return c(),DR(c)},[]);function o(c){HM(c),t(c)}return g.jsx(MM,{api:n,activeAgentId:e,serverApi:a,onSelectServer:o})}function zM(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(vp);return e&&e.trim()?e:null}catch{return null}}function HM(e){if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(vp,e);return}window.localStorage.removeItem(vp)}catch{}}const LS=["gesturestart","gesturechange","gestureend"],jM=[".workspace-list",".terminal-tab-list",".mobile-terminal-key-bar",".upload-toast-body",".file-tree",".file-detail",".file-editor",".file-markdown-preview",".editor-markdown-preview"].join(",");function UM(e=window){if(!KM(e))return()=>{};const t={passive:!1},n=e.document;function a(c){c.cancelable&&c.preventDefault()}function o(c){if(c.defaultPrevented)return;const d=c.touches;!d||d.length===0||(d.length>1||!PM(c.target))&&a(c)}for(const c of LS)n.addEventListener(c,a,t);return n.addEventListener("touchmove",o,t),n.addEventListener("dblclick",a,t),()=>{for(const c of LS)n.removeEventListener(c,a,t);n.removeEventListener("touchmove",o,t),n.removeEventListener("dblclick",a,t)}}function PM(e){return e instanceof Element&&e.closest(jM)!==null}function KM(e){return e.navigator.maxTouchPoints>0?!0:typeof e.matchMedia=="function"&&e.matchMedia("(pointer: coarse)").matches}const OS="--nterminal-viewport-height",zS="--nterminal-keyboard-inset-bottom",HS="data-nterminal-keyboard-visible",IM=120;function FM(e=window){const t=e.document.documentElement,n=e.visualViewport;function a(){const o=qM(e);o!==null&&t.style.setProperty(OS,`${o}px`),t.style.setProperty(zS,`${ew(e)}px`),t.setAttribute(HS,String(WM(e)))}return a(),n?.addEventListener("resize",a),n?.addEventListener("scroll",a),e.addEventListener("resize",a),e.addEventListener("orientationchange",a),e.addEventListener("pageshow",a),e.document.addEventListener("visibilitychange",a),()=>{n?.removeEventListener("resize",a),n?.removeEventListener("scroll",a),e.removeEventListener("resize",a),e.removeEventListener("orientationchange",a),e.removeEventListener("pageshow",a),e.document.removeEventListener("visibilitychange",a),t.style.removeProperty(OS),t.style.removeProperty(zS),t.removeAttribute(HS)}}function qM(e){const t=e.visualViewport?.height;return Jc(t)?t:Jc(e.innerHeight)?e.innerHeight:null}function Jc(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function WM(e){return ew(e)>IM}function ew(e){const t=e.visualViewport?.height;if(!Jc(t)||!Jc(e.innerHeight))return 0;const n=typeof e.visualViewport?.offsetTop=="number"?e.visualViewport.offsetTop:0;return Math.max(0,Math.round(e.innerHeight-t-n))}FM();UM();Pp();gC.createRoot(document.getElementById("root")).render(g.jsx(gi.StrictMode,{children:g.jsx(OM,{})}));export{oC as g,g as j};