nterminal 1.2.40 → 1.2.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/MarkdownPreview-aLa0IUrr.js +1 -0
- package/dist/client/assets/{TranscriptMarkdownBody-D8UaEq5F.js → TranscriptMarkdownBody-DHCOvicf.js} +1 -1
- package/dist/client/assets/index-Cml5_vID.js +54 -0
- package/dist/client/assets/{index-t_kGO29w.js → index-Cuh0iSQN.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/MarkdownPreview-BK2F1vOc.js +0 -1
- package/dist/client/assets/index-Cetq05p1.js +0 -54
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPreview-BK2F1vOc.js","assets/index-t_kGO29w.js","assets/TranscriptMarkdownBody-D8UaEq5F.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
(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 h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).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 dx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jd={exports:{}},zl={};var My;function fx(){if(My)return zl;My=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var h=null;if(c!==void 0&&(h=""+c),o.key!==void 0&&(h=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:h,ref:o!==void 0?o:null,props:c}}return zl.Fragment=t,zl.jsx=n,zl.jsxs=n,zl}var Ny;function px(){return Ny||(Ny=1,Jd.exports=fx()),Jd.exports}var _=px(),ef={exports:{}},He={};var Ay;function mx(){if(Ay)return He;Ay=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"),h=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),w=Symbol.iterator;function x(R){return R===null||typeof R!="object"?null:(R=w&&R[w]||R["@@iterator"],typeof R=="function"?R:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,O={};function D(R,V,se){this.props=R,this.context=V,this.refs=O,this.updater=se||E}D.prototype.isReactComponent={},D.prototype.setState=function(R,V){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,V,"setState")},D.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function Y(){}Y.prototype=D.prototype;function F(R,V,se){this.props=R,this.context=V,this.refs=O,this.updater=se||E}var G=F.prototype=new Y;G.constructor=F,T(G,D.prototype),G.isPureReactComponent=!0;var re=Array.isArray;function ee(){}var J={H:null,A:null,T:null,S:null},oe=Object.prototype.hasOwnProperty;function de(R,V,se){var he=se.ref;return{$$typeof:e,type:R,key:V,ref:he!==void 0?he:null,props:se}}function A(R,V){return de(R.type,V,R.props)}function P(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function K(R){var V={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(se){return V[se]})}var j=/\/+/g;function B(R,V){return typeof R=="object"&&R!==null&&R.key!=null?K(""+R.key):V.toString(36)}function Q(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(ee,ee):(R.status="pending",R.then(function(V){R.status==="pending"&&(R.status="fulfilled",R.value=V)},function(V){R.status==="pending"&&(R.status="rejected",R.reason=V)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function N(R,V,se,he,ye){var me=typeof R;(me==="undefined"||me==="boolean")&&(R=null);var fe=!1;if(R===null)fe=!0;else switch(me){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(R.$$typeof){case e:case t:fe=!0;break;case b:return fe=R._init,N(fe(R._payload),V,se,he,ye)}}if(fe)return ye=ye(R),fe=he===""?"."+B(R,0):he,re(ye)?(se="",fe!=null&&(se=fe.replace(j,"$&/")+"/"),N(ye,V,se,"",function(Ne){return Ne})):ye!=null&&(P(ye)&&(ye=A(ye,se+(ye.key==null||R&&R.key===ye.key?"":(""+ye.key).replace(j,"$&/")+"/")+fe)),V.push(ye)),1;fe=0;var Me=he===""?".":he+":";if(re(R))for(var Re=0;Re<R.length;Re++)he=R[Re],me=Me+B(he,Re),fe+=N(he,V,se,me,ye);else if(Re=x(R),typeof Re=="function")for(R=Re.call(R),Re=0;!(he=R.next()).done;)he=he.value,me=Me+B(he,Re++),fe+=N(he,V,se,me,ye);else if(me==="object"){if(typeof R.then=="function")return N(Q(R),V,se,he,ye);throw V=String(R),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return fe}function I(R,V,se){if(R==null)return R;var he=[],ye=0;return N(R,he,"","",function(me){return V.call(se,me,ye++)}),he}function X(R){if(R._status===-1){var V=R._result;V=V(),V.then(function(se){(R._status===0||R._status===-1)&&(R._status=1,R._result=se)},function(se){(R._status===0||R._status===-1)&&(R._status=2,R._result=se)}),R._status===-1&&(R._status=0,R._result=V)}if(R._status===1)return R._result.default;throw R._result}var ve=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},Se={map:I,forEach:function(R,V,se){I(R,function(){V.apply(this,arguments)},se)},count:function(R){var V=0;return I(R,function(){V++}),V},toArray:function(R){return I(R,function(V){return V})||[]},only:function(R){if(!P(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return He.Activity=y,He.Children=Se,He.Component=D,He.Fragment=n,He.Profiler=o,He.PureComponent=F,He.StrictMode=a,He.Suspense=m,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=J,He.__COMPILER_RUNTIME={__proto__:null,c:function(R){return J.H.useMemoCache(R)}},He.cache=function(R){return function(){return R.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(R,V,se){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var he=T({},R.props),ye=R.key;if(V!=null)for(me in V.key!==void 0&&(ye=""+V.key),V)!oe.call(V,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&V.ref===void 0||(he[me]=V[me]);var me=arguments.length-2;if(me===1)he.children=se;else if(1<me){for(var fe=Array(me),Me=0;Me<me;Me++)fe[Me]=arguments[Me+2];he.children=fe}return de(R.type,ye,he)},He.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:c,_context:R},R},He.createElement=function(R,V,se){var he,ye={},me=null;if(V!=null)for(he in V.key!==void 0&&(me=""+V.key),V)oe.call(V,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(ye[he]=V[he]);var fe=arguments.length-2;if(fe===1)ye.children=se;else if(1<fe){for(var Me=Array(fe),Re=0;Re<fe;Re++)Me[Re]=arguments[Re+2];ye.children=Me}if(R&&R.defaultProps)for(he in fe=R.defaultProps,fe)ye[he]===void 0&&(ye[he]=fe[he]);return de(R,me,ye)},He.createRef=function(){return{current:null}},He.forwardRef=function(R){return{$$typeof:f,render:R}},He.isValidElement=P,He.lazy=function(R){return{$$typeof:b,_payload:{_status:-1,_result:R},_init:X}},He.memo=function(R,V){return{$$typeof:p,type:R,compare:V===void 0?null:V}},He.startTransition=function(R){var V=J.T,se={};J.T=se;try{var he=R(),ye=J.S;ye!==null&&ye(se,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(ee,ve)}catch(me){ve(me)}finally{V!==null&&se.types!==null&&(V.types=se.types),J.T=V}},He.unstable_useCacheRefresh=function(){return J.H.useCacheRefresh()},He.use=function(R){return J.H.use(R)},He.useActionState=function(R,V,se){return J.H.useActionState(R,V,se)},He.useCallback=function(R,V){return J.H.useCallback(R,V)},He.useContext=function(R){return J.H.useContext(R)},He.useDebugValue=function(){},He.useDeferredValue=function(R,V){return J.H.useDeferredValue(R,V)},He.useEffect=function(R,V){return J.H.useEffect(R,V)},He.useEffectEvent=function(R){return J.H.useEffectEvent(R)},He.useId=function(){return J.H.useId()},He.useImperativeHandle=function(R,V,se){return J.H.useImperativeHandle(R,V,se)},He.useInsertionEffect=function(R,V){return J.H.useInsertionEffect(R,V)},He.useLayoutEffect=function(R,V){return J.H.useLayoutEffect(R,V)},He.useMemo=function(R,V){return J.H.useMemo(R,V)},He.useOptimistic=function(R,V){return J.H.useOptimistic(R,V)},He.useReducer=function(R,V,se){return J.H.useReducer(R,V,se)},He.useRef=function(R){return J.H.useRef(R)},He.useState=function(R){return J.H.useState(R)},He.useSyncExternalStore=function(R,V,se){return J.H.useSyncExternalStore(R,V,se)},He.useTransition=function(){return J.H.useTransition()},He.version="19.2.6",He}var Ly;function am(){return Ly||(Ly=1,ef.exports=mx()),ef.exports}var g=am();const ii=dx(g);var tf={exports:{}},jl={},sf={exports:{}},nf={};var By;function _x(){return By||(By=1,(function(e){function t(N,I){var X=N.length;N.push(I);e:for(;0<X;){var ve=X-1>>>1,Se=N[ve];if(0<o(Se,I))N[ve]=I,N[X]=Se,X=ve;else break e}}function n(N){return N.length===0?null:N[0]}function a(N){if(N.length===0)return null;var I=N[0],X=N.pop();if(X!==I){N[0]=X;e:for(var ve=0,Se=N.length,R=Se>>>1;ve<R;){var V=2*(ve+1)-1,se=N[V],he=V+1,ye=N[he];if(0>o(se,X))he<Se&&0>o(ye,se)?(N[ve]=ye,N[he]=X,ve=he):(N[ve]=se,N[V]=X,ve=V);else if(he<Se&&0>o(ye,X))N[ve]=ye,N[he]=X,ve=he;else break e}}return I}function o(N,I){var X=N.sortIndex-I.sortIndex;return X!==0?X:N.id-I.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 h=Date,f=h.now();e.unstable_now=function(){return h.now()-f}}var m=[],p=[],b=1,y=null,w=3,x=!1,E=!1,T=!1,O=!1,D=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function G(N){for(var I=n(p);I!==null;){if(I.callback===null)a(p);else if(I.startTime<=N)a(p),I.sortIndex=I.expirationTime,t(m,I);else break;I=n(p)}}function re(N){if(T=!1,G(N),!E)if(n(m)!==null)E=!0,ee||(ee=!0,K());else{var I=n(p);I!==null&&Q(re,I.startTime-N)}}var ee=!1,J=-1,oe=5,de=-1;function A(){return O?!0:!(e.unstable_now()-de<oe)}function P(){if(O=!1,ee){var N=e.unstable_now();de=N;var I=!0;try{e:{E=!1,T&&(T=!1,Y(J),J=-1),x=!0;var X=w;try{t:{for(G(N),y=n(m);y!==null&&!(y.expirationTime>N&&A());){var ve=y.callback;if(typeof ve=="function"){y.callback=null,w=y.priorityLevel;var Se=ve(y.expirationTime<=N);if(N=e.unstable_now(),typeof Se=="function"){y.callback=Se,G(N),I=!0;break t}y===n(m)&&a(m),G(N)}else a(m);y=n(m)}if(y!==null)I=!0;else{var R=n(p);R!==null&&Q(re,R.startTime-N),I=!1}}break e}finally{y=null,w=X,x=!1}I=void 0}}finally{I?K():ee=!1}}}var K;if(typeof F=="function")K=function(){F(P)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,B=j.port2;j.port1.onmessage=P,K=function(){B.postMessage(null)}}else K=function(){D(P,0)};function Q(N,I){J=D(function(){N(e.unstable_now())},I)}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(N){N.callback=null},e.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):oe=0<N?Math.floor(1e3/N):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(N){switch(w){case 1:case 2:case 3:var I=3;break;default:I=w}var X=w;w=I;try{return N()}finally{w=X}},e.unstable_requestPaint=function(){O=!0},e.unstable_runWithPriority=function(N,I){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var X=w;w=N;try{return I()}finally{w=X}},e.unstable_scheduleCallback=function(N,I,X){var ve=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?ve+X:ve):X=ve,N){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=X+Se,N={id:b++,callback:I,priorityLevel:N,startTime:X,expirationTime:Se,sortIndex:-1},X>ve?(N.sortIndex=X,t(p,N),n(m)===null&&N===n(p)&&(T?(Y(J),J=-1):T=!0,Q(re,X-ve))):(N.sortIndex=Se,t(m,N),E||x||(E=!0,ee||(ee=!0,K()))),N},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(N){var I=w;return function(){var X=w;w=I;try{return N.apply(this,arguments)}finally{w=X}}}})(nf)),nf}var Oy;function vx(){return Oy||(Oy=1,sf.exports=_x()),sf.exports}var rf={exports:{}},Mi={};var zy;function gx(){if(zy)return Mi;zy=1;var e=am();function t(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+m+"; visit "+p+" 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(m,p,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:m,containerInfo:p,implementation:b}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Mi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Mi.createPortal=function(m,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(m,p,null,b)},Mi.flushSync=function(m){var p=h.T,b=a.p;try{if(h.T=null,a.p=2,m)return m()}finally{h.T=p,a.p=b,a.d.f()}},Mi.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(m,p))},Mi.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Mi.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var b=p.as,y=f(b,p.crossOrigin),w=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?a.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:w,fetchPriority:x}):b==="script"&&a.d.X(m,{crossOrigin:y,integrity:w,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Mi.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=f(p.as,p.crossOrigin);a.d.M(m,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(m)},Mi.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,y=f(b,p.crossOrigin);a.d.L(m,b,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Mi.preloadModule=function(m,p){if(typeof m=="string")if(p){var b=f(p.as,p.crossOrigin);a.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(m)},Mi.requestFormReset=function(m){a.d.r(m)},Mi.unstable_batchedUpdates=function(m,p){return m(p)},Mi.useFormState=function(m,p,b){return h.H.useFormState(m,p,b)},Mi.useFormStatus=function(){return h.H.useHostTransitionStatus()},Mi.version="19.2.6",Mi}var jy;function KS(){if(jy)return rf.exports;jy=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(),rf.exports=gx(),rf.exports}var Hy;function yx(){if(Hy)return jl;Hy=1;var e=vx(),t=am(),n=KS();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 h(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 f(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 m(i){if(c(i)!==i)throw Error(a(188))}function p(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 d=u.alternate;if(d===null){if(l=u.return,l!==null){r=l;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===r)return m(u),i;if(d===l)return m(u),s;d=d.sibling}throw Error(a(188))}if(r.return!==l.return)r=u,l=d;else{for(var v=!1,S=u.child;S;){if(S===r){v=!0,r=u,l=d;break}if(S===l){v=!0,l=u,r=d;break}S=S.sibling}if(!v){for(S=d.child;S;){if(S===r){v=!0,r=d,l=u;break}if(S===l){v=!0,l=d,r=u;break}S=S.sibling}if(!v)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 y=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),F=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),A=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function K(i){return i===null||typeof i!="object"?null:(i=P&&i[P]||i["@@iterator"],typeof i=="function"?i:null)}var j=Symbol.for("react.client.reference");function B(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===j?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case T:return"Fragment";case D:return"Profiler";case O:return"StrictMode";case re:return"Suspense";case ee:return"SuspenseList";case de:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case E:return"Portal";case F:return i.displayName||"Context";case Y:return(i._context.displayName||"Context")+".Consumer";case G:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case J:return s=i.displayName||null,s!==null?s:B(i.type)||"Memo";case oe:s=i._payload,i=i._init;try{return B(i(s))}catch{}}return null}var Q=Array.isArray,N=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},ve=[],Se=-1;function R(i){return{current:i}}function V(i){0>Se||(i.current=ve[Se],ve[Se]=null,Se--)}function se(i,s){Se++,ve[Se]=i.current,i.current=s}var he=R(null),ye=R(null),me=R(null),fe=R(null);function Me(i,s){switch(se(me,s),se(ye,i),se(he,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Jg(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Jg(s),i=ey(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}V(he),se(he,i)}function Re(){V(he),V(ye),V(me)}function Ne(i){i.memoizedState!==null&&se(fe,i);var s=he.current,r=ey(s,i.type);s!==r&&(se(ye,i),se(he,r))}function Fe(i){ye.current===i&&(V(he),V(ye)),fe.current===i&&(V(fe),Al._currentValue=X)}var Oe,we;function ne(i){if(Oe===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);Oe=s&&s[1]||"",we=-1<r.stack.indexOf(`
|
|
3
|
-
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
|
-
`+Oe+i+we}var Ee=!1;function Te(i,s){if(!i||Ee)return"";Ee=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(Z){var $=Z}Reflect.construct(i,[],ce)}else{try{ce.call()}catch(Z){$=Z}i.call(ce.prototype)}}else{try{throw Error()}catch(Z){$=Z}(ce=i())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(Z){if(Z&&$&&typeof Z.stack=="string")return[Z.stack,$.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 d=l.DetermineComponentFrameRoot(),v=d[0],S=d[1];if(v&&S){var M=v.split(`
|
|
5
|
-
`),W=S.split(`
|
|
6
|
-
`);for(u=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;u<W.length&&!W[u].includes("DetermineComponentFrameRoot");)u++;if(l===M.length||u===W.length)for(l=M.length-1,u=W.length-1;1<=l&&0<=u&&M[l]!==W[u];)u--;for(;1<=l&&0<=u;l--,u--)if(M[l]!==W[u]){if(l!==1||u!==1)do if(l--,u--,0>u||M[l]!==W[u]){var ie=`
|
|
7
|
-
`+M[l].replace(" at new "," at ");return i.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",i.displayName)),ie}while(1<=l&&0<=u);break}}}finally{Ee=!1,Error.prepareStackTrace=r}return(r=i?i.displayName||i.name:"")?ne(r):""}function je(i,s){switch(i.tag){case 26:case 27:case 5:return ne(i.type);case 16:return ne("Lazy");case 13:return i.child!==s&&s!==null?ne("Suspense Fallback"):ne("Suspense");case 19:return ne("SuspenseList");case 0:case 15:return Te(i.type,!1);case 11:return Te(i.type.render,!1);case 1:return Te(i.type,!0);case 31:return ne("Activity");default:return""}}function Ue(i){try{var s="",r=null;do s+=je(i,r),r=i,i=i.return;while(i);return s}catch(l){return`
|
|
8
|
-
Error generating stack: `+l.message+`
|
|
9
|
-
`+l.stack}}var _t=Object.prototype.hasOwnProperty,rt=e.unstable_scheduleCallback,Ci=e.unstable_cancelCallback,te=e.unstable_shouldYield,Pe=e.unstable_requestPaint,Le=e.unstable_now,bt=e.unstable_getCurrentPriorityLevel,xi=e.unstable_ImmediatePriority,Ei=e.unstable_UserBlockingPriority,ni=e.unstable_NormalPriority,us=e.unstable_LowPriority,Li=e.unstable_IdlePriority,Pi=e.log,zs=e.unstable_setDisableYieldValue,fi=null,Ct=null;function pi(i){if(typeof Pi=="function"&&zs(i),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(fi,i)}catch{}}var xt=Math.clz32?Math.clz32:hr,Xs=Math.log,hs=Math.LN2;function hr(i){return i>>>=0,i===0?32:31-(Xs(i)/hs|0)|0}var ks=256,Bi=262144,dt=4194304;function mt(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 Et(i,s,r){var l=i.pendingLanes;if(l===0)return 0;var u=0,d=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var S=l&134217727;return S!==0?(l=S&~d,l!==0?u=mt(l):(v&=S,v!==0?u=mt(v):r||(r=S&~i,r!==0&&(u=mt(r))))):(S=l&~d,S!==0?u=mt(S):v!==0?u=mt(v):r||(r=l&~i,r!==0&&(u=mt(r)))),u===0?0:s!==0&&s!==u&&(s&d)===0&&(d=u&-u,r=s&-s,d>=r||d===32&&(r&4194048)!==0)?s:u}function jt(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function Gt(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 Ht(){var i=dt;return dt<<=1,(dt&62914560)===0&&(dt=4194304),i}function ri(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function Ti(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Tt(i,s,r,l,u,d){var v=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 S=i.entanglements,M=i.expirationTimes,W=i.hiddenUpdates;for(r=v&~r;0<r;){var ie=31-xt(r),ce=1<<ie;S[ie]=0,M[ie]=-1;var $=W[ie];if($!==null)for(W[ie]=null,ie=0;ie<$.length;ie++){var Z=$[ie];Z!==null&&(Z.lane&=-536870913)}r&=~ce}l!==0&&ki(i,l,0),d!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=d&~(v&~s))}function ki(i,s,r){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-xt(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|r&261930}function Rt(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var l=31-xt(r),u=1<<l;u&s|i[l]&s&&(i[l]|=s),r&=~u}}function it(i,s){var r=s&-s;return r=(r&42)!==0?1:st(r),(r&(i.suspendedLanes|s))!==0?0:r}function st(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 Di(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Ft(){var i=I.p;return i!==0?i:(i=window.event,i===void 0?32:Cy(i.type))}function Mt(i,s){var r=I.p;try{return I.p=i,s()}finally{I.p=r}}var mi=Math.random().toString(36).slice(2),Nt="__reactFiber$"+mi,Zt="__reactProps$"+mi,Ds="__reactContainer$"+mi,dr="__reactEvents$"+mi,qr="__reactListeners$"+mi,Rs="__reactHandles$"+mi,xn="__reactResources$"+mi,Ki="__reactMarker$"+mi;function js(i){delete i[Nt],delete i[Zt],delete i[dr],delete i[qr],delete i[Rs]}function _i(i){var s=i[Nt];if(s)return s;for(var r=i.parentNode;r;){if(s=r[Ds]||r[Nt]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=ly(i);i!==null;){if(r=i[Nt])return r;i=ly(i)}return s}i=r,r=i.parentNode}return null}function Ii(i){if(i=i[Nt]||i[Ds]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function Hs(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(a(33))}function Ms(i){var s=i[xn];return s||(s=i[xn]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function At(i){i[Ki]=!0}var Wr=new Set,$r={};function Qi(i,s){Ji(i,s),Ji(i+"Capture",s)}function Ji(i,s){for($r[i]=s,i=0;i<s.length;i++)Wr.add(s[i])}var Ya=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]*$"),Oi={},Yr={};function Vr(i){return _t.call(Yr,i)?!0:_t.call(Oi,i)?!1:Ya.test(i)?Yr[i]=!0:(Oi[i]=!0,!1)}function Fi(i,s,r){if(Vr(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 z(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 C(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 k(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function H(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ae(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,d=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(v){r=""+v,d.call(this,v)}}),Object.defineProperty(i,s,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(v){r=""+v},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function pe(i){if(!i._valueTracker){var s=H(i)?"checked":"value";i._valueTracker=ae(i,s,""+i[s])}}function ke(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var r=s.getValue(),l="";return i&&(l=H(i)?i.checked?"true":"false":i.value),i=l,i!==r?(s.setValue(i),!0):!1}function ge(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 Qe=/[\n"\\]/g;function Je(i){return i.replace(Qe,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Ri(i,s,r,l,u,d,v,S){i.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?i.type=v:i.removeAttribute("type"),s!=null?v==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+k(s)):i.value!==""+k(s)&&(i.value=""+k(s)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),s!=null?Xr(i,v,k(s)):r!=null?Xr(i,v,k(r)):l!=null&&i.removeAttribute("value"),u==null&&d!=null&&(i.defaultChecked=!!d),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?i.name=""+k(S):i.removeAttribute("name")}function vi(i,s,r,l,u,d,v,S){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(i.type=d),s!=null||r!=null){if(!(d!=="submit"&&d!=="reset"||s!=null)){pe(i);return}r=r!=null?""+k(r):"",s=s!=null?""+k(s):r,S||s===i.value||(i.value=s),i.defaultValue=s}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=S?i.checked:!!l,i.defaultChecked=!!l,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v),pe(i)}function Xr(i,s,r){s==="number"&&ge(i.ownerDocument)===i||i.defaultValue===""+r||(i.defaultValue=""+r)}function En(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=""+k(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 Ns(i,s,r){if(s!=null&&(s=""+k(s),s!==i.value&&(i.value=s),r==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=r!=null?""+k(r):""}function Va(i,s,r,l){if(s==null){if(l!=null){if(r!=null)throw Error(a(92));if(Q(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),s=r}r=k(s),i.defaultValue=r,l=i.textContent,l===r&&l!==""&&l!==null&&(i.value=l),pe(i)}function Gs(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var l1=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 Gm(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||l1.has(s)?s==="float"?i.cssFloat=r:i[s]=(""+r).trim():i[s]=r+"px"}function Zm(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&&Gm(i,u,l)}else for(var d in s)s.hasOwnProperty(d)&&Gm(i,d,s[d])}function Xu(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 o1=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"]]),c1=/^[\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 Oo(i){return c1.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Zs(){}var Gu=null;function Zu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Gr=null,Zr=null;function Qm(i){var s=Ii(i);if(s&&(i=s.stateNode)){var r=i[Zt]||null;e:switch(i=s.stateNode,s.type){case"input":if(Ri(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="'+Je(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var l=r[s];if(l!==i&&l.form===i.form){var u=l[Zt]||null;if(!u)throw Error(a(90));Ri(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&&ke(l)}break e;case"textarea":Ns(i,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&En(i,!!r.multiple,s,!1)}}}var Qu=!1;function Jm(i,s,r){if(Qu)return i(s,r);Qu=!0;try{var l=i(s);return l}finally{if(Qu=!1,(Gr!==null||Zr!==null)&&(wc(),Gr&&(s=Gr,i=Zr,Zr=Gr=null,Qm(s),i)))for(s=0;s<i.length;s++)Qm(i[s])}}function Xa(i,s){var r=i.stateNode;if(r===null)return null;var l=r[Zt]||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 Qs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ju=!1;if(Qs)try{var Ga={};Object.defineProperty(Ga,"passive",{get:function(){Ju=!0}}),window.addEventListener("test",Ga,Ga),window.removeEventListener("test",Ga,Ga)}catch{Ju=!1}var Tn=null,eh=null,zo=null;function e_(){if(zo)return zo;var i,s=eh,r=s.length,l,u="value"in Tn?Tn.value:Tn.textContent,d=u.length;for(i=0;i<r&&s[i]===u[i];i++);var v=r-i;for(l=1;l<=v&&s[r-l]===u[d-l];l++);return zo=u.slice(i,1<l?1-l:void 0)}function jo(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 Ho(){return!0}function t_(){return!1}function qi(i){function s(r,l,u,d,v){this._reactName=r,this._targetInst=u,this.type=l,this.nativeEvent=d,this.target=v,this.currentTarget=null;for(var S in i)i.hasOwnProperty(S)&&(r=i[S],this[S]=r?r(d):d[S]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Ho:t_,this.isPropagationStopped=t_,this}return y(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=Ho)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ho)},persist:function(){},isPersistent:Ho}),s}var fr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Uo=qi(fr),Za=y({},fr,{view:0,detail:0}),u1=qi(Za),th,ih,Qa,Po=y({},Za,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nh,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!==Qa&&(Qa&&i.type==="mousemove"?(th=i.screenX-Qa.screenX,ih=i.screenY-Qa.screenY):ih=th=0,Qa=i),th)},movementY:function(i){return"movementY"in i?i.movementY:ih}}),i_=qi(Po),h1=y({},Po,{dataTransfer:0}),d1=qi(h1),f1=y({},Za,{relatedTarget:0}),sh=qi(f1),p1=y({},fr,{animationName:0,elapsedTime:0,pseudoElement:0}),m1=qi(p1),_1=y({},fr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),v1=qi(_1),g1=y({},fr,{data:0}),s_=qi(g1),y1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},b1={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"},S1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function w1(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=S1[i])?!!s[i]:!1}function nh(){return w1}var C1=y({},Za,{key:function(i){if(i.key){var s=y1[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=jo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?b1[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nh,charCode:function(i){return i.type==="keypress"?jo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?jo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),x1=qi(C1),E1=y({},Po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),n_=qi(E1),T1=y({},Za,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nh}),k1=qi(T1),D1=y({},fr,{propertyName:0,elapsedTime:0,pseudoElement:0}),R1=qi(D1),M1=y({},Po,{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}),N1=qi(M1),A1=y({},fr,{newState:0,oldState:0}),L1=qi(A1),B1=[9,13,27,32],rh=Qs&&"CompositionEvent"in window,Ja=null;Qs&&"documentMode"in document&&(Ja=document.documentMode);var O1=Qs&&"TextEvent"in window&&!Ja,r_=Qs&&(!rh||Ja&&8<Ja&&11>=Ja),a_=" ",l_=!1;function o_(i,s){switch(i){case"keyup":return B1.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function c_(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Qr=!1;function z1(i,s){switch(i){case"compositionend":return c_(s);case"keypress":return s.which!==32?null:(l_=!0,a_);case"textInput":return i=s.data,i===a_&&l_?null:i;default:return null}}function j1(i,s){if(Qr)return i==="compositionend"||!rh&&o_(i,s)?(i=e_(),zo=eh=Tn=null,Qr=!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 r_&&s.locale!=="ko"?null:s.data;default:return null}}var H1={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 u_(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!H1[i.type]:s==="textarea"}function h_(i,s,r,l){Gr?Zr?Zr.push(l):Zr=[l]:Gr=l,s=Rc(s,"onChange"),0<s.length&&(r=new Uo("onChange","change",null,r,l),i.push({event:r,listeners:s}))}var el=null,tl=null;function U1(i){Yg(i,0)}function Ko(i){var s=Hs(i);if(ke(s))return i}function d_(i,s){if(i==="change")return s}var f_=!1;if(Qs){var ah;if(Qs){var lh="oninput"in document;if(!lh){var p_=document.createElement("div");p_.setAttribute("oninput","return;"),lh=typeof p_.oninput=="function"}ah=lh}else ah=!1;f_=ah&&(!document.documentMode||9<document.documentMode)}function m_(){el&&(el.detachEvent("onpropertychange",__),tl=el=null)}function __(i){if(i.propertyName==="value"&&Ko(tl)){var s=[];h_(s,tl,i,Zu(i)),Jm(U1,s)}}function P1(i,s,r){i==="focusin"?(m_(),el=s,tl=r,el.attachEvent("onpropertychange",__)):i==="focusout"&&m_()}function K1(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Ko(tl)}function I1(i,s){if(i==="click")return Ko(s)}function F1(i,s){if(i==="input"||i==="change")return Ko(s)}function q1(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var es=typeof Object.is=="function"?Object.is:q1;function il(i,s){if(es(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(!_t.call(s,u)||!es(i[u],s[u]))return!1}return!0}function v_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function g_(i,s){var r=v_(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=v_(r)}}function y_(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?y_(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function b_(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=ge(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=ge(i.document)}return s}function oh(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 W1=Qs&&"documentMode"in document&&11>=document.documentMode,Jr=null,ch=null,sl=null,uh=!1;function S_(i,s,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;uh||Jr==null||Jr!==ge(l)||(l=Jr,"selectionStart"in l&&oh(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}),sl&&il(sl,l)||(sl=l,l=Rc(ch,"onSelect"),0<l.length&&(s=new Uo("onSelect","select",null,s,r),i.push({event:s,listeners:l}),s.target=Jr)))}function pr(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var ea={animationend:pr("Animation","AnimationEnd"),animationiteration:pr("Animation","AnimationIteration"),animationstart:pr("Animation","AnimationStart"),transitionrun:pr("Transition","TransitionRun"),transitionstart:pr("Transition","TransitionStart"),transitioncancel:pr("Transition","TransitionCancel"),transitionend:pr("Transition","TransitionEnd")},hh={},w_={};Qs&&(w_=document.createElement("div").style,"AnimationEvent"in window||(delete ea.animationend.animation,delete ea.animationiteration.animation,delete ea.animationstart.animation),"TransitionEvent"in window||delete ea.transitionend.transition);function mr(i){if(hh[i])return hh[i];if(!ea[i])return i;var s=ea[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in w_)return hh[i]=s[r];return i}var C_=mr("animationend"),x_=mr("animationiteration"),E_=mr("animationstart"),$1=mr("transitionrun"),Y1=mr("transitionstart"),V1=mr("transitioncancel"),T_=mr("transitionend"),k_=new Map,dh="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(" ");dh.push("scrollEnd");function As(i,s){k_.set(i,s),Qi(s,[i])}var Io=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)},ds=[],ta=0,fh=0;function Fo(){for(var i=ta,s=fh=ta=0;s<i;){var r=ds[s];ds[s++]=null;var l=ds[s];ds[s++]=null;var u=ds[s];ds[s++]=null;var d=ds[s];if(ds[s++]=null,l!==null&&u!==null){var v=l.pending;v===null?u.next=u:(u.next=v.next,v.next=u),l.pending=u}d!==0&&D_(r,u,d)}}function qo(i,s,r,l){ds[ta++]=i,ds[ta++]=s,ds[ta++]=r,ds[ta++]=l,fh|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function ph(i,s,r,l){return qo(i,s,r,l),Wo(i)}function _r(i,s){return qo(i,null,null,s),Wo(i)}function D_(i,s,r){i.lanes|=r;var l=i.alternate;l!==null&&(l.lanes|=r);for(var u=!1,d=i.return;d!==null;)d.childLanes|=r,l=d.alternate,l!==null&&(l.childLanes|=r),d.tag===22&&(i=d.stateNode,i===null||i._visibility&1||(u=!0)),i=d,d=d.return;return i.tag===3?(d=i.stateNode,u&&s!==null&&(u=31-xt(r),i=d.hiddenUpdates,l=i[u],l===null?i[u]=[s]:l.push(s),s.lane=r|536870912),d):null}function Wo(i){if(50<El)throw El=0,Cd=null,Error(a(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var ia={};function X1(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 ts(i,s,r,l){return new X1(i,s,r,l)}function mh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Js(i,s){var r=i.alternate;return r===null?(r=ts(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 R_(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 $o(i,s,r,l,u,d){var v=0;if(l=i,typeof i=="function")mh(i)&&(v=1);else if(typeof i=="string")v=ex(i,r,he.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case de:return i=ts(31,r,s,u),i.elementType=de,i.lanes=d,i;case T:return vr(r.children,u,d,s);case O:v=8,u|=24;break;case D:return i=ts(12,r,s,u|2),i.elementType=D,i.lanes=d,i;case re:return i=ts(13,r,s,u),i.elementType=re,i.lanes=d,i;case ee:return i=ts(19,r,s,u),i.elementType=ee,i.lanes=d,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case F:v=10;break e;case Y:v=9;break e;case G:v=11;break e;case J:v=14;break e;case oe:v=16,l=null;break e}v=29,r=Error(a(130,i===null?"null":typeof i,"")),l=null}return s=ts(v,r,s,u),s.elementType=i,s.type=l,s.lanes=d,s}function vr(i,s,r,l){return i=ts(7,i,l,s),i.lanes=r,i}function _h(i,s,r){return i=ts(6,i,null,s),i.lanes=r,i}function M_(i){var s=ts(18,null,null,0);return s.stateNode=i,s}function vh(i,s,r){return s=ts(4,i.children!==null?i.children:[],i.key,s),s.lanes=r,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var N_=new WeakMap;function fs(i,s){if(typeof i=="object"&&i!==null){var r=N_.get(i);return r!==void 0?r:(s={value:i,source:s,stack:Ue(s)},N_.set(i,s),s)}return{value:i,source:s,stack:Ue(s)}}var sa=[],na=0,Yo=null,nl=0,ps=[],ms=0,kn=null,Us=1,Ps="";function en(i,s){sa[na++]=nl,sa[na++]=Yo,Yo=i,nl=s}function A_(i,s,r){ps[ms++]=Us,ps[ms++]=Ps,ps[ms++]=kn,kn=i;var l=Us;i=Ps;var u=32-xt(l)-1;l&=~(1<<u),r+=1;var d=32-xt(s)+u;if(30<d){var v=u-u%5;d=(l&(1<<v)-1).toString(32),l>>=v,u-=v,Us=1<<32-xt(s)+u|r<<u|l,Ps=d+i}else Us=1<<d|r<<u|l,Ps=i}function gh(i){i.return!==null&&(en(i,1),A_(i,1,0))}function yh(i){for(;i===Yo;)Yo=sa[--na],sa[na]=null,nl=sa[--na],sa[na]=null;for(;i===kn;)kn=ps[--ms],ps[ms]=null,Ps=ps[--ms],ps[ms]=null,Us=ps[--ms],ps[ms]=null}function L_(i,s){ps[ms++]=Us,ps[ms++]=Ps,ps[ms++]=kn,Us=s.id,Ps=s.overflow,kn=i}var gi=null,vt=null,Ge=!1,Dn=null,_s=!1,bh=Error(a(519));function Rn(i){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw rl(fs(s,i)),bh}function B_(i){var s=i.stateNode,r=i.type,l=i.memoizedProps;switch(s[Nt]=i,s[Zt]=l,r){case"dialog":Ye("cancel",s),Ye("close",s);break;case"iframe":case"object":case"embed":Ye("load",s);break;case"video":case"audio":for(r=0;r<kl.length;r++)Ye(kl[r],s);break;case"source":Ye("error",s);break;case"img":case"image":case"link":Ye("error",s),Ye("load",s);break;case"details":Ye("toggle",s);break;case"input":Ye("invalid",s),vi(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ye("invalid",s);break;case"textarea":Ye("invalid",s),Va(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||Zg(s.textContent,r)?(l.popover!=null&&(Ye("beforetoggle",s),Ye("toggle",s)),l.onScroll!=null&&Ye("scroll",s),l.onScrollEnd!=null&&Ye("scrollend",s),l.onClick!=null&&(s.onclick=Zs),s=!0):s=!1,s||Rn(i,!0)}function O_(i){for(gi=i.return;gi;)switch(gi.tag){case 5:case 31:case 13:_s=!1;return;case 27:case 3:_s=!0;return;default:gi=gi.return}}function ra(i){if(i!==gi)return!1;if(!Ge)return O_(i),Ge=!0,!1;var s=i.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=i.type,r=!(r!=="form"&&r!=="button")||Hd(i.type,i.memoizedProps)),r=!r),r&&vt&&Rn(i),O_(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));vt=ay(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));vt=ay(i)}else s===27?(s=vt,Fn(i.type)?(i=Fd,Fd=null,vt=i):vt=s):vt=gi?gs(i.stateNode.nextSibling):null;return!0}function gr(){vt=gi=null,Ge=!1}function Sh(){var i=Dn;return i!==null&&(Vi===null?Vi=i:Vi.push.apply(Vi,i),Dn=null),i}function rl(i){Dn===null?Dn=[i]:Dn.push(i)}var wh=R(null),yr=null,tn=null;function Mn(i,s,r){se(wh,s._currentValue),s._currentValue=r}function sn(i){i._currentValue=wh.current,V(wh)}function Ch(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 xh(i,s,r,l){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var d=u.dependencies;if(d!==null){var v=u.child;d=d.firstContext;e:for(;d!==null;){var S=d;d=u;for(var M=0;M<s.length;M++)if(S.context===s[M]){d.lanes|=r,S=d.alternate,S!==null&&(S.lanes|=r),Ch(d.return,r,i),l||(v=null);break e}d=S.next}}else if(u.tag===18){if(v=u.return,v===null)throw Error(a(341));v.lanes|=r,d=v.alternate,d!==null&&(d.lanes|=r),Ch(v,r,i),v=null}else v=u.child;if(v!==null)v.return=u;else for(v=u;v!==null;){if(v===i){v=null;break}if(u=v.sibling,u!==null){u.return=v.return,v=u;break}v=v.return}u=v}}function aa(i,s,r,l){i=null;for(var u=s,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var v=u.alternate;if(v===null)throw Error(a(387));if(v=v.memoizedProps,v!==null){var S=u.type;es(u.pendingProps.value,v.value)||(i!==null?i.push(S):i=[S])}}else if(u===fe.current){if(v=u.alternate,v===null)throw Error(a(387));v.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(Al):i=[Al])}u=u.return}i!==null&&xh(s,i,r,l),s.flags|=262144}function Vo(i){for(i=i.firstContext;i!==null;){if(!es(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function br(i){yr=i,tn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function yi(i){return z_(yr,i)}function Xo(i,s){return yr===null&&br(i),z_(i,s)}function z_(i,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},tn===null){if(i===null)throw Error(a(308));tn=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else tn=tn.next=s;return r}var G1=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()})}},Z1=e.unstable_scheduleCallback,Q1=e.unstable_NormalPriority,qt={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Eh(){return{controller:new G1,data:new Map,refCount:0}}function al(i){i.refCount--,i.refCount===0&&Z1(Q1,function(){i.controller.abort()})}var ll=null,Th=0,la=0,oa=null;function J1(i,s){if(ll===null){var r=ll=[];Th=0,la=Rd(),oa={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Th++,s.then(j_,j_),s}function j_(){if(--Th===0&&ll!==null){oa!==null&&(oa.status="fulfilled");var i=ll;ll=null,la=0,oa=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function eC(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 H_=N.S;N.S=function(i,s){Sg=Le(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&J1(i,s),H_!==null&&H_(i,s)};var Sr=R(null);function kh(){var i=Sr.current;return i!==null?i:ft.pooledCache}function Go(i,s){s===null?se(Sr,Sr.current):se(Sr,s.pool)}function U_(){var i=kh();return i===null?null:{parent:qt._currentValue,pool:i}}var ca=Error(a(460)),Dh=Error(a(474)),Zo=Error(a(542)),Qo={then:function(){}};function P_(i){return i=i.status,i==="fulfilled"||i==="rejected"}function K_(i,s,r){switch(r=i[r],r===void 0?i.push(s):r!==s&&(s.then(Zs,Zs),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,F_(i),i;default:if(typeof s.status=="string")s.then(Zs,Zs);else{if(i=ft,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,F_(i),i}throw Cr=s,ca}}function wr(i){try{var s=i._init;return s(i._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Cr=r,ca):r}}var Cr=null;function I_(){if(Cr===null)throw Error(a(459));var i=Cr;return Cr=null,i}function F_(i){if(i===ca||i===Zo)throw Error(a(483))}var ua=null,ol=0;function Jo(i){var s=ol;return ol+=1,ua===null&&(ua=[]),K_(ua,i,s)}function cl(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function ec(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 q_(i){function s(U,L){if(i){var q=U.deletions;q===null?(U.deletions=[L],U.flags|=16):q.push(L)}}function r(U,L){if(!i)return null;for(;L!==null;)s(U,L),L=L.sibling;return null}function l(U){for(var L=new Map;U!==null;)U.key!==null?L.set(U.key,U):L.set(U.index,U),U=U.sibling;return L}function u(U,L){return U=Js(U,L),U.index=0,U.sibling=null,U}function d(U,L,q){return U.index=q,i?(q=U.alternate,q!==null?(q=q.index,q<L?(U.flags|=67108866,L):q):(U.flags|=67108866,L)):(U.flags|=1048576,L)}function v(U){return i&&U.alternate===null&&(U.flags|=67108866),U}function S(U,L,q,le){return L===null||L.tag!==6?(L=_h(q,U.mode,le),L.return=U,L):(L=u(L,q),L.return=U,L)}function M(U,L,q,le){var Ae=q.type;return Ae===T?ie(U,L,q.props.children,le,q.key):L!==null&&(L.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===oe&&wr(Ae)===L.type)?(L=u(L,q.props),cl(L,q),L.return=U,L):(L=$o(q.type,q.key,q.props,null,U.mode,le),cl(L,q),L.return=U,L)}function W(U,L,q,le){return L===null||L.tag!==4||L.stateNode.containerInfo!==q.containerInfo||L.stateNode.implementation!==q.implementation?(L=vh(q,U.mode,le),L.return=U,L):(L=u(L,q.children||[]),L.return=U,L)}function ie(U,L,q,le,Ae){return L===null||L.tag!==7?(L=vr(q,U.mode,le,Ae),L.return=U,L):(L=u(L,q),L.return=U,L)}function ce(U,L,q){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=_h(""+L,U.mode,q),L.return=U,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case x:return q=$o(L.type,L.key,L.props,null,U.mode,q),cl(q,L),q.return=U,q;case E:return L=vh(L,U.mode,q),L.return=U,L;case oe:return L=wr(L),ce(U,L,q)}if(Q(L)||K(L))return L=vr(L,U.mode,q,null),L.return=U,L;if(typeof L.then=="function")return ce(U,Jo(L),q);if(L.$$typeof===F)return ce(U,Xo(U,L),q);ec(U,L)}return null}function $(U,L,q,le){var Ae=L!==null?L.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return Ae!==null?null:S(U,L,""+q,le);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case x:return q.key===Ae?M(U,L,q,le):null;case E:return q.key===Ae?W(U,L,q,le):null;case oe:return q=wr(q),$(U,L,q,le)}if(Q(q)||K(q))return Ae!==null?null:ie(U,L,q,le,null);if(typeof q.then=="function")return $(U,L,Jo(q),le);if(q.$$typeof===F)return $(U,L,Xo(U,q),le);ec(U,q)}return null}function Z(U,L,q,le,Ae){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return U=U.get(q)||null,S(L,U,""+le,Ae);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case x:return U=U.get(le.key===null?q:le.key)||null,M(L,U,le,Ae);case E:return U=U.get(le.key===null?q:le.key)||null,W(L,U,le,Ae);case oe:return le=wr(le),Z(U,L,q,le,Ae)}if(Q(le)||K(le))return U=U.get(q)||null,ie(L,U,le,Ae,null);if(typeof le.then=="function")return Z(U,L,q,Jo(le),Ae);if(le.$$typeof===F)return Z(U,L,q,Xo(L,le),Ae);ec(L,le)}return null}function Ce(U,L,q,le){for(var Ae=null,et=null,De=L,Ie=L=0,Xe=null;De!==null&&Ie<q.length;Ie++){De.index>Ie?(Xe=De,De=null):Xe=De.sibling;var tt=$(U,De,q[Ie],le);if(tt===null){De===null&&(De=Xe);break}i&&De&&tt.alternate===null&&s(U,De),L=d(tt,L,Ie),et===null?Ae=tt:et.sibling=tt,et=tt,De=Xe}if(Ie===q.length)return r(U,De),Ge&&en(U,Ie),Ae;if(De===null){for(;Ie<q.length;Ie++)De=ce(U,q[Ie],le),De!==null&&(L=d(De,L,Ie),et===null?Ae=De:et.sibling=De,et=De);return Ge&&en(U,Ie),Ae}for(De=l(De);Ie<q.length;Ie++)Xe=Z(De,U,Ie,q[Ie],le),Xe!==null&&(i&&Xe.alternate!==null&&De.delete(Xe.key===null?Ie:Xe.key),L=d(Xe,L,Ie),et===null?Ae=Xe:et.sibling=Xe,et=Xe);return i&&De.forEach(function(Vn){return s(U,Vn)}),Ge&&en(U,Ie),Ae}function Be(U,L,q,le){if(q==null)throw Error(a(151));for(var Ae=null,et=null,De=L,Ie=L=0,Xe=null,tt=q.next();De!==null&&!tt.done;Ie++,tt=q.next()){De.index>Ie?(Xe=De,De=null):Xe=De.sibling;var Vn=$(U,De,tt.value,le);if(Vn===null){De===null&&(De=Xe);break}i&&De&&Vn.alternate===null&&s(U,De),L=d(Vn,L,Ie),et===null?Ae=Vn:et.sibling=Vn,et=Vn,De=Xe}if(tt.done)return r(U,De),Ge&&en(U,Ie),Ae;if(De===null){for(;!tt.done;Ie++,tt=q.next())tt=ce(U,tt.value,le),tt!==null&&(L=d(tt,L,Ie),et===null?Ae=tt:et.sibling=tt,et=tt);return Ge&&en(U,Ie),Ae}for(De=l(De);!tt.done;Ie++,tt=q.next())tt=Z(De,U,Ie,tt.value,le),tt!==null&&(i&&tt.alternate!==null&&De.delete(tt.key===null?Ie:tt.key),L=d(tt,L,Ie),et===null?Ae=tt:et.sibling=tt,et=tt);return i&&De.forEach(function(hx){return s(U,hx)}),Ge&&en(U,Ie),Ae}function ut(U,L,q,le){if(typeof q=="object"&&q!==null&&q.type===T&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case x:e:{for(var Ae=q.key;L!==null;){if(L.key===Ae){if(Ae=q.type,Ae===T){if(L.tag===7){r(U,L.sibling),le=u(L,q.props.children),le.return=U,U=le;break e}}else if(L.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===oe&&wr(Ae)===L.type){r(U,L.sibling),le=u(L,q.props),cl(le,q),le.return=U,U=le;break e}r(U,L);break}else s(U,L);L=L.sibling}q.type===T?(le=vr(q.props.children,U.mode,le,q.key),le.return=U,U=le):(le=$o(q.type,q.key,q.props,null,U.mode,le),cl(le,q),le.return=U,U=le)}return v(U);case E:e:{for(Ae=q.key;L!==null;){if(L.key===Ae)if(L.tag===4&&L.stateNode.containerInfo===q.containerInfo&&L.stateNode.implementation===q.implementation){r(U,L.sibling),le=u(L,q.children||[]),le.return=U,U=le;break e}else{r(U,L);break}else s(U,L);L=L.sibling}le=vh(q,U.mode,le),le.return=U,U=le}return v(U);case oe:return q=wr(q),ut(U,L,q,le)}if(Q(q))return Ce(U,L,q,le);if(K(q)){if(Ae=K(q),typeof Ae!="function")throw Error(a(150));return q=Ae.call(q),Be(U,L,q,le)}if(typeof q.then=="function")return ut(U,L,Jo(q),le);if(q.$$typeof===F)return ut(U,L,Xo(U,q),le);ec(U,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,L!==null&&L.tag===6?(r(U,L.sibling),le=u(L,q),le.return=U,U=le):(r(U,L),le=_h(q,U.mode,le),le.return=U,U=le),v(U)):r(U,L)}return function(U,L,q,le){try{ol=0;var Ae=ut(U,L,q,le);return ua=null,Ae}catch(De){if(De===ca||De===Zo)throw De;var et=ts(29,De,null,U.mode);return et.lanes=le,et.return=U,et}}}var xr=q_(!0),W_=q_(!1),Nn=!1;function Rh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mh(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 An(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Ln(i,s,r){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(nt&2)!==0){var u=l.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),l.pending=s,s=Wo(i),D_(i,null,r),s}return qo(i,l,s,r),Wo(i)}function ul(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,Rt(i,r)}}function Nh(i,s){var r=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var u=null,d=null;if(r=r.firstBaseUpdate,r!==null){do{var v={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};d===null?u=d=v:d=d.next=v,r=r.next}while(r!==null);d===null?u=d=s:d=d.next=s}else u=d=s;r={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:d,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 Ah=!1;function hl(){if(Ah){var i=oa;if(i!==null)throw i}}function dl(i,s,r,l){Ah=!1;var u=i.updateQueue;Nn=!1;var d=u.firstBaseUpdate,v=u.lastBaseUpdate,S=u.shared.pending;if(S!==null){u.shared.pending=null;var M=S,W=M.next;M.next=null,v===null?d=W:v.next=W,v=M;var ie=i.alternate;ie!==null&&(ie=ie.updateQueue,S=ie.lastBaseUpdate,S!==v&&(S===null?ie.firstBaseUpdate=W:S.next=W,ie.lastBaseUpdate=M))}if(d!==null){var ce=u.baseState;v=0,ie=W=M=null,S=d;do{var $=S.lane&-536870913,Z=$!==S.lane;if(Z?(Ve&$)===$:(l&$)===$){$!==0&&$===la&&(Ah=!0),ie!==null&&(ie=ie.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Ce=i,Be=S;$=s;var ut=r;switch(Be.tag){case 1:if(Ce=Be.payload,typeof Ce=="function"){ce=Ce.call(ut,ce,$);break e}ce=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Be.payload,$=typeof Ce=="function"?Ce.call(ut,ce,$):Ce,$==null)break e;ce=y({},ce,$);break e;case 2:Nn=!0}}$=S.callback,$!==null&&(i.flags|=64,Z&&(i.flags|=8192),Z=u.callbacks,Z===null?u.callbacks=[$]:Z.push($))}else Z={lane:$,tag:S.tag,payload:S.payload,callback:S.callback,next:null},ie===null?(W=ie=Z,M=ce):ie=ie.next=Z,v|=$;if(S=S.next,S===null){if(S=u.shared.pending,S===null)break;Z=S,S=Z.next,Z.next=null,u.lastBaseUpdate=Z,u.shared.pending=null}}while(!0);ie===null&&(M=ce),u.baseState=M,u.firstBaseUpdate=W,u.lastBaseUpdate=ie,d===null&&(u.shared.lanes=0),Hn|=v,i.lanes=v,i.memoizedState=ce}}function $_(i,s){if(typeof i!="function")throw Error(a(191,i));i.call(s)}function Y_(i,s){var r=i.callbacks;if(r!==null)for(i.callbacks=null,i=0;i<r.length;i++)$_(r[i],s)}var ha=R(null),tc=R(0);function V_(i,s){i=dn,se(tc,i),se(ha,s),dn=i|s.baseLanes}function Lh(){se(tc,dn),se(ha,ha.current)}function Bh(){dn=tc.current,V(ha),V(tc)}var is=R(null),vs=null;function Bn(i){var s=i.alternate;se(Ut,Ut.current&1),se(is,i),vs===null&&(s===null||ha.current!==null||s.memoizedState!==null)&&(vs=i)}function Oh(i){se(Ut,Ut.current),se(is,i),vs===null&&(vs=i)}function X_(i){i.tag===22?(se(Ut,Ut.current),se(is,i),vs===null&&(vs=i)):On()}function On(){se(Ut,Ut.current),se(is,is.current)}function ss(i){V(is),vs===i&&(vs=null),V(Ut)}var Ut=R(0);function ic(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Kd(r)||Id(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 nn=0,Ke=null,ot=null,Wt=null,sc=!1,da=!1,Er=!1,nc=0,fl=0,fa=null,tC=0;function Lt(){throw Error(a(321))}function zh(i,s){if(s===null)return!1;for(var r=0;r<s.length&&r<i.length;r++)if(!es(i[r],s[r]))return!1;return!0}function jh(i,s,r,l,u,d){return nn=d,Ke=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,N.H=i===null||i.memoizedState===null?Av:Qh,Er=!1,d=r(l,u),Er=!1,da&&(d=Z_(s,r,l,u)),G_(i),d}function G_(i){N.H=_l;var s=ot!==null&&ot.next!==null;if(nn=0,Wt=ot=Ke=null,sc=!1,fl=0,fa=null,s)throw Error(a(300));i===null||$t||(i=i.dependencies,i!==null&&Vo(i)&&($t=!0))}function Z_(i,s,r,l){Ke=i;var u=0;do{if(da&&(fa=null),fl=0,da=!1,25<=u)throw Error(a(301));if(u+=1,Wt=ot=null,i.updateQueue!=null){var d=i.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}N.H=Lv,d=s(r,l)}while(da);return d}function iC(){var i=N.H,s=i.useState()[0];return s=typeof s.then=="function"?pl(s):s,i=i.useState()[0],(ot!==null?ot.memoizedState:null)!==i&&(Ke.flags|=1024),s}function Hh(){var i=nc!==0;return nc=0,i}function Uh(i,s,r){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~r}function Ph(i){if(sc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}sc=!1}nn=0,Wt=ot=Ke=null,da=!1,fl=nc=0,fa=null}function zi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wt===null?Ke.memoizedState=Wt=i:Wt=Wt.next=i,Wt}function Pt(){if(ot===null){var i=Ke.alternate;i=i!==null?i.memoizedState:null}else i=ot.next;var s=Wt===null?Ke.memoizedState:Wt.next;if(s!==null)Wt=s,ot=i;else{if(i===null)throw Ke.alternate===null?Error(a(467)):Error(a(310));ot=i,i={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},Wt===null?Ke.memoizedState=Wt=i:Wt=Wt.next=i}return Wt}function rc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pl(i){var s=fl;return fl+=1,fa===null&&(fa=[]),i=K_(fa,i,s),s=Ke,(Wt===null?s.memoizedState:Wt.next)===null&&(s=s.alternate,N.H=s===null||s.memoizedState===null?Av:Qh),i}function ac(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return pl(i);if(i.$$typeof===F)return yi(i)}throw Error(a(438,String(i)))}function Kh(i){var s=null,r=Ke.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var l=Ke.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=rc(),Ke.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]=A;return s.index++,r}function rn(i,s){return typeof s=="function"?s(i):s}function lc(i){var s=Pt();return Ih(s,ot,i)}function Ih(i,s,r){var l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var u=i.baseQueue,d=l.pending;if(d!==null){if(u!==null){var v=u.next;u.next=d.next,d.next=v}s.baseQueue=u=d,l.pending=null}if(d=i.baseState,u===null)i.memoizedState=d;else{s=u.next;var S=v=null,M=null,W=s,ie=!1;do{var ce=W.lane&-536870913;if(ce!==W.lane?(Ve&ce)===ce:(nn&ce)===ce){var $=W.revertLane;if($===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),ce===la&&(ie=!0);else if((nn&$)===$){W=W.next,$===la&&(ie=!0);continue}else ce={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},M===null?(S=M=ce,v=d):M=M.next=ce,Ke.lanes|=$,Hn|=$;ce=W.action,Er&&r(d,ce),d=W.hasEagerState?W.eagerState:r(d,ce)}else $={lane:ce,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},M===null?(S=M=$,v=d):M=M.next=$,Ke.lanes|=ce,Hn|=ce;W=W.next}while(W!==null&&W!==s);if(M===null?v=d:M.next=S,!es(d,i.memoizedState)&&($t=!0,ie&&(r=oa,r!==null)))throw r;i.memoizedState=d,i.baseState=v,i.baseQueue=M,l.lastRenderedState=d}return u===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Fh(i){var s=Pt(),r=s.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=i;var l=r.dispatch,u=r.pending,d=s.memoizedState;if(u!==null){r.pending=null;var v=u=u.next;do d=i(d,v.action),v=v.next;while(v!==u);es(d,s.memoizedState)||($t=!0),s.memoizedState=d,s.baseQueue===null&&(s.baseState=d),r.lastRenderedState=d}return[d,l]}function Q_(i,s,r){var l=Ke,u=Pt(),d=Ge;if(d){if(r===void 0)throw Error(a(407));r=r()}else r=s();var v=!es((ot||u).memoizedState,r);if(v&&(u.memoizedState=r,$t=!0),u=u.queue,$h(tv.bind(null,l,u,i),[i]),u.getSnapshot!==s||v||Wt!==null&&Wt.memoizedState.tag&1){if(l.flags|=2048,pa(9,{destroy:void 0},ev.bind(null,l,u,r,s),null),ft===null)throw Error(a(349));d||(nn&127)!==0||J_(l,s,r)}return r}function J_(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=Ke.updateQueue,s===null?(s=rc(),Ke.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function ev(i,s,r,l){s.value=r,s.getSnapshot=l,iv(s)&&sv(i)}function tv(i,s,r){return r(function(){iv(s)&&sv(i)})}function iv(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!es(i,r)}catch{return!0}}function sv(i){var s=_r(i,2);s!==null&&Xi(s,i,2)}function qh(i){var s=zi();if(typeof i=="function"){var r=i;if(i=r(),Er){pi(!0);try{r()}finally{pi(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rn,lastRenderedState:i},s}function nv(i,s,r,l){return i.baseState=r,Ih(i,ot,typeof l=="function"?l:rn)}function sC(i,s,r,l,u){if(uc(i))throw Error(a(485));if(i=s.action,i!==null){var d={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){d.listeners.push(v)}};N.T!==null?r(!0):d.isTransition=!1,l(d),r=s.pending,r===null?(d.next=s.pending=d,rv(s,d)):(d.next=r.next,s.pending=r.next=d)}}function rv(i,s){var r=s.action,l=s.payload,u=i.state;if(s.isTransition){var d=N.T,v={};N.T=v;try{var S=r(u,l),M=N.S;M!==null&&M(v,S),av(i,s,S)}catch(W){Wh(i,s,W)}finally{d!==null&&v.types!==null&&(d.types=v.types),N.T=d}}else try{d=r(u,l),av(i,s,d)}catch(W){Wh(i,s,W)}}function av(i,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){lv(i,s,l)},function(l){return Wh(i,s,l)}):lv(i,s,r)}function lv(i,s,r){s.status="fulfilled",s.value=r,ov(s),i.state=r,s=i.pending,s!==null&&(r=s.next,r===s?i.pending=null:(r=r.next,s.next=r,rv(i,r)))}function Wh(i,s,r){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=r,ov(s),s=s.next;while(s!==l)}i.action=null}function ov(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function cv(i,s){return s}function uv(i,s){if(Ge){var r=ft.formState;if(r!==null){e:{var l=Ke;if(Ge){if(vt){t:{for(var u=vt,d=_s;u.nodeType!==8;){if(!d){u=null;break t}if(u=gs(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){vt=gs(u.nextSibling),l=u.data==="F!";break e}}Rn(l)}l=!1}l&&(s=r[0])}}return r=zi(),r.memoizedState=r.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cv,lastRenderedState:s},r.queue=l,r=Rv.bind(null,Ke,l),l.dispatch=r,l=qh(!1),d=Zh.bind(null,Ke,!1,l.queue),l=zi(),u={state:s,dispatch:null,action:i,pending:null},l.queue=u,r=sC.bind(null,Ke,u,d,r),u.dispatch=r,l.memoizedState=i,[s,r,!1]}function hv(i){var s=Pt();return dv(s,ot,i)}function dv(i,s,r){if(s=Ih(i,s,cv)[0],i=lc(rn)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=pl(s)}catch(v){throw v===ca?Zo:v}else l=s;s=Pt();var u=s.queue,d=u.dispatch;return r!==s.memoizedState&&(Ke.flags|=2048,pa(9,{destroy:void 0},nC.bind(null,u,r),null)),[l,d,i]}function nC(i,s){i.action=s}function fv(i){var s=Pt(),r=ot;if(r!==null)return dv(s,r,i);Pt(),s=s.memoizedState,r=Pt();var l=r.queue.dispatch;return r.memoizedState=i,[s,l,!1]}function pa(i,s,r,l){return i={tag:i,create:r,deps:l,inst:s,next:null},s=Ke.updateQueue,s===null&&(s=rc(),Ke.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 pv(){return Pt().memoizedState}function oc(i,s,r,l){var u=zi();Ke.flags|=i,u.memoizedState=pa(1|s,{destroy:void 0},r,l===void 0?null:l)}function cc(i,s,r,l){var u=Pt();l=l===void 0?null:l;var d=u.memoizedState.inst;ot!==null&&l!==null&&zh(l,ot.memoizedState.deps)?u.memoizedState=pa(s,d,r,l):(Ke.flags|=i,u.memoizedState=pa(1|s,d,r,l))}function mv(i,s){oc(8390656,8,i,s)}function $h(i,s){cc(2048,8,i,s)}function rC(i){Ke.flags|=4;var s=Ke.updateQueue;if(s===null)s=rc(),Ke.updateQueue=s,s.events=[i];else{var r=s.events;r===null?s.events=[i]:r.push(i)}}function _v(i){var s=Pt().memoizedState;return rC({ref:s,nextImpl:i}),function(){if((nt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function vv(i,s){return cc(4,2,i,s)}function gv(i,s){return cc(4,4,i,s)}function yv(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 bv(i,s,r){r=r!=null?r.concat([i]):null,cc(4,4,yv.bind(null,s,i),r)}function Yh(){}function Sv(i,s){var r=Pt();s=s===void 0?null:s;var l=r.memoizedState;return s!==null&&zh(s,l[1])?l[0]:(r.memoizedState=[i,s],i)}function wv(i,s){var r=Pt();s=s===void 0?null:s;var l=r.memoizedState;if(s!==null&&zh(s,l[1]))return l[0];if(l=i(),Er){pi(!0);try{i()}finally{pi(!1)}}return r.memoizedState=[l,s],l}function Vh(i,s,r){return r===void 0||(nn&1073741824)!==0&&(Ve&261930)===0?i.memoizedState=s:(i.memoizedState=r,i=Cg(),Ke.lanes|=i,Hn|=i,r)}function Cv(i,s,r,l){return es(r,s)?r:ha.current!==null?(i=Vh(i,r,l),es(i,s)||($t=!0),i):(nn&42)===0||(nn&1073741824)!==0&&(Ve&261930)===0?($t=!0,i.memoizedState=r):(i=Cg(),Ke.lanes|=i,Hn|=i,s)}function xv(i,s,r,l,u){var d=I.p;I.p=d!==0&&8>d?d:8;var v=N.T,S={};N.T=S,Zh(i,!1,s,r);try{var M=u(),W=N.S;if(W!==null&&W(S,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var ie=eC(M,l);ml(i,s,ie,as(i))}else ml(i,s,l,as(i))}catch(ce){ml(i,s,{then:function(){},status:"rejected",reason:ce},as())}finally{I.p=d,v!==null&&S.types!==null&&(v.types=S.types),N.T=v}}function aC(){}function Xh(i,s,r,l){if(i.tag!==5)throw Error(a(476));var u=Ev(i).queue;xv(i,u,s,X,r===null?aC:function(){return Tv(i),r(l)})}function Ev(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rn,lastRenderedState:X},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rn,lastRenderedState:r},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function Tv(i){var s=Ev(i);s.next===null&&(s=i.alternate.memoizedState),ml(i,s.next.queue,{},as())}function Gh(){return yi(Al)}function kv(){return Pt().memoizedState}function Dv(){return Pt().memoizedState}function lC(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var r=as();i=An(r);var l=Ln(s,i,r);l!==null&&(Xi(l,s,r),ul(l,s,r)),s={cache:Eh()},i.payload=s;return}s=s.return}}function oC(i,s,r){var l=as();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},uc(i)?Mv(s,r):(r=ph(i,s,r,l),r!==null&&(Xi(r,i,l),Nv(r,s,l)))}function Rv(i,s,r){var l=as();ml(i,s,r,l)}function ml(i,s,r,l){var u={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(uc(i))Mv(s,u);else{var d=i.alternate;if(i.lanes===0&&(d===null||d.lanes===0)&&(d=s.lastRenderedReducer,d!==null))try{var v=s.lastRenderedState,S=d(v,r);if(u.hasEagerState=!0,u.eagerState=S,es(S,v))return qo(i,s,u,0),ft===null&&Fo(),!1}catch{}if(r=ph(i,s,u,l),r!==null)return Xi(r,i,l),Nv(r,s,l),!0}return!1}function Zh(i,s,r,l){if(l={lane:2,revertLane:Rd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},uc(i)){if(s)throw Error(a(479))}else s=ph(i,r,l,2),s!==null&&Xi(s,i,2)}function uc(i){var s=i.alternate;return i===Ke||s!==null&&s===Ke}function Mv(i,s){da=sc=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function Nv(i,s,r){if((r&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,Rt(i,r)}}var _l={readContext:yi,use:ac,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};_l.useEffectEvent=Lt;var Av={readContext:yi,use:ac,useCallback:function(i,s){return zi().memoizedState=[i,s===void 0?null:s],i},useContext:yi,useEffect:mv,useImperativeHandle:function(i,s,r){r=r!=null?r.concat([i]):null,oc(4194308,4,yv.bind(null,s,i),r)},useLayoutEffect:function(i,s){return oc(4194308,4,i,s)},useInsertionEffect:function(i,s){oc(4,2,i,s)},useMemo:function(i,s){var r=zi();s=s===void 0?null:s;var l=i();if(Er){pi(!0);try{i()}finally{pi(!1)}}return r.memoizedState=[l,s],l},useReducer:function(i,s,r){var l=zi();if(r!==void 0){var u=r(s);if(Er){pi(!0);try{r(s)}finally{pi(!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=oC.bind(null,Ke,i),[l.memoizedState,i]},useRef:function(i){var s=zi();return i={current:i},s.memoizedState=i},useState:function(i){i=qh(i);var s=i.queue,r=Rv.bind(null,Ke,s);return s.dispatch=r,[i.memoizedState,r]},useDebugValue:Yh,useDeferredValue:function(i,s){var r=zi();return Vh(r,i,s)},useTransition:function(){var i=qh(!1);return i=xv.bind(null,Ke,i.queue,!0,!1),zi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,r){var l=Ke,u=zi();if(Ge){if(r===void 0)throw Error(a(407));r=r()}else{if(r=s(),ft===null)throw Error(a(349));(Ve&127)!==0||J_(l,s,r)}u.memoizedState=r;var d={value:r,getSnapshot:s};return u.queue=d,mv(tv.bind(null,l,d,i),[i]),l.flags|=2048,pa(9,{destroy:void 0},ev.bind(null,l,d,r,s),null),r},useId:function(){var i=zi(),s=ft.identifierPrefix;if(Ge){var r=Ps,l=Us;r=(l&~(1<<32-xt(l)-1)).toString(32)+r,s="_"+s+"R_"+r,r=nc++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=tC++,s="_"+s+"r_"+r.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:Gh,useFormState:uv,useActionState:uv,useOptimistic:function(i){var s=zi();s.memoizedState=s.baseState=i;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=Zh.bind(null,Ke,!0,r),r.dispatch=s,[i,s]},useMemoCache:Kh,useCacheRefresh:function(){return zi().memoizedState=lC.bind(null,Ke)},useEffectEvent:function(i){var s=zi(),r={impl:i};return s.memoizedState=r,function(){if((nt&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},Qh={readContext:yi,use:ac,useCallback:Sv,useContext:yi,useEffect:$h,useImperativeHandle:bv,useInsertionEffect:vv,useLayoutEffect:gv,useMemo:wv,useReducer:lc,useRef:pv,useState:function(){return lc(rn)},useDebugValue:Yh,useDeferredValue:function(i,s){var r=Pt();return Cv(r,ot.memoizedState,i,s)},useTransition:function(){var i=lc(rn)[0],s=Pt().memoizedState;return[typeof i=="boolean"?i:pl(i),s]},useSyncExternalStore:Q_,useId:kv,useHostTransitionStatus:Gh,useFormState:hv,useActionState:hv,useOptimistic:function(i,s){var r=Pt();return nv(r,ot,i,s)},useMemoCache:Kh,useCacheRefresh:Dv};Qh.useEffectEvent=_v;var Lv={readContext:yi,use:ac,useCallback:Sv,useContext:yi,useEffect:$h,useImperativeHandle:bv,useInsertionEffect:vv,useLayoutEffect:gv,useMemo:wv,useReducer:Fh,useRef:pv,useState:function(){return Fh(rn)},useDebugValue:Yh,useDeferredValue:function(i,s){var r=Pt();return ot===null?Vh(r,i,s):Cv(r,ot.memoizedState,i,s)},useTransition:function(){var i=Fh(rn)[0],s=Pt().memoizedState;return[typeof i=="boolean"?i:pl(i),s]},useSyncExternalStore:Q_,useId:kv,useHostTransitionStatus:Gh,useFormState:fv,useActionState:fv,useOptimistic:function(i,s){var r=Pt();return ot!==null?nv(r,ot,i,s):(r.baseState=i,[i,r.queue.dispatch])},useMemoCache:Kh,useCacheRefresh:Dv};Lv.useEffectEvent=_v;function Jh(i,s,r,l){s=i.memoizedState,r=r(l,s),r=r==null?s:y({},s,r),i.memoizedState=r,i.lanes===0&&(i.updateQueue.baseState=r)}var ed={enqueueSetState:function(i,s,r){i=i._reactInternals;var l=as(),u=An(l);u.payload=s,r!=null&&(u.callback=r),s=Ln(i,u,l),s!==null&&(Xi(s,i,l),ul(s,i,l))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var l=as(),u=An(l);u.tag=1,u.payload=s,r!=null&&(u.callback=r),s=Ln(i,u,l),s!==null&&(Xi(s,i,l),ul(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=as(),l=An(r);l.tag=2,s!=null&&(l.callback=s),s=Ln(i,l,r),s!==null&&(Xi(s,i,r),ul(s,i,r))}};function Bv(i,s,r,l,u,d,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,d,v):s.prototype&&s.prototype.isPureReactComponent?!il(r,l)||!il(u,d):!0}function Ov(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&&ed.enqueueReplaceState(s,s.state,null)}function Tr(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=y({},r));for(var u in i)r[u]===void 0&&(r[u]=i[u])}return r}function zv(i){Io(i)}function jv(i){console.error(i)}function Hv(i){Io(i)}function hc(i,s){try{var r=i.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Uv(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 td(i,s,r){return r=An(r),r.tag=3,r.payload={element:null},r.callback=function(){hc(i,s)},r}function Pv(i){return i=An(i),i.tag=3,i}function Kv(i,s,r,l){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var d=l.value;i.payload=function(){return u(d)},i.callback=function(){Uv(s,r,l)}}var v=r.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){Uv(s,r,l),typeof u!="function"&&(Un===null?Un=new Set([this]):Un.add(this));var S=l.stack;this.componentDidCatch(l.value,{componentStack:S!==null?S:""})})}function cC(i,s,r,l,u){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=r.alternate,s!==null&&aa(s,r,u,!0),r=is.current,r!==null){switch(r.tag){case 31:case 13:return vs===null?Cc():r.alternate===null&&Bt===0&&(Bt=3),r.flags&=-257,r.flags|=65536,r.lanes=u,l===Qo?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([l]):s.add(l),Td(i,l,u)),!1;case 22:return r.flags|=65536,l===Qo?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)),Td(i,l,u)),!1}throw Error(a(435,r.tag))}return Td(i,l,u),Cc(),!1}if(Ge)return s=is.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,l!==bh&&(i=Error(a(422),{cause:l}),rl(fs(i,r)))):(l!==bh&&(s=Error(a(423),{cause:l}),rl(fs(s,r))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,l=fs(l,r),u=td(i.stateNode,l,u),Nh(i,u),Bt!==4&&(Bt=2)),!1;var d=Error(a(520),{cause:l});if(d=fs(d,r),xl===null?xl=[d]:xl.push(d),Bt!==4&&(Bt=2),s===null)return!0;l=fs(l,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,i=u&-u,r.lanes|=i,i=td(r.stateNode,l,i),Nh(r,i),!1;case 1:if(s=r.type,d=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Un===null||!Un.has(d))))return r.flags|=65536,u&=-u,r.lanes|=u,u=Pv(u),Kv(u,i,r,l),Nh(r,u),!1}r=r.return}while(r!==null);return!1}var id=Error(a(461)),$t=!1;function bi(i,s,r,l){s.child=i===null?W_(s,null,r,l):xr(s,i.child,r,l)}function Iv(i,s,r,l,u){r=r.render;var d=s.ref;if("ref"in l){var v={};for(var S in l)S!=="ref"&&(v[S]=l[S])}else v=l;return br(s),l=jh(i,s,r,v,d,u),S=Hh(),i!==null&&!$t?(Uh(i,s,u),an(i,s,u)):(Ge&&S&&gh(s),s.flags|=1,bi(i,s,l,u),s.child)}function Fv(i,s,r,l,u){if(i===null){var d=r.type;return typeof d=="function"&&!mh(d)&&d.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=d,qv(i,s,d,l,u)):(i=$o(r.type,null,l,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(d=i.child,!ud(i,u)){var v=d.memoizedProps;if(r=r.compare,r=r!==null?r:il,r(v,l)&&i.ref===s.ref)return an(i,s,u)}return s.flags|=1,i=Js(d,l),i.ref=s.ref,i.return=s,s.child=i}function qv(i,s,r,l,u){if(i!==null){var d=i.memoizedProps;if(il(d,l)&&i.ref===s.ref)if($t=!1,s.pendingProps=l=d,ud(i,u))(i.flags&131072)!==0&&($t=!0);else return s.lanes=i.lanes,an(i,s,u)}return sd(i,s,r,l,u)}function Wv(i,s,r,l){var u=l.children,d=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(d=d!==null?d.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&~d}else l=0,s.child=null;return $v(i,s,d,r,l)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&Go(s,d!==null?d.cachePool:null),d!==null?V_(s,d):Lh(),X_(s);else return l=s.lanes=536870912,$v(i,s,d!==null?d.baseLanes|r:r,r,l)}else d!==null?(Go(s,d.cachePool),V_(s,d),On(),s.memoizedState=null):(i!==null&&Go(s,null),Lh(),On());return bi(i,s,u,r),s.child}function vl(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function $v(i,s,r,l,u){var d=kh();return d=d===null?null:{parent:qt._currentValue,pool:d},s.memoizedState={baseLanes:r,cachePool:d},i!==null&&Go(s,null),Lh(),X_(s),i!==null&&aa(i,s,l,!0),s.childLanes=u,null}function dc(i,s){return s=pc({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Yv(i,s,r){return xr(s,i.child,null,r),i=dc(s,s.pendingProps),i.flags|=2,ss(s),s.memoizedState=null,i}function uC(i,s,r){var l=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Ge){if(l.mode==="hidden")return i=dc(s,l),s.lanes=536870912,vl(null,i);if(Oh(s),(i=vt)?(i=ry(i,_s),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:kn!==null?{id:Us,overflow:Ps}:null,retryLane:536870912,hydrationErrors:null},r=M_(i),r.return=s,s.child=r,gi=s,vt=null)):i=null,i===null)throw Rn(s);return s.lanes=536870912,null}return dc(s,l)}var d=i.memoizedState;if(d!==null){var v=d.dehydrated;if(Oh(s),u)if(s.flags&256)s.flags&=-257,s=Yv(i,s,r);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(a(558));else if($t||aa(i,s,r,!1),u=(r&i.childLanes)!==0,$t||u){if(l=ft,l!==null&&(v=it(l,r),v!==0&&v!==d.retryLane))throw d.retryLane=v,_r(i,v),Xi(l,i,v),id;Cc(),s=Yv(i,s,r)}else i=d.treeContext,vt=gs(v.nextSibling),gi=s,Ge=!0,Dn=null,_s=!1,i!==null&&L_(s,i),s=dc(s,l),s.flags|=4096;return s}return i=Js(i.child,{mode:l.mode,children:l.children}),i.ref=s.ref,s.child=i,i.return=s,i}function fc(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 sd(i,s,r,l,u){return br(s),r=jh(i,s,r,l,void 0,u),l=Hh(),i!==null&&!$t?(Uh(i,s,u),an(i,s,u)):(Ge&&l&&gh(s),s.flags|=1,bi(i,s,r,u),s.child)}function Vv(i,s,r,l,u,d){return br(s),s.updateQueue=null,r=Z_(s,l,r,u),G_(i),l=Hh(),i!==null&&!$t?(Uh(i,s,d),an(i,s,d)):(Ge&&l&&gh(s),s.flags|=1,bi(i,s,r,d),s.child)}function Xv(i,s,r,l,u){if(br(s),s.stateNode===null){var d=ia,v=r.contextType;typeof v=="object"&&v!==null&&(d=yi(v)),d=new r(l,d),s.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=ed,s.stateNode=d,d._reactInternals=s,d=s.stateNode,d.props=l,d.state=s.memoizedState,d.refs={},Rh(s),v=r.contextType,d.context=typeof v=="object"&&v!==null?yi(v):ia,d.state=s.memoizedState,v=r.getDerivedStateFromProps,typeof v=="function"&&(Jh(s,r,v,l),d.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(v=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),v!==d.state&&ed.enqueueReplaceState(d,d.state,null),dl(s,l,d,u),hl(),d.state=s.memoizedState),typeof d.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){d=s.stateNode;var S=s.memoizedProps,M=Tr(r,S);d.props=M;var W=d.context,ie=r.contextType;v=ia,typeof ie=="object"&&ie!==null&&(v=yi(ie));var ce=r.getDerivedStateFromProps;ie=typeof ce=="function"||typeof d.getSnapshotBeforeUpdate=="function",S=s.pendingProps!==S,ie||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(S||W!==v)&&Ov(s,d,l,v),Nn=!1;var $=s.memoizedState;d.state=$,dl(s,l,d,u),hl(),W=s.memoizedState,S||$!==W||Nn?(typeof ce=="function"&&(Jh(s,r,ce,l),W=s.memoizedState),(M=Nn||Bv(s,r,M,l,$,W,v))?(ie||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(s.flags|=4194308)):(typeof d.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=W),d.props=l,d.state=W,d.context=v,l=M):(typeof d.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{d=s.stateNode,Mh(i,s),v=s.memoizedProps,ie=Tr(r,v),d.props=ie,ce=s.pendingProps,$=d.context,W=r.contextType,M=ia,typeof W=="object"&&W!==null&&(M=yi(W)),S=r.getDerivedStateFromProps,(W=typeof S=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(v!==ce||$!==M)&&Ov(s,d,l,M),Nn=!1,$=s.memoizedState,d.state=$,dl(s,l,d,u),hl();var Z=s.memoizedState;v!==ce||$!==Z||Nn||i!==null&&i.dependencies!==null&&Vo(i.dependencies)?(typeof S=="function"&&(Jh(s,r,S,l),Z=s.memoizedState),(ie=Nn||Bv(s,r,ie,l,$,Z,M)||i!==null&&i.dependencies!==null&&Vo(i.dependencies))?(W||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,Z,M),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,Z,M)),typeof d.componentDidUpdate=="function"&&(s.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof d.componentDidUpdate!="function"||v===i.memoizedProps&&$===i.memoizedState||(s.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&$===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=Z),d.props=l,d.state=Z,d.context=M,l=ie):(typeof d.componentDidUpdate!="function"||v===i.memoizedProps&&$===i.memoizedState||(s.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&$===i.memoizedState||(s.flags|=1024),l=!1)}return d=l,fc(i,s),l=(s.flags&128)!==0,d||l?(d=s.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:d.render(),s.flags|=1,i!==null&&l?(s.child=xr(s,i.child,null,u),s.child=xr(s,null,r,u)):bi(i,s,r,u),s.memoizedState=d.state,i=s.child):i=an(i,s,u),i}function Gv(i,s,r,l){return gr(),s.flags|=256,bi(i,s,r,l),s.child}var nd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rd(i){return{baseLanes:i,cachePool:U_()}}function ad(i,s,r){return i=i!==null?i.childLanes&~r:0,s&&(i|=rs),i}function Zv(i,s,r){var l=s.pendingProps,u=!1,d=(s.flags&128)!==0,v;if((v=d)||(v=i!==null&&i.memoizedState===null?!1:(Ut.current&2)!==0),v&&(u=!0,s.flags&=-129),v=(s.flags&32)!==0,s.flags&=-33,i===null){if(Ge){if(u?Bn(s):On(),(i=vt)?(i=ry(i,_s),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:kn!==null?{id:Us,overflow:Ps}:null,retryLane:536870912,hydrationErrors:null},r=M_(i),r.return=s,s.child=r,gi=s,vt=null)):i=null,i===null)throw Rn(s);return Id(i)?s.lanes=32:s.lanes=536870912,null}var S=l.children;return l=l.fallback,u?(On(),u=s.mode,S=pc({mode:"hidden",children:S},u),l=vr(l,u,r,null),S.return=s,l.return=s,S.sibling=l,s.child=S,l=s.child,l.memoizedState=rd(r),l.childLanes=ad(i,v,r),s.memoizedState=nd,vl(null,l)):(Bn(s),ld(s,S))}var M=i.memoizedState;if(M!==null&&(S=M.dehydrated,S!==null)){if(d)s.flags&256?(Bn(s),s.flags&=-257,s=od(i,s,r)):s.memoizedState!==null?(On(),s.child=i.child,s.flags|=128,s=null):(On(),S=l.fallback,u=s.mode,l=pc({mode:"visible",children:l.children},u),S=vr(S,u,r,null),S.flags|=2,l.return=s,S.return=s,l.sibling=S,s.child=l,xr(s,i.child,null,r),l=s.child,l.memoizedState=rd(r),l.childLanes=ad(i,v,r),s.memoizedState=nd,s=vl(null,l));else if(Bn(s),Id(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var W=v.dgst;v=W,l=Error(a(419)),l.stack="",l.digest=v,rl({value:l,source:null,stack:null}),s=od(i,s,r)}else if($t||aa(i,s,r,!1),v=(r&i.childLanes)!==0,$t||v){if(v=ft,v!==null&&(l=it(v,r),l!==0&&l!==M.retryLane))throw M.retryLane=l,_r(i,l),Xi(v,i,l),id;Kd(S)||Cc(),s=od(i,s,r)}else Kd(S)?(s.flags|=192,s.child=i.child,s=null):(i=M.treeContext,vt=gs(S.nextSibling),gi=s,Ge=!0,Dn=null,_s=!1,i!==null&&L_(s,i),s=ld(s,l.children),s.flags|=4096);return s}return u?(On(),S=l.fallback,u=s.mode,M=i.child,W=M.sibling,l=Js(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,W!==null?S=Js(W,S):(S=vr(S,u,r,null),S.flags|=2),S.return=s,l.return=s,l.sibling=S,s.child=l,vl(null,l),l=s.child,S=i.child.memoizedState,S===null?S=rd(r):(u=S.cachePool,u!==null?(M=qt._currentValue,u=u.parent!==M?{parent:M,pool:M}:u):u=U_(),S={baseLanes:S.baseLanes|r,cachePool:u}),l.memoizedState=S,l.childLanes=ad(i,v,r),s.memoizedState=nd,vl(i.child,l)):(Bn(s),r=i.child,i=r.sibling,r=Js(r,{mode:"visible",children:l.children}),r.return=s,r.sibling=null,i!==null&&(v=s.deletions,v===null?(s.deletions=[i],s.flags|=16):v.push(i)),s.child=r,s.memoizedState=null,r)}function ld(i,s){return s=pc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function pc(i,s){return i=ts(22,i,null,s),i.lanes=0,i}function od(i,s,r){return xr(s,i.child,null,r),i=ld(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Qv(i,s,r){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),Ch(i.return,s,r)}function cd(i,s,r,l,u,d){var v=i.memoizedState;v===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:u,treeForkCount:d}:(v.isBackwards=s,v.rendering=null,v.renderingStartTime=0,v.last=l,v.tail=r,v.tailMode=u,v.treeForkCount=d)}function Jv(i,s,r){var l=s.pendingProps,u=l.revealOrder,d=l.tail;l=l.children;var v=Ut.current,S=(v&2)!==0;if(S?(v=v&1|2,s.flags|=128):v&=1,se(Ut,v),bi(i,s,l,r),l=Ge?nl:0,!S&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Qv(i,r,s);else if(i.tag===19)Qv(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&&ic(i)===null&&(u=r),r=r.sibling;r=u,r===null?(u=s.child,s.child=null):(u=r.sibling,r.sibling=null),cd(s,!1,u,r,d,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&&ic(i)===null){s.child=u;break}i=u.sibling,u.sibling=r,r=u,u=i}cd(s,!0,r,null,d,l);break;case"together":cd(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function an(i,s,r){if(i!==null&&(s.dependencies=i.dependencies),Hn|=s.lanes,(r&s.childLanes)===0)if(i!==null){if(aa(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=Js(i,i.pendingProps),s.child=r,r.return=s;i.sibling!==null;)i=i.sibling,r=r.sibling=Js(i,i.pendingProps),r.return=s;r.sibling=null}return s.child}function ud(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&Vo(i)))}function hC(i,s,r){switch(s.tag){case 3:Me(s,s.stateNode.containerInfo),Mn(s,qt,i.memoizedState.cache),gr();break;case 27:case 5:Ne(s);break;case 4:Me(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,Oh(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(Bn(s),s.flags|=128,null):(r&s.child.childLanes)!==0?Zv(i,s,r):(Bn(s),i=an(i,s,r),i!==null?i.sibling:null);Bn(s);break;case 19:var u=(i.flags&128)!==0;if(l=(r&s.childLanes)!==0,l||(aa(i,s,r,!1),l=(r&s.childLanes)!==0),u){if(l)return Jv(i,s,r);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),se(Ut,Ut.current),l)break;return null;case 22:return s.lanes=0,Wv(i,s,r,s.pendingProps);case 24:Mn(s,qt,i.memoizedState.cache)}return an(i,s,r)}function eg(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps)$t=!0;else{if(!ud(i,r)&&(s.flags&128)===0)return $t=!1,hC(i,s,r);$t=(i.flags&131072)!==0}else $t=!1,Ge&&(s.flags&1048576)!==0&&A_(s,nl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=wr(s.elementType),s.type=i,typeof i=="function")mh(i)?(l=Tr(i,l),s.tag=1,s=Xv(null,s,i,l,r)):(s.tag=0,s=sd(null,s,i,l,r));else{if(i!=null){var u=i.$$typeof;if(u===G){s.tag=11,s=Iv(null,s,i,l,r);break e}else if(u===J){s.tag=14,s=Fv(null,s,i,l,r);break e}}throw s=B(i)||i,Error(a(306,s,""))}}return s;case 0:return sd(i,s,s.type,s.pendingProps,r);case 1:return l=s.type,u=Tr(l,s.pendingProps),Xv(i,s,l,u,r);case 3:e:{if(Me(s,s.stateNode.containerInfo),i===null)throw Error(a(387));l=s.pendingProps;var d=s.memoizedState;u=d.element,Mh(i,s),dl(s,l,null,r);var v=s.memoizedState;if(l=v.cache,Mn(s,qt,l),l!==d.cache&&xh(s,[qt],r,!0),hl(),l=v.element,d.isDehydrated)if(d={element:l,isDehydrated:!1,cache:v.cache},s.updateQueue.baseState=d,s.memoizedState=d,s.flags&256){s=Gv(i,s,l,r);break e}else if(l!==u){u=fs(Error(a(424)),s),rl(u),s=Gv(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,vt=gs(i.firstChild),gi=s,Ge=!0,Dn=null,_s=!0,r=W_(s,null,l,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(gr(),l===u){s=an(i,s,r);break e}bi(i,s,l,r)}s=s.child}return s;case 26:return fc(i,s),i===null?(r=hy(s.type,null,s.pendingProps,null))?s.memoizedState=r:Ge||(r=s.type,i=s.pendingProps,l=Mc(me.current).createElement(r),l[Nt]=s,l[Zt]=i,Si(l,r,i),At(l),s.stateNode=l):s.memoizedState=hy(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Ne(s),i===null&&Ge&&(l=s.stateNode=oy(s.type,s.pendingProps,me.current),gi=s,_s=!0,u=vt,Fn(s.type)?(Fd=u,vt=gs(l.firstChild)):vt=u),bi(i,s,s.pendingProps.children,r),fc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Ge&&((u=l=vt)&&(l=KC(l,s.type,s.pendingProps,_s),l!==null?(s.stateNode=l,gi=s,vt=gs(l.firstChild),_s=!1,u=!0):u=!1),u||Rn(s)),Ne(s),u=s.type,d=s.pendingProps,v=i!==null?i.memoizedProps:null,l=d.children,Hd(u,d)?l=null:v!==null&&Hd(u,v)&&(s.flags|=32),s.memoizedState!==null&&(u=jh(i,s,iC,null,null,r),Al._currentValue=u),fc(i,s),bi(i,s,l,r),s.child;case 6:return i===null&&Ge&&((i=r=vt)&&(r=IC(r,s.pendingProps,_s),r!==null?(s.stateNode=r,gi=s,vt=null,i=!0):i=!1),i||Rn(s)),null;case 13:return Zv(i,s,r);case 4:return Me(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=xr(s,null,l,r):bi(i,s,l,r),s.child;case 11:return Iv(i,s,s.type,s.pendingProps,r);case 7:return bi(i,s,s.pendingProps,r),s.child;case 8:return bi(i,s,s.pendingProps.children,r),s.child;case 12:return bi(i,s,s.pendingProps.children,r),s.child;case 10:return l=s.pendingProps,Mn(s,s.type,l.value),bi(i,s,l.children,r),s.child;case 9:return u=s.type._context,l=s.pendingProps.children,br(s),u=yi(u),l=l(u),s.flags|=1,bi(i,s,l,r),s.child;case 14:return Fv(i,s,s.type,s.pendingProps,r);case 15:return qv(i,s,s.type,s.pendingProps,r);case 19:return Jv(i,s,r);case 31:return uC(i,s,r);case 22:return Wv(i,s,r,s.pendingProps);case 24:return br(s),l=yi(qt),i===null?(u=kh(),u===null&&(u=ft,d=Eh(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=r),u=d),s.memoizedState={parent:l,cache:u},Rh(s),Mn(s,qt,u)):((i.lanes&r)!==0&&(Mh(i,s),dl(s,null,null,r),hl()),u=i.memoizedState,d=s.memoizedState,u.parent!==l?(u={parent:l,cache:l},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),Mn(s,qt,l)):(l=d.cache,Mn(s,qt,l),l!==u.cache&&xh(s,[qt],r,!0))),bi(i,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function ln(i){i.flags|=4}function hd(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(kg())i.flags|=8192;else throw Cr=Qo,Dh}else i.flags&=-16777217}function tg(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!_y(s))if(kg())i.flags|=8192;else throw Cr=Qo,Dh}function mc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Ht():536870912,i.lanes|=s,ga|=s)}function gl(i,s){if(!Ge)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 gt(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 dC(i,s,r){var l=s.pendingProps;switch(yh(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gt(s),null;case 1:return gt(s),null;case 3:return r=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),sn(qt),Re(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(i===null||i.child===null)&&(ra(s)?ln(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Sh())),gt(s),null;case 26:var u=s.type,d=s.memoizedState;return i===null?(ln(s),d!==null?(gt(s),tg(s,d)):(gt(s),hd(s,u,null,l,r))):d?d!==i.memoizedState?(ln(s),gt(s),tg(s,d)):(gt(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&ln(s),gt(s),hd(s,u,i,l,r)),null;case 27:if(Fe(s),r=me.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&ln(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return gt(s),null}i=he.current,ra(s)?B_(s):(i=oy(u,l,r),s.stateNode=i,ln(s))}return gt(s),null;case 5:if(Fe(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&ln(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return gt(s),null}if(d=he.current,ra(s))B_(s);else{var v=Mc(me.current);switch(d){case 1:d=v.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=v.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=v.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof l.is=="string"?v.createElement("select",{is:l.is}):v.createElement("select"),l.multiple?d.multiple=!0:l.size&&(d.size=l.size);break;default:d=typeof l.is=="string"?v.createElement(u,{is:l.is}):v.createElement(u)}}d[Nt]=s,d[Zt]=l;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)d.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=d;e:switch(Si(d,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&&ln(s)}}return gt(s),hd(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,r),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&ln(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(a(166));if(i=me.current,ra(s)){if(i=s.stateNode,r=s.memoizedProps,l=null,u=gi,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}i[Nt]=s,i=!!(i.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||Zg(i.nodeValue,r)),i||Rn(s,!0)}else i=Mc(i).createTextNode(l),i[Nt]=s,s.stateNode=i}return gt(s),null;case 31:if(r=s.memoizedState,i===null||i.memoizedState!==null){if(l=ra(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[Nt]=s}else gr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;gt(s),i=!1}else r=Sh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=r),i=!0;if(!i)return s.flags&256?(ss(s),s):(ss(s),null);if((s.flags&128)!==0)throw Error(a(558))}return gt(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=ra(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[Nt]=s}else gr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;gt(s),u=!1}else u=Sh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(ss(s),s):(ss(s),null)}return ss(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),d=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==u&&(l.flags|=2048)),r!==i&&r&&(s.child.flags|=8192),mc(s,s.updateQueue),gt(s),null);case 4:return Re(),i===null&&Ld(s.stateNode.containerInfo),gt(s),null;case 10:return sn(s.type),gt(s),null;case 19:if(V(Ut),l=s.memoizedState,l===null)return gt(s),null;if(u=(s.flags&128)!==0,d=l.rendering,d===null)if(u)gl(l,!1);else{if(Bt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(d=ic(i),d!==null){for(s.flags|=128,gl(l,!1),i=d.updateQueue,s.updateQueue=i,mc(s,i),s.subtreeFlags=0,i=r,r=s.child;r!==null;)R_(r,i),r=r.sibling;return se(Ut,Ut.current&1|2),Ge&&en(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&Le()>bc&&(s.flags|=128,u=!0,gl(l,!1),s.lanes=4194304)}else{if(!u)if(i=ic(d),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,mc(s,i),gl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!d.alternate&&!Ge)return gt(s),null}else 2*Le()-l.renderingStartTime>bc&&r!==536870912&&(s.flags|=128,u=!0,gl(l,!1),s.lanes=4194304);l.isBackwards?(d.sibling=s.child,s.child=d):(i=l.last,i!==null?i.sibling=d:s.child=d,l.last=d)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=Le(),i.sibling=null,r=Ut.current,se(Ut,u?r&1|2:r&1),Ge&&en(s,l.treeForkCount),i):(gt(s),null);case 22:case 23:return ss(s),Bh(),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&&(gt(s),s.subtreeFlags&6&&(s.flags|=8192)):gt(s),r=s.updateQueue,r!==null&&mc(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&&V(Sr),null;case 24:return r=null,i!==null&&(r=i.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),sn(qt),gt(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function fC(i,s){switch(yh(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return sn(qt),Re(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return Fe(s),null;case 31:if(s.memoizedState!==null){if(ss(s),s.alternate===null)throw Error(a(340));gr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(ss(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(a(340));gr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return V(Ut),null;case 4:return Re(),null;case 10:return sn(s.type),null;case 22:case 23:return ss(s),Bh(),i!==null&&V(Sr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return sn(qt),null;case 25:return null;default:return null}}function ig(i,s){switch(yh(s),s.tag){case 3:sn(qt),Re();break;case 26:case 27:case 5:Fe(s);break;case 4:Re();break;case 31:s.memoizedState!==null&&ss(s);break;case 13:ss(s);break;case 19:V(Ut);break;case 10:sn(s.type);break;case 22:case 23:ss(s),Bh(),i!==null&&V(Sr);break;case 24:sn(qt)}}function yl(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 d=r.create,v=r.inst;l=d(),v.destroy=l}r=r.next}while(r!==u)}}catch(S){lt(s,s.return,S)}}function zn(i,s,r){try{var l=s.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var d=u.next;l=d;do{if((l.tag&i)===i){var v=l.inst,S=v.destroy;if(S!==void 0){v.destroy=void 0,u=s;var M=r,W=S;try{W()}catch(ie){lt(u,M,ie)}}}l=l.next}while(l!==d)}}catch(ie){lt(s,s.return,ie)}}function sg(i){var s=i.updateQueue;if(s!==null){var r=i.stateNode;try{Y_(s,r)}catch(l){lt(i,i.return,l)}}}function ng(i,s,r){r.props=Tr(i.type,i.memoizedProps),r.state=i.memoizedState;try{r.componentWillUnmount()}catch(l){lt(i,s,l)}}function bl(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){lt(i,s,u)}}function Ks(i,s){var r=i.ref,l=i.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(u){lt(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){lt(i,s,u)}else r.current=null}function rg(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){lt(i,i.return,u)}}function dd(i,s,r){try{var l=i.stateNode;OC(l,i.type,r,s),l[Zt]=s}catch(u){lt(i,i.return,u)}}function ag(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Fn(i.type)||i.tag===4}function fd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||ag(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&&Fn(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 pd(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=Zs));else if(l!==4&&(l===27&&Fn(i.type)&&(r=i.stateNode,s=null),i=i.child,i!==null))for(pd(i,s,r),i=i.sibling;i!==null;)pd(i,s,r),i=i.sibling}function _c(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&&Fn(i.type)&&(r=i.stateNode),i=i.child,i!==null))for(_c(i,s,r),i=i.sibling;i!==null;)_c(i,s,r),i=i.sibling}function lg(i){var s=i.stateNode,r=i.memoizedProps;try{for(var l=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Si(s,l,r),s[Nt]=i,s[Zt]=r}catch(d){lt(i,i.return,d)}}var on=!1,Yt=!1,md=!1,og=typeof WeakSet=="function"?WeakSet:Set,ai=null;function pC(i,s){if(i=i.containerInfo,zd=jc,i=b_(i),oh(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,d=l.focusNode;l=l.focusOffset;try{r.nodeType,d.nodeType}catch{r=null;break e}var v=0,S=-1,M=-1,W=0,ie=0,ce=i,$=null;t:for(;;){for(var Z;ce!==r||u!==0&&ce.nodeType!==3||(S=v+u),ce!==d||l!==0&&ce.nodeType!==3||(M=v+l),ce.nodeType===3&&(v+=ce.nodeValue.length),(Z=ce.firstChild)!==null;)$=ce,ce=Z;for(;;){if(ce===i)break t;if($===r&&++W===u&&(S=v),$===d&&++ie===l&&(M=v),(Z=ce.nextSibling)!==null)break;ce=$,$=ce.parentNode}ce=Z}r=S===-1||M===-1?null:{start:S,end:M}}else r=null}r=r||{start:0,end:0}}else r=null;for(jd={focusedElem:i,selectionRange:r},jc=!1,ai=s;ai!==null;)if(s=ai,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,ai=i;else for(;ai!==null;){switch(s=ai,d=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&&d!==null){i=void 0,r=s,u=d.memoizedProps,d=d.memoizedState,l=r.stateNode;try{var Ce=Tr(r.type,u);i=l.getSnapshotBeforeUpdate(Ce,d),l.__reactInternalSnapshotBeforeUpdate=i}catch(Be){lt(r,r.return,Be)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,r=i.nodeType,r===9)Pd(i);else if(r===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Pd(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,ai=i;break}ai=s.return}}function cg(i,s,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:un(i,r),l&4&&yl(5,r);break;case 1:if(un(i,r),l&4)if(i=r.stateNode,s===null)try{i.componentDidMount()}catch(v){lt(r,r.return,v)}else{var u=Tr(r.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(v){lt(r,r.return,v)}}l&64&&sg(r),l&512&&bl(r,r.return);break;case 3:if(un(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{Y_(i,s)}catch(v){lt(r,r.return,v)}}break;case 27:s===null&&l&4&&lg(r);case 26:case 5:un(i,r),s===null&&l&4&&rg(r),l&512&&bl(r,r.return);break;case 12:un(i,r);break;case 31:un(i,r),l&4&&dg(i,r);break;case 13:un(i,r),l&4&&fg(i,r),l&64&&(i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(r=CC.bind(null,r),FC(i,r))));break;case 22:if(l=r.memoizedState!==null||on,!l){s=s!==null&&s.memoizedState!==null||Yt,u=on;var d=Yt;on=l,(Yt=s)&&!d?hn(i,r,(r.subtreeFlags&8772)!==0):un(i,r),on=u,Yt=d}break;case 30:break;default:un(i,r)}}function ug(i){var s=i.alternate;s!==null&&(i.alternate=null,ug(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&js(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 St=null,Wi=!1;function cn(i,s,r){for(r=r.child;r!==null;)hg(i,s,r),r=r.sibling}function hg(i,s,r){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(fi,r)}catch{}switch(r.tag){case 26:Yt||Ks(r,s),cn(i,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Yt||Ks(r,s);var l=St,u=Wi;Fn(r.type)&&(St=r.stateNode,Wi=!1),cn(i,s,r),Rl(r.stateNode),St=l,Wi=u;break;case 5:Yt||Ks(r,s);case 6:if(l=St,u=Wi,St=null,cn(i,s,r),St=l,Wi=u,St!==null)if(Wi)try{(St.nodeType===9?St.body:St.nodeName==="HTML"?St.ownerDocument.body:St).removeChild(r.stateNode)}catch(d){lt(r,s,d)}else try{St.removeChild(r.stateNode)}catch(d){lt(r,s,d)}break;case 18:St!==null&&(Wi?(i=St,sy(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.stateNode),Ta(i)):sy(St,r.stateNode));break;case 4:l=St,u=Wi,St=r.stateNode.containerInfo,Wi=!0,cn(i,s,r),St=l,Wi=u;break;case 0:case 11:case 14:case 15:zn(2,r,s),Yt||zn(4,r,s),cn(i,s,r);break;case 1:Yt||(Ks(r,s),l=r.stateNode,typeof l.componentWillUnmount=="function"&&ng(r,s,l)),cn(i,s,r);break;case 21:cn(i,s,r);break;case 22:Yt=(l=Yt)||r.memoizedState!==null,cn(i,s,r),Yt=l;break;default:cn(i,s,r)}}function dg(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Ta(i)}catch(r){lt(s,s.return,r)}}}function fg(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ta(i)}catch(r){lt(s,s.return,r)}}function mC(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new og),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new og),s;default:throw Error(a(435,i.tag))}}function vc(i,s){var r=mC(i);s.forEach(function(l){if(!r.has(l)){r.add(l);var u=xC.bind(null,i,l);l.then(u,u)}})}function $i(i,s){var r=s.deletions;if(r!==null)for(var l=0;l<r.length;l++){var u=r[l],d=i,v=s,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(Fn(S.type)){St=S.stateNode,Wi=!1;break e}break;case 5:St=S.stateNode,Wi=!1;break e;case 3:case 4:St=S.stateNode.containerInfo,Wi=!0;break e}S=S.return}if(St===null)throw Error(a(160));hg(d,v,u),St=null,Wi=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)pg(s,i),s=s.sibling}var Ls=null;function pg(i,s){var r=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:$i(s,i),Yi(i),l&4&&(zn(3,i,i.return),yl(3,i),zn(5,i,i.return));break;case 1:$i(s,i),Yi(i),l&512&&(Yt||r===null||Ks(r,r.return)),l&64&&on&&(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=Ls;if($i(s,i),Yi(i),l&512&&(Yt||r===null||Ks(r,r.return)),l&4){var d=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":d=u.getElementsByTagName("title")[0],(!d||d[Ki]||d[Nt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(l),u.head.insertBefore(d,u.querySelector("head > title"))),Si(d,l,r),d[Nt]=i,At(d),l=d;break e;case"link":var v=py("link","href",u).get(l+(r.href||""));if(v){for(var S=0;S<v.length;S++)if(d=v[S],d.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&d.getAttribute("rel")===(r.rel==null?null:r.rel)&&d.getAttribute("title")===(r.title==null?null:r.title)&&d.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){v.splice(S,1);break t}}d=u.createElement(l),Si(d,l,r),u.head.appendChild(d);break;case"meta":if(v=py("meta","content",u).get(l+(r.content||""))){for(S=0;S<v.length;S++)if(d=v[S],d.getAttribute("content")===(r.content==null?null:""+r.content)&&d.getAttribute("name")===(r.name==null?null:r.name)&&d.getAttribute("property")===(r.property==null?null:r.property)&&d.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&d.getAttribute("charset")===(r.charSet==null?null:r.charSet)){v.splice(S,1);break t}}d=u.createElement(l),Si(d,l,r),u.head.appendChild(d);break;default:throw Error(a(468,l))}d[Nt]=i,At(d),l=d}i.stateNode=l}else my(u,i.type,i.stateNode);else i.stateNode=fy(u,l,i.memoizedProps);else d!==l?(d===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):d.count--,l===null?my(u,i.type,i.stateNode):fy(u,l,i.memoizedProps)):l===null&&i.stateNode!==null&&dd(i,i.memoizedProps,r.memoizedProps)}break;case 27:$i(s,i),Yi(i),l&512&&(Yt||r===null||Ks(r,r.return)),r!==null&&l&4&&dd(i,i.memoizedProps,r.memoizedProps);break;case 5:if($i(s,i),Yi(i),l&512&&(Yt||r===null||Ks(r,r.return)),i.flags&32){u=i.stateNode;try{Gs(u,"")}catch(Ce){lt(i,i.return,Ce)}}l&4&&i.stateNode!=null&&(u=i.memoizedProps,dd(i,u,r!==null?r.memoizedProps:u)),l&1024&&(md=!0);break;case 6:if($i(s,i),Yi(i),l&4){if(i.stateNode===null)throw Error(a(162));l=i.memoizedProps,r=i.stateNode;try{r.nodeValue=l}catch(Ce){lt(i,i.return,Ce)}}break;case 3:if(Lc=null,u=Ls,Ls=Nc(s.containerInfo),$i(s,i),Ls=u,Yi(i),l&4&&r!==null&&r.memoizedState.isDehydrated)try{Ta(s.containerInfo)}catch(Ce){lt(i,i.return,Ce)}md&&(md=!1,mg(i));break;case 4:l=Ls,Ls=Nc(i.stateNode.containerInfo),$i(s,i),Yi(i),Ls=l;break;case 12:$i(s,i),Yi(i);break;case 31:$i(s,i),Yi(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,vc(i,l)));break;case 13:$i(s,i),Yi(i),i.child.flags&8192&&i.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(yc=Le()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,vc(i,l)));break;case 22:u=i.memoizedState!==null;var M=r!==null&&r.memoizedState!==null,W=on,ie=Yt;if(on=W||u,Yt=ie||M,$i(s,i),Yt=ie,on=W,Yi(i),l&8192)e:for(s=i.stateNode,s._visibility=u?s._visibility&-2:s._visibility|1,u&&(r===null||M||on||Yt||kr(i)),r=null,s=i;;){if(s.tag===5||s.tag===26){if(r===null){M=r=s;try{if(d=M.stateNode,u)v=d.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=M.stateNode;var ce=M.memoizedProps.style,$=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;S.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(Ce){lt(M,M.return,Ce)}}}else if(s.tag===6){if(r===null){M=s;try{M.stateNode.nodeValue=u?"":M.memoizedProps}catch(Ce){lt(M,M.return,Ce)}}}else if(s.tag===18){if(r===null){M=s;try{var Z=M.stateNode;u?ny(Z,!0):ny(M.stateNode,!1)}catch(Ce){lt(M,M.return,Ce)}}}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,vc(i,r))));break;case 19:$i(s,i),Yi(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,vc(i,l)));break;case 30:break;case 21:break;default:$i(s,i),Yi(i)}}function Yi(i){var s=i.flags;if(s&2){try{for(var r,l=i.return;l!==null;){if(ag(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var u=r.stateNode,d=fd(i);_c(i,d,u);break;case 5:var v=r.stateNode;r.flags&32&&(Gs(v,""),r.flags&=-33);var S=fd(i);_c(i,S,v);break;case 3:case 4:var M=r.stateNode.containerInfo,W=fd(i);pd(i,W,M);break;default:throw Error(a(161))}}catch(ie){lt(i,i.return,ie)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function mg(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;mg(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function un(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)cg(i,s.alternate,s),s=s.sibling}function kr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:zn(4,s,s.return),kr(s);break;case 1:Ks(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&ng(s,s.return,r),kr(s);break;case 27:Rl(s.stateNode);case 26:case 5:Ks(s,s.return),kr(s);break;case 22:s.memoizedState===null&&kr(s);break;case 30:kr(s);break;default:kr(s)}i=i.sibling}}function hn(i,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,u=i,d=s,v=d.flags;switch(d.tag){case 0:case 11:case 15:hn(u,d,r),yl(4,d);break;case 1:if(hn(u,d,r),l=d,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(W){lt(l,l.return,W)}if(l=d,u=l.updateQueue,u!==null){var S=l.stateNode;try{var M=u.shared.hiddenCallbacks;if(M!==null)for(u.shared.hiddenCallbacks=null,u=0;u<M.length;u++)$_(M[u],S)}catch(W){lt(l,l.return,W)}}r&&v&64&&sg(d),bl(d,d.return);break;case 27:lg(d);case 26:case 5:hn(u,d,r),r&&l===null&&v&4&&rg(d),bl(d,d.return);break;case 12:hn(u,d,r);break;case 31:hn(u,d,r),r&&v&4&&dg(u,d);break;case 13:hn(u,d,r),r&&v&4&&fg(u,d);break;case 22:d.memoizedState===null&&hn(u,d,r),bl(d,d.return);break;case 30:break;default:hn(u,d,r)}s=s.sibling}}function _d(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&&al(r))}function vd(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&al(i))}function Bs(i,s,r,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)_g(i,s,r,l),s=s.sibling}function _g(i,s,r,l){var u=s.flags;switch(s.tag){case 0:case 11:case 15:Bs(i,s,r,l),u&2048&&yl(9,s);break;case 1:Bs(i,s,r,l);break;case 3:Bs(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&&al(i)));break;case 12:if(u&2048){Bs(i,s,r,l),i=s.stateNode;try{var d=s.memoizedProps,v=d.id,S=d.onPostCommit;typeof S=="function"&&S(v,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(M){lt(s,s.return,M)}}else Bs(i,s,r,l);break;case 31:Bs(i,s,r,l);break;case 13:Bs(i,s,r,l);break;case 23:break;case 22:d=s.stateNode,v=s.alternate,s.memoizedState!==null?d._visibility&2?Bs(i,s,r,l):Sl(i,s):d._visibility&2?Bs(i,s,r,l):(d._visibility|=2,ma(i,s,r,l,(s.subtreeFlags&10256)!==0||!1)),u&2048&&_d(v,s);break;case 24:Bs(i,s,r,l),u&2048&&vd(s.alternate,s);break;default:Bs(i,s,r,l)}}function ma(i,s,r,l,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var d=i,v=s,S=r,M=l,W=v.flags;switch(v.tag){case 0:case 11:case 15:ma(d,v,S,M,u),yl(8,v);break;case 23:break;case 22:var ie=v.stateNode;v.memoizedState!==null?ie._visibility&2?ma(d,v,S,M,u):Sl(d,v):(ie._visibility|=2,ma(d,v,S,M,u)),u&&W&2048&&_d(v.alternate,v);break;case 24:ma(d,v,S,M,u),u&&W&2048&&vd(v.alternate,v);break;default:ma(d,v,S,M,u)}s=s.sibling}}function Sl(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:Sl(r,l),u&2048&&_d(l.alternate,l);break;case 24:Sl(r,l),u&2048&&vd(l.alternate,l);break;default:Sl(r,l)}s=s.sibling}}var wl=8192;function _a(i,s,r){if(i.subtreeFlags&wl)for(i=i.child;i!==null;)vg(i,s,r),i=i.sibling}function vg(i,s,r){switch(i.tag){case 26:_a(i,s,r),i.flags&wl&&i.memoizedState!==null&&tx(r,Ls,i.memoizedState,i.memoizedProps);break;case 5:_a(i,s,r);break;case 3:case 4:var l=Ls;Ls=Nc(i.stateNode.containerInfo),_a(i,s,r),Ls=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=wl,wl=16777216,_a(i,s,r),wl=l):_a(i,s,r));break;default:_a(i,s,r)}}function gg(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 Cl(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];ai=l,bg(l,i)}gg(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)yg(i),i=i.sibling}function yg(i){switch(i.tag){case 0:case 11:case 15:Cl(i),i.flags&2048&&zn(9,i,i.return);break;case 3:Cl(i);break;case 12:Cl(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,gc(i)):Cl(i);break;default:Cl(i)}}function gc(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];ai=l,bg(l,i)}gg(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:zn(8,s,s.return),gc(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,gc(s));break;default:gc(s)}i=i.sibling}}function bg(i,s){for(;ai!==null;){var r=ai;switch(r.tag){case 0:case 11:case 15:zn(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:al(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,ai=l;else e:for(r=i;ai!==null;){l=ai;var u=l.sibling,d=l.return;if(ug(l),l===r){ai=null;break e}if(u!==null){u.return=d,ai=u;break e}ai=d}}}var _C={getCacheForType:function(i){var s=yi(qt),r=s.data.get(i);return r===void 0&&(r=i(),s.data.set(i,r)),r},cacheSignal:function(){return yi(qt).controller.signal}},vC=typeof WeakMap=="function"?WeakMap:Map,nt=0,ft=null,$e=null,Ve=0,at=0,ns=null,jn=!1,va=!1,gd=!1,dn=0,Bt=0,Hn=0,Dr=0,yd=0,rs=0,ga=0,xl=null,Vi=null,bd=!1,yc=0,Sg=0,bc=1/0,Sc=null,Un=null,Qt=0,Pn=null,ya=null,fn=0,Sd=0,wd=null,wg=null,El=0,Cd=null;function as(){return(nt&2)!==0&&Ve!==0?Ve&-Ve:N.T!==null?Rd():Ft()}function Cg(){if(rs===0)if((Ve&536870912)===0||Ge){var i=Bi;Bi<<=1,(Bi&3932160)===0&&(Bi=262144),rs=i}else rs=536870912;return i=is.current,i!==null&&(i.flags|=32),rs}function Xi(i,s,r){(i===ft&&(at===2||at===9)||i.cancelPendingCommit!==null)&&(ba(i,0),Kn(i,Ve,rs,!1)),Ti(i,r),((nt&2)===0||i!==ft)&&(i===ft&&((nt&2)===0&&(Dr|=r),Bt===4&&Kn(i,Ve,rs,!1)),Is(i))}function xg(i,s,r){if((nt&6)!==0)throw Error(a(327));var l=!r&&(s&127)===0&&(s&i.expiredLanes)===0||jt(i,s),u=l?bC(i,s):Ed(i,s,!0),d=l;do{if(u===0){va&&!l&&Kn(i,s,0,!1);break}else{if(r=i.current.alternate,d&&!gC(r)){u=Ed(i,s,!1),d=!1;continue}if(u===2){if(d=s,i.errorRecoveryDisabledLanes&d)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){s=v;e:{var S=i;u=xl;var M=S.current.memoizedState.isDehydrated;if(M&&(ba(S,v).flags|=256),v=Ed(S,v,!1),v!==2){if(gd&&!M){S.errorRecoveryDisabledLanes|=d,Dr|=d,u=4;break e}d=Vi,Vi=u,d!==null&&(Vi===null?Vi=d:Vi.push.apply(Vi,d))}u=v}if(d=!1,u!==2)continue}}if(u===1){ba(i,0),Kn(i,s,0,!0);break}e:{switch(l=i,d=u,d){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:Kn(l,s,rs,!jn);break e;case 2:Vi=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(u=yc+300-Le(),10<u)){if(Kn(l,s,rs,!jn),Et(l,0,!0)!==0)break e;fn=s,l.timeoutHandle=ty(Eg.bind(null,l,r,Vi,Sc,bd,s,rs,Dr,ga,jn,d,"Throttled",-0,0),u);break e}Eg(l,r,Vi,Sc,bd,s,rs,Dr,ga,jn,d,null,-0,0)}}break}while(!0);Is(i)}function Eg(i,s,r,l,u,d,v,S,M,W,ie,ce,$,Z){if(i.timeoutHandle=-1,ce=s.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zs},vg(s,d,ce);var Ce=(d&62914560)===d?yc-Le():(d&4194048)===d?Sg-Le():0;if(Ce=ix(ce,Ce),Ce!==null){fn=d,i.cancelPendingCommit=Ce(Lg.bind(null,i,s,d,r,l,u,v,S,M,ie,ce,null,$,Z)),Kn(i,d,v,!W);return}}Lg(i,s,d,r,l,u,v,S,M)}function gC(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],d=u.getSnapshot;u=u.value;try{if(!es(d(),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&=~yd,s&=~Dr,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var u=s;0<u;){var d=31-xt(u),v=1<<d;l[d]=-1,u&=~v}r!==0&&ki(i,r,s)}function wc(){return(nt&6)===0?(Tl(0),!1):!0}function xd(){if($e!==null){if(at===0)var i=$e.return;else i=$e,tn=yr=null,Ph(i),ua=null,ol=0,i=$e;for(;i!==null;)ig(i.alternate,i),i=i.return;$e=null}}function ba(i,s){var r=i.timeoutHandle;r!==-1&&(i.timeoutHandle=-1,HC(r)),r=i.cancelPendingCommit,r!==null&&(i.cancelPendingCommit=null,r()),fn=0,xd(),ft=i,$e=r=Js(i.current,null),Ve=s,at=0,ns=null,jn=!1,va=jt(i,s),gd=!1,ga=rs=yd=Dr=Hn=Bt=0,Vi=xl=null,bd=!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-xt(l),d=1<<u;s|=i[u],l&=~d}return dn=s,Fo(),r}function Tg(i,s){Ke=null,N.H=_l,s===ca||s===Zo?(s=I_(),at=3):s===Dh?(s=I_(),at=4):at=s===id?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ns=s,$e===null&&(Bt=1,hc(i,fs(s,i.current)))}function kg(){var i=is.current;return i===null?!0:(Ve&4194048)===Ve?vs===null:(Ve&62914560)===Ve||(Ve&536870912)!==0?i===vs:!1}function Dg(){var i=N.H;return N.H=_l,i===null?_l:i}function Rg(){var i=N.A;return N.A=_C,i}function Cc(){Bt=4,jn||(Ve&4194048)!==Ve&&is.current!==null||(va=!0),(Hn&134217727)===0&&(Dr&134217727)===0||ft===null||Kn(ft,Ve,rs,!1)}function Ed(i,s,r){var l=nt;nt|=2;var u=Dg(),d=Rg();(ft!==i||Ve!==s)&&(Sc=null,ba(i,s)),s=!1;var v=Bt;e:do try{if(at!==0&&$e!==null){var S=$e,M=ns;switch(at){case 8:xd(),v=6;break e;case 3:case 2:case 9:case 6:is.current===null&&(s=!0);var W=at;if(at=0,ns=null,Sa(i,S,M,W),r&&va){v=0;break e}break;default:W=at,at=0,ns=null,Sa(i,S,M,W)}}yC(),v=Bt;break}catch(ie){Tg(i,ie)}while(!0);return s&&i.shellSuspendCounter++,tn=yr=null,nt=l,N.H=u,N.A=d,$e===null&&(ft=null,Ve=0,Fo()),v}function yC(){for(;$e!==null;)Mg($e)}function bC(i,s){var r=nt;nt|=2;var l=Dg(),u=Rg();ft!==i||Ve!==s?(Sc=null,bc=Le()+500,ba(i,s)):va=jt(i,s);e:do try{if(at!==0&&$e!==null){s=$e;var d=ns;t:switch(at){case 1:at=0,ns=null,Sa(i,s,d,1);break;case 2:case 9:if(P_(d)){at=0,ns=null,Ng(s);break}s=function(){at!==2&&at!==9||ft!==i||(at=7),Is(i)},d.then(s,s);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:P_(d)?(at=0,ns=null,Ng(s)):(at=0,ns=null,Sa(i,s,d,7));break;case 5:var v=null;switch($e.tag){case 26:v=$e.memoizedState;case 5:case 27:var S=$e;if(v?_y(v):S.stateNode.complete){at=0,ns=null;var M=S.sibling;if(M!==null)$e=M;else{var W=S.return;W!==null?($e=W,xc(W)):$e=null}break t}}at=0,ns=null,Sa(i,s,d,5);break;case 6:at=0,ns=null,Sa(i,s,d,6);break;case 8:xd(),Bt=6;break e;default:throw Error(a(462))}}SC();break}catch(ie){Tg(i,ie)}while(!0);return tn=yr=null,N.H=l,N.A=u,nt=r,$e!==null?0:(ft=null,Ve=0,Fo(),Bt)}function SC(){for(;$e!==null&&!te();)Mg($e)}function Mg(i){var s=eg(i.alternate,i,dn);i.memoizedProps=i.pendingProps,s===null?xc(i):$e=s}function Ng(i){var s=i,r=s.alternate;switch(s.tag){case 15:case 0:s=Vv(r,s,s.pendingProps,s.type,void 0,Ve);break;case 11:s=Vv(r,s,s.pendingProps,s.type.render,s.ref,Ve);break;case 5:Ph(s);default:ig(r,s),s=$e=R_(s,dn),s=eg(r,s,dn)}i.memoizedProps=i.pendingProps,s===null?xc(i):$e=s}function Sa(i,s,r,l){tn=yr=null,Ph(s),ua=null,ol=0;var u=s.return;try{if(cC(i,u,s,r,Ve)){Bt=1,hc(i,fs(r,i.current)),$e=null;return}}catch(d){if(u!==null)throw $e=u,d;Bt=1,hc(i,fs(r,i.current)),$e=null;return}s.flags&32768?(Ge||l===1?i=!0:va||(Ve&536870912)!==0?i=!1:(jn=i=!0,(l===2||l===9||l===3||l===6)&&(l=is.current,l!==null&&l.tag===13&&(l.flags|=16384))),Ag(s,i)):xc(s)}function xc(i){var s=i;do{if((s.flags&32768)!==0){Ag(s,jn);return}i=s.return;var r=dC(s.alternate,s,dn);if(r!==null){$e=r;return}if(s=s.sibling,s!==null){$e=s;return}$e=s=i}while(s!==null);Bt===0&&(Bt=5)}function Ag(i,s){do{var r=fC(i.alternate,i);if(r!==null){r.flags&=32767,$e=r;return}if(r=i.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(i=i.sibling,i!==null)){$e=i;return}$e=i=r}while(i!==null);Bt=6,$e=null}function Lg(i,s,r,l,u,d,v,S,M){i.cancelPendingCommit=null;do Ec();while(Qt!==0);if((nt&6)!==0)throw Error(a(327));if(s!==null){if(s===i.current)throw Error(a(177));if(d=s.lanes|s.childLanes,d|=fh,Tt(i,r,d,v,S,M),i===ft&&($e=ft=null,Ve=0),ya=s,Pn=i,fn=r,Sd=d,wd=u,wg=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,EC(ni,function(){return Hg(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=N.T,N.T=null,u=I.p,I.p=2,v=nt,nt|=4;try{pC(i,s,r)}finally{nt=v,I.p=u,N.T=l}}Qt=1,Bg(),Og(),zg()}}function Bg(){if(Qt===1){Qt=0;var i=Pn,s=ya,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=N.T,N.T=null;var l=I.p;I.p=2;var u=nt;nt|=4;try{pg(s,i);var d=jd,v=b_(i.containerInfo),S=d.focusedElem,M=d.selectionRange;if(v!==S&&S&&S.ownerDocument&&y_(S.ownerDocument.documentElement,S)){if(M!==null&&oh(S)){var W=M.start,ie=M.end;if(ie===void 0&&(ie=W),"selectionStart"in S)S.selectionStart=W,S.selectionEnd=Math.min(ie,S.value.length);else{var ce=S.ownerDocument||document,$=ce&&ce.defaultView||window;if($.getSelection){var Z=$.getSelection(),Ce=S.textContent.length,Be=Math.min(M.start,Ce),ut=M.end===void 0?Be:Math.min(M.end,Ce);!Z.extend&&Be>ut&&(v=ut,ut=Be,Be=v);var U=g_(S,Be),L=g_(S,ut);if(U&&L&&(Z.rangeCount!==1||Z.anchorNode!==U.node||Z.anchorOffset!==U.offset||Z.focusNode!==L.node||Z.focusOffset!==L.offset)){var q=ce.createRange();q.setStart(U.node,U.offset),Z.removeAllRanges(),Be>ut?(Z.addRange(q),Z.extend(L.node,L.offset)):(q.setEnd(L.node,L.offset),Z.addRange(q))}}}}for(ce=[],Z=S;Z=Z.parentNode;)Z.nodeType===1&&ce.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<ce.length;S++){var le=ce[S];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}jc=!!zd,jd=zd=null}finally{nt=u,I.p=l,N.T=r}}i.current=s,Qt=2}}function Og(){if(Qt===2){Qt=0;var i=Pn,s=ya,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=N.T,N.T=null;var l=I.p;I.p=2;var u=nt;nt|=4;try{cg(i,s.alternate,s)}finally{nt=u,I.p=l,N.T=r}}Qt=3}}function zg(){if(Qt===4||Qt===3){Qt=0,Pe();var i=Pn,s=ya,r=fn,l=wg;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Qt=5:(Qt=0,ya=Pn=null,jg(i,i.pendingLanes));var u=i.pendingLanes;if(u===0&&(Un=null),Di(r),s=s.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(fi,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=N.T,u=I.p,I.p=2,N.T=null;try{for(var d=i.onRecoverableError,v=0;v<l.length;v++){var S=l[v];d(S.value,{componentStack:S.stack})}}finally{N.T=s,I.p=u}}(fn&3)!==0&&Ec(),Is(i),u=i.pendingLanes,(r&261930)!==0&&(u&42)!==0?i===Cd?El++:(El=0,Cd=i):El=0,Tl(0)}}function jg(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,al(s)))}function Ec(){return Bg(),Og(),zg(),Hg()}function Hg(){if(Qt!==5)return!1;var i=Pn,s=Sd;Sd=0;var r=Di(fn),l=N.T,u=I.p;try{I.p=32>r?32:r,N.T=null,r=wd,wd=null;var d=Pn,v=fn;if(Qt=0,ya=Pn=null,fn=0,(nt&6)!==0)throw Error(a(331));var S=nt;if(nt|=4,yg(d.current),_g(d,d.current,v,r),nt=S,Tl(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(fi,d)}catch{}return!0}finally{I.p=u,N.T=l,jg(i,s)}}function Ug(i,s,r){s=fs(r,s),s=td(i.stateNode,s,2),i=Ln(i,s,2),i!==null&&(Ti(i,2),Is(i))}function lt(i,s,r){if(i.tag===3)Ug(i,i,r);else for(;s!==null;){if(s.tag===3){Ug(s,i,r);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Un===null||!Un.has(l))){i=fs(r,i),r=Pv(2),l=Ln(s,r,2),l!==null&&(Kv(r,l,s,i),Ti(l,2),Is(l));break}}s=s.return}}function Td(i,s,r){var l=i.pingCache;if(l===null){l=i.pingCache=new vC;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)||(gd=!0,u.add(r),i=wC.bind(null,i,s,r),s.then(i,i))}function wC(i,s,r){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&r,i.warmLanes&=~r,ft===i&&(Ve&r)===r&&(Bt===4||Bt===3&&(Ve&62914560)===Ve&&300>Le()-yc?(nt&2)===0&&ba(i,0):yd|=r,ga===Ve&&(ga=0)),Is(i)}function Pg(i,s){s===0&&(s=Ht()),i=_r(i,s),i!==null&&(Ti(i,s),Is(i))}function CC(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),Pg(i,r)}function xC(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),Pg(i,r)}function EC(i,s){return rt(i,s)}var Tc=null,wa=null,kd=!1,kc=!1,Dd=!1,In=0;function Is(i){i!==wa&&i.next===null&&(wa===null?Tc=wa=i:wa=wa.next=i),kc=!0,kd||(kd=!0,kC())}function Tl(i,s){if(!Dd&&kc){Dd=!0;do for(var r=!1,l=Tc;l!==null;){if(i!==0){var u=l.pendingLanes;if(u===0)var d=0;else{var v=l.suspendedLanes,S=l.pingedLanes;d=(1<<31-xt(42|i)+1)-1,d&=u&~(v&~S),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(r=!0,qg(l,d))}else d=Ve,d=Et(l,l===ft?d:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(d&3)===0||jt(l,d)||(r=!0,qg(l,d));l=l.next}while(r);Dd=!1}}function TC(){Kg()}function Kg(){kc=kd=!1;var i=0;In!==0&&jC()&&(i=In);for(var s=Le(),r=null,l=Tc;l!==null;){var u=l.next,d=Ig(l,s);d===0?(l.next=null,r===null?Tc=u:r.next=u,u===null&&(wa=r)):(r=l,(i!==0||(d&3)!==0)&&(kc=!0)),l=u}Qt!==0&&Qt!==5||Tl(i),In!==0&&(In=0)}function Ig(i,s){for(var r=i.suspendedLanes,l=i.pingedLanes,u=i.expirationTimes,d=i.pendingLanes&-62914561;0<d;){var v=31-xt(d),S=1<<v,M=u[v];M===-1?((S&r)===0||(S&l)!==0)&&(u[v]=Gt(S,s)):M<=s&&(i.expiredLanes|=S),d&=~S}if(s=ft,r=Ve,r=Et(i,i===s?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,r===0||i===s&&(at===2||at===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&Ci(l),i.callbackNode=null,i.callbackPriority=0;if((r&3)===0||jt(i,r)){if(s=r&-r,s===i.callbackPriority)return s;switch(l!==null&&Ci(l),Di(r)){case 2:case 8:r=Ei;break;case 32:r=ni;break;case 268435456:r=Li;break;default:r=ni}return l=Fg.bind(null,i),r=rt(r,l),i.callbackPriority=s,i.callbackNode=r,s}return l!==null&&l!==null&&Ci(l),i.callbackPriority=2,i.callbackNode=null,2}function Fg(i,s){if(Qt!==0&&Qt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var r=i.callbackNode;if(Ec()&&i.callbackNode!==r)return null;var l=Ve;return l=Et(i,i===ft?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(xg(i,l,s),Ig(i,Le()),i.callbackNode!=null&&i.callbackNode===r?Fg.bind(null,i):null)}function qg(i,s){if(Ec())return null;xg(i,s,!0)}function kC(){UC(function(){(nt&6)!==0?rt(xi,TC):Kg()})}function Rd(){if(In===0){var i=la;i===0&&(i=ks,ks<<=1,(ks&261888)===0&&(ks=256)),In=i}return In}function Wg(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Oo(""+i)}function $g(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 DC(i,s,r,l,u){if(s==="submit"&&r&&r.stateNode===u){var d=Wg((u[Zt]||null).action),v=l.submitter;v&&(s=(s=v[Zt]||null)?Wg(s.formAction):v.getAttribute("formAction"),s!==null&&(d=s,v=null));var S=new Uo("action","action",null,l,u);i.push({event:S,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(In!==0){var M=v?$g(u,v):new FormData(u);Xh(r,{pending:!0,data:M,method:u.method,action:d},null,M)}}else typeof d=="function"&&(S.preventDefault(),M=v?$g(u,v):new FormData(u),Xh(r,{pending:!0,data:M,method:u.method,action:d},d,M))},currentTarget:u}]})}}for(var Md=0;Md<dh.length;Md++){var Nd=dh[Md],RC=Nd.toLowerCase(),MC=Nd[0].toUpperCase()+Nd.slice(1);As(RC,"on"+MC)}As(C_,"onAnimationEnd"),As(x_,"onAnimationIteration"),As(E_,"onAnimationStart"),As("dblclick","onDoubleClick"),As("focusin","onFocus"),As("focusout","onBlur"),As($1,"onTransitionRun"),As(Y1,"onTransitionStart"),As(V1,"onTransitionCancel"),As(T_,"onTransitionEnd"),Ji("onMouseEnter",["mouseout","mouseover"]),Ji("onMouseLeave",["mouseout","mouseover"]),Ji("onPointerEnter",["pointerout","pointerover"]),Ji("onPointerLeave",["pointerout","pointerover"]),Qi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var kl="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(" "),NC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(kl));function Yg(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 d=void 0;if(s)for(var v=l.length-1;0<=v;v--){var S=l[v],M=S.instance,W=S.currentTarget;if(S=S.listener,M!==d&&u.isPropagationStopped())break e;d=S,u.currentTarget=W;try{d(u)}catch(ie){Io(ie)}u.currentTarget=null,d=M}else for(v=0;v<l.length;v++){if(S=l[v],M=S.instance,W=S.currentTarget,S=S.listener,M!==d&&u.isPropagationStopped())break e;d=S,u.currentTarget=W;try{d(u)}catch(ie){Io(ie)}u.currentTarget=null,d=M}}}}function Ye(i,s){var r=s[dr];r===void 0&&(r=s[dr]=new Set);var l=i+"__bubble";r.has(l)||(Vg(s,i,2,!1),r.add(l))}function Ad(i,s,r){var l=0;s&&(l|=4),Vg(r,i,l,s)}var Dc="_reactListening"+Math.random().toString(36).slice(2);function Ld(i){if(!i[Dc]){i[Dc]=!0,Wr.forEach(function(r){r!=="selectionchange"&&(NC.has(r)||Ad(r,!1,i),Ad(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Dc]||(s[Dc]=!0,Ad("selectionchange",!1,s))}}function Vg(i,s,r,l){switch(Cy(s)){case 2:var u=rx;break;case 8:u=ax;break;default:u=Vd}r=u.bind(null,s,r,i),u=void 0,!Ju||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 Bd(i,s,r,l,u){var d=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var v=l.tag;if(v===3||v===4){var S=l.stateNode.containerInfo;if(S===u)break;if(v===4)for(v=l.return;v!==null;){var M=v.tag;if((M===3||M===4)&&v.stateNode.containerInfo===u)return;v=v.return}for(;S!==null;){if(v=_i(S),v===null)return;if(M=v.tag,M===5||M===6||M===26||M===27){l=d=v;continue e}S=S.parentNode}}l=l.return}Jm(function(){var W=d,ie=Zu(r),ce=[];e:{var $=k_.get(i);if($!==void 0){var Z=Uo,Ce=i;switch(i){case"keypress":if(jo(r)===0)break e;case"keydown":case"keyup":Z=x1;break;case"focusin":Ce="focus",Z=sh;break;case"focusout":Ce="blur",Z=sh;break;case"beforeblur":case"afterblur":Z=sh;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":Z=i_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=d1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=k1;break;case C_:case x_:case E_:Z=m1;break;case T_:Z=R1;break;case"scroll":case"scrollend":Z=u1;break;case"wheel":Z=N1;break;case"copy":case"cut":case"paste":Z=v1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=n_;break;case"toggle":case"beforetoggle":Z=L1}var Be=(s&4)!==0,ut=!Be&&(i==="scroll"||i==="scrollend"),U=Be?$!==null?$+"Capture":null:$;Be=[];for(var L=W,q;L!==null;){var le=L;if(q=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||q===null||U===null||(le=Xa(L,U),le!=null&&Be.push(Dl(L,le,q))),ut)break;L=L.return}0<Be.length&&($=new Z($,Ce,null,r,ie),ce.push({event:$,listeners:Be}))}}if((s&7)===0){e:{if($=i==="mouseover"||i==="pointerover",Z=i==="mouseout"||i==="pointerout",$&&r!==Gu&&(Ce=r.relatedTarget||r.fromElement)&&(_i(Ce)||Ce[Ds]))break e;if((Z||$)&&($=ie.window===ie?ie:($=ie.ownerDocument)?$.defaultView||$.parentWindow:window,Z?(Ce=r.relatedTarget||r.toElement,Z=W,Ce=Ce?_i(Ce):null,Ce!==null&&(ut=c(Ce),Be=Ce.tag,Ce!==ut||Be!==5&&Be!==27&&Be!==6)&&(Ce=null)):(Z=null,Ce=W),Z!==Ce)){if(Be=i_,le="onMouseLeave",U="onMouseEnter",L="mouse",(i==="pointerout"||i==="pointerover")&&(Be=n_,le="onPointerLeave",U="onPointerEnter",L="pointer"),ut=Z==null?$:Hs(Z),q=Ce==null?$:Hs(Ce),$=new Be(le,L+"leave",Z,r,ie),$.target=ut,$.relatedTarget=q,le=null,_i(ie)===W&&(Be=new Be(U,L+"enter",Ce,r,ie),Be.target=q,Be.relatedTarget=ut,le=Be),ut=le,Z&&Ce)t:{for(Be=AC,U=Z,L=Ce,q=0,le=U;le;le=Be(le))q++;le=0;for(var Ae=L;Ae;Ae=Be(Ae))le++;for(;0<q-le;)U=Be(U),q--;for(;0<le-q;)L=Be(L),le--;for(;q--;){if(U===L||L!==null&&U===L.alternate){Be=U;break t}U=Be(U),L=Be(L)}Be=null}else Be=null;Z!==null&&Xg(ce,$,Z,Be,!1),Ce!==null&&ut!==null&&Xg(ce,ut,Ce,Be,!0)}}e:{if($=W?Hs(W):window,Z=$.nodeName&&$.nodeName.toLowerCase(),Z==="select"||Z==="input"&&$.type==="file")var et=d_;else if(u_($))if(f_)et=F1;else{et=K1;var De=P1}else Z=$.nodeName,!Z||Z.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?W&&Xu(W.elementType)&&(et=d_):et=I1;if(et&&(et=et(i,W))){h_(ce,et,r,ie);break e}De&&De(i,$,W),i==="focusout"&&W&&$.type==="number"&&W.memoizedProps.value!=null&&Xr($,"number",$.value)}switch(De=W?Hs(W):window,i){case"focusin":(u_(De)||De.contentEditable==="true")&&(Jr=De,ch=W,sl=null);break;case"focusout":sl=ch=Jr=null;break;case"mousedown":uh=!0;break;case"contextmenu":case"mouseup":case"dragend":uh=!1,S_(ce,r,ie);break;case"selectionchange":if(W1)break;case"keydown":case"keyup":S_(ce,r,ie)}var Ie;if(rh)e:{switch(i){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else Qr?o_(i,r)&&(Xe="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(Xe="onCompositionStart");Xe&&(r_&&r.locale!=="ko"&&(Qr||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&Qr&&(Ie=e_()):(Tn=ie,eh="value"in Tn?Tn.value:Tn.textContent,Qr=!0)),De=Rc(W,Xe),0<De.length&&(Xe=new s_(Xe,i,null,r,ie),ce.push({event:Xe,listeners:De}),Ie?Xe.data=Ie:(Ie=c_(r),Ie!==null&&(Xe.data=Ie)))),(Ie=O1?z1(i,r):j1(i,r))&&(Xe=Rc(W,"onBeforeInput"),0<Xe.length&&(De=new s_("onBeforeInput","beforeinput",null,r,ie),ce.push({event:De,listeners:Xe}),De.data=Ie)),DC(ce,i,W,r,ie)}Yg(ce,s)})}function Dl(i,s,r){return{instance:i,listener:s,currentTarget:r}}function Rc(i,s){for(var r=s+"Capture",l=[];i!==null;){var u=i,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=Xa(i,r),u!=null&&l.unshift(Dl(i,u,d)),u=Xa(i,s),u!=null&&l.push(Dl(i,u,d))),i.tag===3)return l;i=i.return}return[]}function AC(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Xg(i,s,r,l,u){for(var d=s._reactName,v=[];r!==null&&r!==l;){var S=r,M=S.alternate,W=S.stateNode;if(S=S.tag,M!==null&&M===l)break;S!==5&&S!==26&&S!==27||W===null||(M=W,u?(W=Xa(r,d),W!=null&&v.unshift(Dl(r,W,M))):u||(W=Xa(r,d),W!=null&&v.push(Dl(r,W,M)))),r=r.return}v.length!==0&&i.push({event:s,listeners:v})}var LC=/\r\n?/g,BC=/\u0000|\uFFFD/g;function Gg(i){return(typeof i=="string"?i:""+i).replace(LC,`
|
|
10
|
-
`).replace(BC,"")}function Zg(i,s){return s=Gg(s),Gg(i)===s}function ct(i,s,r,l,u,d){switch(r){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Gs(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Gs(i,""+l);break;case"className":z(i,"class",l);break;case"tabIndex":z(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":z(i,r,l);break;case"style":Zm(i,l,d);break;case"data":if(s!=="object"){z(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=Oo(""+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 d=="function"&&(r==="formAction"?(s!=="input"&&ct(i,s,"name",u.name,u,null),ct(i,s,"formEncType",u.formEncType,u,null),ct(i,s,"formMethod",u.formMethod,u,null),ct(i,s,"formTarget",u.formTarget,u,null)):(ct(i,s,"encType",u.encType,u,null),ct(i,s,"method",u.method,u,null),ct(i,s,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=Oo(""+l),i.setAttribute(r,l);break;case"onClick":l!=null&&(i.onclick=Zs);break;case"onScroll":l!=null&&Ye("scroll",i);break;case"onScrollEnd":l!=null&&Ye("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=Oo(""+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":Ye("beforetoggle",i),Ye("toggle",i),Fi(i,"popover",l);break;case"xlinkActuate":C(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":C(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":C(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":C(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":C(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":C(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":C(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":C(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":C(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Fi(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=o1.get(r)||r,Fi(i,r,l))}}function Od(i,s,r,l,u,d){switch(r){case"style":Zm(i,l,d);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"?Gs(i,l):(typeof l=="number"||typeof l=="bigint")&&Gs(i,""+l);break;case"onScroll":l!=null&&Ye("scroll",i);break;case"onScrollEnd":l!=null&&Ye("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Zs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$r.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),s=r.slice(2,u?r.length-7:void 0),d=i[Zt]||null,d=d!=null?d[r]:null,typeof d=="function"&&i.removeEventListener(s,d,u),typeof l=="function")){typeof d!="function"&&d!==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,""):Fi(i,r,l)}}}function Si(i,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",i),Ye("load",i);var l=!1,u=!1,d;for(d in r)if(r.hasOwnProperty(d)){var v=r[d];if(v!=null)switch(d){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:ct(i,s,d,v,r,null)}}u&&ct(i,s,"srcSet",r.srcSet,r,null),l&&ct(i,s,"src",r.src,r,null);return;case"input":Ye("invalid",i);var S=d=v=u=null,M=null,W=null;for(l in r)if(r.hasOwnProperty(l)){var ie=r[l];if(ie!=null)switch(l){case"name":u=ie;break;case"type":v=ie;break;case"checked":M=ie;break;case"defaultChecked":W=ie;break;case"value":d=ie;break;case"defaultValue":S=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(a(137,s));break;default:ct(i,s,l,ie,r,null)}}vi(i,d,S,M,W,v,u,!1);return;case"select":Ye("invalid",i),l=v=d=null;for(u in r)if(r.hasOwnProperty(u)&&(S=r[u],S!=null))switch(u){case"value":d=S;break;case"defaultValue":v=S;break;case"multiple":l=S;default:ct(i,s,u,S,r,null)}s=d,r=v,i.multiple=!!l,s!=null?En(i,!!l,s,!1):r!=null&&En(i,!!l,r,!0);return;case"textarea":Ye("invalid",i),d=u=l=null;for(v in r)if(r.hasOwnProperty(v)&&(S=r[v],S!=null))switch(v){case"value":l=S;break;case"defaultValue":u=S;break;case"children":d=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(a(91));break;default:ct(i,s,v,S,r,null)}Va(i,l,u,d);return;case"option":for(M in r)r.hasOwnProperty(M)&&(l=r[M],l!=null)&&(M==="selected"?i.selected=l&&typeof l!="function"&&typeof l!="symbol":ct(i,s,M,l,r,null));return;case"dialog":Ye("beforetoggle",i),Ye("toggle",i),Ye("cancel",i),Ye("close",i);break;case"iframe":case"object":Ye("load",i);break;case"video":case"audio":for(l=0;l<kl.length;l++)Ye(kl[l],i);break;case"image":Ye("error",i),Ye("load",i);break;case"details":Ye("toggle",i);break;case"embed":case"source":case"link":Ye("error",i),Ye("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(W in r)if(r.hasOwnProperty(W)&&(l=r[W],l!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:ct(i,s,W,l,r,null)}return;default:if(Xu(s)){for(ie in r)r.hasOwnProperty(ie)&&(l=r[ie],l!==void 0&&Od(i,s,ie,l,r,void 0));return}}for(S in r)r.hasOwnProperty(S)&&(l=r[S],l!=null&&ct(i,s,S,l,r,null))}function OC(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,d=null,v=null,S=null,M=null,W=null,ie=null;for(Z in r){var ce=r[Z];if(r.hasOwnProperty(Z)&&ce!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":M=ce;default:l.hasOwnProperty(Z)||ct(i,s,Z,null,l,ce)}}for(var $ in l){var Z=l[$];if(ce=r[$],l.hasOwnProperty($)&&(Z!=null||ce!=null))switch($){case"type":d=Z;break;case"name":u=Z;break;case"checked":W=Z;break;case"defaultChecked":ie=Z;break;case"value":v=Z;break;case"defaultValue":S=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(a(137,s));break;default:Z!==ce&&ct(i,s,$,Z,l,ce)}}Ri(i,v,S,M,W,ie,d,u);return;case"select":Z=v=S=$=null;for(d in r)if(M=r[d],r.hasOwnProperty(d)&&M!=null)switch(d){case"value":break;case"multiple":Z=M;default:l.hasOwnProperty(d)||ct(i,s,d,null,l,M)}for(u in l)if(d=l[u],M=r[u],l.hasOwnProperty(u)&&(d!=null||M!=null))switch(u){case"value":$=d;break;case"defaultValue":S=d;break;case"multiple":v=d;default:d!==M&&ct(i,s,u,d,l,M)}s=S,r=v,l=Z,$!=null?En(i,!!r,$,!1):!!l!=!!r&&(s!=null?En(i,!!r,s,!0):En(i,!!r,r?[]:"",!1));return;case"textarea":Z=$=null;for(S in r)if(u=r[S],r.hasOwnProperty(S)&&u!=null&&!l.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:ct(i,s,S,null,l,u)}for(v in l)if(u=l[v],d=r[v],l.hasOwnProperty(v)&&(u!=null||d!=null))switch(v){case"value":$=u;break;case"defaultValue":Z=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(a(91));break;default:u!==d&&ct(i,s,v,u,l,d)}Ns(i,$,Z);return;case"option":for(var Ce in r)$=r[Ce],r.hasOwnProperty(Ce)&&$!=null&&!l.hasOwnProperty(Ce)&&(Ce==="selected"?i.selected=!1:ct(i,s,Ce,null,l,$));for(M in l)$=l[M],Z=r[M],l.hasOwnProperty(M)&&$!==Z&&($!=null||Z!=null)&&(M==="selected"?i.selected=$&&typeof $!="function"&&typeof $!="symbol":ct(i,s,M,$,l,Z));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 Be in r)$=r[Be],r.hasOwnProperty(Be)&&$!=null&&!l.hasOwnProperty(Be)&&ct(i,s,Be,null,l,$);for(W in l)if($=l[W],Z=r[W],l.hasOwnProperty(W)&&$!==Z&&($!=null||Z!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(a(137,s));break;default:ct(i,s,W,$,l,Z)}return;default:if(Xu(s)){for(var ut in r)$=r[ut],r.hasOwnProperty(ut)&&$!==void 0&&!l.hasOwnProperty(ut)&&Od(i,s,ut,void 0,l,$);for(ie in l)$=l[ie],Z=r[ie],!l.hasOwnProperty(ie)||$===Z||$===void 0&&Z===void 0||Od(i,s,ie,$,l,Z);return}}for(var U in r)$=r[U],r.hasOwnProperty(U)&&$!=null&&!l.hasOwnProperty(U)&&ct(i,s,U,null,l,$);for(ce in l)$=l[ce],Z=r[ce],!l.hasOwnProperty(ce)||$===Z||$==null&&Z==null||ct(i,s,ce,$,l,Z)}function Qg(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zC(){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],d=u.transferSize,v=u.initiatorType,S=u.duration;if(d&&S&&Qg(v)){for(v=0,S=u.responseEnd,l+=1;l<r.length;l++){var M=r[l],W=M.startTime;if(W>S)break;var ie=M.transferSize,ce=M.initiatorType;ie&&Qg(ce)&&(M=M.responseEnd,v+=ie*(M<S?1:(S-W)/(M-W)))}if(--l,s+=8*(d+v)/(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 zd=null,jd=null;function Mc(i){return i.nodeType===9?i:i.ownerDocument}function Jg(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 ey(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 Hd(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 Ud=null;function jC(){var i=window.event;return i&&i.type==="popstate"?i===Ud?!1:(Ud=i,!0):(Ud=null,!1)}var ty=typeof setTimeout=="function"?setTimeout:void 0,HC=typeof clearTimeout=="function"?clearTimeout:void 0,iy=typeof Promise=="function"?Promise:void 0,UC=typeof queueMicrotask=="function"?queueMicrotask:typeof iy<"u"?function(i){return iy.resolve(null).then(i).catch(PC)}:ty;function PC(i){setTimeout(function(){throw i})}function Fn(i){return i==="head"}function sy(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),Ta(s);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Rl(i.ownerDocument.documentElement);else if(r==="head"){r=i.ownerDocument.head,Rl(r);for(var d=r.firstChild;d;){var v=d.nextSibling,S=d.nodeName;d[Ki]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&d.rel.toLowerCase()==="stylesheet"||r.removeChild(d),d=v}}else r==="body"&&Rl(i.ownerDocument.body);r=u}while(r);Ta(s)}function ny(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 Pd(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":Pd(r),js(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}i.removeChild(r)}}function KC(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[Ki])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(d=i.getAttribute("rel"),d==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(d!==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(d=i.getAttribute("src"),(d!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===d)return i}else return i;if(i=gs(i.nextSibling),i===null)break}return null}function IC(i,s,r){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=gs(i.nextSibling),i===null))return null;return i}function ry(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=gs(i.nextSibling),i===null))return null;return i}function Kd(i){return i.data==="$?"||i.data==="$~"}function Id(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function FC(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 gs(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 ay(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"||r==="/&"){if(s===0)return gs(i.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}i=i.nextSibling}return null}function ly(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 oy(i,s,r){switch(s=Mc(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 Rl(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);js(i)}var ys=new Map,cy=new Set;function Nc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var pn=I.d;I.d={f:qC,r:WC,D:$C,C:YC,L:VC,m:XC,X:ZC,S:GC,M:QC};function qC(){var i=pn.f(),s=wc();return i||s}function WC(i){var s=Ii(i);s!==null&&s.tag===5&&s.type==="form"?Tv(s):pn.r(i)}var Ca=typeof document>"u"?null:document;function uy(i,s,r){var l=Ca;if(l&&typeof s=="string"&&s){var u=Je(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),cy.has(u)||(cy.add(u),i={rel:i,crossOrigin:r,href:s},l.querySelector(u)===null&&(s=l.createElement("link"),Si(s,"link",i),At(s),l.head.appendChild(s)))}}function $C(i){pn.D(i),uy("dns-prefetch",i,null)}function YC(i,s){pn.C(i,s),uy("preconnect",i,s)}function VC(i,s,r){pn.L(i,s,r);var l=Ca;if(l&&i&&s){var u='link[rel="preload"][as="'+Je(s)+'"]';s==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+Je(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+Je(r.imageSizes)+'"]')):u+='[href="'+Je(i)+'"]';var d=u;switch(s){case"style":d=xa(i);break;case"script":d=Ea(i)}ys.has(d)||(i=y({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:i,as:s},r),ys.set(d,i),l.querySelector(u)!==null||s==="style"&&l.querySelector(Ml(d))||s==="script"&&l.querySelector(Nl(d))||(s=l.createElement("link"),Si(s,"link",i),At(s),l.head.appendChild(s)))}}function XC(i,s){pn.m(i,s);var r=Ca;if(r&&i){var l=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+Je(l)+'"][href="'+Je(i)+'"]',d=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Ea(i)}if(!ys.has(d)&&(i=y({rel:"modulepreload",href:i},s),ys.set(d,i),r.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Nl(d)))return}l=r.createElement("link"),Si(l,"link",i),At(l),r.head.appendChild(l)}}}function GC(i,s,r){pn.S(i,s,r);var l=Ca;if(l&&i){var u=Ms(l).hoistableStyles,d=xa(i);s=s||"default";var v=u.get(d);if(!v){var S={loading:0,preload:null};if(v=l.querySelector(Ml(d)))S.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},r),(r=ys.get(d))&&qd(i,r);var M=v=l.createElement("link");At(M),Si(M,"link",i),M._p=new Promise(function(W,ie){M.onload=W,M.onerror=ie}),M.addEventListener("load",function(){S.loading|=1}),M.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Ac(v,s,l)}v={type:"stylesheet",instance:v,count:1,state:S},u.set(d,v)}}}function ZC(i,s){pn.X(i,s);var r=Ca;if(r&&i){var l=Ms(r).hoistableScripts,u=Ea(i),d=l.get(u);d||(d=r.querySelector(Nl(u)),d||(i=y({src:i,async:!0},s),(s=ys.get(u))&&Wd(i,s),d=r.createElement("script"),At(d),Si(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function QC(i,s){pn.M(i,s);var r=Ca;if(r&&i){var l=Ms(r).hoistableScripts,u=Ea(i),d=l.get(u);d||(d=r.querySelector(Nl(u)),d||(i=y({src:i,async:!0,type:"module"},s),(s=ys.get(u))&&Wd(i,s),d=r.createElement("script"),At(d),Si(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function hy(i,s,r,l){var u=(u=me.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=xa(r.href),r=Ms(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=xa(r.href);var d=Ms(u).hoistableStyles,v=d.get(i);if(v||(u=u.ownerDocument||u,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(i,v),(d=u.querySelector(Ml(i)))&&!d._p&&(v.instance=d,v.state.loading=5),ys.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},ys.set(i,r),d||JC(u,i,r,v.state))),s&&l===null)throw Error(a(528,""));return v}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=Ea(r),r=Ms(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 xa(i){return'href="'+Je(i)+'"'}function Ml(i){return'link[rel="stylesheet"]['+i+"]"}function dy(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function JC(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}),Si(s,"link",r),At(s),i.head.appendChild(s))}function Ea(i){return'[src="'+Je(i)+'"]'}function Nl(i){return"script[async]"+i}function fy(i,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+Je(r.href)+'"]');if(l)return s.instance=l,At(l),l;var u=y({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),At(l),Si(l,"style",u),Ac(l,r.precedence,i),s.instance=l;case"stylesheet":u=xa(r.href);var d=i.querySelector(Ml(u));if(d)return s.state.loading|=4,s.instance=d,At(d),d;l=dy(r),(u=ys.get(u))&&qd(l,u),d=(i.ownerDocument||i).createElement("link"),At(d);var v=d;return v._p=new Promise(function(S,M){v.onload=S,v.onerror=M}),Si(d,"link",l),s.state.loading|=4,Ac(d,r.precedence,i),s.instance=d;case"script":return d=Ea(r.src),(u=i.querySelector(Nl(d)))?(s.instance=u,At(u),u):(l=r,(u=ys.get(d))&&(l=y({},r),Wd(l,u)),i=i.ownerDocument||i,u=i.createElement("script"),At(u),Si(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,Ac(l,r.precedence,i));return s.instance}function Ac(i,s,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,d=u,v=0;v<l.length;v++){var S=l[v];if(S.dataset.precedence===s)d=S;else if(d!==u)break}d?d.parentNode.insertBefore(i,d.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(i,s.firstChild))}function qd(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Wd(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Lc=null;function py(i,s,r){if(Lc===null){var l=new Map,u=Lc=new Map;u.set(r,l)}else u=Lc,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 d=r[u];if(!(d[Ki]||d[Nt]||i==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var v=d.getAttribute(s)||"";v=i+v;var S=l.get(v);S?S.push(d):l.set(v,[d])}}return l}function my(i,s,r){i=i.ownerDocument||i,i.head.insertBefore(r,s==="title"?i.querySelector("head > title"):null)}function ex(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 _y(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function tx(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=xa(l.href),d=s.querySelector(Ml(u));if(d){s=d._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Bc.bind(i),s.then(i,i)),r.state.loading|=4,r.instance=d,At(d);return}d=s.ownerDocument||s,l=dy(l),(u=ys.get(u))&&qd(l,u),d=d.createElement("link"),At(d);var v=d;v._p=new Promise(function(S,M){v.onload=S,v.onerror=M}),Si(d,"link",l),r.instance=d}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(i.count++,r=Bc.bind(i),s.addEventListener("load",r),s.addEventListener("error",r))}}var $d=0;function ix(i,s){return i.stylesheets&&i.count===0&&zc(i,i.stylesheets),0<i.count||0<i.imgCount?function(r){var l=setTimeout(function(){if(i.stylesheets&&zc(i,i.stylesheets),i.unsuspend){var d=i.unsuspend;i.unsuspend=null,d()}},6e4+s);0<i.imgBytes&&$d===0&&($d=62500*zC());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&zc(i,i.stylesheets),i.unsuspend)){var d=i.unsuspend;i.unsuspend=null,d()}},(i.imgBytes>$d?50:800)+s);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Bc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)zc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Oc=null;function zc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Oc=new Map,s.forEach(sx,i),Oc=null,Bc.call(i))}function sx(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]"),d=0;d<u.length;d++){var v=u[d];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(r.set(v.dataset.precedence,v),l=v)}l&&r.set(null,l)}u=s.instance,v=u.getAttribute("data-precedence"),d=r.get(v)||l,d===l&&r.set(null,u),r.set(v,u),this.count++,l=Bc.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),d?d.parentNode.insertBefore(u,d.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var Al={$$typeof:F,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function nx(i,s,r,l,u,d,v,S,M){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=ri(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ri(0),this.hiddenUpdates=ri(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function vy(i,s,r,l,u,d,v,S,M,W,ie,ce){return i=new nx(i,s,r,v,M,W,ie,ce,S),s=1,d===!0&&(s|=24),d=ts(3,null,null,s),i.current=d,d.stateNode=i,s=Eh(),s.refCount++,i.pooledCache=s,s.refCount++,d.memoizedState={element:l,isDehydrated:r,cache:s},Rh(d),i}function gy(i){return i?(i=ia,i):ia}function yy(i,s,r,l,u,d){u=gy(u),l.context===null?l.context=u:l.pendingContext=u,l=An(s),l.payload={element:r},d=d===void 0?null:d,d!==null&&(l.callback=d),r=Ln(i,l,s),r!==null&&(Xi(r,i,s),ul(r,i,s))}function by(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<s?r:s}}function Yd(i,s){by(i,s),(i=i.alternate)&&by(i,s)}function Sy(i){if(i.tag===13||i.tag===31){var s=_r(i,67108864);s!==null&&Xi(s,i,67108864),Yd(i,67108864)}}function wy(i){if(i.tag===13||i.tag===31){var s=as();s=st(s);var r=_r(i,s);r!==null&&Xi(r,i,s),Yd(i,s)}}var jc=!0;function rx(i,s,r,l){var u=N.T;N.T=null;var d=I.p;try{I.p=2,Vd(i,s,r,l)}finally{I.p=d,N.T=u}}function ax(i,s,r,l){var u=N.T;N.T=null;var d=I.p;try{I.p=8,Vd(i,s,r,l)}finally{I.p=d,N.T=u}}function Vd(i,s,r,l){if(jc){var u=Xd(l);if(u===null)Bd(i,s,l,Hc,r),xy(i,l);else if(ox(u,i,s,r,l))l.stopPropagation();else if(xy(i,l),s&4&&-1<lx.indexOf(i)){for(;u!==null;){var d=Ii(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var v=mt(d.pendingLanes);if(v!==0){var S=d;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var M=1<<31-xt(v);S.entanglements[1]|=M,v&=~M}Is(d),(nt&6)===0&&(bc=Le()+500,Tl(0))}}break;case 31:case 13:S=_r(d,2),S!==null&&Xi(S,d,2),wc(),Yd(d,2)}if(d=Xd(l),d===null&&Bd(i,s,l,Hc,r),d===u)break;u=d}u!==null&&l.stopPropagation()}else Bd(i,s,l,null,r)}}function Xd(i){return i=Zu(i),Gd(i)}var Hc=null;function Gd(i){if(Hc=null,i=_i(i),i!==null){var s=c(i);if(s===null)i=null;else{var r=s.tag;if(r===13){if(i=h(s),i!==null)return i;i=null}else if(r===31){if(i=f(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 Cy(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(bt()){case xi:return 2;case Ei:return 8;case ni:case us:return 32;case Li:return 268435456;default:return 32}default:return 32}}var Zd=!1,qn=null,Wn=null,$n=null,Ll=new Map,Bl=new Map,Yn=[],lx="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 xy(i,s){switch(i){case"focusin":case"focusout":qn=null;break;case"dragenter":case"dragleave":Wn=null;break;case"mouseover":case"mouseout":$n=null;break;case"pointerover":case"pointerout":Ll.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bl.delete(s.pointerId)}}function Ol(i,s,r,l,u,d){return i===null||i.nativeEvent!==d?(i={blockedOn:s,domEventName:r,eventSystemFlags:l,nativeEvent:d,targetContainers:[u]},s!==null&&(s=Ii(s),s!==null&&Sy(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function ox(i,s,r,l,u){switch(s){case"focusin":return qn=Ol(qn,i,s,r,l,u),!0;case"dragenter":return Wn=Ol(Wn,i,s,r,l,u),!0;case"mouseover":return $n=Ol($n,i,s,r,l,u),!0;case"pointerover":var d=u.pointerId;return Ll.set(d,Ol(Ll.get(d)||null,i,s,r,l,u)),!0;case"gotpointercapture":return d=u.pointerId,Bl.set(d,Ol(Bl.get(d)||null,i,s,r,l,u)),!0}return!1}function Ey(i){var s=_i(i.target);if(s!==null){var r=c(s);if(r!==null){if(s=r.tag,s===13){if(s=h(r),s!==null){i.blockedOn=s,Mt(i.priority,function(){wy(r)});return}}else if(s===31){if(s=f(r),s!==null){i.blockedOn=s,Mt(i.priority,function(){wy(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 Uc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=Xd(i.nativeEvent);if(r===null){r=i.nativeEvent;var l=new r.constructor(r.type,r);Gu=l,r.target.dispatchEvent(l),Gu=null}else return s=Ii(r),s!==null&&Sy(s),i.blockedOn=r,!1;s.shift()}return!0}function Ty(i,s,r){Uc(i)&&r.delete(s)}function cx(){Zd=!1,qn!==null&&Uc(qn)&&(qn=null),Wn!==null&&Uc(Wn)&&(Wn=null),$n!==null&&Uc($n)&&($n=null),Ll.forEach(Ty),Bl.forEach(Ty)}function Pc(i,s){i.blockedOn===s&&(i.blockedOn=null,Zd||(Zd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,cx)))}var Kc=null;function ky(i){Kc!==i&&(Kc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Kc===i&&(Kc=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(Gd(l||r)===null)continue;break}var d=Ii(r);d!==null&&(i.splice(s,3),s-=3,Xh(d,{pending:!0,data:u,method:r.method,action:l},l,u))}}))}function Ta(i){function s(M){return Pc(M,i)}qn!==null&&Pc(qn,i),Wn!==null&&Pc(Wn,i),$n!==null&&Pc($n,i),Ll.forEach(s),Bl.forEach(s);for(var r=0;r<Yn.length;r++){var l=Yn[r];l.blockedOn===i&&(l.blockedOn=null)}for(;0<Yn.length&&(r=Yn[0],r.blockedOn===null);)Ey(r),r.blockedOn===null&&Yn.shift();if(r=(i.ownerDocument||i).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var u=r[l],d=r[l+1],v=u[Zt]||null;if(typeof d=="function")v||ky(r);else if(v){var S=null;if(d&&d.hasAttribute("formAction")){if(u=d,v=d[Zt]||null)S=v.formAction;else if(Gd(u)!==null)continue}else S=v.action;typeof S=="function"?r[l+1]=S:(r.splice(l,3),l-=3),ky(r)}}}function Dy(){function i(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(v){return u=v})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.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 Qd(i){this._internalRoot=i}Ic.prototype.render=Qd.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(a(409));var r=s.current,l=as();yy(r,l,i,s,null,null)},Ic.prototype.unmount=Qd.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;yy(i.current,2,null,i,null,null),wc(),s[Ds]=null}};function Ic(i){this._internalRoot=i}Ic.prototype.unstable_scheduleHydration=function(i){if(i){var s=Ft();i={blockedOn:null,target:i,priority:s};for(var r=0;r<Yn.length&&s!==0&&s<Yn[r].priority;r++);Yn.splice(r,0,i),r===0&&Ey(i)}};var Ry=t.version;if(Ry!=="19.2.6")throw Error(a(527,Ry,"19.2.6"));I.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=p(s),i=i!==null?b(i):null,i=i===null?null:i.stateNode,i};var ux={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fc.isDisabled&&Fc.supportsFiber)try{fi=Fc.inject(ux),Ct=Fc}catch{}}return jl.createRoot=function(i,s){if(!o(i))throw Error(a(299));var r=!1,l="",u=zv,d=jv,v=Hv;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&&(d=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=vy(i,1,!1,null,null,r,l,null,u,d,v,Dy),i[Ds]=s.current,Ld(i),new Qd(s)},jl.hydrateRoot=function(i,s,r){if(!o(i))throw Error(a(299));var l=!1,u="",d=zv,v=jv,S=Hv,M=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(d=r.onUncaughtError),r.onCaughtError!==void 0&&(v=r.onCaughtError),r.onRecoverableError!==void 0&&(S=r.onRecoverableError),r.formState!==void 0&&(M=r.formState)),s=vy(i,1,!0,s,r??null,l,u,M,d,v,S,Dy),s.context=gy(null),r=s.current,l=as(),l=st(l),u=An(l),u.callback=null,Ln(r,u,l),r=l,s.current.lanes=r,Ti(s,r),Is(s),i[Ds]=s.current,Ld(i),new Ic(s)},jl.version="19.2.6",jl}var Uy;function bx(){if(Uy)return tf.exports;Uy=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(),tf.exports=yx(),tf.exports}var Sx=bx();class bn extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status}function Bu(e=fetch){return{getSession:()=>xe(e,"/api/auth/session"),setupPassword:t=>xe(e,"/api/auth/password",Ze("POST",t)),login:t=>xe(e,"/api/auth/login",Ze("POST",t)),reauth:t=>xe(e,"/api/auth/reauth",Ze("POST",t)),logout:()=>xe(e,"/api/auth/logout",{method:"POST",credentials:"same-origin"}),setupTotp:()=>xe(e,"/api/auth/totp/setup",{method:"POST",credentials:"same-origin"}),activateTotp:t=>xe(e,"/api/auth/totp/activate",Ze("POST",t)),disableTotp:()=>xe(e,"/api/auth/totp",{method:"DELETE",credentials:"same-origin"}),listDevices:()=>xe(e,"/api/auth/devices"),revokeDevice:async t=>{await Ra(e,`/api/auth/devices/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listNetworks:()=>xe(e,"/api/auth/networks"),addNetwork:t=>xe(e,"/api/auth/networks",Ze("POST",t)),removeNetwork:async t=>{await Ra(e,`/api/auth/networks/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listAgents:()=>xe(e,"/api/agents"),addAgent:t=>xe(e,"/api/agents",Ze("POST",t)),renameAgent:(t,n)=>xe(e,`/api/agents/${encodeURIComponent(t)}`,Ze("PATCH",{name:n})),getMainInfo:()=>xe(e,"/api/main"),renameMain:t=>xe(e,"/api/main",Ze("PATCH",{name:t})),removeAgent:async t=>{await Ra(e,`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},uninstallAgent:t=>xe(e,`/api/agents/${encodeURIComponent(t)}/uninstall`,{method:"POST",credentials:"same-origin"}),pingAgent:t=>xe(e,`/api/agents/${encodeURIComponent(t)}/ping`),getMainStats:()=>xe(e,"/api/stats"),getAgentStats:t=>xe(e,`/api/agents/${encodeURIComponent(t)}/stats`),getVersion:()=>xe(e,"/api/version"),checkUpdate:()=>xe(e,"/api/update/check",{method:"POST",credentials:"same-origin"}),runUpdate:()=>xe(e,"/api/update",{method:"POST",credentials:"same-origin"}),getAgentVersion:t=>xe(e,`/api/agents/${encodeURIComponent(t)}/version`),checkAgentUpdate:t=>xe(e,`/api/agents/${encodeURIComponent(t)}/update/check`,{method:"POST",credentials:"same-origin"}),runAgentUpdate:t=>xe(e,`/api/agents/${encodeURIComponent(t)}/update`,{method:"POST",credentials:"same-origin"}),listTerminals:()=>xe(e,"/api/terminals"),getTerminalLayout:()=>xe(e,"/api/terminal-layout"),saveTerminalLayout:t=>xe(e,"/api/terminal-layout",Ze("PUT",t)),createFileRoot:t=>xe(e,"/api/files/root",Ze("POST",t)),listFiles:t=>xe(e,"/api/files/list",Ze("POST",t)),readFile:t=>xe(e,"/api/files/read",Ze("POST",t)),writeFile:t=>xe(e,"/api/files/write",Ze("POST",t)),createFileEntry:t=>xe(e,"/api/files/create",Ze("POST",t)),moveFileEntry:t=>xe(e,"/api/files/move",Ze("POST",t)),previewDeleteFileEntry:t=>xe(e,"/api/files/delete-preview",Ze("POST",t)),deleteFileEntry:t=>xe(e,"/api/files/delete",Ze("POST",t)),openFileInTerminal:t=>xe(e,"/api/files/open",Ze("POST",t)),previewFile:t=>IS(e,"/api/files/preview",Ze("POST",t)),createTerminal:(t={})=>xe(e,"/api/terminals",Ze("POST",t)),closeTerminal:async t=>{await Ra(e,`/api/terminals/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},renameTerminal:(t,n)=>xe(e,`/api/terminals/${encodeURIComponent(t)}`,Ze("PATCH",{title:n})),getTerminalHistory:(t,n={})=>xe(e,`/api/terminals/${encodeURIComponent(t)}/history${mu(n)}`),getTerminalTranscriptHistory:(t,n={})=>xe(e,`/api/terminals/${encodeURIComponent(t)}/transcript-history${mu(n)}`),getTerminalTranscriptSource:t=>xe(e,`/api/terminals/${encodeURIComponent(t)}/transcript-source`),listNotificationAssets:()=>xe(e,"/api/notification-assets"),uploadNotificationAsset:t=>{const n=new FormData;return n.append("asset",t),xe(e,"/api/notification-assets",{method:"POST",credentials:"same-origin",body:n})},updateNotificationAssetSelection:t=>xe(e,"/api/notification-assets/selection",Ze("PUT",t)),deleteNotificationAsset:async t=>{await Ra(e,`/api/notification-assets/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})}}}function co(e,t=fetch){const n=a=>e?`/api/agents/${encodeURIComponent(e)}/${a}`:`/api/${a}`;return{isAgent:e!==null,listTerminals:()=>xe(t,n("terminals")),createTerminal:(a={})=>xe(t,n("terminals"),Ze("POST",a)),closeTerminal:async a=>{await Ra(t,n(`terminals/${encodeURIComponent(a)}`),{method:"DELETE",credentials:"same-origin"})},renameTerminal:(a,o)=>xe(t,n(`terminals/${encodeURIComponent(a)}`),Ze("PATCH",{title:o})),getTerminalHistory:(a,o={})=>xe(t,`${n(`terminals/${encodeURIComponent(a)}/history`)}${mu(o)}`),getTerminalTranscriptHistory:(a,o={})=>xe(t,`${n(`terminals/${encodeURIComponent(a)}/transcript-history`)}${mu(o)}`),getTerminalTranscriptSource:a=>xe(t,n(`terminals/${encodeURIComponent(a)}/transcript-source`)),getTerminalLayout:()=>xe(t,n("terminal-layout")),saveTerminalLayout:a=>xe(t,n("terminal-layout"),Ze("PUT",a)),createFileRoot:a=>xe(t,n("files/root"),Ze("POST",a)),listFiles:a=>xe(t,n("files/list"),Ze("POST",a)),readFile:a=>xe(t,n("files/read"),Ze("POST",a)),writeFile:a=>xe(t,n("files/write"),Ze("POST",a)),createFileEntry:a=>xe(t,n("files/create"),Ze("POST",a)),moveFileEntry:a=>xe(t,n("files/move"),Ze("POST",a)),previewDeleteFileEntry:a=>xe(t,n("files/delete-preview"),Ze("POST",a)),deleteFileEntry:a=>xe(t,n("files/delete"),Ze("POST",a)),openFileInTerminal:a=>xe(t,n("files/open"),Ze("POST",a)),previewFile:a=>IS(t,n("files/preview"),Ze("POST",a)),createWebSocketUrl:(a,o=window.location.href)=>wx(n(`terminals/${encodeURIComponent(a)}/ws`),o)}}function wx(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 Ze(e,t){return{method:e,headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)}}function mu(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)),e.includeTools!==void 0&&t.set("includeTools",e.includeTools?"true":"false");const n=t.toString();return n?`?${n}`:""}async function xe(e,t,n){const a=await e(t,n??{credentials:"same-origin"});await lm(a);try{return await a.json()}catch{throw new bn(a.status,"invalid_json_response")}}async function Ra(e,t,n){const a=await e(t,n);await lm(a)}async function IS(e,t,n){const a=await e(t,n);return await lm(a),a.blob()}async function lm(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 bn(e.status,t)}function FS({size:e=22}){return _.jsx("img",{className:"nterminal-mark",src:"/brand/nterminal-mark.svg",width:e,height:e,alt:"","aria-hidden":"true"})}function qS({height:e=18}){const t=Math.round(7.147058823529412*e);return _.jsx("img",{className:"nterminal-wordmark",src:"/brand/nterminal-wordmark.svg",width:t,height:e,alt:"NTerminal"})}var Vl=KS();const Ou=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ka(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function om(e){return"nodeType"in e}function Zi(e){var t,n;return e?Ka(e)?e:om(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function cm(e){const{Document:t}=Zi(e);return e instanceof t}function Eo(e){return Ka(e)?!1:e instanceof Zi(e).HTMLElement}function WS(e){return e instanceof Zi(e).SVGElement}function Ia(e){return e?Ka(e)?e.document:om(e)?cm(e)?e:Eo(e)||WS(e)?e.ownerDocument:document:document:document}const ar=Ou?g.useLayoutEffect:g.useEffect;function um(e){const t=g.useRef(e);return ar(()=>{t.current=e}),g.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 Cx(){const e=g.useRef(null),t=g.useCallback((a,o)=>{e.current=setInterval(a,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function uo(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return ar(()=>{n.current!==e&&(n.current=e)},t),n}function To(e,t){const n=g.useRef();return g.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function _u(e){const t=um(e),n=g.useRef(null),a=g.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,a]}function Lf(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let af={};function zu(e,t){return g.useMemo(()=>{if(t)return t;const n=af[e]==null?0:af[e]+1;return af[e]=n,e+"-"+n},[e,t])}function $S(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,h)=>{const f=Object.entries(h);for(const[m,p]of f){const b=c[m];b!=null&&(c[m]=b+e*p)}return c},{...t})}}const Oa=$S(1),vu=$S(-1);function xx(e){return"clientX"in e&&"clientY"in e}function YS(e){if(!e)return!1;const{KeyboardEvent:t}=Zi(e.target);return t&&e instanceof t}function Ex(e){if(!e)return!1;const{TouchEvent:t}=Zi(e.target);return t&&e instanceof t}function Bf(e){if(Ex(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 xx(e)?{x:e.clientX,y:e.clientY}:null}const Of=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[Of.Translate.toString(e),Of.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),Py="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Tx(e){return e.matches(Py)?e:e.querySelector(Py)}const kx={display:"none"};function Dx(e){let{id:t,value:n}=e;return ii.createElement("div",{id:t,style:kx},n)}function Rx(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 ii.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":!0},n)}function Mx(){const[e,t]=g.useState("");return{announce:g.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const VS=g.createContext(null);function Nx(e){const t=g.useContext(VS);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ax(){const[e]=g.useState(()=>new Set),t=g.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[g.useCallback(a=>{let{type:o,event:c}=a;e.forEach(h=>{var f;return(f=h[o])==null?void 0:f.call(h,c)})},[e]),t]}const Lx={draggable:`
|
|
11
|
-
To pick up a draggable item, press the space bar.
|
|
12
|
-
While dragging, use the arrow keys to move the item.
|
|
13
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
14
|
-
`},Bx={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 Ox(e){let{announcements:t=Bx,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=Lx}=e;const{announce:c,announcement:h}=Mx(),f=zu("DndLiveRegion"),[m,p]=g.useState(!1);if(g.useEffect(()=>{p(!0)},[]),Nx(g.useMemo(()=>({onDragStart(y){let{active:w}=y;c(t.onDragStart({active:w}))},onDragMove(y){let{active:w,over:x}=y;t.onDragMove&&c(t.onDragMove({active:w,over:x}))},onDragOver(y){let{active:w,over:x}=y;c(t.onDragOver({active:w,over:x}))},onDragEnd(y){let{active:w,over:x}=y;c(t.onDragEnd({active:w,over:x}))},onDragCancel(y){let{active:w,over:x}=y;c(t.onDragCancel({active:w,over:x}))}}),[c,t])),!m)return null;const b=ii.createElement(ii.Fragment,null,ii.createElement(Dx,{id:a,value:o.draggable}),ii.createElement(Rx,{id:f,announcement:h}));return n?Vl.createPortal(b,n):b}var ti;(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"})(ti||(ti={}));function gu(){}function Ky(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function zx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const Os=Object.freeze({x:0,y:0});function jx(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function Hx(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Ux(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),h=o-a,f=c-n;if(a<o&&n<c){const m=t.width*t.height,p=e.width*e.height,b=h*f,y=b/(m+p-b);return Number(y.toFixed(4))}return 0}const Px=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const o=[];for(const c of a){const{id:h}=c,f=n.get(h);if(f){const m=Ux(f,t);m>0&&o.push({id:h,data:{droppableContainer:c,value:m}})}}return o.sort(jx)};function Kx(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function XS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Os}function Ix(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((h,f)=>({...h,top:h.top+e*f.y,bottom:h.bottom+e*f.y,left:h.left+e*f.x,right:h.right+e*f.x}),{...n})}}const Fx=Ix(1);function qx(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 Wx(e,t,n){const a=qx(t);if(!a)return e;const{scaleX:o,scaleY:c,x:h,y:f}=a,m=e.left-h-(1-o)*parseFloat(n),p=e.top-f-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),b=o?e.width/o:e.width,y=c?e.height/c:e.height;return{width:b,height:y,top:p,right:m+b,bottom:p+y,left:m}}const $x={ignoreTransform:!1};function ko(e,t){t===void 0&&(t=$x);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:p,transformOrigin:b}=Zi(e).getComputedStyle(e);p&&(n=Wx(n,p,b))}const{top:a,left:o,width:c,height:h,bottom:f,right:m}=n;return{top:a,left:o,width:c,height:h,bottom:f,right:m}}function Iy(e){return ko(e,{ignoreTransform:!0})}function Yx(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Vx(e,t){return t===void 0&&(t=Zi(e).getComputedStyle(e)),t.position==="fixed"}function Xx(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 hm(e,t){const n=[];function a(o){if(t!=null&&n.length>=t||!o)return n;if(cm(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Eo(o)||WS(o)||n.includes(o))return n;const c=Zi(e).getComputedStyle(o);return o!==e&&Xx(o,c)&&n.push(o),Vx(o,c)?n:a(o.parentNode)}return e?a(e):n}function GS(e){const[t]=hm(e,1);return t??null}function lf(e){return!Ou||!e?null:Ka(e)?e:om(e)?cm(e)||e===Ia(e).scrollingElement?window:Eo(e)?e:null:null}function ZS(e){return Ka(e)?e.scrollX:e.scrollLeft}function QS(e){return Ka(e)?e.scrollY:e.scrollTop}function zf(e){return{x:ZS(e),y:QS(e)}}var oi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(oi||(oi={}));function JS(e){return!Ou||!e?!1:e===document.scrollingElement}function e0(e){const t={x:0,y:0},n=JS(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,h=e.scrollTop>=a.y,f=e.scrollLeft>=a.x;return{isTop:o,isLeft:c,isBottom:h,isRight:f,maxScroll:a,minScroll:t}}const Gx={x:.2,y:.2};function Zx(e,t,n,a,o){let{top:c,left:h,right:f,bottom:m}=n;a===void 0&&(a=10),o===void 0&&(o=Gx);const{isTop:p,isBottom:b,isLeft:y,isRight:w}=e0(e),x={x:0,y:0},E={x:0,y:0},T={height:t.height*o.y,width:t.width*o.x};return!p&&c<=t.top+T.height?(x.y=oi.Backward,E.y=a*Math.abs((t.top+T.height-c)/T.height)):!b&&m>=t.bottom-T.height&&(x.y=oi.Forward,E.y=a*Math.abs((t.bottom-T.height-m)/T.height)),!w&&f>=t.right-T.width?(x.x=oi.Forward,E.x=a*Math.abs((t.right-T.width-f)/T.width)):!y&&h<=t.left+T.width&&(x.x=oi.Backward,E.x=a*Math.abs((t.left+T.width-h)/T.width)),{direction:x,speed:E}}function Qx(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:h}=window;return{top:0,left:0,right:c,bottom:h,width:c,height:h}}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 t0(e){return e.reduce((t,n)=>Oa(t,zf(n)),Os)}function Jx(e){return e.reduce((t,n)=>t+ZS(n),0)}function eE(e){return e.reduce((t,n)=>t+QS(n),0)}function tE(e,t){if(t===void 0&&(t=ko),!e)return;const{top:n,left:a,bottom:o,right:c}=t(e);GS(e)&&(o<=0||c<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const iE=[["x",["left","right"],Jx],["y",["top","bottom"],eE]];class dm{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=hm(n),o=t0(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,h,f]of iE)for(const m of h)Object.defineProperty(this,m,{get:()=>{const p=f(a),b=o[c]-p;return this.rect[m]+b},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class io{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 sE(e){const{EventTarget:t}=Zi(e);return e instanceof t?e:Ia(e)}function of(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 ws;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ws||(ws={}));function Fy(e){e.preventDefault()}function nE(e){e.stopPropagation()}var pt;(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"})(pt||(pt={}));const i0={start:[pt.Space,pt.Enter],cancel:[pt.Esc],end:[pt.Space,pt.Enter,pt.Tab]},rE=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case pt.Right:return{...n,x:n.x+25};case pt.Left:return{...n,x:n.x-25};case pt.Down:return{...n,y:n.y+25};case pt.Up:return{...n,y:n.y-25}}};class s0{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 io(Ia(n)),this.windowListeners=new io(Zi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ws.Resize,this.handleCancel),this.windowListeners.add(ws.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ws.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&tE(a),n(Os)}handleKeyDown(t){if(YS(t)){const{active:n,context:a,options:o}=this.props,{keyboardCodes:c=i0,coordinateGetter:h=rE,scrollBehavior:f="smooth"}=o,{code:m}=t;if(c.end.includes(m)){this.handleEnd(t);return}if(c.cancel.includes(m)){this.handleCancel(t);return}const{collisionRect:p}=a.current,b=p?{x:p.left,y:p.top}:Os;this.referenceCoordinates||(this.referenceCoordinates=b);const y=h(t,{active:n,context:a.current,currentCoordinates:b});if(y){const w=vu(y,b),x={x:0,y:0},{scrollableAncestors:E}=a.current;for(const T of E){const O=t.code,{isTop:D,isRight:Y,isLeft:F,isBottom:G,maxScroll:re,minScroll:ee}=e0(T),J=Qx(T),oe={x:Math.min(O===pt.Right?J.right-J.width/2:J.right,Math.max(O===pt.Right?J.left:J.left+J.width/2,y.x)),y:Math.min(O===pt.Down?J.bottom-J.height/2:J.bottom,Math.max(O===pt.Down?J.top:J.top+J.height/2,y.y))},de=O===pt.Right&&!Y||O===pt.Left&&!F,A=O===pt.Down&&!G||O===pt.Up&&!D;if(de&&oe.x!==y.x){const P=T.scrollLeft+w.x,K=O===pt.Right&&P<=re.x||O===pt.Left&&P>=ee.x;if(K&&!w.y){T.scrollTo({left:P,behavior:f});return}K?x.x=T.scrollLeft-P:x.x=O===pt.Right?T.scrollLeft-re.x:T.scrollLeft-ee.x,x.x&&T.scrollBy({left:-x.x,behavior:f});break}else if(A&&oe.y!==y.y){const P=T.scrollTop+w.y,K=O===pt.Down&&P<=re.y||O===pt.Up&&P>=ee.y;if(K&&!w.x){T.scrollTo({top:P,behavior:f});return}K?x.y=T.scrollTop-P:x.y=O===pt.Down?T.scrollTop-re.y:T.scrollTop-ee.y,x.y&&T.scrollBy({top:-x.y,behavior:f});break}}this.handleMove(t,Oa(vu(y,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()}}s0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=i0,onActivation:o}=t,{active:c}=n;const{code:h}=e.nativeEvent;if(a.start.includes(h)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function qy(e){return!!(e&&"distance"in e)}function Wy(e){return!!(e&&"delay"in e)}class fm{constructor(t,n,a){var o;a===void 0&&(a=sE(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:h}=c;this.props=t,this.events=n,this.document=Ia(h),this.documentListeners=new io(this.document),this.listeners=new io(a),this.windowListeners=new io(Zi(h)),this.initialCoordinates=(o=Bf(c))!=null?o:Os,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(ws.Resize,this.handleCancel),this.windowListeners.add(ws.DragStart,Fy),this.windowListeners.add(ws.VisibilityChange,this.handleCancel),this.windowListeners.add(ws.ContextMenu,Fy),this.documentListeners.add(ws.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Wy(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(qy(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(ws.Click,nE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ws.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:o,props:c}=this,{onMove:h,options:{activationConstraint:f}}=c;if(!o)return;const m=(n=Bf(t))!=null?n:Os,p=vu(o,m);if(!a&&f){if(qy(f)){if(f.tolerance!=null&&of(p,f.tolerance))return this.handleCancel();if(of(p,f.distance))return this.handleStart()}if(Wy(f)&&of(p,f.tolerance))return this.handleCancel();this.handlePending(f,p);return}t.cancelable&&t.preventDefault(),h(m)}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===pt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const aE={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class n0 extends fm{constructor(t){const{event:n}=t,a=Ia(n.target);super(t,aE,a)}}n0.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 lE={move:{name:"mousemove"},end:{name:"mouseup"}};var jf;(function(e){e[e.RightClick=2]="RightClick"})(jf||(jf={}));class r0 extends fm{constructor(t){super(t,lE,Ia(t.event.target))}}r0.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===jf.RightClick?!1:(a?.({event:n}),!0)}}];const cf={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class a0 extends fm{constructor(t){super(t,cf)}static setup(){return window.addEventListener(cf.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(cf.move.name,t)};function t(){}}}a0.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 so;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(so||(so={}));var yu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(yu||(yu={}));function oE(e){let{acceleration:t,activator:n=so.Pointer,canScroll:a,draggingRect:o,enabled:c,interval:h=5,order:f=yu.TreeOrder,pointerCoordinates:m,scrollableAncestors:p,scrollableAncestorRects:b,delta:y,threshold:w}=e;const x=uE({delta:y,disabled:!c}),[E,T]=Cx(),O=g.useRef({x:0,y:0}),D=g.useRef({x:0,y:0}),Y=g.useMemo(()=>{switch(n){case so.Pointer:return m?{top:m.y,bottom:m.y,left:m.x,right:m.x}:null;case so.DraggableRect:return o}},[n,o,m]),F=g.useRef(null),G=g.useCallback(()=>{const ee=F.current;if(!ee)return;const J=O.current.x*D.current.x,oe=O.current.y*D.current.y;ee.scrollBy(J,oe)},[]),re=g.useMemo(()=>f===yu.TreeOrder?[...p].reverse():p,[f,p]);g.useEffect(()=>{if(!c||!p.length||!Y){T();return}for(const ee of re){if(a?.(ee)===!1)continue;const J=p.indexOf(ee),oe=b[J];if(!oe)continue;const{direction:de,speed:A}=Zx(ee,oe,Y,t,w);for(const P of["x","y"])x[P][de[P]]||(A[P]=0,de[P]=0);if(A.x>0||A.y>0){T(),F.current=ee,E(G,h),O.current=A,D.current=de;return}}O.current={x:0,y:0},D.current={x:0,y:0},T()},[t,G,a,T,c,h,JSON.stringify(Y),JSON.stringify(x),E,p,re,b,JSON.stringify(w)])}const cE={x:{[oi.Backward]:!1,[oi.Forward]:!1},y:{[oi.Backward]:!1,[oi.Forward]:!1}};function uE(e){let{delta:t,disabled:n}=e;const a=Lf(t);return To(o=>{if(n||!a||!o)return cE;const c={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[oi.Backward]:o.x[oi.Backward]||c.x===-1,[oi.Forward]:o.x[oi.Forward]||c.x===1},y:{[oi.Backward]:o.y[oi.Backward]||c.y===-1,[oi.Forward]:o.y[oi.Forward]||c.y===1}}},[n,t,a])}function hE(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return To(o=>{var c;return t==null?null:(c=a??o)!=null?c:null},[a,t])}function dE(e,t){return g.useMemo(()=>e.reduce((n,a)=>{const{sensor:o}=a,c=o.activators.map(h=>({eventName:h.eventName,handler:t(h.handler,a)}));return[...n,...c]},[]),[e,t])}var ho;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ho||(ho={}));var Hf;(function(e){e.Optimized="optimized"})(Hf||(Hf={}));const $y=new Map;function fE(e,t){let{dragging:n,dependencies:a,config:o}=t;const[c,h]=g.useState(null),{frequency:f,measure:m,strategy:p}=o,b=g.useRef(e),y=O(),w=uo(y),x=g.useCallback(function(D){D===void 0&&(D=[]),!w.current&&h(Y=>Y===null?D:Y.concat(D.filter(F=>!Y.includes(F))))},[w]),E=g.useRef(null),T=To(D=>{if(y&&!n)return $y;if(!D||D===$y||b.current!==e||c!=null){const Y=new Map;for(let F of e){if(!F)continue;if(c&&c.length>0&&!c.includes(F.id)&&F.rect.current){Y.set(F.id,F.rect.current);continue}const G=F.node.current,re=G?new dm(m(G),G):null;F.rect.current=re,re&&Y.set(F.id,re)}return Y}return D},[e,c,n,y,m]);return g.useEffect(()=>{b.current=e},[e]),g.useEffect(()=>{y||x()},[n,y]),g.useEffect(()=>{c&&c.length>0&&h(null)},[JSON.stringify(c)]),g.useEffect(()=>{y||typeof f!="number"||E.current!==null||(E.current=setTimeout(()=>{x(),E.current=null},f))},[f,y,x,...a]),{droppableRects:T,measureDroppableContainers:x,measuringScheduled:c!=null};function O(){switch(p){case ho.Always:return!1;case ho.BeforeDragging:return n;default:return!n}}}function l0(e,t){return To(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function pE(e,t){return l0(e,t)}function mE(e){let{callback:t,disabled:n}=e;const a=um(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(a)},[a,n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function ju(e){let{callback:t,disabled:n}=e;const a=um(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(a)},[n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function _E(e){return new dm(ko(e),e)}function Yy(e,t,n){t===void 0&&(t=_E);const[a,o]=g.useState(null);function c(){o(m=>{if(!e)return null;if(e.isConnected===!1){var p;return(p=m??n)!=null?p:null}const b=t(e);return JSON.stringify(m)===JSON.stringify(b)?m:b})}const h=mE({callback(m){if(e)for(const p of m){const{type:b,target:y}=p;if(b==="childList"&&y instanceof HTMLElement&&y.contains(e)){c();break}}}}),f=ju({callback:c});return ar(()=>{c(),e?(f?.observe(e),h?.observe(document.body,{childList:!0,subtree:!0})):(f?.disconnect(),h?.disconnect())},[e]),a}function vE(e){const t=l0(e);return XS(e,t)}const Vy=[];function gE(e){const t=g.useRef(e),n=To(a=>e?a&&a!==Vy&&e&&t.current&&e.parentNode===t.current.parentNode?a:hm(e):Vy,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function yE(e){const[t,n]=g.useState(null),a=g.useRef(e),o=g.useCallback(c=>{const h=lf(c.target);h&&n(f=>f?(f.set(h,zf(h)),new Map(f)):null)},[]);return g.useEffect(()=>{const c=a.current;if(e!==c){h(c);const f=e.map(m=>{const p=lf(m);return p?(p.addEventListener("scroll",o,{passive:!0}),[p,zf(p)]):null}).filter(m=>m!=null);n(f.length?new Map(f):null),a.current=e}return()=>{h(e),h(c)};function h(f){f.forEach(m=>{const p=lf(m);p?.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,h)=>Oa(c,h),Os):t0(e):Os,[e,t])}function Xy(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const a=e!==Os;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?vu(e,n.current):Os}function bE(e){g.useEffect(()=>{if(!Ou)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 SE(e,t){return g.useMemo(()=>e.reduce((n,a)=>{let{eventName:o,handler:c}=a;return n[o]=h=>{c(h,t)},n},{}),[e,t])}function o0(e){return g.useMemo(()=>e?Yx(e):null,[e])}const Gy=[];function wE(e,t){t===void 0&&(t=ko);const[n]=e,a=o0(n?Zi(n):null),[o,c]=g.useState(Gy);function h(){c(()=>e.length?e.map(m=>JS(m)?a:new dm(t(m),m)):Gy)}const f=ju({callback:h});return ar(()=>{f?.disconnect(),h(),e.forEach(m=>f?.observe(m))},[e]),o}function CE(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Eo(t)?t:e}function xE(e){let{measure:t}=e;const[n,a]=g.useState(null),o=g.useCallback(p=>{for(const{target:b}of p)if(Eo(b)){a(y=>{const w=t(b);return y?{...y,width:w.width,height:w.height}:w});break}},[t]),c=ju({callback:o}),h=g.useCallback(p=>{const b=CE(p);c?.disconnect(),b&&c?.observe(b),a(b?t(b):null)},[t,c]),[f,m]=_u(h);return g.useMemo(()=>({nodeRef:f,rect:n,setRef:m}),[n,f,m])}const EE=[{sensor:n0,options:{}},{sensor:s0,options:{}}],TE={current:{}},su={draggable:{measure:Iy},droppable:{measure:Iy,strategy:ho.WhileDragging,frequency:Hf.Optimized},dragOverlay:{measure:ko}};class no 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 kE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new no,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:gu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:su,measureDroppableContainers:gu,windowRect:null,measuringScheduled:!1},DE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:gu,draggableNodes:new Map,over:null,measureDroppableContainers:gu},Hu=g.createContext(DE),RE=g.createContext(kE);function ME(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new no}}}function NE(e,t){switch(t.type){case ti.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ti.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 ti.DragEnd:case ti.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ti.RegisterDroppable:{const{element:n}=t,{id:a}=n,o=new no(e.droppable.containers);return o.set(a,n),{...e,droppable:{...e.droppable,containers:o}}}case ti.SetDroppableDisabled:{const{id:n,key:a,disabled:o}=t,c=e.droppable.containers.get(n);if(!c||a!==c.key)return e;const h=new no(e.droppable.containers);return h.set(n,{...c,disabled:o}),{...e,droppable:{...e.droppable,containers:h}}}case ti.UnregisterDroppable:{const{id:n,key:a}=t,o=e.droppable.containers.get(n);if(!o||a!==o.key)return e;const c=new no(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function AE(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:o}=g.useContext(Hu),c=Lf(a),h=Lf(n?.id);return g.useEffect(()=>{if(!t&&!a&&c&&h!=null){if(!YS(c)||document.activeElement===c.target)return;const f=o.get(h);if(!f)return;const{activatorNode:m,node:p}=f;if(!m.current&&!p.current)return;requestAnimationFrame(()=>{for(const b of[m.current,p.current]){if(!b)continue;const y=Tx(b);if(y){y.focus();break}}})}},[a,t,o,h,c]),null}function LE(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((o,c)=>c({transform:o,...a}),n):n}function BE(e){return g.useMemo(()=>({draggable:{...su.draggable,...e?.draggable},droppable:{...su.droppable,...e?.droppable},dragOverlay:{...su.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function OE(e){let{activeNode:t,measure:n,initialRect:a,config:o=!0}=e;const c=g.useRef(!1),{x:h,y:f}=typeof o=="boolean"?{x:o,y:o}:o;ar(()=>{if(!h&&!f||!t){c.current=!1;return}if(c.current||!a)return;const p=t?.node.current;if(!p||p.isConnected===!1)return;const b=n(p),y=XS(b,a);if(h||(y.x=0),f||(y.y=0),c.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const w=GS(p);w&&w.scrollBy({top:y.y,left:y.x})}},[t,h,f,a,n])}const c0=g.createContext({...Os,scaleX:1,scaleY:1});var er;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(er||(er={}));const zE=g.memo(function(t){var n,a,o,c;let{id:h,accessibility:f,autoScroll:m=!0,children:p,sensors:b=EE,collisionDetection:y=Px,measuring:w,modifiers:x,...E}=t;const T=g.useReducer(NE,void 0,ME),[O,D]=T,[Y,F]=Ax(),[G,re]=g.useState(er.Uninitialized),ee=G===er.Initialized,{draggable:{active:J,nodes:oe,translate:de},droppable:{containers:A}}=O,P=J!=null?oe.get(J):null,K=g.useRef({initial:null,translated:null}),j=g.useMemo(()=>{var dt;return J!=null?{id:J,data:(dt=P?.data)!=null?dt:TE,rect:K}:null},[J,P]),B=g.useRef(null),[Q,N]=g.useState(null),[I,X]=g.useState(null),ve=uo(E,Object.values(E)),Se=zu("DndDescribedBy",h),R=g.useMemo(()=>A.getEnabled(),[A]),V=BE(w),{droppableRects:se,measureDroppableContainers:he,measuringScheduled:ye}=fE(R,{dragging:ee,dependencies:[de.x,de.y],config:V.droppable}),me=hE(oe,J),fe=g.useMemo(()=>I?Bf(I):null,[I]),Me=Bi(),Re=pE(me,V.draggable.measure);OE({activeNode:J!=null?oe.get(J):null,config:Me.layoutShiftCompensation,initialRect:Re,measure:V.draggable.measure});const Ne=Yy(me,V.draggable.measure,Re),Fe=Yy(me?me.parentElement:null),Oe=g.useRef({activatorEvent:null,active:null,activeNode:me,collisionRect:null,collisions:null,droppableRects:se,draggableNodes:oe,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),we=A.getNodeFor((n=Oe.current.over)==null?void 0:n.id),ne=xE({measure:V.dragOverlay.measure}),Ee=(a=ne.nodeRef.current)!=null?a:me,Te=ee?(o=ne.rect)!=null?o:Ne:null,je=!!(ne.nodeRef.current&&ne.rect),Ue=vE(je?null:Ne),_t=o0(Ee?Zi(Ee):null),rt=gE(ee?we??me:null),Ci=wE(rt),te=LE(x,{transform:{x:de.x-Ue.x,y:de.y-Ue.y,scaleX:1,scaleY:1},activatorEvent:I,active:j,activeNodeRect:Ne,containerNodeRect:Fe,draggingNodeRect:Te,over:Oe.current.over,overlayNodeRect:ne.rect,scrollableAncestors:rt,scrollableAncestorRects:Ci,windowRect:_t}),Pe=fe?Oa(fe,de):null,Le=yE(rt),bt=Xy(Le),xi=Xy(Le,[Ne]),Ei=Oa(te,bt),ni=Te?Fx(Te,te):null,us=j&&ni?y({active:j,collisionRect:ni,droppableRects:se,droppableContainers:R,pointerCoordinates:Pe}):null,Li=Hx(us,"id"),[Pi,zs]=g.useState(null),fi=je?te:Oa(te,xi),Ct=Kx(fi,(c=Pi?.rect)!=null?c:null,Ne),pi=g.useRef(null),xt=g.useCallback((dt,mt)=>{let{sensor:Et,options:jt}=mt;if(B.current==null)return;const Gt=oe.get(B.current);if(!Gt)return;const Ht=dt.nativeEvent,ri=new Et({active:B.current,activeNode:Gt,event:Ht,options:jt,context:Oe,onAbort(Tt){if(!oe.get(Tt))return;const{onDragAbort:Rt}=ve.current,it={id:Tt};Rt?.(it),Y({type:"onDragAbort",event:it})},onPending(Tt,ki,Rt,it){if(!oe.get(Tt))return;const{onDragPending:Di}=ve.current,Ft={id:Tt,constraint:ki,initialCoordinates:Rt,offset:it};Di?.(Ft),Y({type:"onDragPending",event:Ft})},onStart(Tt){const ki=B.current;if(ki==null)return;const Rt=oe.get(ki);if(!Rt)return;const{onDragStart:it}=ve.current,st={activatorEvent:Ht,active:{id:ki,data:Rt.data,rect:K}};Vl.unstable_batchedUpdates(()=>{it?.(st),re(er.Initializing),D({type:ti.DragStart,initialCoordinates:Tt,active:ki}),Y({type:"onDragStart",event:st}),N(pi.current),X(Ht)})},onMove(Tt){D({type:ti.DragMove,coordinates:Tt})},onEnd:Ti(ti.DragEnd),onCancel:Ti(ti.DragCancel)});pi.current=ri;function Ti(Tt){return async function(){const{active:Rt,collisions:it,over:st,scrollAdjustedTranslate:Di}=Oe.current;let Ft=null;if(Rt&&Di){const{cancelDrop:Mt}=ve.current;Ft={activatorEvent:Ht,active:Rt,collisions:it,delta:Di,over:st},Tt===ti.DragEnd&&typeof Mt=="function"&&await Promise.resolve(Mt(Ft))&&(Tt=ti.DragCancel)}B.current=null,Vl.unstable_batchedUpdates(()=>{D({type:Tt}),re(er.Uninitialized),zs(null),N(null),X(null),pi.current=null;const Mt=Tt===ti.DragEnd?"onDragEnd":"onDragCancel";if(Ft){const mi=ve.current[Mt];mi?.(Ft),Y({type:Mt,event:Ft})}})}}},[oe]),Xs=g.useCallback((dt,mt)=>(Et,jt)=>{const Gt=Et.nativeEvent,Ht=oe.get(jt);if(B.current!==null||!Ht||Gt.dndKit||Gt.defaultPrevented)return;const ri={active:Ht};dt(Et,mt.options,ri)===!0&&(Gt.dndKit={capturedBy:mt.sensor},B.current=jt,xt(Et,mt))},[oe,xt]),hs=dE(b,Xs);bE(b),ar(()=>{Ne&&G===er.Initializing&&re(er.Initialized)},[Ne,G]),g.useEffect(()=>{const{onDragMove:dt}=ve.current,{active:mt,activatorEvent:Et,collisions:jt,over:Gt}=Oe.current;if(!mt||!Et)return;const Ht={active:mt,activatorEvent:Et,collisions:jt,delta:{x:Ei.x,y:Ei.y},over:Gt};Vl.unstable_batchedUpdates(()=>{dt?.(Ht),Y({type:"onDragMove",event:Ht})})},[Ei.x,Ei.y]),g.useEffect(()=>{const{active:dt,activatorEvent:mt,collisions:Et,droppableContainers:jt,scrollAdjustedTranslate:Gt}=Oe.current;if(!dt||B.current==null||!mt||!Gt)return;const{onDragOver:Ht}=ve.current,ri=jt.get(Li),Ti=ri&&ri.rect.current?{id:ri.id,rect:ri.rect.current,data:ri.data,disabled:ri.disabled}:null,Tt={active:dt,activatorEvent:mt,collisions:Et,delta:{x:Gt.x,y:Gt.y},over:Ti};Vl.unstable_batchedUpdates(()=>{zs(Ti),Ht?.(Tt),Y({type:"onDragOver",event:Tt})})},[Li]),ar(()=>{Oe.current={activatorEvent:I,active:j,activeNode:me,collisionRect:ni,collisions:us,droppableRects:se,draggableNodes:oe,draggingNode:Ee,draggingNodeRect:Te,droppableContainers:A,over:Pi,scrollableAncestors:rt,scrollAdjustedTranslate:Ei},K.current={initial:Te,translated:ni}},[j,me,us,ni,oe,Ee,Te,se,A,Pi,rt,Ei]),oE({...Me,delta:de,draggingRect:ni,pointerCoordinates:Pe,scrollableAncestors:rt,scrollableAncestorRects:Ci});const hr=g.useMemo(()=>({active:j,activeNode:me,activeNodeRect:Ne,activatorEvent:I,collisions:us,containerNodeRect:Fe,dragOverlay:ne,draggableNodes:oe,droppableContainers:A,droppableRects:se,over:Pi,measureDroppableContainers:he,scrollableAncestors:rt,scrollableAncestorRects:Ci,measuringConfiguration:V,measuringScheduled:ye,windowRect:_t}),[j,me,Ne,I,us,Fe,ne,oe,A,se,Pi,he,rt,Ci,V,ye,_t]),ks=g.useMemo(()=>({activatorEvent:I,activators:hs,active:j,activeNodeRect:Ne,ariaDescribedById:{draggable:Se},dispatch:D,draggableNodes:oe,over:Pi,measureDroppableContainers:he}),[I,hs,j,Ne,D,Se,oe,Pi,he]);return ii.createElement(VS.Provider,{value:F},ii.createElement(Hu.Provider,{value:ks},ii.createElement(RE.Provider,{value:hr},ii.createElement(c0.Provider,{value:Ct},p)),ii.createElement(AE,{disabled:f?.restoreFocus===!1})),ii.createElement(Ox,{...f,hiddenTextDescribedById:Se}));function Bi(){const dt=Q?.autoScrollEnabled===!1,mt=typeof m=="object"?m.enabled===!1:m===!1,Et=ee&&!dt&&!mt;return typeof m=="object"?{...m,enabled:Et}:{enabled:Et}}}),jE=g.createContext(null),Zy="button",HE="Draggable";function u0(e){let{id:t,data:n,disabled:a=!1,attributes:o}=e;const c=zu(HE),{activators:h,activatorEvent:f,active:m,activeNodeRect:p,ariaDescribedById:b,draggableNodes:y,over:w}=g.useContext(Hu),{role:x=Zy,roleDescription:E="draggable",tabIndex:T=0}=o??{},O=m?.id===t,D=g.useContext(O?c0:jE),[Y,F]=_u(),[G,re]=_u(),ee=SE(h,t),J=uo(n);ar(()=>(y.set(t,{id:t,key:c,node:Y,activatorNode:G,data:J}),()=>{const de=y.get(t);de&&de.key===c&&y.delete(t)}),[y,t]);const oe=g.useMemo(()=>({role:x,tabIndex:T,"aria-disabled":a,"aria-pressed":O&&x===Zy?!0:void 0,"aria-roledescription":E,"aria-describedby":b.draggable}),[a,x,T,O,E,b.draggable]);return{active:m,activatorEvent:f,activeNodeRect:p,attributes:oe,isDragging:O,listeners:a?void 0:ee,node:Y,over:w,setNodeRef:F,setActivatorNodeRef:re,transform:D}}const UE="Droppable",PE={timeout:25};function h0(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:o}=e;const c=zu(UE),{active:h,dispatch:f,over:m,measureDroppableContainers:p}=g.useContext(Hu),b=g.useRef({disabled:n}),y=g.useRef(!1),w=g.useRef(null),x=g.useRef(null),{disabled:E,updateMeasurementsFor:T,timeout:O}={...PE,...o},D=uo(T??a),Y=g.useCallback(()=>{if(!y.current){y.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{p(Array.isArray(D.current)?D.current:[D.current]),x.current=null},O)},[O]),F=ju({callback:Y,disabled:E||!h}),G=g.useCallback((oe,de)=>{F&&(de&&(F.unobserve(de),y.current=!1),oe&&F.observe(oe))},[F]),[re,ee]=_u(G),J=uo(t);return g.useEffect(()=>{!F||!re.current||(F.disconnect(),y.current=!1,F.observe(re.current))},[re,F]),g.useEffect(()=>(f({type:ti.RegisterDroppable,element:{id:a,key:c,disabled:n,node:re,rect:w,data:J}}),()=>f({type:ti.UnregisterDroppable,key:c,id:a})),[a]),g.useEffect(()=>{n!==b.current.disabled&&(f({type:ti.SetDroppableDisabled,id:a,key:c,disabled:n}),b.current.disabled=n)},[a,c,n,f]),{active:h,rect:w,isOver:m?.id===a,node:re,over:m,setNodeRef:ee}}const KE=128,IE=512,FE=64,qE=4096;function d0(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>KE)return null;const n=t.workspaces.map(WE);return n.some(a=>a===null)?null:{activeWorkspaceId:t.activeWorkspaceId,workspaces:n}}function WE(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>IE)return null;const n=t.tabs.map($E);return n.some(a=>a===null)?null:{id:t.id,title:t.title,activeTabId:t.activeTabId,tabs:n}}function $E(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=YE(t.root);return n?{id:t.id,title:t.title,activeTerminalId:t.activeTerminalId,root:n}:null}function YE(e){if(!e||typeof e!="object")return null;let t=0;return Uf(e,1,()=>(t+=1,t<=qE))}function Uf(e,t,n){if(!e||typeof e!="object"||t>FE||!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=Uf(a.first,t+1,n),c=Uf(a.second,t+1,n);return!o||!c?null:{type:"split",direction:a.direction,ratio:VE(a.ratio),first:o,second:c}}function VE(e){return typeof e=="number"&&Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}const f0=[{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 Qy(e){return e===void 0?"unknown":e==="error"?"offline":"ok"}function Jy(e){const t=e.trim();return t?t.charAt(0).toUpperCase():"?"}const eb="Local",XE=3e4,p0="nterminal.serverList.viewMode.v1";function GE(){try{return window.localStorage.getItem(p0)==="list"?"list":"stats"}catch{return"stats"}}function ZE(e){try{window.localStorage.setItem(p0,e)}catch{}}function nu(e){return e===void 0?"":e==="error"?"offline":[`CPU ${xs(e.cpuPercent)} ${pm(e)}`,`MEM ${xs(e.memoryPercent)} ${Sn(e.memoryUsedBytes,e.memoryTotalBytes)}`,`DISK ${xs(e.diskPercent)} ${Sn(e.diskUsedBytes,e.diskTotalBytes)}`,`SWAP ${xs(e.swapPercent)} ${Sn(e.swapUsedBytes,e.swapTotalBytes)}`].join(" · ")}function QE(e){if(!(e===void 0||e==="error"))return[`CPU ${xs(e.cpuPercent)} (${pm(e)})`,`RAM ${xs(e.memoryPercent)} (${Sn(e.memoryUsedBytes,e.memoryTotalBytes)})`,`Disk ${xs(e.diskPercent)} (${Sn(e.diskUsedBytes,e.diskTotalBytes)})`,`Swap ${xs(e.swapPercent)} (${Sn(e.swapUsedBytes,e.swapTotalBytes)})`].join(" · ")}function tb(e,t){const n=nu(t);return`${e}${n?` — ${n}`:""}. Double-click to rename.`}function xs(e){return typeof e=="number"&&Number.isFinite(e)?`${Math.round(e)}%`:"–"}function pm(e){const t=Number.isFinite(e.cores)&&e.cores>0?e.cores:null;return e.cpuPercent===null||e.cpuPercent===void 0||!Number.isFinite(e.cpuPercent)||t===null?`–/${t??"–"} cores`:`${Pf(e.cpuPercent/100*t)}/${t} cores`}function Sn(e,t){return!ib(e)||!ib(t)?"–/–":JE(e,t)}function JE(e,t){const n=t>=1073741824?"GB":t>=1048576?"MB":"KB",a=n==="GB"?1024**3:n==="MB"?1024**2:1024;return`${Pf(e/a)}/${Pf(t/a)} ${n}`}function Pf(e){return e>=10||Number.isInteger(e)?e.toFixed(0):e.toFixed(1)}function ib(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function qc(e){return typeof e!="number"||!Number.isFinite(e)?"normal":e>95?"danger":e>90?"warning":"normal"}function e2(e){return[{label:"CPU",percent:xs(e.cpuPercent),detail:pm(e),tone:qc(e.cpuPercent)},{label:"MEM",percent:xs(e.memoryPercent),detail:Sn(e.memoryUsedBytes,e.memoryTotalBytes),tone:qc(e.memoryPercent)},{label:"DISK",percent:xs(e.diskPercent),detail:Sn(e.diskUsedBytes,e.diskTotalBytes),tone:qc(e.diskPercent)},{label:"SWAP",percent:xs(e.swapPercent),detail:Sn(e.swapUsedBytes,e.swapTotalBytes),tone:qc(e.swapPercent)}]}function sb({entry:e}){return e==="error"?_.jsx("span",{className:"server-list-stats server-list-stats--offline",children:"offline"}):e===void 0?_.jsx("span",{className:"server-list-stats server-list-stats-grid","aria-hidden":"true",children:["CPU","MEM","DISK","SWAP"].map(t=>_.jsxs("span",{className:"server-list-stat-cell",children:[_.jsx("span",{className:"server-list-stat-label",children:t}),_.jsx("span",{className:"server-list-stat-value",children:"–"}),_.jsx("span",{className:"server-list-stat-detail",children:"–"})]},t))}):_.jsx("span",{className:"server-list-stats server-list-stats-grid",title:QE(e),children:e2(e).map(t=>_.jsxs("span",{className:"server-list-stat-cell",children:[_.jsx("span",{className:"server-list-stat-label",children:t.label}),_.jsx("span",{className:"server-list-stat-value","data-tone":t.tone,children:t.percent}),_.jsx("span",{className:"server-list-stat-detail",children:t.detail})]},t.label))})}function uf({api:e,activeAgentId:t,onSelectServer:n,onSessionInvalid:a,refreshToken:o=0,compact:c=!1}){const[h,f]=g.useState([]),[m,p]=g.useState(null),[b,y]=g.useState(null),[w,x]=g.useState(""),E=g.useRef(null),[T,O]=g.useState(()=>GE()),[D,Y]=g.useState({});g.useEffect(()=>{let A=!1;return e.listAgents().then(P=>{A||f(P.agents)}).catch(()=>{}),e.getMainInfo().then(P=>{A||p(P.name)}).catch(()=>{}),()=>{A=!0}},[e,o]),g.useEffect(()=>{b&&(E.current?.focus(),E.current?.select())},[b]),g.useEffect(()=>{let A=!1;function P(){const j=[{key:"__main__",load:()=>e.getMainStats()},...h.map(Q=>({key:Q.id,load:()=>e.getAgentStats(Q.id)}))],B=new Set(j.map(Q=>Q.key));Y(Q=>{const N={};for(const I of B)I in Q&&(N[I]=Q[I]);return N});for(const Q of j)Q.load().then(N=>{A||Y(I=>B.has(Q.key)?{...I,[Q.key]:N}:I)}).catch(N=>{if(!A){if(N instanceof bn&&N.status===401){a?.();return}Y(I=>B.has(Q.key)?{...I,[Q.key]:"error"}:I)}})}P();const K=window.setInterval(P,XE);return()=>{A=!0,window.clearInterval(K)}},[e,h,a]);function F(A){A==="main"?(x(m??""),y({kind:"main"})):(x(A.name),y({kind:"agent",id:A.id}))}async function G(){if(!b)return;const A=w.trim(),P=b;if(y(null),P.kind==="main"){const K=A||"";try{const j=await e.renameMain(K);p(j.name)}catch{}}else{if(!A)return;const K=h.find(j=>j.id===P.id)?.name;f(j=>j.map(B=>B.id===P.id?{...B,name:A}:B));try{await e.renameAgent(P.id,A)}catch{K!==void 0&&f(j=>j.map(B=>B.id===P.id?{...B,name:K}:B))}}}function re(){y(null)}function ee(A){O(A),ZE(A)}const J=m?.trim()||eb,oe=b?.kind==="main",de=T==="stats";return c?_.jsxs("div",{className:"server-list server-list--compact",children:[_.jsxs("button",{type:"button",className:`server-list-chip${t===null?" server-list-chip--active":""}`,onClick:()=>n(null),"aria-label":J,title:`${J}${nu(D.__main__)?` — ${nu(D.__main__)}`:""}`,children:[_.jsx("span",{className:"server-list-chip-initial",children:Jy(J)}),_.jsx("span",{className:"server-list-chip-pip","data-status":Qy(D.__main__)})]}),h.map(A=>{const P=D[A.id],K=nu(P);return _.jsxs("button",{type:"button",className:`server-list-chip${t===A.id?" server-list-chip--active":""}`,onClick:()=>n(A.id),"aria-label":A.name,title:`${A.name}${K?` — ${K}`:""}`,children:[_.jsx("span",{className:"server-list-chip-initial",children:Jy(A.name)}),_.jsx("span",{className:"server-list-chip-pip","data-status":Qy(P)})]},A.id)})]}):_.jsxs("div",{className:`server-list server-list--${T}`,children:[_.jsxs("div",{className:"server-list-toolbar","aria-label":"Server list display",children:[_.jsx("button",{type:"button",className:"server-list-view-button","aria-pressed":T==="list",onClick:()=>ee("list"),title:"Show server names only",children:"List"}),_.jsx("button",{type:"button",className:"server-list-view-button","aria-pressed":T==="stats",onClick:()=>ee("stats"),title:"Show resource usage",children:"Stats"})]}),_.jsx("div",{className:"server-list-row",children:oe?_.jsx("form",{className:"server-list-editor",onSubmit:A=>{A.preventDefault(),G()},children:_.jsx("input",{ref:E,"aria-label":"Rename main server",value:w,onChange:A=>x(A.target.value),onBlur:()=>{G()},onKeyDown:A=>{A.key==="Escape"&&(A.preventDefault(),re())},placeholder:eb})}):_.jsxs("button",{type:"button",className:`server-list-item${t===null?" server-list-item--active":""}`,onClick:()=>n(null),onDoubleClick:A=>{A.preventDefault(),F("main")},title:tb(J,D.__main__),children:[_.jsxs("span",{className:"server-list-item-header",children:[_.jsx("span",{className:"server-list-dot"}),_.jsx("span",{className:"server-list-name",children:J})]}),de?_.jsx(sb,{entry:D.__main__}):null]})}),h.map(A=>{const P=b?.kind==="agent"&&b.id===A.id;return _.jsx("div",{className:"server-list-row",children:P?_.jsx("form",{className:"server-list-editor",onSubmit:K=>{K.preventDefault(),G()},children:_.jsx("input",{ref:E,"aria-label":`Rename ${A.name}`,value:w,onChange:K=>x(K.target.value),onBlur:()=>{G()},onKeyDown:K=>{K.key==="Escape"&&(K.preventDefault(),re())}})}):_.jsxs("button",{type:"button",className:`server-list-item${t===A.id?" server-list-item--active":""}`,onClick:()=>n(A.id),onDoubleClick:K=>{K.preventDefault(),F({id:A.id,name:A.name})},title:tb(A.name,D[A.id]),children:[_.jsxs("span",{className:"server-list-item-header",children:[_.jsx("span",{className:"server-list-dot"}),_.jsx("span",{className:"server-list-name",title:A.url,children:A.name})]}),de?_.jsx(sb,{entry:D[A.id]}):null]})},A.id)})]})}function t2({api:e}){const[t,n]=g.useState([]),[a,o]=g.useState([]),[c,h]=g.useState(!1),[f,m]=g.useState(null),[p,b]=g.useState(""),[y,w]=g.useState("");async function x(){try{const[D,Y,F]=await Promise.all([e.listDevices(),e.listNetworks(),e.getSession()]);n(D.devices),o(Y.networks),h(F.totpEnabled),m(null)}catch(D){m(D instanceof Error?D.message:"Failed to load")}}g.useEffect(()=>{x()},[]);async function E(D){await e.revokeDevice(D),await x()}async function T(D){await e.removeNetwork(D),await x()}async function O(D){D.preventDefault(),m(null);try{await e.addNetwork({value:p.trim(),label:y.trim()}),b(""),w(""),await x()}catch(Y){m(Y instanceof Error?Y.message:"Failed to add network")}}return _.jsxs(_.Fragment,{children:[f?_.jsx("p",{className:"form-error",children:f}):null,_.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Trusted devices"}),_.jsx("p",{className:"muted",children:"Devices that can re-authenticate with a 2FA code only (no password) for 30 days."}),t.length===0?_.jsx("p",{className:"muted",children:"No trusted devices."}):_.jsx("ul",{className:"security-list",children:t.map(D=>_.jsxs("li",{children:[_.jsxs("div",{children:[_.jsxs("span",{className:"security-item-label",children:[D.label,D.current?_.jsx("span",{className:"security-badge",children:"this device"}):null]}),_.jsxs("span",{className:"security-item-meta",children:["last seen ",new Date(D.lastSeenAt).toLocaleString()]})]}),_.jsx("button",{type:"button",className:"security-remove",onClick:()=>{E(D.id)},children:"revoke"})]},D.id))})]}),_.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Trusted networks"}),_.jsx("p",{className:"muted",children:"Sessions from these IPs/ranges skip the 2FA re-auth prompt."}),a.length===0?_.jsx("p",{className:"muted",children:"No trusted networks."}):_.jsx("ul",{className:"security-list",children:a.map(D=>_.jsxs("li",{children:[_.jsxs("div",{children:[_.jsx("span",{className:"security-item-label",children:D.value}),D.label!==D.value?_.jsx("span",{className:"security-item-meta",children:D.label}):null]}),_.jsx("button",{type:"button",className:"security-remove",onClick:()=>{T(D.id)},children:"remove"})]},D.id))}),_.jsxs("form",{className:"security-add-form",onSubmit:O,children:[_.jsx("input",{type:"text",placeholder:"IP or CIDR (e.g. 203.0.113.4 or 192.168.0.0/24)",value:p,onChange:D=>b(D.currentTarget.value),required:!0}),_.jsx("input",{type:"text",placeholder:"Label (optional)",value:y,onChange:D=>w(D.currentTarget.value)}),_.jsx("button",{type:"submit",disabled:!p.trim(),children:"Add"})]})]}),c?_.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Two-factor authentication"}),_.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."}),_.jsx("button",{type:"button",className:"security-remove",onClick:async()=>{await e.disableTotp(),await x()},children:"Disable 2FA"})]}):null]})}const m0="nterminal.notifications.completionEnabled",mm="nterminal.notifications.completionToastEnabled",_m="nterminal.notifications.completionToastDurationSeconds",vm="nterminal.notifications.completionToastPersistent",Kf="nterminal:completion-toast-display",ro=6.5,If=2,Ff=60;function Uu(){return typeof window<"u"&&"Notification"in window}function _0(){try{return window.localStorage.getItem(m0)==="true"}catch{return!1}}function nb(e){try{window.localStorage.setItem(m0,e?"true":"false")}catch{}}function Hr(){return{enabled:r2(),durationSeconds:n2(),persistUntilDismissed:a2()}}function i2(e){if(typeof window<"u"){try{window.localStorage.setItem(mm,e?"true":"false")}catch{}ym()}return Hr()}function rb(e){const t=g0(e);if(typeof window<"u"){try{window.localStorage.setItem(_m,String(t))}catch{}ym()}return Hr()}function s2(e){if(typeof window<"u"){try{window.localStorage.setItem(vm,e?"true":"false")}catch{}ym()}return Hr()}function v0(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===mm||n.key===_m||n.key===vm)&&e()};return window.addEventListener(Kf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Kf,e),window.removeEventListener("storage",t)}}function gm(){return Uu()?window.Notification.permission:"unsupported"}function n2(){if(typeof window>"u")return ro;try{const e=window.localStorage.getItem(_m);return e===null?ro:g0(Number(e))}catch{return ro}}function r2(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(mm)!=="false"}catch{return!0}}function a2(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(vm)==="true"}catch{return!1}}function g0(e){if(!Number.isFinite(e))return ro;const t=Math.round(e*2)/2;return Math.max(If,Math.min(Ff,t))}function ym(){typeof window<"u"&&window.dispatchEvent(new CustomEvent(Kf))}async function l2(){if(!Uu())return"unsupported";try{return await window.Notification.requestPermission()}catch{return gm()}}function o2(e){if(!Uu()||gm()!=="granted"||!_0()||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 c2=1500,bm="nterminal.terminal.fontSize",Sm="nterminal.terminal.fontFamily",qf="nterminal:terminal-font-size",Wf="nterminal:terminal-font-family",$f=11,Yf=20,zr=14,bu=[{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:[]}],ja="meslo";Vf(ja);async function hf(e=zr,t=ja){if(typeof document>"u"||!document.fonts)return;const n=S0(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,c2)})])}function y0(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return zr;const n=Math.round(t);return Math.max($f,Math.min(Yf,n))}function b0(e){return bu.some(t=>t.id===e)?e:ja}function Vf(e){return S0(e).cssFamily}function S0(e){return bu.find(t=>t.id===e)??bu[0]}function Xf(){if(typeof window>"u")return zr;try{const e=window.localStorage.getItem(bm);return e?y0(e):zr}catch{return zr}}function Gf(){if(typeof window>"u")return ja;try{return b0(window.localStorage.getItem(Sm))}catch{return ja}}function Wc(e){const t=y0(e);if(typeof window>"u")return t;try{window.localStorage.setItem(bm,String(t))}catch{}return window.dispatchEvent(new CustomEvent(qf,{detail:t})),t}function u2(e){const t=b0(e);if(typeof window>"u")return t;try{window.localStorage.setItem(Sm,t)}catch{}return window.dispatchEvent(new CustomEvent(Wf,{detail:t})),t}function w0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===bm&&e()};return window.addEventListener(qf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(qf,e),window.removeEventListener("storage",t)}}function C0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Sm&&e()};return window.addEventListener(Wf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Wf,e),window.removeEventListener("storage",t)}}const wm="nterminal.terminal.showScrollProgress",Zf="nterminal:terminal-scroll-progress";function Qf(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(wm)!=="false"}catch{return!0}}function h2(e){if(typeof window<"u"){try{window.localStorage.setItem(wm,e?"true":"false")}catch{}window.dispatchEvent(new CustomEvent(Zf,{detail:e}))}return e}function x0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===wm&&e()};return window.addEventListener(Zf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Zf,e),window.removeEventListener("storage",t)}}const Cm="nterminal.shortcuts.workspace.v1",Jf="nterminal:workspace-shortcuts",fo=[{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"}],xm={"server.previous":Ai("ArrowUp",{ctrlKey:!0}),"server.next":Ai("ArrowDown",{ctrlKey:!0}),"tab.previous":Ai("ArrowLeft",{ctrlKey:!0}),"tab.next":Ai("ArrowRight",{ctrlKey:!0}),"tab.index":Ai("Digit",{ctrlKey:!0,altKey:!0}),"pane.index":Ai("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.right":Ai("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Ai("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})},d2={"server.previous":Ai("BracketLeft",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"server.next":Ai("BracketRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"tab.previous":Ai("BracketLeft",{ctrlKey:!0,altKey:!0}),"tab.next":Ai("BracketRight",{ctrlKey:!0,altKey:!0}),"tab.index":Ai("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"pane.index":Ai("Digit",{ctrlKey:!0,altKey:!0}),"split.right":Ai("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Ai("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})};function Ur(){const e=D0(xm);if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Cm);if(!t)return e;const n=JSON.parse(t);for(const a of fo){const o=n[a.id];if(S2(o)){const c=R0(o,a);b2(c,d2[a.id])||(e[a.id]=c)}}}catch{return e}return e}function ab(){return JSON.stringify(Ur())}function f2(e,t){const n=Ur(),a=fo.find(o=>o.id===e);return a&&(n[e]=R0(t,a),Em(n)),n}function p2(e){const t=Ur();return t[e]={...xm[e]},Em(t),t}function m2(){const e=D0(xm);return Em(e),e}function E0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Cm&&e()};return window.addEventListener(Jf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Jf,e),window.removeEventListener("storage",t)}}function _2(e,t){const n=N0(e);return!n||C2(n)||t.indexed&&M0(e)===null?null:{ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,code:t.indexed?"Digit":n}}function v2(e){const t=Ur();for(const n of fo){const a=t[n.id];if(!(!a||!w2(e,a))){if(n.indexed){if(a.code!=="Digit")continue;const o=M0(e);if(o!==null)return{id:n.id,index:o};continue}if(N0(e)===a.code)return{id:n.id,index:null}}}return null}function T0(e){return k0(Ur()[e])}function k0(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(x2(e.code)),t.join("+")}const g2=()=>T0("split.right"),y2=()=>T0("split.down");function Ai(e,t){return{ctrlKey:t.ctrlKey??!1,altKey:t.altKey??!1,shiftKey:t.shiftKey??!1,metaKey:t.metaKey??!1,code:e}}function D0(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{...n}]))}function b2(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey&&e.code===t.code}function Em(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Cm,JSON.stringify(e))}catch{}window.dispatchEvent(new CustomEvent(Jf))}}function R0(e,t){return{ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,shiftKey:!!e.shiftKey,metaKey:!!e.metaKey,code:t.indexed?"Digit":e.code}}function S2(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 w2(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey}function M0(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 N0(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 C2(e){return e==="ControlLeft"||e==="ControlRight"||e==="AltLeft"||e==="AltRight"||e==="ShiftLeft"||e==="ShiftRight"||e==="MetaLeft"||e==="MetaRight"}function x2(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 Tm="nterminal.theme.accent",ep="nterminal:theme-accent",po=[{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"}],Su="aqua";function Do(e){return po.some(t=>t.id===e)?e:Su}function km(e){return po.find(t=>t.id===e)??po[0]}function lr(){if(typeof window>"u")return Su;try{return Do(window.localStorage.getItem(Tm))}catch{return Su}}function E2(e){const t=Do(e);if(typeof window<"u"){try{window.localStorage.setItem(Tm,t)}catch{}Dm(t),window.dispatchEvent(new CustomEvent(ep,{detail:t}))}return t}function Dm(e=lr()){if(typeof document>"u")return;const t=km(Do(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 T2(e=lr()){return km(Do(e)).accent}function k2(e=lr()){return km(Do(e)).xtermSelection}function A0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Tm&&(Dm(lr()),e())};return window.addEventListener(ep,e),window.addEventListener("storage",t),()=>{window.removeEventListener(ep,e),window.removeEventListener("storage",t)}}const D2="Automatic update needs write access to the global npm install. Run this from a normal NTerminal runtime-user shell; only the npm install step uses sudo.";function R2(e="nterminal",t=new Date){return{reason:"permission",message:D2,command:`sudo npm i -g ${e}@latest --prefer-online && nterminal restart-after-update`,detectedAt:t.toISOString()}}function M2(e){return/\b(?:EACCES|EPERM)\b|permission denied|missing write access|access denied|operation was rejected by your operating system|operation not permitted|root-owned files/i.test(e)}const L0=3600*1e3,N2="local",tp=new Set,nr=new Map;let or={checking:!1,hasUpdates:!1,lastCheckedAt:null},Rm=null,ao=null,wu=0,Jn=null;function A2(e){return tp.add(e),()=>{tp.delete(e)}}function lb(){return or}function L2(e){const t=H2();Rm=e,Mm(),ip(e,t);const n=()=>{if(document.visibilityState!=="visible"||!cr(e,t))return;const a=or.lastCheckedAt;(a===null||Date.now()-a>=L0)&&ip(e,t)};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n),cr(e,t)&&j2()}}function B2(e,t){nr.set(e,B0(t)),Ha({...or,hasUpdates:Nm(),lastCheckedAt:Date.now()})}function df(e){e===void 0?nr.clear():nr.set(e,!1),Ha({...or,hasUpdates:Nm()})}async function ip(e,t){if(!cr(e,t))return;if(Jn&&Jn.api===e&&Jn.runId===t)return Jn.promise;Ha({...or,checking:!0});const n=O2(e,t).finally(()=>{Jn?.promise===n&&(Jn=null),cr(e,t)&&(Ha({...or,checking:!1,lastCheckedAt:Date.now()}),z2(e,t))});return Jn={api:e,runId:t,promise:n},n}async function O2(e,t){try{const n=await e.listAgents();if(!cr(e,t))return;const a=[{key:N2,check:()=>e.checkUpdate()},...n.agents.map(c=>({key:c.id,check:()=>e.checkAgentUpdate(c.id)}))],o=new Map;if(await Promise.all(a.map(async c=>{try{const h=await c.check();o.set(c.key,B0(h))}catch{o.set(c.key,nr.get(c.key)??!1)}})),!cr(e,t))return;nr.clear();for(const[c,h]of o)nr.set(c,h);Ha({...or,hasUpdates:Nm()})}catch{}}function z2(e,t){cr(e,t)&&(Mm(),ao=window.setTimeout(()=>{ao=null,cr(e,t)&&ip(e,t)},L0))}function j2(){wu+=1,Mm(),Rm=null,Jn=null,nr.clear(),Ha({checking:!1,hasUpdates:!1,lastCheckedAt:null})}function Mm(){ao!==null&&(window.clearTimeout(ao),ao=null)}function H2(){return wu+=1,wu}function cr(e,t){return Rm===e&&wu===t}function B0(e){return e.updateAvailable===!0}function Nm(){return Array.from(nr.values()).some(Boolean)}function Ha(e){or=e;for(const t of Array.from(tp))t()}const U2=e=>new Promise(t=>setTimeout(t,e));function P2({api:e,onAgentRemoved:t}){const[n,a]=g.useState([{key:"local",id:null,name:"Local (main)"}]),[o,c]=g.useState({}),[h,f]=g.useState(!1),[m,p]=g.useState(null),[b,y]=g.useState(!1);function w(A,P){c(K=>({...K,[A]:{...K[A],...P}}))}const x=A=>A.id===null?e.getVersion():e.getAgentVersion(A.id),E=A=>A.id===null?e.checkUpdate():e.checkAgentUpdate(A.id),T=A=>A.id===null?e.runUpdate():e.runAgentUpdate(A.id);g.useEffect(()=>{let A=!1;return e.listAgents().then(P=>{if(A)return;const K=[{key:"local",id:null,name:"Local (main)"},...P.agents.map(j=>({key:j.id,id:j.id,name:j.name}))];a(K);for(const j of K)x(j).then(B=>w(j.key,{version:B,manualUpdate:B.manualUpdate??null})).catch(B=>w(j.key,{error:B instanceof Error?B.message:"unreachable"}))}).catch(()=>{}),()=>{A=!0}},[]);async function O(A){w(A.key,{busy:!0,status:"checking…",error:void 0});try{const P=await E(A);B2(A.key,P),w(A.key,{latestVersion:P.latestVersion,updateAvailable:P.updateAvailable,status:J(P),...P.updateAvailable===!1?{manualUpdate:null}:{},busy:!1})}catch(P){w(A.key,{busy:!1,error:P instanceof Error?P.message:"check failed"})}}async function D(){f(!0),await Promise.all(n.map(A=>O(A))),f(!1)}async function Y(A,P){const K=Date.now()+18e4;for(;Date.now()<K;){await U2(3e3);try{const j=await x(A);if(P&&j.runningVersion!==P.runningVersion)return j}catch{}}return null}async function F(A){let P=o[A.key]?.version;if(!P)try{P=await x(A),w(A.key,{version:P,manualUpdate:P.manualUpdate??null})}catch(B){return w(A.key,{busy:!1,error:B instanceof Error?B.message:"version check failed"}),"failed"}w(A.key,{busy:!0,status:"updating…",error:void 0});let K;try{K=await T(A)}catch(B){return w(A.key,{busy:!1,error:B instanceof Error?B.message:"update failed"}),"failed"}if(!K.ok){const B=K.manualUpdate??(M2(K.message)?R2():null);return B?(w(A.key,{busy:!1,status:"manual update required",error:void 0,manualUpdate:B}),"manual"):(w(A.key,{busy:!1,status:void 0,error:K.message}),"failed")}if(!K.changed)return w(A.key,{busy:!1,status:"already up to date",updateAvailable:!1,manualUpdate:null}),df(A.key),"unchanged";w(A.key,{status:"restarting…"});const j=await Y(A,P);return j?(w(A.key,{busy:!1,version:j,updateAvailable:!1,status:"updated",manualUpdate:j.manualUpdate??null}),df(A.key),A.id===null&&(y(!0),p("Main server updated. Reload the page to use the new client.")),"updated"):(w(A.key,{busy:!1,status:void 0,error:"timed out — check the server log"}),"failed")}async function G(A){if(!(A.id===null||!window.confirm([`Delete secondary server "${A.name}"?`,"","If the secondary is reachable, NTerminal will schedule a clean uninstall on that host, stop its runtime, remove its local state, and remove it from this main server.","If it is already gone or unreachable, only the stale registration on this main server will be removed.","","This can close live terminals on that secondary. Continue?"].join(`
|
|
15
|
-
`)))){w(A.key,{busy:!0,status:"deleting…",error:void 0}),p(null);try{const K=await e.uninstallAgent(A.id);a(j=>j.filter(B=>B.key!==A.key)),c(j=>{const B={...j};return delete B[A.key],B}),df(A.key),t?.(A.id),p(K.message)}catch(K){w(A.key,{busy:!1,status:void 0,error:K instanceof Error?K.message:"delete failed"})}}}async function re(){f(!0),p(null);const A=n.filter(N=>N.id!==null),P=n.find(N=>N.id===null),K=await Promise.all(A.map(N=>F(N))),j=K.filter(N=>N==="failed").length;let B=K.filter(N=>N==="manual").length,Q=null;if(P&&(Q=await F(P),Q==="manual"&&(B+=1),Q==="updated")){j>0&&p("Main server updated. Reload the page to use the new client. Some secondary servers failed; check their rows and retry."),f(!1);return}j>0&&B>0?p("Some servers failed and some need manual update. Check each marked row."):j>0?p("Some secondary servers failed to update. Check their rows and retry."):B>0&&p("Some servers need manual update. Copy and run the command shown on each marked server."),f(!1)}function ee(A){return A?A.error?A.error:A.status?A.status:A.manualUpdate?"manual update required":A.version?`v${A.version.version}`:"…":"…"}function J(A){return A.error?A.error:typeof A.updateAvailable=="boolean"?A.updateAvailable?`latest v${A.latestVersion??"available"}`:"up to date":"unknown"}function oe(A){const P=A?.version;return P?`npm package v${P.runningVersion}`:""}async function de(A,P){try{await K2(P),w(A,{copiedCommand:!0}),window.setTimeout(()=>w(A,{copiedCommand:!1}),1800)}catch(K){w(A,{error:K instanceof Error?K.message:"copy failed"})}}return _.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Servers"}),_.jsxs("div",{className:"update-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{D()},disabled:h,children:"Check for updates"}),_.jsx("button",{type:"button",onClick:()=>{re()},disabled:h,children:"Update all"})]}),m?_.jsx("p",{className:"settings-status",children:m}):null,b?_.jsxs("div",{className:"server-reload-required",role:"status",children:[_.jsx("span",{children:"Main server update is ready."}),_.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:"Reload page"})]}):null,_.jsx("ul",{className:"security-list",children:n.map(A=>{const P=o[A.key],K=oe(P),j=P?.manualUpdate??null,B=P?.version!==void 0&&P?.updateAvailable!==!1&&!P?.busy&&!h,Q=A.id!==null&&!P?.busy&&!h;return _.jsxs("li",{children:[_.jsxs("div",{className:"server-row-main",children:[_.jsxs("div",{children:[_.jsx("span",{className:"security-item-label",children:A.name}),_.jsxs("span",{className:"security-item-meta",children:[K?`${K} — `:"",ee(P)]})]}),j?_.jsxs("div",{className:"server-manual-update",children:[_.jsx("span",{children:j.message}),_.jsxs("div",{className:"server-manual-command",children:[_.jsx("code",{children:j.command}),_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{de(A.key,j.command)},children:P?.copiedCommand?"Copied":"Copy"})]})]}):null]}),_.jsxs("div",{className:"server-row-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{F(A)},disabled:!B,children:P?.busy?"…":"Update"}),A.id!==null?_.jsx("button",{type:"button",className:"server-delete-button",onClick:()=>{G(A)},disabled:!Q,children:"Delete"}):null]})]},A.key)})})]})}async function K2(e){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{if(!document.execCommand("copy"))throw new Error("copy failed")}finally{t.remove()}}const $c=[{id:"terminal",label:"Terminal"},{id:"shortcuts",label:"Shortcuts"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"},{id:"servers",label:"Servers"}];function I2({onClose:e,api:t,updateAvailable:n=!1,onNotificationAssetsChanged:a,onAgentRemoved:o}){const c=g.useMemo(()=>t??Bu(),[t]),[h,f]=g.useState(()=>Xf()),[m,p]=g.useState(()=>Gf()),[b,y]=g.useState(()=>Qf()),[w,x]=g.useState(()=>lr()),[E,T]=g.useState(()=>Ur()),[O,D]=g.useState(null),[Y,F]=g.useState(null),[G,re]=g.useState("terminal"),[ee,J]=g.useState(()=>_0()),[oe,de]=g.useState(()=>Hr()),[A,P]=g.useState(()=>gm()),[K,j]=g.useState([]),[B,Q]=g.useState([]),[N,I]=g.useState([]),[X,ve]=g.useState(5*1024*1024),[Se,R]=g.useState(!1),[V,se]=g.useState(null),he=g.useRef(null),ye=g.useRef(null),me=g.useRef({terminal:null,shortcuts:null,notifications:null,security:null,servers:null}),fe=g.useMemo(()=>new Set(B),[B]),Me=!F2(B,N);g.useEffect(()=>w0(()=>f(Xf())),[]),g.useEffect(()=>C0(()=>p(Gf())),[]),g.useEffect(()=>x0(()=>y(Qf())),[]),g.useEffect(()=>A0(()=>x(lr())),[]),g.useEffect(()=>E0(()=>T(Ur())),[]),g.useEffect(()=>v0(()=>de(Hr())),[]),g.useEffect(()=>{if(!O)return;const te=fo.find(Le=>Le.id===O);if(!te)return;const Pe=Le=>{if(Le.preventDefault(),Le.stopPropagation(),Le.key==="Escape"){D(null),F(null);return}const bt=_2(Le,te);if(!bt){F(te.indexed?"Press a shortcut ending in a number from 1 to 9.":"Press a complete shortcut.");return}T(f2(O,bt)),D(null),F(null)};return window.addEventListener("keydown",Pe,!0),()=>window.removeEventListener("keydown",Pe,!0)},[O]),g.useEffect(()=>{let te=!1;return c.listNotificationAssets().then(Pe=>{te||Ee(Pe)}).catch(Pe=>{te||se(Yc(Pe))}),()=>{te=!0}},[c]);function Re(te){f(Wc(Number(te)))}function Ne(te){de(rb(Number(te)))}function Fe(te){re(te);const Pe=ye.current,Le=me.current[te];if(!Pe||!Le)return;const bt=Math.max(0,ob(Le,Pe)-12);typeof Pe.scrollTo=="function"?Pe.scrollTo({top:bt,behavior:"smooth"}):Pe.scrollTop=bt}function Oe(){const te=ye.current;if(!te)return;if(te.scrollTop+te.clientHeight>=te.scrollHeight-2){re($c[$c.length-1].id);return}let Pe="terminal";const Le=te.scrollTop+Math.min(180,Math.max(48,te.clientHeight*.28));for(const bt of $c){const xi=me.current[bt.id];xi&&ob(xi,te)<=Le&&(Pe=bt.id)}re(Pe)}function we(te){T(p2(te)),D(null),F(null)}function ne(){T(m2()),D(null),F(null)}function Ee(te){const Pe=te.assets.filter(Le=>Le.enabled).map(Le=>Le.id);j(te.assets),Q(Pe),I(Pe),ve(te.maxFileBytes),se(null)}async function Te(){if(ee){nb(!1),J(!1);return}let te=A;te==="default"&&(te=await l2(),P(te)),te==="granted"&&(nb(!0),J(!0))}async function je(te){const Pe=te?.[0];if(Pe){if(Pe.size>X){se(`File must be ${ff(X)} or smaller.`),_t();return}if(Pe.type!=="video/mp4"&&Pe.type!=="video/webm"){se("Upload an MP4 or WebM video."),_t();return}R(!0),se(null);try{await c.uploadNotificationAsset(Pe),Ee(await c.listNotificationAssets()),a?.()}catch(Le){se(Yc(Le))}finally{R(!1),_t()}}}async function Ue(te){R(!0),se(null);try{await c.deleteNotificationAsset(te),Ee(await c.listNotificationAssets()),a?.()}catch(Pe){se(Yc(Pe))}finally{R(!1)}}function _t(){he.current&&(he.current.value="")}function rt(te,Pe){const Le=new Set(B);if(Pe?Le.add(te):Le.delete(te),Le.size===0){se("Keep at least one toast video selected.");return}se(null),Q(Array.from(Le))}async function Ci(){if(B.length===0){se("Keep at least one toast video selected.");return}R(!0),se(null);try{const te=await c.updateNotificationAssetSelection({enabledAssetIds:B});Ee(te),a?.()}catch(te){se(Yc(te))}finally{R(!1)}}return _.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-label":"Settings",onClick:e,children:_.jsxs("div",{className:"security-panel settings-panel",onClick:te=>te.stopPropagation(),children:[_.jsxs("header",{className:"security-panel-header",children:[_.jsx("h2",{children:"Settings"}),_.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:e,children:"×"})]}),_.jsxs("div",{className:"settings-layout",children:[_.jsx("nav",{className:"settings-nav","aria-label":"Settings categories",children:$c.map(te=>_.jsxs("button",{type:"button","data-active":G===te.id?"true":"false","aria-current":G===te.id?"true":void 0,onClick:()=>Fe(te.id),children:[te.label,te.id==="servers"&&n?_.jsx("span",{className:"update-pulse-dot settings-update-dot","aria-hidden":"true"}):null]},te.id))}),_.jsxs("div",{ref:ye,className:"settings-content",onScroll:Oe,children:[_.jsxs("section",{id:"settings-terminal",ref:te=>{me.current.terminal=te},className:"security-section settings-section",children:[_.jsx("h3",{children:"Terminal"}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Font size"}),_.jsxs("span",{className:"settings-control-value",children:[h,"px"]}),_.jsx("input",{type:"range",min:$f,max:Yf,step:1,value:h,"aria-label":"Terminal font size",onChange:te=>Re(te.currentTarget.value)})]}),_.jsxs("div",{className:"settings-stepper-row",children:[_.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(Wc(h-1)),children:"-"}),_.jsx("input",{type:"number",min:$f,max:Yf,step:1,value:h,"aria-label":"Terminal font size value",onChange:te=>Re(te.currentTarget.value)}),_.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(Wc(h+1)),children:"+"}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:()=>f(Wc(zr)),children:"Reset"})]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Font family"}),_.jsx("select",{value:m,"aria-label":"Terminal font family",onChange:te=>p(u2(te.currentTarget.value)),children:bu.map(te=>_.jsx("option",{value:te.id,children:te.label},te.id))})]}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:b,onChange:te=>y(h2(te.currentTarget.checked))}),"Show scroll progress"]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Accent theme"}),_.jsx("select",{value:w,"aria-label":"Theme accent",onChange:te=>x(E2(te.currentTarget.value)),children:po.map(te=>_.jsx("option",{value:te.id,children:te.label},te.id))})]}),_.jsx("div",{className:"settings-theme-swatches","aria-hidden":"true",children:po.map(te=>_.jsx("span",{className:"settings-theme-swatch","data-active":w===te.id?"true":"false",style:{"--settings-theme-accent":te.accent}},te.id))})]}),_.jsxs("section",{id:"settings-shortcuts",ref:te=>{me.current.shortcuts=te},className:"security-section settings-section",children:[_.jsxs("div",{className:"settings-section-heading",children:[_.jsx("h3",{children:"Shortcuts"}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:ne,children:"Reset all"})]}),_.jsx("p",{className:"muted",children:"Defaults avoid Chrome's browser-tab shortcuts. Click a shortcut, then press the new key combo."}),Y?_.jsx("p",{className:"settings-error",children:Y}):null,_.jsx("ul",{className:"settings-shortcut-list","aria-label":"Workspace shortcuts",children:fo.map(te=>{const Pe=O===te.id;return _.jsxs("li",{children:[_.jsxs("div",{children:[_.jsx("span",{className:"settings-shortcut-label",children:te.label}),_.jsx("span",{className:"settings-shortcut-group",children:te.group})]}),_.jsxs("div",{className:"settings-shortcut-actions",children:[_.jsx("button",{type:"button",className:"settings-shortcut-recorder","data-recording":Pe?"true":"false",onClick:()=>{D(te.id),F(null)},children:Pe?"Press keys…":k0(E[te.id])}),_.jsx("button",{type:"button",className:"secondary-button settings-shortcut-reset",onClick:()=>we(te.id),children:"Reset"})]})]},te.id)})})]}),_.jsxs("section",{id:"settings-notifications",ref:te=>{me.current.notifications=te},className:"security-section settings-section",children:[_.jsx("h3",{children:"Notifications"}),Uu()?_.jsxs(_.Fragment,{children:[_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:ee&&A==="granted",onChange:()=>{Te()},disabled:A==="denied"}),"System notification when page is hidden"]}),A==="denied"?_.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."}):_.jsx("p",{className:"muted",children:"Uses browser notifications only when this page isn't visible. Animated toast is controlled separately below."})]}):_.jsx("p",{className:"muted",children:"This browser doesn't expose the Notification API; animated toast and in-app badges can still work."}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:oe.enabled,onChange:te=>de(i2(te.currentTarget.checked))}),"Show animated completion toast"]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Toast duration"}),_.jsx("span",{className:"settings-control-value",children:oe.persistUntilDismissed?"Until closed":`${oe.durationSeconds}s`}),_.jsx("input",{type:"range",min:If,max:Ff,step:.5,value:oe.durationSeconds,disabled:!oe.enabled||oe.persistUntilDismissed,"aria-label":"Completion toast duration",onChange:te=>Ne(te.currentTarget.value)})]}),_.jsxs("div",{className:"settings-stepper-row settings-duration-row",children:[_.jsx("input",{type:"number",min:If,max:Ff,step:.5,value:oe.durationSeconds,disabled:!oe.enabled||oe.persistUntilDismissed,"aria-label":"Completion toast duration value",onChange:te=>Ne(te.currentTarget.value)}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",disabled:!oe.enabled||oe.persistUntilDismissed,onClick:()=>de(rb(ro)),children:"Reset"})]}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:oe.persistUntilDismissed,disabled:!oe.enabled,onChange:te=>de(s2(te.currentTarget.checked))}),"Keep toast until dismissed"]}),_.jsxs("div",{className:"settings-assets-header",children:[_.jsx("span",{children:"Toast videos"}),_.jsxs("span",{children:[ff(X)," max"]})]}),_.jsx("input",{ref:he,type:"file",accept:"video/mp4,video/webm",className:"settings-asset-input","aria-label":"Upload toast video",onChange:te=>{je(te.currentTarget.files)}}),_.jsx("button",{type:"button",className:"secondary-button settings-upload-button",disabled:Se,onClick:()=>he.current?.click(),children:"Upload video"}),V?_.jsx("p",{className:"settings-error",children:V}):null,K.length>0?_.jsx("ul",{className:"settings-asset-list","aria-label":"Toast videos",children:K.map(te=>_.jsxs("li",{"data-enabled":fe.has(te.id)?"true":"false",children:[_.jsxs("label",{className:"settings-asset-choice",children:[_.jsx("input",{type:"checkbox",checked:fe.has(te.id),disabled:Se,"aria-label":`Use ${te.filename}`,onChange:Pe=>rt(te.id,Pe.currentTarget.checked)}),_.jsx("video",{src:te.url,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),_.jsxs("span",{className:"settings-asset-copy",children:[_.jsx("span",{children:te.filename}),_.jsx("small",{children:te.source==="built-in"?"Built-in":ff(te.size)})]})]}),te.source==="uploaded"?_.jsx("button",{type:"button",className:"secondary-button settings-asset-delete",disabled:Se,"aria-label":`Delete ${te.filename}`,onClick:()=>{Ue(te.id)},children:"x"}):null]},te.id))}):_.jsx("p",{className:"muted",children:"Built-in videos will be used."}),_.jsx("button",{type:"button",className:"secondary-button settings-save-assets-button",disabled:Se||K.length===0||!Me,onClick:()=>{Ci()},children:"Save selected videos"})]}),_.jsx("div",{id:"settings-security",ref:te=>{me.current.security=te},className:"settings-section-group",children:_.jsx(t2,{api:c})}),_.jsx("div",{id:"settings-servers",ref:te=>{me.current.servers=te},className:"settings-section-group",children:_.jsx(P2,{api:c,...o?{onAgentRemoved:o}:{}})})]})]})]})})}function ob(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return n.top-a.top+t.scrollTop}function ff(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 F2(e,t){if(e.length!==t.length)return!1;const n=new Set(t);return e.every(a=>n.has(a))}class Rr extends Error{constructor(t,n){super(n),this.status=t,this.name="UploadClientError"}status}function q2(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)=>{let h=!1;const f=()=>{e.signal?.removeEventListener("abort",b)},m=y=>{h||(h=!0,f(),o(y))},p=y=>{h||(h=!0,f(),c(y))},b=()=>{t.abort(),p(new Rr(0,"Upload aborted."))};if(e.signal?.aborted){p(new Rr(0,"Upload aborted."));return}e.signal?.addEventListener("abort",b,{once:!0}),t.open("POST","/api/uploads"),t.withCredentials=!0,t.upload.onprogress=y=>{if(e.onProgress){if(y.lengthComputable&&y.total>0){e.onProgress({loaded:y.loaded,total:y.total,percent:Math.round(y.loaded/y.total*100)});return}e.onProgress({loaded:y.loaded,total:null,percent:null})}},t.onload=()=>{if(t.status>=200&&t.status<300){try{m(JSON.parse(t.responseText))}catch{p(new Rr(t.status,"Invalid upload response."))}return}p(new Rr(t.status,W2(t.responseText,t.statusText||`HTTP ${t.status}`)))},t.onerror=()=>p(new Rr(0,"Upload failed.")),t.onabort=()=>p(new Rr(0,"Upload aborted.")),t.ontimeout=()=>p(new Rr(0,"Upload timed out.")),t.send(n)})}function W2(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 $2="modulepreload",Y2=function(e){return"/"+e},cb={},Am=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let m=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=h?.nonce||h?.getAttribute("nonce");o=m(n.map(p=>{if(p=Y2(p),p in cb)return;cb[p]=!0;const b=p.endsWith(".css"),y=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":$2,b||(w.as="script"),w.crossOrigin="",w.href=p,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((x,E)=>{w.addEventListener("load",x),w.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(h){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=h,window.dispatchEvent(f),!f.defaultPrevented)throw h}return o.then(h=>{for(const f of h||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},V2=g.lazy(()=>Am(()=>import("./MarkdownPreview-BK2F1vOc.js"),__vite__mapDeps([0,1])));function X2({api:e,activeTerminalId:t,activeTerminalCwd:n,onOpenFile:a}){const[o,c]=g.useState(null),[h,f]=g.useState(""),[m,p]=g.useState({}),[b,y]=g.useState(()=>new Set),[w,x]=g.useState(null),[E,T]=g.useState({type:"empty"}),[O,D]=g.useState("idle"),[Y,F]=g.useState(null),G=g.useRef(null),re=g.useRef(null),ee=g.useRef(!1),J=g.useRef(0),oe=g.useRef(null);oe.current===null&&t&&(oe.current=t);const de=oe.current,A=t?mf(t,n):null,P=o?[o.rootPath,h].filter(Boolean).join("/"):"",K=w?.path??null;g.useEffect(()=>(ee.current=!0,()=>{ee.current=!1,J.current+=1,Me()}),[]),g.useEffect(()=>{oe.current=t,re.current=null;const ne=t?mf(t,n):null;j(t,ne)},[e]),g.useEffect(()=>{if(!de||t!==de)return;const ne=mf(de,n);ne!==re.current&&j(de,ne)},[de,t,n]);async function j(ne,Ee=A){const Te=Re();if(re.current=Ee,Me(),c(null),f(""),p({}),y(new Set),x(null),T({type:"empty"}),F(null),!ne){D("idle");return}D("loading");try{const je=await e.createFileRoot({terminalId:ne});if(!Ne(Te))return;c({rootToken:je.rootToken,rootPath:je.rootPath});const Ue=await e.listFiles({rootToken:je.rootToken,path:""});if(!Ne(Te))return;N(Ue),D("idle")}catch(je){if(await Fe(je,Te))return;Ne(Te)&&(F(Xn(je)),D("idle"))}}async function B(ne=h,Ee=o){if(!Ee)return;const Te=Re();D("loading"),F(null);try{const je=await e.listFiles({rootToken:Ee.rootToken,path:ne});if(!Ne(Te))return;N(je),D("idle")}catch(je){if(await Fe(je,Te))return;Ne(Te)&&(F(Xn(je)),D("idle"))}}async function Q(){oe.current=t,await j(t,A)}function N(ne){p(Ee=>({...Ee,[ne.path]:Z2(ne.entries)}))}async function I(ne){if(!(!pf(ne)||!o)){if(x(ne),F(null),ne.kind==="directory"){f(ne.path),fe(),await ve(ne);return}if(f(Mr(ne.path)),ne.editable){await R(ne);return}ne.previewKind!=="none"&&await se(ne,ne.previewKind)}}async function X(ne){if(!(!pf(ne)||!o)){if(x(ne),F(null),ne.kind==="directory"){f(ne.path),fe(),await ve(ne);return}if(f(Mr(ne.path)),ne.editable){await V(ne);return}ne.previewKind!=="none"&&await se(ne,ne.previewKind)}}async function ve(ne){if(b.has(ne.path)){y(Ee=>{const Te=new Set(Ee);return Te.delete(ne.path),Te});return}y(Ee=>new Set(Ee).add(ne.path)),await B(ne.path)}function Se(ne,Ee){ne.key==="Enter"&&(ne.preventDefault(),X(Ee))}async function R(ne){if(!o)return;const Ee=Re();D("loading"),Me();try{const Te=await e.readFile({rootToken:o.rootToken,path:ne.path});if(!Ne(Ee))return;T({type:"text-preview",file:ne,read:Te}),D("idle")}catch(Te){if(await Fe(Te,Ee))return;Ne(Ee)&&(F(Xn(Te)),D("idle"))}}async function V(ne){if(!o)return;const Ee=Re();D("loading");try{await a({rootToken:o.rootToken,path:ne.path}),Ne(Ee)&&D("idle")}catch(Te){if(await Fe(Te,Ee))return;Ne(Ee)&&(F(Xn(Te)),D("idle"))}}async function se(ne,Ee){if(!o)return;const Te=Re();D("loading"),Me();try{const je=await e.previewFile({rootToken:o.rootToken,path:ne.path});if(!Ne(Te))return;const Ue=URL.createObjectURL(je);if(!Ne(Te)){URL.revokeObjectURL(Ue);return}G.current=Ue,T({type:"preview",file:ne,previewKind:Ee,url:Ue}),D("idle")}catch(je){if(await Fe(je,Te))return;Ne(Te)&&(F(Xn(je)),D("idle"))}}async function he(ne){if(!o)return;const Ee=ne==="file"?"New file":"New folder",Te=window.prompt(Ee,""),je=w?w.kind==="directory"?w.path:Mr(w.path):h,Ue=ub(Te,je);if(Ue){F(null);try{const _t=await e.createFileEntry({rootToken:o.rootToken,path:Ue,kind:ne});x(_t.entry),await B(je)}catch(_t){if(await Fe(_t))return;F(Xn(_t))}}}async function ye(){if(!o||!w)return;const ne=window.prompt("Move selected entry",w.path),Ee=ub(ne,"");if(!Ee||Ee===w.path)return;const Te=Mr(w.path),je=Mr(Ee);F(null);try{const Ue=await e.moveFileEntry({rootToken:o.rootToken,sourcePath:w.path,destinationPath:Ee});x(Ue.entry),f(Ue.entry.kind==="directory"?Ue.entry.path:Mr(Ue.entry.path)),fe(),await B(Te),je!==Te&&await B(je)}catch(Ue){if(await Fe(Ue))return;F(Xn(Ue))}}async function me(){if(!o||!w)return;const ne=w.path,Ee=Mr(ne);F(null);try{const Te=await e.previewDeleteFileEntry({rootToken:o.rootToken,path:w.path}),je=Te.descendantCount>0?` and ${Te.descendantCount} nested item${Te.descendantCount===1?"":"s"}`:"";if(!window.confirm(`Delete ${Te.path}${je}?`))return;await e.deleteFileEntry({rootToken:o.rootToken,path:w.path,previewToken:Te.previewToken}),x(null),f(Ee),y(Ue=>{const _t=new Set(Ue);for(const rt of Ue)(rt===ne||rt.startsWith(`${ne}/`))&&_t.delete(rt);return _t}),fe(),await B(Ee)}catch(Te){if(await Fe(Te))return;F(Xn(Te))}}function fe(){J.current+=1,Me(),T({type:"empty"})}function Me(){G.current&&(URL.revokeObjectURL(G.current),G.current=null)}function Re(){return J.current+=1,J.current}function Ne(ne){return ee.current&&ne===J.current}async function Fe(ne,Ee){return Q2(ne)?(Ee!==void 0&&!Ne(Ee)||await j(t,A),!0):!1}function Oe(ne,Ee){const Te=pf(ne),je=ne.kind==="directory"&&b.has(ne.path),Ue=m[ne.path]??[],_t={"--file-tree-depth":Ee};return _.jsxs(ii.Fragment,{children:[_.jsxs("button",{type:"button",className:"file-entry-button","data-kind":ne.kind,"data-expanded":je,"data-active":K===ne.path,disabled:!Te,style:_t,"aria-expanded":ne.kind==="directory"?je:void 0,"aria-label":`${ne.kind==="directory"?"Open folder":"Open file"} ${ne.name}`,title:ne.kind==="directory"?"Expand or collapse folder":"Click to preview. Double-click or press Enter to open.",onClick:()=>{I(ne)},onDoubleClick:()=>{X(ne)},onKeyDown:rt=>Se(rt,ne),children:[_.jsx("span",{className:"file-entry-disclosure","aria-hidden":"true",children:ne.kind==="directory"?je?"▾":"▸":""}),_.jsx("span",{className:"file-entry-name",children:ne.name}),_.jsx("small",{children:G2(ne)})]}),je?_.jsx("div",{className:"file-tree-children",role:"group",children:Ue.map(rt=>Oe(rt,Ee+1))}):null]},ne.path)}const we=m[""]??[];return _.jsxs("section",{className:"file-explorer","aria-label":"Files","aria-busy":O==="loading",children:[_.jsxs("header",{className:"file-explorer-header",children:[_.jsx("div",{className:"file-explorer-path",title:P,children:P||"No active pane"}),_.jsxs("div",{className:"file-explorer-toolbar","aria-label":"File actions",children:[_.jsx("button",{type:"button","aria-label":"Refresh files",title:"Refresh",disabled:!t,onClick:()=>{Q()},children:"↻"}),_.jsx("button",{type:"button","aria-label":"New file",title:"New file",disabled:!o,onClick:()=>{he("file")},children:"+"}),_.jsx("button",{type:"button","aria-label":"New folder",title:"New folder",disabled:!o,onClick:()=>{he("directory")},children:"▣"})]})]}),Y?_.jsx("div",{className:"file-explorer-alert",role:"alert",children:Y}):null,_.jsxs("div",{className:"file-explorer-layout",children:[_.jsx("div",{className:"file-tree","aria-label":P?`Files in ${P}`:"Files",children:we.map(ne=>Oe(ne,0))}),_.jsxs("section",{className:"file-detail","aria-label":"File detail",children:[_.jsxs("div",{className:"file-detail-header",children:[_.jsx("strong",{children:w?.name??"detail"}),_.jsxs("div",{className:"file-detail-actions",children:[_.jsx("button",{type:"button","aria-label":"Move selected entry",disabled:!w,onClick:()=>{ye()},children:"Move"}),_.jsx("button",{type:"button","aria-label":"Delete selected entry",disabled:!w,onClick:()=>{me()},children:"Delete"})]})]}),O==="loading"?_.jsx("div",{className:"file-detail-empty",children:"loading"}):null,E.type==="empty"&&O!=="loading"?_.jsx("div",{className:"file-detail-empty",children:"No file selected"}):null,E.type==="preview"?_.jsxs("div",{className:"file-preview-frame",children:[E.previewKind==="image"?_.jsx("img",{src:E.url,alt:E.file.name}):null,E.previewKind==="pdf"?_.jsx("iframe",{src:E.url,title:E.file.name}):null]}):null,E.type==="text-preview"&&E.read.language==="markdown"?_.jsx("div",{className:"file-markdown-preview","aria-label":`Preview for ${E.file.name}`,children:_.jsx(g.Suspense,{fallback:_.jsx("div",{className:"file-markdown-preview-loading",children:"loading preview"}),children:_.jsx(V2,{content:E.read.content})})}):null,E.type==="text-preview"&&E.read.language==="text"?_.jsx("pre",{className:"file-text-preview","aria-label":`Preview for ${E.file.name}`,children:E.read.content}):null]})]})]})}function pf(e){return e.kind==="directory"||e.editable||e.previewKind!=="none"}function G2(e){return e.kind==="directory"?"dir":e.editable?"edit":e.previewKind!=="none"?e.previewKind:"unsupported"}function mf(e,t){return`${e}\0${t??""}`}function Z2(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 Mr(e){const t=e.split("/").filter(Boolean);return t.pop(),t.join("/")}function ub(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 Xn(e){return e instanceof Error?e.message:"Request failed"}function Q2(e){return e instanceof bn&&e.status===409&&e.message==="terminal_cwd_changed"}const J2=g.lazy(()=>Am(()=>import("./MarkdownPreview-BK2F1vOc.js"),__vite__mapDeps([0,1])));function hb({api:e,editor:t,canClose:n,onClose:a}){const[o,c]=g.useState(t.read),[h,f]=g.useState(t.read.content),[m,p]=g.useState("idle"),[b,y]=g.useState(null),[w,x]=g.useState(!1),[E,T]=g.useState("edit"),O=g.useRef(t),D=g.useRef(t.read),Y=g.useRef(t.read.content),F=g.useRef(!1),G=g.useRef(!1),re=g.useRef(0),ee=h!==o.content&&m!=="saving"&&!w;g.useEffect(()=>(G.current=!0,()=>{G.current=!1,re.current+=1}),[]),g.useEffect(()=>{re.current+=1,F.current=!1,O.current=t,D.current=t.read,Y.current=t.read.content,c(t.read),f(t.read.content),p("idle"),y(null),x(!1),T("edit")},[t.id,t.read]),g.useEffect(()=>{O.current=t},[t]),g.useEffect(()=>{D.current=o},[o]),g.useEffect(()=>{Y.current=h},[h]),g.useEffect(()=>{if(h===o.content||w)return;const P=window.setInterval(()=>{!F.current&&Y.current!==D.current.content&&J()},1e3);return()=>window.clearInterval(P)},[h===o.content,w,t.id]);async function J(){if(F.current)return;const P=Y.current,K=D.current;if(P===K.content)return;const j=O.current,B=re.current;F.current=!0,p("saving"),y(null),x(!1);try{const Q=await e.writeFile({rootToken:j.rootToken,path:j.path,content:P,expectedVersion:K.version});if(!G.current||B!==re.current)return;const N={...K,content:P,version:Q.version};D.current=N,c(N),p(Y.current===P?"saved":"idle")}catch(Q){if(!G.current||B!==re.current)return;if(Q instanceof bn&&Q.status===409){x(!0),p("idle");return}y(eT(Q)),p("idle")}finally{B===re.current&&(F.current=!1)}}const oe=m==="saving"?"saving":m==="saved"?"saved":o.language,de=o.language==="markdown",A=de&&E==="preview";return _.jsxs("section",{className:"editor-pane","aria-label":`Editor pane ${t.title}`,children:[_.jsxs("header",{className:"editor-pane-header",children:[_.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),_.jsx("strong",{children:t.title}),_.jsx("span",{className:"terminal-pane-spacer"}),_.jsx("span",{className:"terminal-pane-state",children:oe}),_.jsx("button",{type:"button","aria-label":`Save ${t.title}`,disabled:!ee,onClick:()=>{J()},children:"Save"}),de?_.jsx("button",{type:"button","aria-label":`${A?"Edit":"Preview"} ${t.title}`,onClick:()=>T(P=>P==="preview"?"edit":"preview"),children:A?"Edit":"Preview"}):null,n?_.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close editor ${t.title}`,onClick:a,children:"x"}):null]}),b?_.jsx("div",{className:"editor-pane-alert",role:"alert",children:b}):null,w?_.jsx("div",{className:"editor-pane-alert",role:"alert",children:"File changed on disk."}):null,A?_.jsx("div",{className:"editor-markdown-preview","aria-label":`Markdown preview for ${t.title}`,children:_.jsx(g.Suspense,{fallback:_.jsx("div",{className:"editor-markdown-preview-loading",children:"loading preview"}),children:_.jsx(J2,{content:h})})}):_.jsx("textarea",{className:"editor-pane-textarea","aria-label":`Editor for ${t.title}`,spellCheck:!1,value:h,onChange:P=>{const K=P.target.value;Y.current=K,f(K),p("idle"),y(null),x(!1)}})]})}function eT(e){return e instanceof Error?e.message:"Request failed"}var tT=2,iT=1,sT=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),h={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},f=h.top+h.bottom,m=h.right+h.left,p=a-f,b=o-m-t;return{cols:Math.max(tT,Math.floor(b/e.css.cell.width)),rows:Math.max(iT,Math.floor(p/e.css.cell.height))}}};var O0=Object.defineProperty,nT=Object.getOwnPropertyDescriptor,rT=(e,t)=>{for(var n in t)O0(e,n,{get:t[n],enumerable:!0})},zt=(e,t,n,a)=>{for(var o=a>1?void 0:a?nT(t,n):t,c=e.length-1,h;c>=0;c--)(h=e[c])&&(o=(a?h(t,n,o):h(o))||o);return a&&o&&O0(t,n,o),o},be=(e,t)=>(n,a)=>t(n,a,e),db="Terminal input",sp={get:()=>db,set:e=>db=e},fb="Too much output to announce, navigate to rows manually to read",np={get:()=>fb,set:e=>fb=e};function aT(e){return e.replace(/\r?\n/g,"\r")}function lT(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function oT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function cT(e,t,n,a){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");z0(o,t,n,a)}}function z0(e,t,n,a){e=aT(e),e=lT(e,n.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function j0(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 pb(e,t,n,a,o){j0(e,t,n),o&&a.rightClickSelect(e),t.value=a.selectionText,t.select()}function tr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Pu(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 uT=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 h=e.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=n)return this._interim=h,a;let f=e.charCodeAt(c);56320<=f&&f<=57343?t[a++]=(h-55296)*1024+f-56320+65536:(t[a++]=h,t[a++]=f);continue}h!==65279&&(t[a++]=h)}return a}},hT=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,h,f,m=0,p=0;if(this.interim[0]){let w=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let E=0,T;for(;(T=this.interim[++E]&63)&&E<4;)x<<=6,x|=T;let O=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=O-E;for(;p<D;){if(p>=n)return 0;if(T=e[p++],(T&192)!==128){p--,w=!0;break}else this.interim[E++]=T,x<<=6,x|=T&63}w||(O===2?x<128?p--:t[a++]=x:O===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,y=p;for(;y<n;){for(;y<b&&!((o=e[y])&128)&&!((c=e[y+1])&128)&&!((h=e[y+2])&128)&&!((f=e[y+3])&128);)t[a++]=o,t[a++]=c,t[a++]=h,t[a++]=f,y+=4;if(o=e[y++],o<128)t[a++]=o;else if((o&224)===192){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(m=(o&31)<<6|c&63,m<128){y--;continue}t[a++]=m}else if((o&240)===224){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,a;if(h=e[y++],(h&192)!==128){y--;continue}if(m=(o&15)<<12|(c&63)<<6|h&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[a++]=m}else if((o&248)===240){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,a;if(h=e[y++],(h&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=h,a;if(f=e[y++],(f&192)!==128){y--;continue}if(m=(o&7)<<18|(c&63)<<12|(h&63)<<6|f&63,m<65536||m>1114111)continue;t[a++]=m}}return a}},H0="",sr=" ",Ro=class U0{constructor(){this.fg=0,this.bg=0,this.extended=new Cu}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 U0;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}},Cu=class P0{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 P0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Es=class K0 extends Ro{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Cu,this.combinedData=""}static fromCharData(t){let n=new K0;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?tr(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()]}},mb="di$target",rp="di$dependencies",_f=new Map;function dT(e){return e[rp]||[]}function di(e){if(_f.has(e))return _f.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");fT(t,n,o)};return t._id=e,_f.set(e,t),t}function fT(e,t,n){t[mb]===t?t[rp].push({id:e,index:n}):(t[rp]=[{id:e,index:n}],t[mb]=t)}var Hi=di("BufferService"),I0=di("CoreMouseService"),Ir=di("CoreService"),pT=di("CharsetService"),Lm=di("InstantiationService"),F0=di("LogService"),Ui=di("OptionsService"),q0=di("OscLinkService"),mT=di("UnicodeService"),Mo=di("DecorationService"),ap=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 Es,h=n.getTrimmedLength(),f=-1,m=-1,p=!1;for(let b=0;b<h;b++)if(!(m===-1&&!n.hasContent(b))){if(n.loadCell(b,c),c.hasExtendedAttrs()&&c.extended.urlId)if(m===-1){m=b,f=c.extended.urlId;continue}else p=c.extended.urlId!==f;else m!==-1&&(p=!0);if(p||m!==-1&&b===h-1){let y=this._oscLinkService.getLinkData(f)?.uri;if(y){let w={start:{x:m+1,y:e},end:{x:b+(!p&&b===h-1?1:0),y:e}},x=!1;if(!o?.allowNonHttpProtocols)try{let E=new URL(y);["http:","https:"].includes(E.protocol)||(x=!0)}catch{x=!0}x||a.push({text:y,range:w,activate:(E,T)=>o?o.activate(E,T,w):_T(E,T),hover:(E,T)=>o?.hover?.(E,T,w),leave:(E,T)=>o?.leave?.(E,T,w)})}p=!1,c.hasExtendedAttrs()&&c.extended.urlId?(m=b,f=c.extended.urlId):(m=-1,f=-1)}}t(a)}};ap=zt([be(0,Hi),be(1,Ui),be(2,q0)],ap);function _T(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
16
|
-
|
|
17
|
-
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 Ku=di("CharSizeService"),wn=di("CoreBrowserService"),Bm=di("MouseService"),Cn=di("RenderService"),vT=di("SelectionService"),W0=di("CharacterJoinerService"),Fa=di("ThemeService"),$0=di("LinkProviderService"),gT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?_b.isErrorNoTelemetry(e)?new _b(e.message+`
|
|
18
|
-
|
|
19
|
-
`+e.stack):new Error(e.message+`
|
|
20
|
-
|
|
21
|
-
`+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)}},yT=new gT;function ru(e){bT(e)||yT.onUnexpectedError(e)}var lp="Canceled";function bT(e){return e instanceof ST?!0:e instanceof Error&&e.name===lp&&e.message===lp}var ST=class extends Error{constructor(){super(lp),this.name=this.message}};function wT(e){return new Error(`Illegal argument: ${e}`)}var _b=class op extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof op)return t;let n=new op;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},cp=class Y0 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Y0.prototype)}};function ls(e,t=0){return e[e.length-(1+t)]}var CT;(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})(CT||={});function xT(e,t){let n=this,a=!1,o;return function(){return a||(a=!0,t||(o=e.apply(n,arguments))),o}}var V0;(e=>{function t(G){return G&&typeof G=="object"&&typeof G[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function a(){return n}e.empty=a;function*o(G){yield G}e.single=o;function c(G){return t(G)?G:o(G)}e.wrap=c;function h(G){return G||n}e.from=h;function*f(G){for(let re=G.length-1;re>=0;re--)yield G[re]}e.reverse=f;function m(G){return!G||G[Symbol.iterator]().next().done===!0}e.isEmpty=m;function p(G){return G[Symbol.iterator]().next().value}e.first=p;function b(G,re){let ee=0;for(let J of G)if(re(J,ee++))return!0;return!1}e.some=b;function y(G,re){for(let ee of G)if(re(ee))return ee}e.find=y;function*w(G,re){for(let ee of G)re(ee)&&(yield ee)}e.filter=w;function*x(G,re){let ee=0;for(let J of G)yield re(J,ee++)}e.map=x;function*E(G,re){let ee=0;for(let J of G)yield*re(J,ee++)}e.flatMap=E;function*T(...G){for(let re of G)yield*re}e.concat=T;function O(G,re,ee){let J=ee;for(let oe of G)J=re(J,oe);return J}e.reduce=O;function*D(G,re,ee=G.length){for(re<0&&(re+=G.length),ee<0?ee+=G.length:ee>G.length&&(ee=G.length);re<ee;re++)yield G[re]}e.slice=D;function Y(G,re=Number.POSITIVE_INFINITY){let ee=[];if(re===0)return[ee,G];let J=G[Symbol.iterator]();for(let oe=0;oe<re;oe++){let de=J.next();if(de.done)return[ee,e.empty()];ee.push(de.value)}return[ee,{[Symbol.iterator](){return J}}]}e.consume=Y;async function F(G){let re=[];for await(let ee of G)re.push(ee);return Promise.resolve(re)}e.asyncToArray=F})(V0||={});function Pr(e){if(V0.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 ET(...e){return wt(()=>Pr(e))}function wt(e){return{dispose:xT(()=>{e()})}}var X0=class G0{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{Pr(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?G0.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)}};X0.DISABLE_DISPOSED_WARNING=!1;var rr=X0,We=class{constructor(){this._store=new rr,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)}};We.None=Object.freeze({dispose(){}});var Ua=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}},yn=typeof window=="object"?window:globalThis,up=class hp{constructor(t){this.element=t,this.next=hp.Undefined,this.prev=hp.Undefined}};up.Undefined=new up(void 0);var kt=up,vb=class{constructor(){this._first=kt.Undefined,this._last=kt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===kt.Undefined}clear(){let e=this._first;for(;e!==kt.Undefined;){let t=e.next;e.prev=kt.Undefined,e.next=kt.Undefined,e=t}this._first=kt.Undefined,this._last=kt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new kt(e);if(this._first===kt.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!==kt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==kt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==kt.Undefined&&e.next!==kt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===kt.Undefined&&e.next===kt.Undefined?(this._first=kt.Undefined,this._last=kt.Undefined):e.next===kt.Undefined?(this._last=this._last.prev,this._last.next=kt.Undefined):e.prev===kt.Undefined&&(this._first=this._first.next,this._first.prev=kt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==kt.Undefined;)yield e.element,e=e.next}},TT=globalThis.performance&&typeof globalThis.performance.now=="function",kT=class Z0{static create(t){return new Z0(t)}constructor(t){this._now=TT&&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}},wi;(e=>{e.None=()=>We.None;function t(K,j){return y(K,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function n(K){return(j,B=null,Q)=>{let N=!1,I;return I=K(X=>{if(!N)return I?I.dispose():N=!0,j.call(B,X)},null,Q),N&&I.dispose(),I}}e.once=n;function a(K,j,B){return p((Q,N=null,I)=>K(X=>Q.call(N,j(X)),null,I),B)}e.map=a;function o(K,j,B){return p((Q,N=null,I)=>K(X=>{j(X),Q.call(N,X)},null,I),B)}e.forEach=o;function c(K,j,B){return p((Q,N=null,I)=>K(X=>j(X)&&Q.call(N,X),null,I),B)}e.filter=c;function h(K){return K}e.signal=h;function f(...K){return(j,B=null,Q)=>{let N=ET(...K.map(I=>I(X=>j.call(B,X))));return b(N,Q)}}e.any=f;function m(K,j,B,Q){let N=B;return a(K,I=>(N=j(N,I),N),Q)}e.reduce=m;function p(K,j){let B,Q={onWillAddFirstListener(){B=K(N.fire,N)},onDidRemoveLastListener(){B?.dispose()}},N=new _e(Q);return j?.add(N),N.event}function b(K,j){return j instanceof Array?j.push(K):j&&j.add(K),K}function y(K,j,B=100,Q=!1,N=!1,I,X){let ve,Se,R,V=0,se,he={leakWarningThreshold:I,onWillAddFirstListener(){ve=K(me=>{V++,Se=j(Se,me),Q&&!R&&(ye.fire(Se),Se=void 0),se=()=>{let fe=Se;Se=void 0,R=void 0,(!Q||V>1)&&ye.fire(fe),V=0},typeof B=="number"?(clearTimeout(R),R=setTimeout(se,B)):R===void 0&&(R=0,queueMicrotask(se))})},onWillRemoveListener(){N&&V>0&&se?.()},onDidRemoveLastListener(){se=void 0,ve.dispose()}},ye=new _e(he);return X?.add(ye),ye.event}e.debounce=y;function w(K,j=0,B){return e.debounce(K,(Q,N)=>Q?(Q.push(N),Q):[N],j,void 0,!0,void 0,B)}e.accumulate=w;function x(K,j=(Q,N)=>Q===N,B){let Q=!0,N;return c(K,I=>{let X=Q||!j(I,N);return Q=!1,N=I,X},B)}e.latch=x;function E(K,j,B){return[e.filter(K,j,B),e.filter(K,Q=>!j(Q),B)]}e.split=E;function T(K,j=!1,B=[],Q){let N=B.slice(),I=K(Se=>{N?N.push(Se):ve.fire(Se)});Q&&Q.add(I);let X=()=>{N?.forEach(Se=>ve.fire(Se)),N=null},ve=new _e({onWillAddFirstListener(){I||(I=K(Se=>ve.fire(Se)),Q&&Q.add(I))},onDidAddFirstListener(){N&&(j?setTimeout(X):X())},onDidRemoveLastListener(){I&&I.dispose(),I=null}});return Q&&Q.add(ve),ve.event}e.buffer=T;function O(K,j){return(B,Q,N)=>{let I=j(new Y);return K(function(X){let ve=I.evaluate(X);ve!==D&&B.call(Q,ve)},void 0,N)}}e.chain=O;let D=Symbol("HaltChainable");class Y{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(B=>(j(B),B)),this}filter(j){return this.steps.push(B=>j(B)?B:D),this}reduce(j,B){let Q=B;return this.steps.push(N=>(Q=j(Q,N),Q)),this}latch(j=(B,Q)=>B===Q){let B=!0,Q;return this.steps.push(N=>{let I=B||!j(N,Q);return B=!1,Q=N,I?N:D}),this}evaluate(j){for(let B of this.steps)if(j=B(j),j===D)break;return j}}function F(K,j,B=Q=>Q){let Q=(...ve)=>X.fire(B(...ve)),N=()=>K.on(j,Q),I=()=>K.removeListener(j,Q),X=new _e({onWillAddFirstListener:N,onDidRemoveLastListener:I});return X.event}e.fromNodeEventEmitter=F;function G(K,j,B=Q=>Q){let Q=(...ve)=>X.fire(B(...ve)),N=()=>K.addEventListener(j,Q),I=()=>K.removeEventListener(j,Q),X=new _e({onWillAddFirstListener:N,onDidRemoveLastListener:I});return X.event}e.fromDOMEventEmitter=G;function re(K){return new Promise(j=>n(K)(j))}e.toPromise=re;function ee(K){let j=new _e;return K.then(B=>{j.fire(B)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=ee;function J(K,j){return K(B=>j.fire(B))}e.forward=J;function oe(K,j,B){return j(B),K(Q=>j(Q))}e.runAndSubscribe=oe;class de{constructor(j,B){this._observable=j,this._counter=0,this._hasChanged=!1;let Q={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new _e(Q),B&&B.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,B){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function A(K,j){return new de(K,j).emitter.event}e.fromObservable=A;function P(K){return(j,B,Q)=>{let N=0,I=!1,X={beginUpdate(){N++},endUpdate(){N--,N===0&&(K.reportChanges(),I&&(I=!1,j.call(B)))},handlePossibleChange(){},handleChange(){I=!0}};K.addObserver(X),K.reportChanges();let ve={dispose(){K.removeObserver(X)}};return Q instanceof rr?Q.add(ve):Array.isArray(Q)&&Q.push(ve),ve}}e.fromObservableLight=P})(wi||={});var dp=class fp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${fp._idPool++}`,fp.all.add(this)}start(t){this._stopWatch=new kT,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}}};dp.all=new Set,dp._idPool=0;var DT=dp,RT=-1,Q0=class J0{constructor(t,n,a=(J0._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,h]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${h}):`;console.warn(f),console.warn(c);let m=new AT(f,c);this._errorHandler(m)}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}};Q0._idPool=1;var MT=Q0,NT=class ew{constructor(t){this.value=t}static create(){let t=new Error;return new ew(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
|
-
`).slice(2).join(`
|
|
23
|
-
`))}},AT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},LT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},BT=0,vf=class{constructor(e){this.value=e,this.id=BT++}},OT=2,zT,_e=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new MT(e?.onListenerError??ru,this._options?.leakWarningThreshold??RT):void 0,this._perfMon=this._options?._profName?new DT(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 h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new LT(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||ru)(m),We.None}if(this._disposed)return We.None;t&&(e=e.bind(t));let a=new vf(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=NT.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof vf?(this._deliveryQueue??=new jT,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=wt(()=>{o?.(),this._removeListener(a)});return n instanceof rr?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*OT<=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||ru;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 vf)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}},jT=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}},pp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _e,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _e,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}};pp.INSTANCE=new pp;var Om=pp;function HT(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Om.INSTANCE.onDidChangeZoomLevel;function UT(e){return Om.INSTANCE.getZoomFactor(e)}Om.INSTANCE.onDidChangeFullscreen;var qa=typeof navigator=="object"?navigator.userAgent:"",mp=qa.indexOf("Firefox")>=0,PT=qa.indexOf("AppleWebKit")>=0,zm=qa.indexOf("Chrome")>=0,KT=!zm&&qa.indexOf("Safari")>=0;qa.indexOf("Electron/")>=0;qa.indexOf("Android")>=0;var gf=!1;if(typeof yn.matchMedia=="function"){let e=yn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=yn.matchMedia("(display-mode: fullscreen)");gf=e.matches,HT(yn,e,({matches:n})=>{gf&&t.matches||(gf=n)})}var Na="en",_p=!1,vp=!1,au=!1,tw=!1,Vc,lu=Na,gb=Na,IT,vn,jr=globalThis,cs;typeof jr.vscode<"u"&&typeof jr.vscode.process<"u"?cs=jr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(cs=process);var FT=typeof cs?.versions?.electron=="string",qT=FT&&cs?.type==="renderer";if(typeof cs=="object"){_p=cs.platform==="win32",vp=cs.platform==="darwin",au=cs.platform==="linux",au&&cs.env.SNAP&&cs.env.SNAP_REVISION,cs.env.CI||cs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Vc=Na,lu=Na;let e=cs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Vc=t.userLocale,gb=t.osLocale,lu=t.resolvedLanguage||Na,IT=t.languagePack?.translationsConfigFile}catch{}tw=!0}else typeof navigator=="object"&&!qT?(vn=navigator.userAgent,_p=vn.indexOf("Windows")>=0,vp=vn.indexOf("Macintosh")>=0,(vn.indexOf("Macintosh")>=0||vn.indexOf("iPad")>=0||vn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,au=vn.indexOf("Linux")>=0,vn?.indexOf("Mobi")>=0,lu=globalThis._VSCODE_NLS_LANGUAGE||Na,Vc=navigator.language.toLowerCase(),gb=Vc):console.error("Unable to resolve platform.");var iw=_p,Ys=vp,WT=au,yb=tw,Vs=vn,Gn=lu,$T;(e=>{function t(){return Gn}e.value=t;function n(){return Gn.length===2?Gn==="en":Gn.length>=3?Gn[0]==="e"&&Gn[1]==="n"&&Gn[2]==="-":!1}e.isDefaultVariant=n;function a(){return Gn==="en"}e.isDefault=a})($T||={});var YT=typeof jr.postMessage=="function"&&!jr.importScripts;(()=>{if(YT){let e=[];jr.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}),jr.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})();var VT=!!(Vs&&Vs.indexOf("Chrome")>=0);Vs&&Vs.indexOf("Firefox")>=0;!VT&&Vs&&Vs.indexOf("Safari")>=0;Vs&&Vs.indexOf("Edg/")>=0;Vs&&Vs.indexOf("Android")>=0;var ka=typeof navigator=="object"?navigator:{};yb||document.queryCommandSupported&&document.queryCommandSupported("copy")||ka&&ka.clipboard&&ka.clipboard.writeText,yb||ka&&ka.clipboard&&ka.clipboard.readText;var jm=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}},yf=new jm,bb=new jm,Sb=new jm,XT=new Array(230),sw;(e=>{function t(f){return yf.keyCodeToStr(f)}e.toString=t;function n(f){return yf.strToKeyCode(f)}e.fromString=n;function a(f){return bb.keyCodeToStr(f)}e.toUserSettingsUS=a;function o(f){return Sb.keyCodeToStr(f)}e.toUserSettingsGeneral=o;function c(f){return bb.strToKeyCode(f)||Sb.strToKeyCode(f)}e.fromUserSettings=c;function h(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return yf.keyCodeToStr(f)}e.toElectronAccelerator=h})(sw||={});var GT=class nw{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 nw&&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 ZT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},ZT=class{constructor(e){if(e.length===0)throw wT("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 QT(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return sw.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(mp)switch(t){case 59:return 85;case 60:if(WT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ys)return 57;break}else if(PT&&(Ys&&t===93||!Ys&&t===92))return 57;return XT[t]||0}var JT=Ys?256:2048,ek=512,tk=1024,ik=Ys?2048:256,wb=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=QT(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|=JT),this.altKey&&(t|=ek),this.shiftKey&&(t|=tk),this.metaKey&&(t|=ik),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new GT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Cb=new WeakMap;function sk(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 nk=class{static getSameOriginWindowChain(e){let t=Cb.get(e);if(!t){t=[],Cb.set(e,t);let n=e,a;do a=sk(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 h=c.window.deref();if(n+=h?.scrollY??0,a+=h?.scrollX??0,h===t||!c.iframeElement)break;let f=c.iframeElement.getBoundingClientRect();n+=f.top,a+=f.left}return{top:n,left:a}}},Xc=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=nk.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},xb=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(zm){let o=navigator.userAgent.match(/Chrome\/(\d+)/);a=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,h=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")a?this.deltaY=o.wheelDeltaY/(120*h):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 f=e;f.deltaMode===f.DOM_DELTA_LINE?mp&&!Ys?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")KT&&iw?this.deltaX=-(o.wheelDeltaX/120):a?this.deltaX=o.wheelDeltaX/(120*h):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 f=e;f.deltaMode===f.DOM_DELTA_LINE?mp&&!Ys?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*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},rw=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),rk;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof ak?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:wi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:rw})})(rk||={});var ak=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?rw:(this._emitter||(this._emitter=new _e),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Hm=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 cp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new cp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},lk=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 cp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=n.setInterval(()=>{e()},t);this.disposable=wt(()=>{n.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},ok;(e=>{async function t(a){let o,c=await Promise.all(a.map(h=>h.then(f=>f,f=>{o||(o=f)})));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(h){c(h)}})}e.withAsyncBody=n})(ok||={});var Eb=class Ss{static fromArray(t){return new Ss(n=>{n.emitMany(t)})}static fromPromise(t){return new Ss(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ss(async n=>{await Promise.all(t.map(async a=>n.emitOne(await a)))})}static merge(t){return new Ss(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 _e,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 wi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ss(async a=>{for await(let o of t)a.emitOne(n(o))})}map(t){return Ss.map(this,t)}static filter(t,n){return new Ss(async a=>{for await(let o of t)n(o)&&a.emitOne(o)})}filter(t){return Ss.filter(this,t)}static coalesce(t){return Ss.filter(t,n=>!!n)}coalesce(){return Ss.coalesce(this)}static async toPromise(t){let n=[];for await(let a of t)n.push(a);return n}toPromise(){return Ss.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())}};Eb.EMPTY=Eb.fromArray([]);var{getWindow:$s,getWindowId:ck,onDidRegisterWindow:uk}=(function(){let e=new Map,t={window:yn,disposables:new rr};e.set(yn.vscodeWindowId,t);let n=new _e,a=new _e,o=new _e;function c(h,f){return(typeof h=="number"?e.get(h):void 0)??(f?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:a.event,registerWindow(h){if(e.has(h.vscodeWindowId))return We.None;let f=new rr,m={window:h,disposables:f.add(new rr)};return e.set(h.vscodeWindowId,m),f.add(wt(()=>{e.delete(h.vscodeWindowId),a.fire(h)})),f.add(ze(h,li.BEFORE_UNLOAD,()=>{o.fire(h)})),n.fire(m),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:c,getWindow(h){let f=h;if(f?.ownerDocument?.defaultView)return f.ownerDocument.defaultView.window;let m=h;return m?.view?m.view.window:yn},getDocument(h){return $s(h).document}}})(),hk=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 ze(e,t,n,a){return new hk(e,t,n,a)}var Tb=function(e,t,n,a){return ze(e,t,n,a)},Um,dk=class extends lk{constructor(e){super(),this.defaultTarget=e&&$s(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},kb=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){ru(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 h=e.get(c)??[];for(t.set(c,h),e.set(c,[]),a.set(c,!0);h.length>0;)h.sort(kb.sort),h.shift().execute();a.set(c,!1)};Um=(c,h,f=0)=>{let m=ck(c),p=new kb(h,f),b=e.get(m);return b||(b=[],e.set(m,b)),b.push(p),n.get(m)||(n.set(m,!0),c.requestAnimationFrame(()=>o(m))),p}})();function fk(e){let t=e.getBoundingClientRect(),n=$s(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var li={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"},pk=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=Gi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Gi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Gi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Gi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Gi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Gi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Gi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Gi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Gi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Gi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Gi(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=Gi(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=Gi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Gi(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 Gi(e){return typeof e=="number"?`${e}px`:e}function lo(e){return new pk(e)}var aw=class{constructor(){this._hooks=new rr,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(wt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=$s(e)}this._hooks.add(ze(c,li.POINTER_MOVE,h=>{if(h.buttons!==n){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(ze(c,li.POINTER_UP,h=>this.stopMonitoring(!0)))}};function mk(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(...h){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,h)}),this[c]}}var Ws;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ws||={});var Xl=class Ni extends We{constructor(){super(),this.dispatched=!1,this.targets=new vb,this.ignoreTargets=new vb,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(wi.runAndSubscribe(uk,({window:t,disposables:n})=>{n.add(ze(t.document,"touchstart",a=>this.onTouchStart(a),{passive:!1})),n.add(ze(t.document,"touchend",a=>this.onTouchEnd(t,a))),n.add(ze(t.document,"touchmove",a=>this.onTouchMove(a),{passive:!1}))},{window:yn,disposables:this._store}))}static addTarget(t){if(!Ni.isTouchDevice())return We.None;Ni.INSTANCE||(Ni.INSTANCE=new Ni);let n=Ni.INSTANCE.targets.push(t);return wt(n)}static ignoreTarget(t){if(!Ni.isTouchDevice())return We.None;Ni.INSTANCE||(Ni.INSTANCE=new Ni);let n=Ni.INSTANCE.ignoreTargets.push(t);return wt(n)}static isTouchDevice(){return"ontouchstart"in yn||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 h=this.newGestureEvent(Ws.Start,c.target);h.pageX=c.pageX,h.pageY=c.pageY,this.dispatchEvent(h)}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,h=n.changedTouches.length;c<h;c++){let f=n.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let m=this.activeTouches[f.identifier],p=Date.now()-m.initialTimeStamp;if(p<Ni.HOLD_DELAY&&Math.abs(m.initialPageX-ls(m.rollingPageX))<30&&Math.abs(m.initialPageY-ls(m.rollingPageY))<30){let b=this.newGestureEvent(Ws.Tap,m.initialTarget);b.pageX=ls(m.rollingPageX),b.pageY=ls(m.rollingPageY),this.dispatchEvent(b)}else if(p>=Ni.HOLD_DELAY&&Math.abs(m.initialPageX-ls(m.rollingPageX))<30&&Math.abs(m.initialPageY-ls(m.rollingPageY))<30){let b=this.newGestureEvent(Ws.Contextmenu,m.initialTarget);b.pageX=ls(m.rollingPageX),b.pageY=ls(m.rollingPageY),this.dispatchEvent(b)}else if(o===1){let b=ls(m.rollingPageX),y=ls(m.rollingPageY),w=ls(m.rollingTimestamps)-m.rollingTimestamps[0],x=b-m.rollingPageX[0],E=y-m.rollingPageY[0],T=[...this.targets].filter(O=>m.initialTarget instanceof Node&&O.contains(m.initialTarget));this.inertia(t,T,a,Math.abs(x)/w,x>0?1:-1,b,Math.abs(E)/w,E>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(Ws.End,m.initialTarget)),delete this.activeTouches[f.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===Ws.Tap){let n=new Date().getTime(),a=0;n-this._lastSetTapCountTime>Ni.CLEAR_TAP_COUNT_TIME?a=1:a=2,this._lastSetTapCountTime=n,t.tapCount=a}else(t.type===Ws.Change||t.type===Ws.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,h,f,m,p){this.handle=Um(t,()=>{let b=Date.now(),y=b-a,w=0,x=0,E=!0;o+=Ni.SCROLL_FRICTION*y,f+=Ni.SCROLL_FRICTION*y,o>0&&(E=!1,w=c*o*y),f>0&&(E=!1,x=m*f*y);let T=this.newGestureEvent(Ws.Change);T.translationX=w,T.translationY=x,n.forEach(O=>O.dispatchEvent(T)),E||this.inertia(t,n,b,o,c,h+w,f,m,p+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 h=this.activeTouches[c.identifier],f=this.newGestureEvent(Ws.Change,h.initialTarget);f.translationX=c.pageX-ls(h.rollingPageX),f.translationY=c.pageY-ls(h.rollingPageY),f.pageX=c.pageX,f.pageY=c.pageY,this.dispatchEvent(f),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(c.pageX),h.rollingPageY.push(c.pageY),h.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Xl.SCROLL_FRICTION=-.005,Xl.HOLD_DELAY=700,Xl.CLEAR_TAP_COUNT_TIME=400,zt([mk],Xl,"isTouchDevice",1);var _k=Xl,Pm=class extends We{onclick(e,t){this._register(ze(e,li.CLICK,n=>t(new Xc($s(e),n))))}onmousedown(e,t){this._register(ze(e,li.MOUSE_DOWN,n=>t(new Xc($s(e),n))))}onmouseover(e,t){this._register(ze(e,li.MOUSE_OVER,n=>t(new Xc($s(e),n))))}onmouseleave(e,t){this._register(ze(e,li.MOUSE_LEAVE,n=>t(new Xc($s(e),n))))}onkeydown(e,t){this._register(ze(e,li.KEY_DOWN,n=>t(new wb(n))))}onkeyup(e,t){this._register(ze(e,li.KEY_UP,n=>t(new wb(n))))}oninput(e,t){this._register(ze(e,li.INPUT,t))}onblur(e,t){this._register(ze(e,li.BLUR,t))}onfocus(e,t){this._register(ze(e,li.FOCUS,t))}onchange(e,t){this._register(ze(e,li.CHANGE,t))}ignoreGesture(e){return _k.ignoreTarget(e)}},Db=11,vk=class extends Pm{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=Db+"px",this.domNode.style.height=Db+"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 aw),this._register(Tb(this.bgDomNode,li.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Tb(this.domNode,li.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new dk),this._pointerdownScheduleRepeatTimer=this._register(new Hm)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,$s(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()}},gk=class gp{constructor(t,n,a,o,c,h,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,a=a|0,o=o|0,c=c|0,h=h|0,f=f|0),this.rawScrollLeft=o,this.rawScrollTop=f,n<0&&(n=0),o+n>a&&(o=a-n),o<0&&(o=0),c<0&&(c=0),f+c>h&&(f=h-c),f<0&&(f=0),this.width=n,this.scrollWidth=a,this.scrollLeft=o,this.height=c,this.scrollHeight=h,this.scrollTop=f}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 gp(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 gp(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,h=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,m=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:h,scrollHeightChanged:f,scrollTopChanged:m}}},yk=class extends We{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new gk(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 Mb(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=Mb.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)))}},Rb=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function bf(e,t){let n=t-e;return function(a){return e+n*wk(a)}}function bk(e,t,n){return function(a){return a<n?e(a/n):t((a-n)/(1-n))}}var Mb=class yp{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),bk(bf(t,o),bf(c,n),.33)}return bf(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 Rb(a,o,!1)}return new Rb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,a){return yp.start(t,n,a)}static start(t,n,a){a=a+10;let o=Date.now()-10;return new yp(t,n,o,a)}};function Sk(e){return Math.pow(e,3)}function wk(e){return 1-Sk(1-e)}var Ck=class extends We{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 Hm)}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":"")))}},xk=140,lw=class extends Pm{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 Ck(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new aw),this._shouldRender=!0,this.domNode=lo(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(ze(this.domNode.domNode,li.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new vk(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,a){this.slider=lo(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(ze(this.slider.domNode,li.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=fk(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),h=Math.abs(c-n);if(iw&&h>xk){this._setDesiredScrollPositionNow(a.getScrollPosition());return}let f=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(a.getDesiredScrollPositionFromDelta(f))},()=>{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()}},ow=class bp{constructor(t,n,a,o,c,h){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(a),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=c,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new bp(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 h=Math.max(0,a-t),f=Math.max(0,h-2*n),m=o>0&&o>a;if(!m)return{computedAvailableSize:Math.round(h),computedIsNeeded:m,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(a*f/o))),b=(f-p)/(o-a),y=c*b;return{computedAvailableSize:Math.round(h),computedIsNeeded:m,computedSliderSize:Math.round(p),computedSliderRatio:b,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=bp._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)}},Ek=class extends lw{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new ow(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}},Tk=class extends lw{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new ow(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}},kk=500,Nb=50,Dk=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Sp=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(zm){let n=$s(t.browserEvent),a=UT(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 Dk(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),h=Math.abs(n.deltaX),f=Math.abs(n.deltaY),m=Math.max(Math.min(o,h),1),p=Math.max(Math.min(c,f),1),b=Math.max(o,h),y=Math.max(c,f);b%m===0&&y%p===0&&(a-=.5)}return Math.min(Math.max(a,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Sp.INSTANCE=new Sp;var Rk=Sp,Mk=class extends Pm{constructor(e,t,n){super(),this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new _e),this.onWillScroll=this._onWillScroll.event,this._options=Ak(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 Tk(this._scrollable,this._options,a)),this._horizontalScrollbar=this._register(new Ek(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=lo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=lo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=lo(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 Hm),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Pr(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,Ys&&(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 xb(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Pr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new xb(n))};this._mouseWheelToDispose.push(ze(this._listenOnDomNode,li.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Rk.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 h=!Ys&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),m={};if(o){let p=Nb*o,b=f.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(m,b)}if(c){let p=Nb*c,b=f.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(m,b)}m=this._scrollable.validateScrollPosition(m),(f.scrollLeft!==m.scrollLeft||f.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),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(),kk)}},Nk=class extends Mk{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 Ak(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,Ys&&(t.className+=" mac"),t}var wp=class extends We{constructor(e,t,n,a,o,c,h,f){super(),this._bufferService=n,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new yk({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>Um(a.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Nk(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(wi.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(wt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=a.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(wt(()=>this._styleElement.remove())),this._register(wi.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(`
|
|
24
|
-
`)})),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(p=>this._handleScroll(p)))}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}};wp=zt([be(2,Hi),be(3,wn),be(4,I0),be(5,Fa),be(6,Ui),be(7,Cn)],wp);var Cp=class extends We{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(wt(()=>{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()}};Cp=zt([be(1,Hi),be(2,wn),be(3,Mo),be(4,Cn)],Cp);var Lk=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)}},Fs={full:0,left:0,center:0,right:0},Zn={full:0,left:0,center:0,right:0},Hl={full:0,left:0,center:0,right:0},xu=class extends We{constructor(e,t,n,a,o,c,h,f){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=a,this._renderService=o,this._optionsService=c,this._themeService=h,this._coreBrowserService=f,this._colorZoneStore=new Lk,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(wt(()=>this._canvas?.remove()));let m=this._canvas.getContext("2d");if(m)this._ctx=m;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);Zn.full=this._canvas.width,Zn.left=e,Zn.center=t,Zn.right=e,this._refreshDrawHeightConstants(),Hl.full=1,Hl.left=1,Hl.center=1+Zn.left,Hl.right=1+Zn.left+Zn.center}_refreshDrawHeightConstants(){Fs.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);Fs.left=t,Fs.center=t,Fs.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fs.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fs.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fs.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Fs.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(Hl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Fs[e.position||"full"]/2),Zn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Fs[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}))}};xu=zt([be(2,Hi),be(3,Mo),be(4,Cn),be(5,Ui),be(6,Fa),be(7,wn)],xu);var ue;(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=`
|
|
25
|
-
`,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=""))(ue||={});var ou;(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=""))(ou||={});var cw;(e=>e.ST=`${ue.ESC}\\`)(cw||={});var xp=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(`${ue.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)}}};xp=zt([be(2,Hi),be(3,Ui),be(4,Ir),be(5,Cn)],xp);var ci=0,ui=0,hi=0,Ot=0,Ab={css:"#00000000",rgba:0},Xt;(e=>{function t(o,c,h,f){return f!==void 0?`#${Nr(o)}${Nr(c)}${Nr(h)}${Nr(f)}`:`#${Nr(o)}${Nr(c)}${Nr(h)}`}e.toCss=t;function n(o,c,h,f=255){return(o<<24|c<<16|h<<8|f)>>>0}e.toRgba=n;function a(o,c,h,f){return{css:e.toCss(o,c,h,f),rgba:e.toRgba(o,c,h,f)}}e.toColor=a})(Xt||={});var yt;(e=>{function t(m,p){if(Ot=(p.rgba&255)/255,Ot===1)return{css:p.css,rgba:p.rgba};let b=p.rgba>>24&255,y=p.rgba>>16&255,w=p.rgba>>8&255,x=m.rgba>>24&255,E=m.rgba>>16&255,T=m.rgba>>8&255;ci=x+Math.round((b-x)*Ot),ui=E+Math.round((y-E)*Ot),hi=T+Math.round((w-T)*Ot);let O=Xt.toCss(ci,ui,hi),D=Xt.toRgba(ci,ui,hi);return{css:O,rgba:D}}e.blend=t;function n(m){return(m.rgba&255)===255}e.isOpaque=n;function a(m,p,b){let y=cu.ensureContrastRatio(m.rgba,p.rgba,b);if(y)return Xt.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=a;function o(m){let p=(m.rgba|255)>>>0;return[ci,ui,hi]=cu.toChannels(p),{css:Xt.toCss(ci,ui,hi),rgba:p}}e.opaque=o;function c(m,p){return Ot=Math.round(p*255),[ci,ui,hi]=cu.toChannels(m.rgba),{css:Xt.toCss(ci,ui,hi,Ot),rgba:Xt.toRgba(ci,ui,hi,Ot)}}e.opacity=c;function h(m,p){return Ot=m.rgba&255,c(m,Ot*p/255)}e.multiplyOpacity=h;function f(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=f})(yt||={});var Dt;(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 ci=parseInt(o.slice(1,2).repeat(2),16),ui=parseInt(o.slice(2,3).repeat(2),16),hi=parseInt(o.slice(3,4).repeat(2),16),Xt.toColor(ci,ui,hi);case 5:return ci=parseInt(o.slice(1,2).repeat(2),16),ui=parseInt(o.slice(2,3).repeat(2),16),hi=parseInt(o.slice(3,4).repeat(2),16),Ot=parseInt(o.slice(4,5).repeat(2),16),Xt.toColor(ci,ui,hi,Ot);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 ci=parseInt(c[1]),ui=parseInt(c[2]),hi=parseInt(c[3]),Ot=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Xt.toColor(ci,ui,hi,Ot);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),[ci,ui,hi,Ot]=t.getImageData(0,0,1,1).data,Ot!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Xt.toRgba(ci,ui,hi,Ot),css:o}}e.toColor=a})(Dt||={});var ji;(e=>{function t(a){return n(a>>16&255,a>>8&255,a&255)}e.relativeLuminance=t;function n(a,o,c){let h=a/255,f=o/255,m=c/255,p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),y=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return p*.2126+b*.7152+y*.0722}e.relativeLuminance2=n})(ji||={});var cu;(e=>{function t(h,f){if(Ot=(f&255)/255,Ot===1)return f;let m=f>>24&255,p=f>>16&255,b=f>>8&255,y=h>>24&255,w=h>>16&255,x=h>>8&255;return ci=y+Math.round((m-y)*Ot),ui=w+Math.round((p-w)*Ot),hi=x+Math.round((b-x)*Ot),Xt.toRgba(ci,ui,hi)}e.blend=t;function n(h,f,m){let p=ji.relativeLuminance(h>>8),b=ji.relativeLuminance(f>>8);if(mn(p,b)<m){if(b<p){let x=a(h,f,m),E=mn(p,ji.relativeLuminance(x>>8));if(E<m){let T=o(h,f,m),O=mn(p,ji.relativeLuminance(T>>8));return E>O?x:T}return x}let y=o(h,f,m),w=mn(p,ji.relativeLuminance(y>>8));if(w<m){let x=a(h,f,m),E=mn(p,ji.relativeLuminance(x>>8));return w>E?y:x}return y}}e.ensureContrastRatio=n;function a(h,f,m){let p=h>>24&255,b=h>>16&255,y=h>>8&255,w=f>>24&255,x=f>>16&255,E=f>>8&255,T=mn(ji.relativeLuminance2(w,x,E),ji.relativeLuminance2(p,b,y));for(;T<m&&(w>0||x>0||E>0);)w-=Math.max(0,Math.ceil(w*.1)),x-=Math.max(0,Math.ceil(x*.1)),E-=Math.max(0,Math.ceil(E*.1)),T=mn(ji.relativeLuminance2(w,x,E),ji.relativeLuminance2(p,b,y));return(w<<24|x<<16|E<<8|255)>>>0}e.reduceLuminance=a;function o(h,f,m){let p=h>>24&255,b=h>>16&255,y=h>>8&255,w=f>>24&255,x=f>>16&255,E=f>>8&255,T=mn(ji.relativeLuminance2(w,x,E),ji.relativeLuminance2(p,b,y));for(;T<m&&(w<255||x<255||E<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),E=Math.min(255,E+Math.ceil((255-E)*.1)),T=mn(ji.relativeLuminance2(w,x,E),ji.relativeLuminance2(p,b,y));return(w<<24|x<<16|E<<8|255)>>>0}e.increaseLuminance=o;function c(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=c})(cu||={});function Nr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function mn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Bk=class extends Ro{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()]}},Eu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Es}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,h=0,f=t.getFg(0),m=t.getBg(0);for(let p=0;p<t.getTrimmedLength();p++)if(t.loadCell(p,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==m){if(p-o>1){let b=this._getJoinedRanges(a,h,c,t,o);for(let y=0;y<b.length;y++)n.push(b[y])}o=p,h=c,f=this._workCell.fg,m=this._workCell.bg}c+=this._workCell.getChars().length||sr.length}if(this._bufferService.cols-o>1){let p=this._getJoinedRanges(a,h,c,t,o);for(let b=0;b<p.length;b++)n.push(p[b])}return n}_getJoinedRanges(e,t,n,a,o){let c=e.substring(t,n),h=[];try{h=this._characterJoiners[0].handler(c)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let m=this._characterJoiners[f].handler(c);for(let p=0;p<m.length;p++)Eu._mergeRanges(h,m[p])}catch(m){console.error(m)}return this._stringRangesToCellRanges(h,a,o),h}_stringRangesToCellRanges(e,t,n){let a=0,o=!1,c=0,h=e[a];if(h){for(let f=n;f<this._bufferService.cols;f++){let m=t.getWidth(f),p=t.getString(f).length||sr.length;if(m!==0){if(!o&&h[0]<=c&&(h[0]=f,o=!0),h[1]<=c){if(h[1]=f,h=e[++a],!h)break;h[0]<=c?(h[0]=f,o=!0):o=!1}c+=p}}h&&(h[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}};Eu=zt([be(0,Hi)],Eu);function Ok(e){return 57508<=e&&e<=57558}function zk(e){return 9472<=e&&e<=9631}function jk(e){return Ok(e)||zk(e)}function Hk(){return{css:{canvas:Gc(),cell:Gc()},device:{canvas:Gc(),cell:Gc(),char:{width:0,height:0,left:0,top:0}}}}function Gc(){return{width:0,height:0}}var Ep=class{constructor(e,t,n,a,o,c,h){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=a,this._coreService=o,this._decorationService=c,this._themeService=h,this._workCell=new Es,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,h,f,m,p,b){let y=[],w=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,E=e.getNoBgTrimmedLength();n&&E<c+1&&(E=c+1);let T,O=0,D="",Y=0,F=0,G=0,re=0,ee=!1,J=0,oe=!1,de=0,A=0,P=[],K=p!==-1&&b!==-1;for(let j=0;j<E;j++){e.loadCell(j,this._workCell);let B=this._workCell.getWidth();if(B===0)continue;let Q=!1,N=j>=A,I=j,X=this._workCell;if(w.length>0&&j===w[0][0]&&N){let we=w.shift(),ne=this._isCellInSelection(we[0],t);for(Y=we[0]+1;Y<we[1];Y++)N&&=ne===this._isCellInSelection(Y,t);N&&=!n||c<we[0]||c>=we[1],N?(Q=!0,X=new Bk(this._workCell,e.translateToString(!0,we[0],we[1]),we[1]-we[0]),I=we[1]-1,B=X.getWidth()):A=we[1]}let ve=this._isCellInSelection(j,t),Se=n&&j===c,R=K&&j>=p&&j<=b,V=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,we=>{V=!0});let se=X.getChars()||sr;if(se===" "&&(X.isUnderline()||X.isOverline())&&(se=" "),de=B*f-m.get(se,X.isBold(),X.isItalic()),!T)T=this._document.createElement("span");else if(O&&(ve&&oe||!ve&&!oe&&X.bg===F)&&(ve&&oe&&x.selectionForeground||X.fg===G)&&X.extended.ext===re&&R===ee&&de===J&&!Se&&!Q&&!V&&N){X.isInvisible()?D+=sr:D+=se,O++;continue}else O&&(T.textContent=D),T=this._document.createElement("span"),O=0,D="";if(F=X.bg,G=X.fg,re=X.extended.ext,ee=R,J=de,oe=ve,Q&&c>=j&&c<=I&&(c=j),!this._coreService.isCursorHidden&&Se&&this._coreService.isCursorInitialized){if(P.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&P.push("xterm-cursor-blink"),P.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":P.push("xterm-cursor-outline");break;case"block":P.push("xterm-cursor-block");break;case"bar":P.push("xterm-cursor-bar");break;case"underline":P.push("xterm-cursor-underline");break}}if(X.isBold()&&P.push("xterm-bold"),X.isItalic()&&P.push("xterm-italic"),X.isDim()&&P.push("xterm-dim"),X.isInvisible()?D=sr:D=X.getChars()||sr,X.isUnderline()&&(P.push(`xterm-underline-${X.extended.underlineStyle}`),D===" "&&(D=" "),!X.isUnderlineColorDefault()))if(X.isUnderlineColorRGB())T.style.textDecorationColor=`rgb(${Ro.toColorRGB(X.getUnderlineColor()).join(",")})`;else{let we=X.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&X.isBold()&&we<8&&(we+=8),T.style.textDecorationColor=x.ansi[we].css}X.isOverline()&&(P.push("xterm-overline"),D===" "&&(D=" ")),X.isStrikethrough()&&P.push("xterm-strikethrough"),R&&(T.style.textDecoration="underline");let he=X.getFgColor(),ye=X.getFgColorMode(),me=X.getBgColor(),fe=X.getBgColorMode(),Me=!!X.isInverse();if(Me){let we=he;he=me,me=we;let ne=ye;ye=fe,fe=ne}let Re,Ne,Fe=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,we=>{we.options.layer!=="top"&&Fe||(we.backgroundColorRGB&&(fe=50331648,me=we.backgroundColorRGB.rgba>>8&16777215,Re=we.backgroundColorRGB),we.foregroundColorRGB&&(ye=50331648,he=we.foregroundColorRGB.rgba>>8&16777215,Ne=we.foregroundColorRGB),Fe=we.options.layer==="top")}),!Fe&&ve&&(Re=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,me=Re.rgba>>8&16777215,fe=50331648,Fe=!0,x.selectionForeground&&(ye=50331648,he=x.selectionForeground.rgba>>8&16777215,Ne=x.selectionForeground)),Fe&&P.push("xterm-decoration-top");let Oe;switch(fe){case 16777216:case 33554432:Oe=x.ansi[me],P.push(`xterm-bg-${me}`);break;case 50331648:Oe=Xt.toColor(me>>16,me>>8&255,me&255),this._addStyle(T,`background-color:#${Lb((me>>>0).toString(16),"0",6)}`);break;default:Me?(Oe=x.foreground,P.push("xterm-bg-257")):Oe=x.background}switch(Re||X.isDim()&&(Re=yt.multiplyOpacity(Oe,.5)),ye){case 16777216:case 33554432:X.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(T,Oe,x.ansi[he],X,Re,void 0)||P.push(`xterm-fg-${he}`);break;case 50331648:let we=Xt.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(T,Oe,we,X,Re,Ne)||this._addStyle(T,`color:#${Lb(he.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(T,Oe,x.foreground,X,Re,Ne)||Me&&P.push("xterm-fg-257")}P.length&&(T.className=P.join(" "),P.length=0),!Se&&!Q&&!V&&N?O++:T.textContent=D,de!==this.defaultSpacing&&(T.style.letterSpacing=`${de}px`),y.push(T),j=I}return T&&O&&(T.textContent=D),y}_applyMinimumContrast(e,t,n,a,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||jk(a.getCode()))return!1;let h=this._getContrastCache(a),f;if(!o&&!c&&(f=h.getColor(t.rgba,n.rgba)),f===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);f=yt.ensureContrastRatio(o||t,c||n,m),h.setColor((o||t).rgba,(c||n).rgba,f??null)}return f?(this._addStyle(e,`color:${f.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]}};Ep=zt([be(1,W0),be(2,Ui),be(3,wn),be(4,Ir),be(5,Mo),be(6,Fa)],Ep);function Lb(e,t,n){for(;e.length<n;)e=t+e;return e}var Uk=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 h=this._measure(e,0);return h>0&&(this._flat[a]=h),h}let o=e;t&&(o+="B"),n&&(o+="I");let c=this._holey.get(o);if(c===void 0){let h=0;t&&(h|=1),n&&(h|=2),c=this._measure(e,h),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}},Pk=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,h=n[1]-o,f=Math.max(c,0),m=Math.min(h,e.rows-1);if(f>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=m,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 Kk(){return new Pk}var Sf="xterm-dom-renderer-owner-",bs="xterm-rows",Zc="xterm-fg-",Bb="xterm-bg-",Ul="xterm-focus",Qc="xterm-selection",Ik=1,Tp=class extends We{constructor(e,t,n,a,o,c,h,f,m,p,b,y,w,x){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=a,this._viewportElement=o,this._helperContainer=c,this._linkifier2=h,this._charSizeService=m,this._optionsService=p,this._bufferService=b,this._coreService=y,this._coreBrowserService=w,this._themeService=x,this._terminalClass=Ik++,this._rowElements=[],this._selectionRenderModel=Kk(),this.onRequestRedraw=this._register(new _e).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(bs),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(Qc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Hk(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(E=>this._injectCss(E))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(Ep,document),this._element.classList.add(Sf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(E=>this._handleLinkHover(E))),this._register(this._linkifier2.onHideLinkUnderline(E=>this._handleLinkLeave(E))),this._register(wt(()=>{this._element.classList.remove(Sf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Uk(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} .${bs} 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} .${bs} { 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} .${bs} .xterm-dim { color: ${yt.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} .${bs}.${Ul} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${bs}.${Ul} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${bs}.${Ul} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${bs} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${bs} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${bs} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${bs} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${bs} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Qc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Qc} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Qc} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,h]of e.ansi.entries())t+=`${this._terminalSelector} .${Zc}${c} { color: ${h.css}; }${this._terminalSelector} .${Zc}${c}.xterm-dim { color: ${yt.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${Bb}${c} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${Zc}257 { color: ${yt.opaque(e.background).css}; }${this._terminalSelector} .${Zc}257.xterm-dim { color: ${yt.multiplyOpacity(yt.opaque(e.background),.5).css}; }${this._terminalSelector} .${Bb}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(Ul),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ul),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,h=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let m=e[0]>t[0];f.appendChild(this._createSelectionElement(c,m?t[0]:e[0],m?e[0]:t[0],h-c+1))}else{let m=a===c?e[0]:0,p=c===o?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,m,p));let b=h-c-1;if(f.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,b)),c!==h){let y=o===h?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(h,0,y))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,n,a=1){let o=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(n-t);return c+h>this.dimensions.css.canvas.width&&(h=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=`${h}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,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let p=m+n.ydisp,b=this._rowElements[m],y=n.lines.get(p);if(!b||!y)break;b.replaceChildren(...this._rowFactory.createRow(y,p,p===a,h,f,o,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Sf}${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 h=this._bufferService.rows-1;n=Math.max(Math.min(n,h),0),a=Math.max(Math.min(a,h),0),o=Math.min(o,this._bufferService.cols);let f=this._bufferService.buffer,m=f.ybase+f.y,p=Math.min(f.x,o-1),b=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=n;x<=a;++x){let E=x+f.ydisp,T=this._rowElements[x],O=f.lines.get(E);if(!T||!O)break;T.replaceChildren(...this._rowFactory.createRow(O,E,E===m,y,w,p,b,this.dimensions.css.cell.width,this._widthCache,c?x===n?e:0:-1,c?(x===a?t:o)-1:-1))}}};Tp=zt([be(7,Lm),be(8,Ku),be(9,Ui),be(10,Hi),be(11,Ir),be(12,wn),be(13,Fa)],Tp);var kp=class extends We{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new _e),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new qk(this._optionsService))}catch{this._measureStrategy=this._register(new Fk(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())}};kp=zt([be(2,Ui)],kp);var uw=class extends We{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)}},Fk=class extends uw{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}},qk=class extends uw{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}},Wk=class extends We{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 $k(this._window)),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new _e),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(wi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ze(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ze(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}},$k=class extends We{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ua),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(wt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ze(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)}},Yk=class extends We{constructor(){super(),this.linkProviders=[],this._register(wt(()=>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 Km(e,t,n){let a=n.getBoundingClientRect(),o=e.getComputedStyle(n),c=parseInt(o.getPropertyValue("padding-left")),h=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-a.left-c,t.clientY-a.top-h]}function Vk(e,t,n,a,o,c,h,f,m){if(!c)return;let p=Km(e,t,n);if(p)return p[0]=Math.ceil((p[0]+(m?h/2:0))/h),p[1]=Math.ceil(p[1]/f),p[0]=Math.min(Math.max(p[0],1),a+(m?1:0)),p[1]=Math.min(Math.max(p[1],1),o),p}var Dp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,a,o){return Vk(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=Km(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])}}};Dp=zt([be(0,Cn),be(1,Ku)],Dp);var Xk=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=[]}},hw={};rT(hw,{getSafariVersion:()=>Zk,isChromeOS:()=>mw,isFirefox:()=>dw,isIpad:()=>Qk,isIphone:()=>Jk,isLegacyEdge:()=>Gk,isLinux:()=>Im,isMac:()=>Tu,isNode:()=>Iu,isSafari:()=>fw,isWindows:()=>pw});var Iu=typeof process<"u"&&"title"in process,No=Iu?"node":navigator.userAgent,Ao=Iu?"node":navigator.platform,dw=No.includes("Firefox"),Gk=No.includes("Edge"),fw=/^((?!chrome|android).)*safari/i.test(No);function Zk(){if(!fw)return 0;let e=No.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Tu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ao),Qk=Ao==="iPad",Jk=Ao==="iPhone",pw=["Windows","Win16","Win32","WinCE"].includes(Ao),Im=Ao.indexOf("Linux")>=0,mw=/\bCrOS\b/.test(No),_w=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()}},eD=class extends _w{_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())}}},tD=class extends _w{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ku=!Iu&&"requestIdleCallback"in window?tD:eD,iD=class{constructor(){this._queue=new ku}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Rp=class extends We{constructor(e,t,n,a,o,c,h,f,m){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=a,this._coreService=o,this._coreBrowserService=f,this._renderer=this._register(new Ua),this._pausedResizeTask=new iD,this._observerDisposable=this._register(new Ua),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 _e),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new _e),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new _e),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Xk((p,b)=>this._renderRows(p,b),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new sD(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(wt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.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(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(p=>this._registerIntersectionObserver(p,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=wt(()=>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()}};Rp=zt([be(2,Ui),be(3,Ku),be(4,Ir),be(5,Mo),be(6,Hi),be(7,wn),be(8,Fa)],Rp);var sD=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 nD(e,t,n,a){let o=n.buffer.x,c=n.buffer.y;if(!n.buffer.hasScrollback)return lD(o,c,e,t,n,a)+Fu(c,t,n,a)+oD(o,c,e,t,n,a);let h;if(c===t)return h=o>e?"D":"C",_o(Math.abs(o-e),mo(h,a));h=c>t?"D":"C";let f=Math.abs(c-t),m=aD(c>t?e:o,n)+(f-1)*n.cols+1+rD(c>t?o:e);return _o(m,mo(h,a))}function rD(e,t){return e-1}function aD(e,t){return t.cols-e}function lD(e,t,n,a,o,c){return Fu(t,a,o,c).length===0?"":_o(gw(e,t,e,t-Kr(t,o),!1,o).length,mo("D",c))}function Fu(e,t,n,a){let o=e-Kr(e,n),c=t-Kr(t,n),h=Math.abs(o-c)-cD(e,t,n);return _o(h,mo(vw(e,t),a))}function oD(e,t,n,a,o,c){let h;Fu(t,a,o,c).length>0?h=a-Kr(a,o):h=t;let f=a,m=uD(e,t,n,a,o,c);return _o(gw(e,h,n,f,m==="C",o).length,mo(m,c))}function cD(e,t,n){let a=0,o=e-Kr(e,n),c=t-Kr(t,n);for(let h=0;h<Math.abs(o-c);h++){let f=vw(e,t)==="A"?-1:1;n.buffer.lines.get(o+f*h)?.isWrapped&&a++}return a}function Kr(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 uD(e,t,n,a,o,c){let h;return Fu(n,a,o,c).length>0?h=a-Kr(a,o):h=t,e<n&&h<=a||e>=n&&h<a?"C":"D"}function vw(e,t){return e>t?"A":"B"}function gw(e,t,n,a,o,c){let h=e,f=t,m="";for(;(h!==n||f!==a)&&f>=0&&f<c.buffer.lines.length;)h+=o?1:-1,o&&h>c.cols-1?(m+=c.buffer.translateBufferLineToString(f,!1,e,h),h=0,e=0,f++):!o&&h<0&&(m+=c.buffer.translateBufferLineToString(f,!1,0,e+1),h=c.cols-1,e=h,f--);return m+c.buffer.translateBufferLineToString(f,!1,e,h)}function mo(e,t){let n=t?"O":"[";return ue.ESC+n+e}function _o(e,t){e=Math.floor(e);let n="";for(let a=0;a<e;a++)n+=t;return n}var hD=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 Ob(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 wf=50,dD=15,fD=50,pD=500,mD=" ",_D=new RegExp(mD,"g"),Mp=class extends We{constructor(e,t,n,a,o,c,h,f,m){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=a,this._coreService=o,this._mouseService=c,this._optionsService=h,this._renderService=f,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Es,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new _e),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new _e),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new hD(this._bufferService),this._activeSelectionMode=0,this._register(wt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.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 h=e[1];h<=t[1];h++){let f=n.translateBufferLineToString(h,!0,o,c);a.push(f)}}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 h=n.lines.get(c),f=n.translateBufferLineToString(c,!0);h?.isWrapped?a[a.length-1]+=f:a.push(f)}if(e[1]!==t[1]){let c=n.lines.get(t[1]),h=n.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?a[a.length-1]+=h:a.push(h)}}return a.map(o=>o.replace(_D," ")).join(pw?`\r
|
|
26
|
-
`:`
|
|
27
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Im&&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=Ob(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=Km(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,-wf),wf),t/=wf,t/Math.abs(t)+Math.round(t*(dD-1)))}shouldForceSelection(e){return Tu?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(),fD)}_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&&!(Tu&&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<pD&&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=nD(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 h=o.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(c,e[0]),m=f,p=e[0]-f,b=0,y=0,w=0,x=0;if(h.charAt(f)===" "){for(;f>0&&h.charAt(f-1)===" ";)f--;for(;m<h.length&&h.charAt(m+1)===" ";)m++}else{let O=e[0],D=e[0];c.getWidth(O)===0&&(b++,O--),c.getWidth(D)===2&&(y++,D++);let Y=c.getString(D).length;for(Y>1&&(x+=Y-1,m+=Y-1);O>0&&f>0&&!this._isCharWordSeparator(c.loadCell(O-1,this._workCell));){c.loadCell(O-1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===0?(b++,O--):F>1&&(w+=F-1,f-=F-1),f--,O--}for(;D<c.length&&m+1<h.length&&!this._isCharWordSeparator(c.loadCell(D+1,this._workCell));){c.loadCell(D+1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,D++):F>1&&(x+=F-1,m+=F-1),m++,D++}}m++;let E=f+p-b+w,T=Math.min(this._bufferService.cols,m-f+b+y-w-x);if(!(!t&&h.slice(f,m).trim()==="")){if(n&&E===0&&c.getCodePoint(0)!==32){let O=o.lines.get(e[1]-1);if(O&&c.isWrapped&&O.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let Y=this._bufferService.cols-D.start;E-=Y,T+=Y}}}if(a&&E+T===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let O=o.lines.get(e[1]+1);if(O?.isWrapped&&O.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(T+=D.length)}}return{start:E,length:T}}}_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=Ob(n,this._bufferService.cols)}};Mp=zt([be(3,Hi),be(4,Ir),be(5,Bm),be(6,Ui),be(7,Cn),be(8,wn)],Mp);var zb=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={}}},jb=class{constructor(){this._color=new zb,this._css=new zb}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()}},Jt=Object.freeze((()=>{let e=[Dt.toColor("#2e3436"),Dt.toColor("#cc0000"),Dt.toColor("#4e9a06"),Dt.toColor("#c4a000"),Dt.toColor("#3465a4"),Dt.toColor("#75507b"),Dt.toColor("#06989a"),Dt.toColor("#d3d7cf"),Dt.toColor("#555753"),Dt.toColor("#ef2929"),Dt.toColor("#8ae234"),Dt.toColor("#fce94f"),Dt.toColor("#729fcf"),Dt.toColor("#ad7fa8"),Dt.toColor("#34e2e2"),Dt.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:Xt.toCss(a,o,c),rgba:Xt.toRgba(a,o,c)})}for(let n=0;n<24;n++){let a=8+n*10;e.push({css:Xt.toCss(a,a,a),rgba:Xt.toRgba(a,a,a)})}return e})()),Lr=Dt.toColor("#ffffff"),Gl=Dt.toColor("#000000"),Hb=Dt.toColor("#ffffff"),Ub=Gl,Pl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},vD=Lr,Np=class extends We{constructor(e){super(),this._optionsService=e,this._contrastCache=new jb,this._halfContrastCache=new jb,this._onChangeColors=this._register(new _e),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Lr,background:Gl,cursor:Hb,cursorAccent:Ub,selectionForeground:void 0,selectionBackgroundTransparent:Pl,selectionBackgroundOpaque:yt.blend(Gl,Pl),selectionInactiveBackgroundTransparent:Pl,selectionInactiveBackgroundOpaque:yt.blend(Gl,Pl),scrollbarSliderBackground:yt.opacity(Lr,.2),scrollbarSliderHoverBackground:yt.opacity(Lr,.4),scrollbarSliderActiveBackground:yt.opacity(Lr,.5),overviewRulerBorder:Lr,ansi:Jt.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=ht(e.foreground,Lr),t.background=ht(e.background,Gl),t.cursor=yt.blend(t.background,ht(e.cursor,Hb)),t.cursorAccent=yt.blend(t.background,ht(e.cursorAccent,Ub)),t.selectionBackgroundTransparent=ht(e.selectionBackground,Pl),t.selectionBackgroundOpaque=yt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ht(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=yt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ht(e.selectionForeground,Ab):void 0,t.selectionForeground===Ab&&(t.selectionForeground=void 0),yt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=yt.opacity(t.selectionBackgroundTransparent,.3)),yt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=yt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ht(e.scrollbarSliderBackground,yt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ht(e.scrollbarSliderHoverBackground,yt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ht(e.scrollbarSliderActiveBackground,yt.opacity(t.foreground,.5)),t.overviewRulerBorder=ht(e.overviewRulerBorder,vD),t.ansi=Jt.slice(),t.ansi[0]=ht(e.black,Jt[0]),t.ansi[1]=ht(e.red,Jt[1]),t.ansi[2]=ht(e.green,Jt[2]),t.ansi[3]=ht(e.yellow,Jt[3]),t.ansi[4]=ht(e.blue,Jt[4]),t.ansi[5]=ht(e.magenta,Jt[5]),t.ansi[6]=ht(e.cyan,Jt[6]),t.ansi[7]=ht(e.white,Jt[7]),t.ansi[8]=ht(e.brightBlack,Jt[8]),t.ansi[9]=ht(e.brightRed,Jt[9]),t.ansi[10]=ht(e.brightGreen,Jt[10]),t.ansi[11]=ht(e.brightYellow,Jt[11]),t.ansi[12]=ht(e.brightBlue,Jt[12]),t.ansi[13]=ht(e.brightMagenta,Jt[13]),t.ansi[14]=ht(e.brightCyan,Jt[14]),t.ansi[15]=ht(e.brightWhite,Jt[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]=ht(e.extendedAnsi[a],Jt[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()}}};Np=zt([be(0,Ui)],Np);function ht(e,t){if(e!==void 0)try{return Dt.toColor(e)}catch{}return t}var gD=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)}},yD=class{constructor(){this._services=new gD,this._services.set(Lm,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=dT(e).sort((c,h)=>c.index-h.index),a=[];for(let c of n){let h=this._services.get(c.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);a.push(h)}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)}},bD={trace:0,debug:1,info:2,warn:3,error:4,off:5},SD="xterm.js: ",Ap=class extends We{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=bD[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?"":SD)+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)}};Ap=zt([be(0,Ui)],Ap);var Pb=class extends We{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new _e),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new _e),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new _e),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}},qe=3,Vt=Object.freeze(new Ro),Jc=0,Cf=2,Zl=class yw{constructor(t,n,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*qe);let o=n||Es.fromCharData([0,H0,1,0]);for(let c=0;c<t;++c)this.setCell(c,o);this.length=t}get(t){let n=this._data[t*qe+0],a=n&2097151;return[this._data[t*qe+1],n&2097152?this._combined[t]:a?tr(a):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):a]}set(t,n){this._data[t*qe+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*qe+0]=t|2097152|n[2]<<22):this._data[t*qe+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*qe+0]>>22}hasWidth(t){return this._data[t*qe+0]&12582912}getFg(t){return this._data[t*qe+1]}getBg(t){return this._data[t*qe+2]}hasContent(t){return this._data[t*qe+0]&4194303}getCodePoint(t){let n=this._data[t*qe+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*qe+0]&2097152}getString(t){let n=this._data[t*qe+0];return n&2097152?this._combined[t]:n&2097151?tr(n&2097151):""}isProtected(t){return this._data[t*qe+2]&536870912}loadCell(t,n){return Jc=t*qe,n.content=this._data[Jc+0],n.fg=this._data[Jc+1],n.bg=this._data[Jc+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*qe+0]=n.content,this._data[t*qe+1]=n.fg,this._data[t*qe+2]=n.bg}setCellFromCodepoint(t,n,a,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*qe+0]=n|a<<22,this._data[t*qe+1]=o.fg,this._data[t*qe+2]=o.bg}addCodepointToCell(t,n,a){let o=this._data[t*qe+0];o&2097152?this._combined[t]+=tr(n):o&2097151?(this._combined[t]=tr(o&2097151)+tr(n),o&=-2097152,o|=2097152):o=n|1<<22,a&&(o&=-12582913,o|=a<<22),this._data[t*qe+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 Es;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 Es;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*Cf<this._data.buffer.byteLength;let a=t*qe;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 h=0;h<o.length;h++){let f=parseInt(o[h],10);f>=t&&delete this._combined[f]}let c=Object.keys(this._extendedAttrs);for(let h=0;h<c.length;h++){let f=parseInt(c[h],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,a*4*Cf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Cf<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 yw(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*qe+0]&4194303)return t+(this._data[t*qe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*qe+0]&4194303||this._data[t*qe+2]&50331648)return t+(this._data[t*qe+0]>>22);return 0}copyCellsFrom(t,n,a,o,c){let h=t._data;if(c)for(let m=o-1;m>=0;m--){for(let p=0;p<qe;p++)this._data[(a+m)*qe+p]=h[(n+m)*qe+p];h[(n+m)*qe+2]&268435456&&(this._extendedAttrs[a+m]=t._extendedAttrs[n+m])}else for(let m=0;m<o;m++){for(let p=0;p<qe;p++)this._data[(a+m)*qe+p]=h[(n+m)*qe+p];h[(n+m)*qe+2]&268435456&&(this._extendedAttrs[a+m]=t._extendedAttrs[n+m])}let f=Object.keys(t._combined);for(let m=0;m<f.length;m++){let p=parseInt(f[m],10);p>=n&&(this._combined[p-n+a]=t._combined[p])}}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 h=this._data[n*qe+0],f=h&2097151,m=h&2097152?this._combined[n]:f?tr(f):sr;if(c+=m,o)for(let p=0;p<m.length;++p)o.push(n);n+=h>>22||1}return o&&o.push(n),c}};function wD(e,t,n,a,o,c){let h=[];for(let f=0;f<e.length-1;f++){let m=f,p=e.get(++m);if(!p.isWrapped)continue;let b=[e.get(f)];for(;m<e.length&&p.isWrapped;)b.push(p),p=e.get(++m);if(!c&&a>=f&&a<m){f+=b.length-1;continue}let y=0,w=vo(b,y,t),x=1,E=0;for(;x<b.length;){let O=vo(b,x,t),D=O-E,Y=n-w,F=Math.min(D,Y);b[y].copyCellsFrom(b[x],E,w,F,!1),w+=F,w===n&&(y++,w=0),E+=F,E===O&&(x++,E=0),w===0&&y!==0&&b[y-1].getWidth(n-1)===2&&(b[y].copyCellsFrom(b[y-1],n-1,w++,1,!1),b[y-1].setCell(n-1,o))}b[y].replaceCells(w,n,o);let T=0;for(let O=b.length-1;O>0&&(O>y||b[O].getTrimmedLength()===0);O--)T++;T>0&&(h.push(f+b.length-T),h.push(T)),f+=b.length-1}return h}function CD(e,t){let n=[],a=0,o=t[a],c=0;for(let h=0;h<e.length;h++)if(o===h){let f=t[++a];e.onDeleteEmitter.fire({index:h-c,amount:f}),h+=f-1,c+=f,o=t[++a]}else n.push(h);return{layout:n,countRemoved:c}}function xD(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 ED(e,t,n){let a=[],o=e.map((m,p)=>vo(e,p,t)).reduce((m,p)=>m+p),c=0,h=0,f=0;for(;f<o;){if(o-f<n){a.push(o-f);break}c+=n;let m=vo(e,h,t);c>m&&(c-=m,h++);let p=e[h].getWidth(c-1)===2;p&&c--;let b=p?n-1:n;a.push(b),f+=b}return a}function vo(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 bw=class Sw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Sw._nextId++,this._onDispose=this.register(new _e),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Pr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};bw._nextId=1;var TD=bw,si={},Br=si.B;si[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:"≥","{":"π","|":"≠","}":"£","~":"·"};si.A={"#":"£"};si.B=void 0;si[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};si.C=si[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};si.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};si.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};si.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};si.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};si.E=si[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};si.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};si.H=si[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};si["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Kb=4294967295,Ib=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=Vt.clone(),this.savedCharset=Br,this.markers=[],this._nullCell=Es.fromCharData([0,H0,1,0]),this._whitespaceCell=Es.fromCharData([0,sr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ku,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Pb(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 Cu),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 Cu),this._whitespaceCell}getBlankLine(e,t){return new Zl(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>Kb?Kb:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Vt);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 Pb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Vt),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 h=0;h<this.lines.length;h++)a+=+this.lines.get(h).resize(e,n);let c=0;if(this._rows<t)for(let h=this._rows;h<t;h++)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 Zl(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 Zl(e,n)));else for(let h=this._rows;h>t;h--)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 h=this.lines.length-o;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,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=wD(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Vt),n);if(a.length>0){let o=CD(this.lines,a);xD(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let a=this.getNullCell(Vt),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Zl(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(Vt),o=[],c=0;for(let h=this.lines.length-1;h>=0;h--){let f=this.lines.get(h);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let m=[f];for(;f.isWrapped&&h>0;)f=this.lines.get(--h),m.unshift(f);if(!n){let F=this.ybase+this.y;if(F>=h&&F<h+m.length)continue}let p=m[m.length-1].getTrimmedLength(),b=ED(m,this._cols,e),y=b.length-m.length,w;this.ybase===0&&this.y!==this.lines.length-1?w=Math.max(0,this.y-this.lines.maxLength+y):w=Math.max(0,this.lines.length-this.lines.maxLength+y);let x=[];for(let F=0;F<y;F++){let G=this.getBlankLine(Vt,!0);x.push(G)}x.length>0&&(o.push({start:h+m.length+c,newLines:x}),c+=x.length),m.push(...x);let E=b.length-1,T=b[E];T===0&&(E--,T=b[E]);let O=m.length-y-1,D=p;for(;O>=0;){let F=Math.min(D,T);if(m[E]===void 0)break;if(m[E].copyCellsFrom(m[O],D-F,T-F,F,!0),T-=F,T===0&&(E--,T=b[E]),D-=F,D===0){O--;let G=Math.max(O,0);D=vo(m,G,this._cols)}}for(let F=0;F<m.length;F++)b[F]<e&&m[F].setCell(b[F],a);let Y=y-w;for(;Y-- >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+y,this.ybase+t-1)}if(o.length>0){let h=[],f=[];for(let T=0;T<this.lines.length;T++)f.push(this.lines.get(T));let m=this.lines.length,p=m-1,b=0,y=o[b];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let w=0;for(let T=Math.min(this.lines.maxLength-1,m+c-1);T>=0;T--)if(y&&y.start>p+w){for(let O=y.newLines.length-1;O>=0;O--)this.lines.set(T--,y.newLines[O]);T++,h.push({index:p+1,amount:y.newLines.length}),w+=y.newLines.length,y=o[++b]}else this.lines.set(T,f[p--]);let x=0;for(let T=h.length-1;T>=0;T--)h[T].index+=x,this.lines.onInsertEmitter.fire(h[T]),x+=h[T].amount;let E=Math.max(0,m+c-this.lines.maxLength);E>0&&this.lines.onTrimEmitter.fire(E)}}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 TD(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)}},kD=class extends We{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new _e),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 Ib(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Ib(!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)}},ww=2,Cw=1,Lp=class extends We{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,ww),this.rows=Math.max(e.rawOptions.rows||0,Cw),this.buffers=this._register(new kD(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 h=n.lines.isFull;c===n.lines.length-1?h?n.lines.recycle().copyFrom(a):n.lines.push(a.clone()):n.lines.splice(c+1,0,a.clone()),h?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let h=c-o+1;n.lines.shiftElements(o+1,h-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))}};Lp=zt([be(0,Ui)],Lp);var Da={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:Tu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},DD=["normal","bold","100","200","300","400","500","600","700","800","900"],RD=class extends We{constructor(e){super(),this._onOptionChange=this._register(new _e),this.onOptionChange=this._onOptionChange.event;let t={...Da};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(wt(()=>{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 Da))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,a)=>{if(!(n in Da))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=Da[e]),!MD(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Da[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=DD.includes(t)?t:Da[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 MD(e){return e==="block"||e==="underline"||e==="bar"}function Ql(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]&&Ql(e[a],t-1);return n}var Fb=Object.freeze({insertMode:!1}),qb=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Bp=class extends We{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 _e),this.onData=this._onData.event,this._onUserInput=this._register(new _e),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new _e),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ql(Fb),this.decPrivateModes=Ql(qb)}reset(){this.modes=Ql(Fb),this.decPrivateModes=Ql(qb)}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))}};Bp=zt([be(0,Hi),be(1,F0),be(2,Ui)],Bp);var Wb={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 xf(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 Ef=String.fromCharCode,$b={DEFAULT:e=>{let t=[xf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Ef(t[0])}${Ef(t[1])}${Ef(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${xf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${xf(e,!0)};${e.x};${e.y}${t}`}},Op=class extends We{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 _e),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(Wb))this.addProtocol(a,Wb[a]);for(let a of Object.keys($b))this.addEncoding(a,$b[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)}};Op=zt([be(0,Hi),be(1,Ir),be(2,Ui)],Op);var Tf=[[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]],ND=[[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]],ei;function AD(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 LD=class{constructor(){if(this.version="6",!ei){ei=new Uint8Array(65536),ei.fill(1),ei[0]=0,ei.fill(0,1,32),ei.fill(0,127,160),ei.fill(2,4352,4448),ei[9001]=2,ei[9002]=2,ei.fill(2,11904,42192),ei[12351]=1,ei.fill(2,44032,55204),ei.fill(2,63744,64256),ei.fill(2,65040,65050),ei.fill(2,65072,65136),ei.fill(2,65280,65377),ei.fill(2,65504,65511);for(let e=0;e<Tf.length;++e)ei.fill(0,Tf[e][0],Tf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ei[e]:AD(e,ND)?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=Or.extractWidth(t);o===0?a=!1:o>n&&(n=o)}return Or.createPropertyValue(0,n,a)}},Or=class uu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _e,this.onChange=this._onChange.event;let t=new LD;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 h=t.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=o)return n+this.wcwidth(h);let p=t.charCodeAt(c);56320<=p&&p<=57343?h=(h-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let f=this.charProperties(h,a),m=uu.extractWidth(f);uu.extractShouldJoin(f)&&(m-=uu.extractWidth(a)),n+=m,a=f}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},BD=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 Yb(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 Kl=2147483647,OD=256,xw=class zp{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>OD)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 zp;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 zp(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>Kl?Kl: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>Kl?Kl: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,Kl):t}},Il=[],zD=class{constructor(){this._state=0,this._active=Il,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=Il}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=Il,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Il,!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",Pu(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=Il,this._id=-1,this._state=0}}},os=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+=Pu(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}},Fl=[],jD=class{constructor(){this._handlers=Object.create(null),this._active=Fl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Fl}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=Fl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Fl,!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",Pu(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=Fl,this._ident=0}},Jl=new xw;Jl.addParam(0);var Vb=class{constructor(e){this._handler=e,this._data="",this._params=Jl,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Jl,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Pu(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=Jl,this._data="",this._hitLimit=!1,n));return this._params=Jl,this._data="",this._hitLimit=!1,t}},HD=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}},Cs=160,UD=(function(){let e=new HD(4095),t=Array.apply(null,Array(256)).map((f,m)=>m),n=(f,m)=>t.slice(f,m),a=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let c=n(0,14),h;e.setDefault(1,0),e.addMany(a,0,2,0);for(h in c)e.addMany([24,26,153,154],h,3,0),e.addMany(n(128,144),h,3,0),e.addMany(n(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,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(Cs,0,2,0),e.add(Cs,8,5,8),e.add(Cs,6,0,6),e.add(Cs,11,0,11),e.add(Cs,13,13,13),e})(),PD=class extends We{constructor(e=UD){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 xw,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(wt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new zD),this._dcsParser=this._register(new jD),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,h;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 f=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&m>-1){for(;m>=0&&(h=f[m](this._params),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 4:if(n===!1&&m>-1){for(;m>=0&&(h=f[m](),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 6:if(a=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(a!==24&&a!==26,n),h)return h;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],h=this._oscParser.end(a!==24&&a!==26,n),h)return h;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 f=c;f<t;++f){switch(a=e[f],o=this._transitions.table[this.currentState<<8|(a<160?a:Cs)],o>>4){case 2:for(let w=f+1;;++w){if(w>=t||(a=e[w])<32||a>126&&a<Cs){this._printHandler(e,f,w),f=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<Cs){this._printHandler(e,f,w),f=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<Cs){this._printHandler(e,f,w),f=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<Cs){this._printHandler(e,f,w),f=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:f,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|a],p=m?m.length-1:-1;for(;p>=0&&(h=m[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(3,m,p,o,f),h;p<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(++f<t&&(a=e[f])>47&&a<60);f--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let b=this._escHandlers[this._collect<<8|a],y=b?b.length-1:-1;for(;y>=0&&(h=b[y](),h!==!0);y--)if(h instanceof Promise)return this._preserveStack(4,b,y,o,f),h;y<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=f+1;;++w)if(w>=t||(a=e[w])===24||a===26||a===27||a>127&&a<Cs){this._dcsParser.put(e,f,w),f=w-1;break}break;case 14:if(h=this._dcsParser.unhook(a!==24&&a!==26),h)return this._preserveStack(6,[],0,o,f),h;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=f+1;;w++)if(w>=t||(a=e[w])<32||a>127&&a<Cs){this._oscParser.put(e,f,w),f=w-1;break}break;case 6:if(h=this._oscParser.end(a!==24&&a!==26),h)return this._preserveStack(5,[],0,o,f),h;a===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},KD=/^([\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})$/,ID=/^[\da-f]+$/;function Xb(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=KD.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),ID.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 kf(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 FD(e,t=16){let[n,a,o]=e;return`rgb:${kf(n,t)}/${kf(a,t)}/${kf(o,t)}`}var qD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Qn=131072,Gb=10;function Zb(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 Qb=5e3,Jb=0,WD=class extends We{constructor(e,t,n,a,o,c,h,f,m=new PD){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=a,this._optionsService=o,this._oscLinkService=c,this._coreMouseService=h,this._unicodeService=f,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new uT,this._utf8Decoder=new hT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Vt.clone(),this._eraseAttrDataInternal=Vt.clone(),this._onRequestBell=this._register(new _e),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new _e),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new _e),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new _e),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new _e),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new _e),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new _e),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new _e),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new _e),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 jp(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,b)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:b.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,b,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:b,data:y})}),this._parser.setDcsHandlerFallback((p,b,y)=>{b==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:b,payload:y})}),this._parser.setPrintHandler((p,b,y)=>this.print(p,b,y)),this._parser.registerCsiHandler({final:"@"},p=>this.insertChars(p)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},p=>this.scrollLeft(p)),this._parser.registerCsiHandler({final:"A"},p=>this.cursorUp(p)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},p=>this.scrollRight(p)),this._parser.registerCsiHandler({final:"B"},p=>this.cursorDown(p)),this._parser.registerCsiHandler({final:"C"},p=>this.cursorForward(p)),this._parser.registerCsiHandler({final:"D"},p=>this.cursorBackward(p)),this._parser.registerCsiHandler({final:"E"},p=>this.cursorNextLine(p)),this._parser.registerCsiHandler({final:"F"},p=>this.cursorPrecedingLine(p)),this._parser.registerCsiHandler({final:"G"},p=>this.cursorCharAbsolute(p)),this._parser.registerCsiHandler({final:"H"},p=>this.cursorPosition(p)),this._parser.registerCsiHandler({final:"I"},p=>this.cursorForwardTab(p)),this._parser.registerCsiHandler({final:"J"},p=>this.eraseInDisplay(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},p=>this.eraseInDisplay(p,!0)),this._parser.registerCsiHandler({final:"K"},p=>this.eraseInLine(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},p=>this.eraseInLine(p,!0)),this._parser.registerCsiHandler({final:"L"},p=>this.insertLines(p)),this._parser.registerCsiHandler({final:"M"},p=>this.deleteLines(p)),this._parser.registerCsiHandler({final:"P"},p=>this.deleteChars(p)),this._parser.registerCsiHandler({final:"S"},p=>this.scrollUp(p)),this._parser.registerCsiHandler({final:"T"},p=>this.scrollDown(p)),this._parser.registerCsiHandler({final:"X"},p=>this.eraseChars(p)),this._parser.registerCsiHandler({final:"Z"},p=>this.cursorBackwardTab(p)),this._parser.registerCsiHandler({final:"`"},p=>this.charPosAbsolute(p)),this._parser.registerCsiHandler({final:"a"},p=>this.hPositionRelative(p)),this._parser.registerCsiHandler({final:"b"},p=>this.repeatPrecedingCharacter(p)),this._parser.registerCsiHandler({final:"c"},p=>this.sendDeviceAttributesPrimary(p)),this._parser.registerCsiHandler({prefix:">",final:"c"},p=>this.sendDeviceAttributesSecondary(p)),this._parser.registerCsiHandler({final:"d"},p=>this.linePosAbsolute(p)),this._parser.registerCsiHandler({final:"e"},p=>this.vPositionRelative(p)),this._parser.registerCsiHandler({final:"f"},p=>this.hVPosition(p)),this._parser.registerCsiHandler({final:"g"},p=>this.tabClear(p)),this._parser.registerCsiHandler({final:"h"},p=>this.setMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"h"},p=>this.setModePrivate(p)),this._parser.registerCsiHandler({final:"l"},p=>this.resetMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"l"},p=>this.resetModePrivate(p)),this._parser.registerCsiHandler({final:"m"},p=>this.charAttributes(p)),this._parser.registerCsiHandler({final:"n"},p=>this.deviceStatus(p)),this._parser.registerCsiHandler({prefix:"?",final:"n"},p=>this.deviceStatusPrivate(p)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},p=>this.softReset(p)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},p=>this.setCursorStyle(p)),this._parser.registerCsiHandler({final:"r"},p=>this.setScrollRegion(p)),this._parser.registerCsiHandler({final:"s"},p=>this.saveCursor(p)),this._parser.registerCsiHandler({final:"t"},p=>this.windowOptions(p)),this._parser.registerCsiHandler({final:"u"},p=>this.restoreCursor(p)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},p=>this.insertColumns(p)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},p=>this.deleteColumns(p)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},p=>this.selectProtected(p)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},p=>this.requestMode(p,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},p=>this.requestMode(p,!1)),this._parser.setExecuteHandler(ue.BEL,()=>this.bell()),this._parser.setExecuteHandler(ue.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ue.BS,()=>this.backspace()),this._parser.setExecuteHandler(ue.HT,()=>this.tab()),this._parser.setExecuteHandler(ue.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ue.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ou.IND,()=>this.index()),this._parser.setExecuteHandler(ou.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ou.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new os(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new os(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new os(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new os(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new os(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new os(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new os(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new os(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new os(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new os(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new os(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new os(p=>this.restoreCursorColor(p))),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 p in si)this._parser.registerEscHandler({intermediates:"(",final:p},()=>this.selectCharset("("+p)),this._parser.registerEscHandler({intermediates:")",final:p},()=>this.selectCharset(")"+p)),this._parser.registerEscHandler({intermediates:"*",final:p},()=>this.selectCharset("*"+p)),this._parser.registerEscHandler({intermediates:"+",final:p},()=>this.selectCharset("+"+p)),this._parser.registerEscHandler({intermediates:"-",final:p},()=>this.selectCharset("-"+p)),this._parser.registerEscHandler({intermediates:".",final:p},()=>this.selectCharset("."+p)),this._parser.registerEscHandler({intermediates:"/",final:p},()=>this.selectCharset("/"+p));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(p=>(this._logService.error("Parsing error: ",p),p)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Vb((p,b)=>this.requestStatusString(p,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"),Qb))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Qb} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,a=this._activeBuffer.x,o=this._activeBuffer.y,c=0,h=this._parseStack.paused;if(h){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>Qn&&(c=this._parseStack.position+Qn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,p=>String.fromCharCode(p)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(p=>p.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Qn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Qn))),h||this._dirtyRowTracker.clearRange(),e.length>Qn)for(let p=c;p<e.length;p+=Qn){let b=p+Qn<e.length?p+Qn:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(p,b),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,b),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,y))return this._preserveStack(a,o,y,p),this._logSlowResolvingAsync(n),n}else if(!h){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,p))return this._preserveStack(a,o,p,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==a||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,n){let a,o,c=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,b=this._curAttrData,y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.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 E=this._unicodeService.charProperties(a,w);o=Or.extractWidth(E);let T=Or.extractShouldJoin(E),O=T?Or.extractWidth(w):0;if(w=E,h&&this._onA11yChar.fire(tr(a)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-O>f){if(m){let D=y,Y=this._activeBuffer.x-O;for(this._activeBuffer.x=O,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),y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),O>0&&y instanceof Zl&&y.copyCellsFrom(D,Y,0,O,!1);Y<f;)D.setCellFromCodepoint(Y++,0,1,b)}else if(this._activeBuffer.x=f-1,o===2)continue}if(T&&this._activeBuffer.x){let D=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-D,a,o);for(let Y=o-O;--Y>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,b);continue}if(p&&(y.insertCells(this._activeBuffer.x,o-O,this._activeBuffer.getNullCell(b)),y.getWidth(f-1)===2&&y.setCellFromCodepoint(f-1,0,1,b)),y.setCellFromCodepoint(this._activeBuffer.x++,a,o,b),o>0)for(;--o;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,b)}this._parser.precedingJoinState=w,this._activeBuffer.x<f&&n-t>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.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=>Zb(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Vb(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new os(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(Vt));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=Or.extractWidth(t),o=this._activeBuffer.x-a,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),h=new Uint32Array(c.length*n),f=0;for(let p=0;p<c.length;){let b=c.codePointAt(p)||0;h[f++]=b,p+=b>65535?2:1}let m=f;for(let p=1;p<n;++p)h.copyWithin(m,0,f),m+=f;return this.print(h,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ue.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ue.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ue.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ue.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ue.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,Br),this._charsetService.setgCharset(1,Br),this._charsetService.setgCharset(2,Br),this._charsetService.setgCharset(3,Br);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;(T=>(T[T.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",T[T.SET=1]="SET",T[T.RESET=2]="RESET",T[T.PERMANENTLY_SET=3]="PERMANENTLY_SET",T[T.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let a=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:c}=this._coreMouseService,h=this._coreService,{buffers:f,cols:m}=this._bufferService,{active:p,alt:b}=f,y=this._optionsService.rawOptions,w=(T,O)=>(h.triggerDataEvent(`${ue.ESC}[${t?"":"?"}${T};${O}$y`),!0),x=T=>T?1:2,E=e.params[0];return t?E===2?w(E,4):E===4?w(E,x(h.modes.insertMode)):E===12?w(E,3):E===20?w(E,x(y.convertEol)):w(E,0):E===1?w(E,x(a.applicationCursorKeys)):E===3?w(E,y.windowOptions.setWinLines?m===80?2:m===132?1:0:0):E===6?w(E,x(a.origin)):E===7?w(E,x(a.wraparound)):E===8?w(E,3):E===9?w(E,x(o==="X10")):E===12?w(E,x(y.cursorBlink)):E===25?w(E,x(!h.isCursorHidden)):E===45?w(E,x(a.reverseWraparound)):E===66?w(E,x(a.applicationKeypad)):E===67?w(E,4):E===1e3?w(E,x(o==="VT200")):E===1002?w(E,x(o==="DRAG")):E===1003?w(E,x(o==="ANY")):E===1004?w(E,x(a.sendFocus)):E===1005?w(E,4):E===1006?w(E,x(c==="SGR")):E===1015?w(E,4):E===1016?w(E,x(c==="SGR_PIXELS")):E===1048?w(E,1):E===47||E===1047||E===1049?w(E,x(p===b)):E===2004?w(E,x(a.bracketedPasteMode)):E===2026?w(E,x(a.synchronizedOutput)):w(E,0)}_updateAttrColor(e,t,n,a,o){return t===2?(e|=50331648,e&=-16777216,e|=Ro.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 h=e.getSubParams(t+c),f=0;do a[1]===5&&(o=1),a[c+f+1+o]=h[f];while(++f<h.length&&f+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 h=2;h<a.length;++h)a[h]===-1&&(a[h]=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=Vt.fg,e.bg=Vt.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|=Vt.fg&16777215):n===49?(a.bg&=-67108864,a.bg|=Vt.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|=Vt.fg&16777215,a.bg&=-67108864,a.bg|=Vt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ue.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.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(`${ue.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=Vt.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(!Zb(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(`${ue.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Gb&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Gb&&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(eS(c))if(o==="?")t.push({type:0,index:c});else{let h=Xb(o);h&&t.push({type:1,index:c,color:h})}}}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=Xb(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]);eS(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,Br),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(qD[e[0]],si[e[1]]||Br),!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=Vt.clone(),this._eraseAttrDataInternal=Vt.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 Es;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=h=>(this._coreService.triggerDataEvent(`${ue.ESC}${h}${ue.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)}},jp=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&&(Jb=e,e=t,t=Jb),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};jp=zt([be(0,Hi)],jp);function eS(e){return 0<=e&&e<256}var $D=5e7,tS=12,YD=50,VD=class extends We{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 _e),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>$D)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 h=f=>performance.now()-n>=tS?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);o.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(h);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=a.length,performance.now()-n>=tS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>YD&&(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()}},Hp=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 f=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(m,f)),this._dataByLinkId.set(m.id,m),m.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),h={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.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)))}};Hp=zt([be(0,Hi)],Hp);var iS=!1,XD=class extends We{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ua),this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onData=this._register(new _e),this.onData=this._onData.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new _e),this._instantiationService=new yD,this.optionsService=this._register(new RD(e)),this._instantiationService.setService(Ui,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Lp)),this._instantiationService.setService(Hi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ap)),this._instantiationService.setService(F0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Bp)),this._instantiationService.setService(Ir,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Op)),this._instantiationService.setService(I0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Or)),this._instantiationService.setService(mT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(BD),this._instantiationService.setService(pT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Hp),this._instantiationService.setService(q0,this._oscLinkService),this._inputHandler=this._register(new WD(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(wi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(wi.forward(this._bufferService.onResize,this._onResize)),this._register(wi.forward(this.coreService.onData,this._onData)),this._register(wi.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 VD((t,n)=>this._inputHandler.parse(t,n))),this._register(wi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new _e),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&&!iS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),iS=!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,ww),t=Math.max(t,Cw),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(Yb.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Yb(this._bufferService),!1))),this._windowsWrappingHeuristics.value=wt(()=>{for(let t of e)t.dispose()})}}},GD={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 ZD(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=ue.ESC+"OA":o.key=ue.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ue.ESC+"OD":o.key=ue.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ue.ESC+"OC":o.key=ue.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ue.ESC+"OB":o.key=ue.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ue.DEL,e.altKey&&(o.key=ue.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ue.ESC+"[Z";break}o.key=ue.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ue.ESC+ue.CR:ue.CR,o.cancel=!0;break;case 27:o.key=ue.ESC,e.altKey&&(o.key=ue.ESC+ue.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"D":t?o.key=ue.ESC+"OD":o.key=ue.ESC+"[D";break;case 39:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"C":t?o.key=ue.ESC+"OC":o.key=ue.ESC+"[C";break;case 38:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"A":t?o.key=ue.ESC+"OA":o.key=ue.ESC+"[A";break;case 40:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"B":t?o.key=ue.ESC+"OB":o.key=ue.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ue.ESC+"[2~");break;case 46:c?o.key=ue.ESC+"[3;"+(c+1)+"~":o.key=ue.ESC+"[3~";break;case 36:c?o.key=ue.ESC+"[1;"+(c+1)+"H":t?o.key=ue.ESC+"OH":o.key=ue.ESC+"[H";break;case 35:c?o.key=ue.ESC+"[1;"+(c+1)+"F":t?o.key=ue.ESC+"OF":o.key=ue.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ue.ESC+"[5;"+(c+1)+"~":o.key=ue.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ue.ESC+"[6;"+(c+1)+"~":o.key=ue.ESC+"[6~";break;case 112:c?o.key=ue.ESC+"[1;"+(c+1)+"P":o.key=ue.ESC+"OP";break;case 113:c?o.key=ue.ESC+"[1;"+(c+1)+"Q":o.key=ue.ESC+"OQ";break;case 114:c?o.key=ue.ESC+"[1;"+(c+1)+"R":o.key=ue.ESC+"OR";break;case 115:c?o.key=ue.ESC+"[1;"+(c+1)+"S":o.key=ue.ESC+"OS";break;case 116:c?o.key=ue.ESC+"[15;"+(c+1)+"~":o.key=ue.ESC+"[15~";break;case 117:c?o.key=ue.ESC+"[17;"+(c+1)+"~":o.key=ue.ESC+"[17~";break;case 118:c?o.key=ue.ESC+"[18;"+(c+1)+"~":o.key=ue.ESC+"[18~";break;case 119:c?o.key=ue.ESC+"[19;"+(c+1)+"~":o.key=ue.ESC+"[19~";break;case 120:c?o.key=ue.ESC+"[20;"+(c+1)+"~":o.key=ue.ESC+"[20~";break;case 121:c?o.key=ue.ESC+"[21;"+(c+1)+"~":o.key=ue.ESC+"[21~";break;case 122:c?o.key=ue.ESC+"[23;"+(c+1)+"~":o.key=ue.ESC+"[23~";break;case 123:c?o.key=ue.ESC+"[24;"+(c+1)+"~":o.key=ue.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=ue.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ue.DEL:e.keyCode===219?o.key=ue.ESC:e.keyCode===220?o.key=ue.FS:e.keyCode===221&&(o.key=ue.GS);else if((!n||a)&&e.altKey&&!e.metaKey){let h=GD[e.keyCode]?.[e.shiftKey?1:0];if(h)o.key=ue.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(f);e.shiftKey&&(m=m.toUpperCase()),o.key=ue.ESC+m}else if(e.keyCode===32)o.key=ue.ESC+(e.ctrlKey?ue.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),o.key=ue.ESC+f,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=ue.US),e.key==="@"&&(o.key=ue.NUL));break}return o}var Kt=0,QD=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ku,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ku,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||(Kt=this._search(t),Kt===-1)||this._getKey(this._array[Kt])!==t)return!1;do if(this._array[Kt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Kt),!0;while(++Kt<this._array.length&&this._getKey(this._array[Kt])===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&&(Kt=this._search(e),!(Kt<0||Kt>=this._array.length)&&this._getKey(this._array[Kt])===e))do yield this._array[Kt];while(++Kt<this._array.length&&this._getKey(this._array[Kt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Kt=this._search(e),!(Kt<0||Kt>=this._array.length)&&this._getKey(this._array[Kt])===e))do t(this._array[Kt]);while(++Kt<this._array.length&&this._getKey(this._array[Kt])===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}},Df=0,sS=0,JD=class extends We{constructor(){super(),this._decorations=new QD(e=>e?.marker.line),this._onDecorationRegistered=this._register(new _e),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new _e),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(wt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new eR(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=>{Df=o.options.x??0,sS=Df+(o.options.width??1),e>=Df&&e<sS&&(!n||(o.options.layer??"bottom")===n)&&a(o)})}},eR=class extends rr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new _e),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new _e),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=Dt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Dt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},tR=1e3,iR=class{constructor(e,t=tR){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)}},nS=20,Du=class extends We{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 iR(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(`
|
|
28
|
-
`))),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(ze(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(wt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<nS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
29
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===nS+1&&(this._liveRegion.textContent+=np.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),h=[],f=c?.translateToString(!0,void 0,void 0,h)||"",m=(n.ydisp+o+1).toString(),p=this._rowElements[o];p&&(f.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=f,this._rowColumns.set(p,h)),p.setAttribute("aria-posinset",m),p.setAttribute("aria-setsize",a),this._alignRowWidth(p))}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 h,f;if(t===0?(h=n,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(h=this._rowElements.shift(),f=n,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}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:f,offset:m})=>{let p=f instanceof Text?f.parentNode:f,b=parseInt(p?.getAttribute("aria-posinset"),10)-1;if(isNaN(b))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(p);if(!y)return console.warn("columns is null. Race condition?"),null;let w=m<y.length?y[m]:y.slice(-1)[0]+1;return w>=this._terminal.cols&&(++b,w=0),{row:b,column:w}},c=o(t),h=o(n);if(!(!c||!h)){if(c.row>h.row||c.row===h.row&&c.column>=h.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(h.row-c.row)*this._terminal.cols-c.column+h.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})`}};Du=zt([be(1,Lm),be(2,wn),be(3,Cn)],Du);var Up=class extends We{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 _e),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new _e),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(wt(()=>{Pr(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(ze(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ze(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ze(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ze(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 h=c?.map(f=>({link:f}));this._activeProviderReplies?.set(a,h),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 h=o[c],f=h.link.range.start.y<e?0:h.link.range.start.x,m=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let p=f;p<=m;p++){if(n.has(p)){o.splice(c--,1);break}n.add(p)}}}}_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(h=>this._linkAtPosition(h.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 h=this._activeProviderReplies.get(c)?.find(f=>this._linkAtPosition(f.link,t));if(h){n=!0,this._handleNewLink(h);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&&sR(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,Pr(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}}};Up=zt([be(1,Bm),be(2,Cn),be(3,Hi),be(4,$0)],Up);function sR(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 nR=class extends XD{constructor(e={}){super(e),this._linkifier=this._register(new Ua),this.browser=hw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ua),this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new _e),this.onKey=this._onKey.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new _e),this.onBell=this._onBell.event,this._onFocus=this._register(new _e),this._onBlur=this._register(new _e),this._onA11yCharEmitter=this._register(new _e),this._onA11yTabEmitter=this._register(new _e),this._onWillOpen=this._register(new _e),this._setup(),this._decorationService=this._instantiationService.createInstance(JD),this._instantiationService.setService(Mo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Yk),this._instantiationService.setService($0,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(ap)),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(wi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(wi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(wi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(wi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(wt(()=>{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=yt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ue.ESC}]${a};${FD(o)}${cw.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=Xt.toColor(...t.color));else{let c=n;this._themeService.modifyColors(h=>h[c]=Xt.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(Du,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ue.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(ue.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,h=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=h+"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(ze(this.element,"copy",t=>{this.hasSelection()&&oT(t,this._selectionService)}));let e=t=>cT(t,this.textarea,this.coreService,this.optionsService);this._register(ze(this.textarea,"paste",e)),this._register(ze(this.element,"paste",e)),dw?this._register(ze(this.element,"mousedown",t=>{t.button===2&&pb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ze(this.element,"contextmenu",t=>{pb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Im&&this._register(ze(this.element,"auxclick",t=>{t.button===1&&j0(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ze(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ze(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ze(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ze(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ze(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ze(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ze(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(ze(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",sp.get()),mw||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(Wk,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(wn,this._coreBrowserService),this._register(ze(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(ze(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(kp,this._document,this._helperContainer),this._instantiationService.setService(Ku,this._charSizeService),this._themeService=this._instantiationService.createInstance(Np),this._instantiationService.setService(Fa,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Eu),this._instantiationService.setService(W0,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Rp,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(xp,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Dp),this._instantiationService.setService(Bm,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(Up,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(wp,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(Mp,this.element,this.screenElement,a)),this._instantiationService.setService(vT,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(wi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Cp,this.screenElement)),this._register(ze(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(Du,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Tp,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(c){let h=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!h)return!1;let f,m;switch(c.overrideType||c.type){case"mousemove":m=32,c.buttons===void 0?(f=3,c.button!==void 0&&(f=c.button<3?c.button:3)):f=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":m=0,f=c.button<3?c.button:3;break;case"mousedown":m=1,f=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let p=c.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;m=p<0?0:1,f=4;break;default:return!1}return m===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:f,action:m,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(ze(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(ze(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 h=ue.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!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){z0(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=ZD(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===ue.ETX||n.key===ue.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)&&(rR(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(Vt));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(ue.ESC+"[I"):this.coreService.triggerDataEvent(ue.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(`${ue.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(`${ue.ESC}[6;${o};${a}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function rR(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var aR=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)}},lR=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 Es)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},rS=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 lR(t)}getNullCell(){return new Es}},oR=class extends We{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new _e),this.onBufferChange=this._onBufferChange.event,this._normal=new rS(this._core.buffers.normal,"normal"),this._alternate=new rS(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)}},cR=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)}},uR=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}},hR=["cols","rows"],qs=0,dR=class extends We{constructor(e){super(),this._core=this._register(new nR(e)),this._addonManager=this._register(new aR),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(hR.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 cR(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new uR(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 oR(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
|
|
30
|
-
`,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 sp.get()},set promptLabel(e){sp.set(e)},get tooMuchOutput(){return np.get()},set tooMuchOutput(e){np.set(e)}}}_verifyIntegers(...e){for(qs of e)if(qs===1/0||isNaN(qs)||qs%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(qs of e)if(qs&&(qs===1/0||isNaN(qs)||qs%1!==0||qs<0))throw new Error("This API only accepts positive integers")}};class fR{pending=null;accept(t){let n="";for(const a of t)n+=this.acceptChar(a);return n}acceptChar(t){return t===""?this.acceptBackspace():Dw.has(t)?this.acceptConsonant(t):Rw.has(t)?this.acceptVowel(t):vR(t)&&this.canReplacePendingWith(t)?(this.pending=lS(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(Mw.has(t))return this.pending.final=t,"";const o=this.flushPending();return this.pending={initial:t},o}const n=_R.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=mR.get(`${this.pending.vowel}${t}`);return c?(this.pending.vowel=c,""):this.flushPending()+t}const n=aS.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=oS({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=aS.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=lS(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=oS(this.pending);return this.pending=null,t}}const Ru=44032,Mu=21,Aa=28,pR=19*Mu*Aa,Ew=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],Tw=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],kw=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],Dw=Fm(Ew),Rw=Fm(Tw),Mw=Fm(kw),mR=new Map([["ㅗㅏ","ㅘ"],["ㅗㅐ","ㅙ"],["ㅗㅣ","ㅚ"],["ㅜㅓ","ㅝ"],["ㅜㅔ","ㅞ"],["ㅜㅣ","ㅟ"],["ㅡㅣ","ㅢ"]]),Nw=[["ㄱㅅ","ㄳ"],["ㄴㅈ","ㄵ"],["ㄴㅎ","ㄶ"],["ㄹㄱ","ㄺ"],["ㄹㅁ","ㄻ"],["ㄹㅂ","ㄼ"],["ㄹㅅ","ㄽ"],["ㄹㅌ","ㄾ"],["ㄹㅍ","ㄿ"],["ㄹㅎ","ㅀ"],["ㅂㅅ","ㅄ"]],_R=new Map(Nw),aS=new Map(Nw.map(([e,t])=>[t,[e[0],e[1]]]));function Fm(e){return new Map(e.map((t,n)=>[t,n]))}function vR(e){const t=e.codePointAt(0);return t!==void 0&&t>=Ru&&t<Ru+pR}function lS(e){const t=e.codePointAt(0)-Ru,n=Math.floor(t/(Mu*Aa)),a=Math.floor(t%(Mu*Aa)/Aa),o=t%Aa,c={initial:Ew[n],vowel:Tw[a]};return o===0?c:{...c,final:kw[o]}}function oS(e){if(!e.vowel)return e.initial;const t=Dw.get(e.initial),n=Rw.get(e.vowel),a=e.final?Mw.get(e.final):0;return t===void 0||n===void 0||a===void 0?`${e.initial}${e.vowel}${e.final??""}`:String.fromCodePoint(Ru+(t*Mu+n)*Aa+a)}const gR=[{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 yR({ctrlActive:e,onCtrl:t,onStandaloneKey:n,onPreserveFocus:a,onHide:o}){function c(h){h.stopPropagation(),a()}return _.jsxs("div",{className:"mobile-terminal-key-bar",role:"toolbar","aria-label":"Mobile terminal keys",onMouseDown:c,onPointerDown:c,children:[_.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"}),gR.map(h=>_.jsx("button",{type:"button",className:"mobile-terminal-key","aria-label":h.ariaLabel,onClick:()=>n(h.key),children:h.label},h.key)),_.jsx("button",{type:"button",className:"mobile-terminal-key mobile-terminal-key-hide","aria-label":"Hide terminal control keys",title:"Hide",onClick:o,children:"×"})]})}const bR={escape:"\x1B",tab:" ",arrowUp:"\x1B[A",arrowDown:"\x1B[B",arrowRight:"\x1B[C",arrowLeft:"\x1B[D"};function SR(e){return bR[e]}function wR(e){return/^[a-z]$/i.test(e)?String.fromCharCode(e.toUpperCase().charCodeAt(0)-64):null}const cS="--nterminal-viewport-height",uS="--nterminal-keyboard-inset-bottom",hS="data-nterminal-keyboard-visible",qm="data-nterminal-compose-open",Pp="nterminal:viewport-refresh",CR=120;function xR(e=window){const t=e.document.documentElement,n=e.visualViewport;function a(){const o=ER(e);o!==null&&t.style.setProperty(cS,`${o}px`),t.style.setProperty(uS,`${Aw(e)}px`),t.setAttribute(hS,String(TR(e)))}return a(),n?.addEventListener("resize",a),n?.addEventListener("scroll",a),e.addEventListener("resize",a),e.addEventListener(Pp,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(Pp,a),e.removeEventListener("orientationchange",a),e.removeEventListener("pageshow",a),e.document.removeEventListener("visibilitychange",a),t.style.removeProperty(cS),t.style.removeProperty(uS),t.removeAttribute(hS)}}function ER(e){if(e.document.documentElement.hasAttribute(qm)&&oo(e.innerHeight))return e.innerHeight;const t=e.visualViewport?.height;return oo(t)?t:oo(e.innerHeight)?e.innerHeight:null}function oo(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function TR(e){return Aw(e)>CR}function Aw(e){const t=e.visualViewport?.height;if(!oo(t)||!oo(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))}const Lo=new Map,go=new Map,kR=Object.freeze({open:!1,text:""});function DR(e){let t=go.get(e);return t||(t=new Set,go.set(e,t)),t}function Lw(e){const t=go.get(e);if(t)for(const n of Array.from(t))n()}function Wm(e){return Lo.get(e)??kR}function RR(e,t){const n=DR(e);return n.add(t),()=>{n.delete(t)}}function MR(e,t){const n=Wm(e);n.open!==t&&(Lo.set(e,{...n,open:t}),Lw(e))}function NR(e,t){const n=Wm(e);n.text!==t&&(Lo.set(e,{...n,text:t}),Lw(e))}function dS(e){Lo.delete(e),go.delete(e)}function AR(){Lo.clear(),go.clear()}const fS=120,LR=420,hu=new Set;let za=null;function BR({terminalId:e,onSubmit:t,disabled:n=!1}){const a=g.useMemo(()=>T=>RR(e,T),[e]),o=g.useMemo(()=>()=>Wm(e),[e]),c=g.useSyncExternalStore(a,o,o),{open:h,text:f}=c,m=g.useRef(null),p=g.useRef(null),b=g.useRef(null);g.useLayoutEffect(()=>{if(!(!h||!Kp()))return zR(e),()=>jR(e)},[h,e]),g.useLayoutEffect(()=>{const T=m.current?.closest(".terminal-pane");if(!T)return;function O(){T?.removeAttribute("data-compose-open"),T?.style.removeProperty("--compose-drawer-panel-height")}if(!h){O();return}const D=p.current;T.setAttribute("data-compose-open","true");function Y(){const ee=D?.getBoundingClientRect().height??0;ee>0&&T?.style.setProperty("--compose-drawer-panel-height",`${Math.ceil(ee)}px`)}Y();const F=[window.setTimeout(Y,0),window.setTimeout(Y,180),window.setTimeout(Y,260)],G=window.requestAnimationFrame?.(Y)??null,re=typeof ResizeObserver=="function"&&D?new ResizeObserver(Y):null;return re&&D&&re.observe(D),()=>{for(const ee of F)window.clearTimeout(ee);G!==null&&window.cancelAnimationFrame?.(G),re?.disconnect(),O()}},[h]),g.useEffect(()=>{h&&b.current?.focus()},[h]);function y(T){MR(e,T)}function w(T){NR(e,T)}function x(){OR(m.current),y(!1),pS()}function E(){if(n||!f)return;const T=f.replace(/\r\n/g,`
|
|
31
|
-
`).replace(/\n/g,"\r");if(T&&t(T),window.setTimeout(()=>t("\r"),fS),w(""),Kp()){b.current?.blur(),pS();return}window.setTimeout(()=>b.current?.focus(),fS+20)}return _.jsxs("div",{ref:m,className:"compose-drawer","data-open":h?"true":"false",children:[_.jsxs("button",{type:"button",className:"compose-drawer-handle","aria-label":"Open compose drawer","aria-hidden":h?"true":void 0,tabIndex:h?-1:0,title:"Compose long input — type without per-keystroke latency, send with Cmd/Ctrl+Enter",onClick:()=>y(!0),children:[_.jsx("span",{"aria-hidden":"true",children:"▴"}),_.jsx("span",{children:"compose"}),f?_.jsx("span",{className:"compose-drawer-handle-dot","aria-label":"draft saved"}):null]}),_.jsxs("div",{ref:p,className:"compose-drawer-panel","aria-hidden":h?void 0:"true",children:[_.jsxs("button",{type:"button",className:"compose-drawer-header","aria-label":"Collapse compose drawer",tabIndex:h?0:-1,title:"Click to collapse — Esc also closes when focus is in the textarea",onClick:x,children:[_.jsx("span",{"aria-hidden":"true",children:"▾"}),_.jsx("span",{className:"compose-drawer-title",children:"compose"}),_.jsx("span",{className:"compose-drawer-hint","aria-hidden":"true",children:"Cmd/Ctrl+Enter to send · Enter for newline · Esc to close"}),_.jsx("span",{className:"compose-drawer-close","aria-hidden":"true",children:"×"})]}),_.jsx("textarea",{ref:b,className:"compose-drawer-input","aria-label":"Compose input",tabIndex:h?0:-1,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",value:f,onChange:T=>w(T.target.value),onKeyDown:T=>{if(T.key==="Enter"&&(T.metaKey||T.ctrlKey)){T.preventDefault(),E();return}T.key==="Escape"&&(T.preventDefault(),x())},placeholder:"Type a longer command here, then Cmd/Ctrl+Enter to send."}),_.jsxs("div",{className:"compose-drawer-actions",children:[_.jsx("button",{type:"button",className:"compose-drawer-clear",tabIndex:h?0:-1,onClick:()=>{w(""),b.current?.focus()},disabled:!f,children:"Clear"}),_.jsx("button",{type:"button",className:"compose-drawer-send",tabIndex:h?0:-1,onClick:E,disabled:n||!f,children:"Send"})]})]})]})}function OR(e){const t=document.activeElement;t instanceof HTMLElement&&(!e||e.contains(t))&&t.blur()}function Kp(){return navigator.maxTouchPoints>0?!0:typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}function pS(){if(!Kp())return;const e=()=>{window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0,La()};e(),window.requestAnimationFrame?.(e),window.setTimeout(e,120),window.setTimeout(e,320)}function zR(e){za!==null&&(window.clearTimeout(za),za=null),hu.add(e),document.documentElement.setAttribute(qm,"true"),La()}function jR(e){if(hu.delete(e),hu.size>0||za!==null){La();return}za=window.setTimeout(()=>{if(za=null,hu.size>0){La();return}document.documentElement.removeAttribute(qm),La()},LR),La()}function La(){window.dispatchEvent(new Event(Pp))}function HR(e){e.attachCustomKeyEventHandler(o=>{if(UR(o)){const c=mS(e);return c?(o.preventDefault(),o.stopPropagation(),_S(c),!1):!0}return PR(o)?(o.preventDefault(),o.stopPropagation(),KR(e),!1):!0});const t=e.element;if(!t)return{dispose(){e.attachCustomKeyEventHandler(()=>!0)}};const n=o=>{const c=mS(e);if(c){if(o.clipboardData){o.clipboardData.setData("text/plain",c),o.preventDefault();return}o.preventDefault(),_S(c)}},a=o=>{const c=o.clipboardData?.getData("text/plain");if(c===void 0)return;const h=Bw(c);h!==c&&(o.preventDefault(),o.stopImmediatePropagation(),e.paste(h))};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 UR(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 PR(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 KR(e){if(navigator.clipboard?.readText)try{const t=await navigator.clipboard.readText();if(!t)return;e.paste(Bw(t))}catch{}}function mS(e){return e.hasSelection()?e.getSelection():""}function Bw(e){return e.replace(/(?:\r\n|\r|\n)+$/,"")}async function _S(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}IR(e)}function IR(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 FR=[4,10,11,12];function qR(e,t){const n=[e.parser.registerCsiHandler({final:"c"},a=>vS(a)),e.parser.registerCsiHandler({prefix:">",final:"c"},a=>vS(a)),e.parser.registerCsiHandler({final:"n"},a=>WR(a)),e.parser.registerCsiHandler({prefix:"?",final:"n"},a=>$R(a)),e.parser.registerCsiHandler({final:"t"},a=>YR(a)),e.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...FR.map(a=>e.parser.registerOscHandler(a,o=>VR(o)))];return{dispose(){for(const a of n)a.dispose()}}}function vS(e){return qu(e)===0}function WR(e){const t=qu(e);return t===5||t===6}function $R(e){return qu(e)===6}function YR(e){const t=qu(e);return t===14||t===16||t===18}function VR(e){return e.split(";").some(t=>t==="?")}function qu(e){const t=e[0];return typeof t=="number"?t:0}const Pa=new Map,XR=2*1024*1024,GR=1500,ZR=25e3;function QR(e,t){let n=Pa.get(e);n||(n=eM(e),Pa.set(e,n),$m(n)),n.listeners.add(t);const a=c=>sM(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 Ip(e){const t=Pa.get(e);t&&(nM(t),Pa.delete(e))}function JR(e){const t=Pa.get(e);if(!t)return!1;t.exited=!1,t.reconnectEnabled=!0,t.reconnectTimer!==null&&(window.clearTimeout(t.reconnectTimer),t.reconnectTimer=null),Wu(t);const n=t.socket;return t.socket=null,Ma(t,"reconnecting"),n&&(n.readyState===WebSocket.OPEN||n.readyState===WebSocket.CONNECTING)&&n.close(),$m(t),!0}function gS(){for(const e of Array.from(Pa.keys()))Ip(e)}function eM(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 $m(e){if(!e.reconnectEnabled)return;Ma(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){Ma(e,"connected");for(const n of e.pendingOut)t.send(JSON.stringify(n));e.pendingOut.length=0,e.isAlive=!0,tM(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}iM(e,o),Ow(e,{type:"message",message:o})}}),t.addEventListener("close",n=>{if(e.socket===t){if(e.socket=null,Wu(e),n.code===1008){e.reconnectEnabled=!1,Ma(e,"unauthorized");return}if(e.exited||!e.reconnectEnabled){Ma(e,"closed");return}Ma(e,"reconnecting"),e.reconnectTimer=window.setTimeout(()=>{e.reconnectTimer=null,$m(e)},GR)}}),t.addEventListener("error",()=>{})}function tM(e){Wu(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)}))}},ZR)}function Wu(e){e.heartbeat!==null&&(window.clearInterval(e.heartbeat),e.heartbeat=null)}function iM(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>XR&&e.output.length>1;){const t=e.output.shift();e.outputBytes-=t.length}}function Ma(e,t){e.status!==t&&(e.status=t,Ow(e,{type:"status",status:t}))}function Ow(e,t){for(const n of Array.from(e.listeners))n(t)}function sM(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 nM(e){e.reconnectEnabled=!1,e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),Wu(e);const t=e.socket;e.socket=null,t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),e.listeners.clear()}const rM=[0,50,150,350],aM=[300,1200,2500],bS=1e3,lM=1e5,Fp="\x1B[?1049l\x1B[?1047l\x1B[?47l",oM=new Set(["47","1047","1049"]),zw=400,cM=6,SS=[500,1500,3e3,5e3,8e3],uM=ii.lazy(()=>Am(()=>import("./TranscriptMarkdownBody-D8UaEq5F.js"),__vite__mapDeps([2,1])));function wS({terminal:e,serverApi:t,active:n,visible:a=!0,canClose:o,refreshCwdOnEnter:c=!1,tabId:h,onSelect:f,onClose:m,onExit:p,onSnapshot:b,onAuthClose:y}){const w=g.useSyncExternalStore(w0,Xf,()=>zr),x=g.useSyncExternalStore(C0,Gf,()=>ja),E=g.useSyncExternalStore(x0,Qf,()=>!0),T=g.useSyncExternalStore(A0,lr,()=>Su),O=g.useRef(null),D=g.useRef(null),Y=g.useRef(null),F=g.useRef(null),G=g.useRef({onExit:p,onSnapshot:b}),re=g.useRef(t.createWebSocketUrl),ee=g.useRef(y),J=g.useRef(null),oe=g.useRef(new Map),de=g.useRef([]),A=g.useRef([]),P=g.useRef([]),K=g.useRef(0),j=g.useRef(!1),B=g.useRef(null),Q=g.useRef(0),N=g.useRef(null),I=g.useRef(null),X=g.useRef(!1),ve=g.useRef(!1),Se=g.useRef(!1),R=g.useRef(0),V=g.useRef(null),se=g.useRef(null),he=g.useRef(null),ye=g.useRef(null),me=g.useRef(!1),fe=g.useRef(!1),Me=g.useRef(!1),Re=g.useRef(!1),Ne=g.useRef(!1),Fe=g.useRef(!1),Oe=g.useRef(!1),we=g.useRef(n),ne=g.useRef(a),Ee=g.useRef(c),Te=g.useRef(w),je=g.useRef(x),[,Ue]=g.useState("connecting"),[_t,rt]=g.useState(!1),[Ci,te]=g.useState(null),[Pe,Le]=g.useState(!1),[bt,xi]=g.useState(null),[Ei,ni]=g.useState(!1),[us,Li]=g.useState(!1),[Pi,zs]=g.useState(!1),[fi,Ct]=g.useState(null),[pi,xt]=g.useState(!1),[Xs,hs]=g.useState(!1);g.useLayoutEffect(()=>{we.current=n},[n]),g.useLayoutEffect(()=>{ne.current=a},[a]),g.useLayoutEffect(()=>{Ee.current=c},[c]),g.useLayoutEffect(()=>{Te.current=w},[w]),g.useLayoutEffect(()=>{je.current=x},[x]),g.useEffect(()=>{a&&n&&e.status==="running"&&(it(),Oi())},[n,a,e.status]),g.useEffect(()=>{G.current={onExit:p,onSnapshot:b}},[p,b]),g.useEffect(()=>{re.current=t.createWebSocketUrl,ee.current=y},[t,y]),g.useEffect(()=>{let z=!1,C=null,k=0;const H=wM(e.currentCommand);function ae(){C!==null&&(window.clearTimeout(C),C=null)}function pe(){if(!H||k>=SS.length||z)return;const ge=SS[k++];C=window.setTimeout(()=>{C=null,ke()},ge)}async function ke(){try{const ge=await t.getTerminalTranscriptSource(e.id);if(z)return;Ct(ge.source),ge.source||pe()}catch(ge){if(z)return;Ct(null),Rf(ge)&&pe()}}return Ct(null),e.status!=="running"?()=>{z=!0,ae()}:(ke(),()=>{z=!0,ae()})},[t,e.currentCommand,e.id,e.status]),g.useEffect(()=>{xt(!1)},[e.id,fi?.provider,fi?.sessionId]),g.useEffect(()=>{const z=D.current;z&&(z.options.disableStdin=e.status==="exited"),e.status==="exited"&&Ue("closed")},[e.status]),g.useEffect(()=>{const z=D.current;z&&(z.options.fontSize=w,hf(w,je.current).then(()=>{Te.current===w&&it()}))},[w]),g.useEffect(()=>{const z=D.current;z&&(z.options.fontFamily=Vf(x),hf(Te.current,x).then(()=>{je.current===x&&it()}))},[x]),g.useEffect(()=>{const z=D.current;z&&(z.options.theme=CS(T))},[T]),g.useEffect(()=>{const z=O.current;if(!z)return;let C=!1,k=null,H=null,ae=null,pe=null,ke=null,ge=null,Qe=null;J.current=null,Ne.current=!1,Fe.current=!1,V.current=null,se.current=null,st(),ks();const Je=Te.current,Ri=je.current,vi=new dR({cursorBlink:!0,convertEol:!1,disableStdin:e.status==="exited",fontFamily:Vf(Ri),fontSize:Je,fontWeight:400,fontWeightBold:700,macOptionClickForcesSelection:!0,scrollback:lM,theme:{...CS(lr())}}),Xr=new sT;return vi.loadAddon(Xr),pe=qR(vi),D.current=vi,Y.current=Xr,hf(Je,Ri).then(()=>{if(C)return;vi.open(z),Ne.current=!0,k=HR(vi),ne.current&&we.current&&e.status==="running"&&Oi(),it(),ke=NM(z,vi,()=>Te.current*1.2,Ft,Ns=>{jt(Ns)},xn,Ki),ge=DM(z,vi,Ft,Ns=>{jt(Ns)},xn,Ki);const En=new fR;H=vi.onData(Ns=>{if(Oe.current){const Gs=wR(Ns);if(Gs){Vr(!1),Ji(Gs);return}}const Va=En.accept(Ns);Va&&Ji(Va)}),ae=vi.onScroll(Ns=>{if(fe.current||Re.current||Me.current){Mt();return}Zt(),ir(vi)&&Rs({scrollToBottom:!0}),Ft(),Ns<=3&&jt()}),Qe=new ResizeObserver(()=>{ki()}),Qe.observe(z),Fe.current&&(mt(),Fe.current=!1,it()),Rt()}),()=>{C=!0,Ne.current=!1,Fe.current=!1,st(),Di(),Nt(),Me.current=!1,ke?.(),ge?.(),Qe?.disconnect(),k?.dispose(),H?.dispose(),ae?.dispose(),pe?.dispose(),vi.dispose(),D.current=null,Y.current=null}},[e.id]),g.useEffect(()=>{const z=re.current(e.id),C=QR(z,hr);return F.current=C.send,Ue(C.status),C.status==="connected"&&it(),C.snapshot&&(G.current.onSnapshot(C.snapshot,{notifyCompletion:!1}),D.current&&(it(),Bi(C.output,C.history),it())),()=>{C.detach(),F.current=null}},[e.id,e.status]);function hr(z){if(z.type==="status"){Ue(z.status),z.status==="unauthorized"&&ee.current?.(),z.status==="connected"&&it();return}Tt(z.message)}function ks(z=[],C=null){A.current=[],P.current=TS(z),K.current=0,j.current=!1,B.current=null,Me.current=!1,Q.current+=1,N.current=C,I.current=null,X.current=!1,ve.current=!1,Se.current=!1,Fe.current=!1,he.current=null,me.current=!1,rt(!1),te(null),Le(!1),xi(null),ni(!1),Li(!1)}function Bi(z=[],C=null){ks(z,C),dt()}function dt(){if(!D.current||!Ne.current){Fe.current=!0;return}Fe.current=!1,mt()}async function mt(){const z=D.current;if(!z)return;const C=eu(z,me.current),k=C?P.current.length:K.current;await Et(z,{liveOutputLimit:k,scrollToBottom:C}),D.current===z&&Mt()}function Et(z,C={}){return new Promise(k=>{Me.current=!0,j.current=!1;const H=Q.current+1;Q.current=H;const ae=Math.max(0,Math.min(C.liveOutputLimit??P.current.length,P.current.length)),pe=()=>{if(D.current!==z||Q.current!==H){k();return}try{K.current=ae,C.scrollToBottom&&js(z)}finally{Me.current=!1;const ge=qr();ge&&Rs(ge),k()}},ke=()=>{if(D.current!==z||Q.current!==H){k();return}z.clear();const ge=TS([...A.current,...P.current.slice(0,ae)]);if(ge.length===0){pe();return}for(let Qe=0;Qe<ge.length;Qe+=1){const Je=ge[Qe];Qe===ge.length-1?z.write(Je,pe):z.write(Je)}};if(z.buffer.active.type==="alternate"){z.write(Fp,ke);return}ke()})}async function jt(z=0){const C=D.current;if(Se.current||!C)return;const k=N.current;Se.current=!0,rt(!0);const H=C.buffer.active.viewportY;try{let ae=!!(k&&!k.hasMore);if(!ae)try{const pe=await t.getTerminalHistory(e.id,{beforeLine:k?.startLine??0,limit:bS});if(N.current={startLine:pe.startLine,endLine:pe.endLine,hasMore:pe.hasMore},pe.output.length>0){await Ht(C,pe.output,H,z);return}ae=!pe.hasMore}catch(pe){ae=Rf(pe)}ae&&await Gt(C,H,z)}catch{}finally{Se.current=!1,rt(!1)}}async function Gt(z,C,k){if(!(X.current||ve.current))try{const H=I.current,ae=await t.getTerminalTranscriptHistory(e.id,{...H?{cursor:H}:{},limit:zw});Ct(ae.source),I.current=ae.cursor,ve.current=!ae.hasMore||!ae.cursor;const pe=ae.output.map(Hw);if(pe.length===0)return;await Ht(z,pe,C,k)}catch(H){Rf(H)&&(X.current=!0)}}async function Ht(z,C,k,H){A.current=[...C,...A.current];const ae=TM(C);await Et(z,{liveOutputLimit:K.current,scrollToBottom:!1}),D.current===z&&(_i(z,Math.max(0,k+ae+Math.min(0,H))),me.current=!ir(z),Ft())}g.useEffect(()=>{const z=window.visualViewport;function C(){document.visibilityState==="visible"&&it()}function k(){it()}function H(){Rt()}return document.addEventListener("visibilitychange",C),window.addEventListener("pageshow",k),window.addEventListener("resize",H),z?.addEventListener("resize",H),z?.addEventListener("scroll",H),()=>{document.removeEventListener("visibilitychange",C),window.removeEventListener("pageshow",k),window.removeEventListener("resize",H),z?.removeEventListener("resize",H),z?.removeEventListener("scroll",H)}},[e.id]);function ri(){const z=re.current(e.id),C=R.current+1;R.current=C,V.current={generation:C,snapshot:null},se.current=C,Ue("reconnecting"),JR(z),Ti(C)}async function Ti(z){try{const C=await t.getTerminalHistory(e.id,{limit:bS});if(R.current!==z)return;const k=V.current,H=k?.generation===z?k.snapshot:null;V.current=null,H&&(se.current=null);const ae={startLine:C.startLine,endLine:C.endLine,hasMore:C.hasMore};if(C.output.length>0){Bi(C.output,ae);return}H?Bi(H.output,H.history):se.current=null}catch{if(R.current!==z)return;const C=V.current,k=C?.generation===z?C.snapshot:null;V.current=null,se.current=null,k&&Bi(k.output,k.history)}}function Tt(z){if(z.type==="snapshot"&&z.terminal.id===e.id){if(G.current.onSnapshot(z.terminal,{notifyCompletion:!1}),!D.current)return;it();const H=V.current;if(H){H.snapshot={output:z.output,history:z.history??null},it();return}if(se.current!==null){se.current=null,it();return}Bi(z.output,z.history??null),it();return}if(z.type==="terminal_updated"&&z.terminal.id===e.id){G.current.onSnapshot(z.terminal,{notifyCompletion:!0});return}if(z.type==="output"&&z.terminalId===e.id){const k=Kw(z.data);if(!k)return;P.current.push(k),D.current&&Ne.current?Rs({scrollToBottom:!0}):Fe.current=!0;return}const C=D.current;if(C){if(z.type==="exit"&&z.terminalId===e.id){G.current.onExit(z.exitCode),Ue("closed");return}z.type==="error"&&C.writeln(`\r
|
|
32
|
-
[nterminal] ${z.message}`)}}function ki(z=25){if(document.visibilityState==="hidden"||!ne.current||oe.current.has(z))return;const C=window.setTimeout(()=>{oe.current.delete(z),$r()},z);oe.current.set(z,C)}function Rt(){for(const z of rM)ki(z)}function it(){J.current=null,Rt()}function st(){for(const z of oe.current.values())window.clearTimeout(z);oe.current.clear()}function Di(){for(const z of de.current)window.clearTimeout(z);de.current=[]}function Ft(){if(Mt(),!he.current){Le(!1);return}Le(!0),Nt(),ye.current=window.setTimeout(()=>{ye.current=null,Le(!1)},1200)}function Mt(){const z=D.current,C=z?kM(z):null;if(he.current=C,te(C),Li(!!(z&&C)),ni(!!(z&&C&&!ir(z))),C||!z||!mi()){xi(null);return}xi({alternate:z.buffer.active.type==="alternate"})}function mi(){const z=N.current;return A.current.length>0||!!z?.hasMore}function Nt(){ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null)}function Zt(){const z=D.current;z&&(me.current=!ir(z),Mt())}function Ds(z){B.current=Mf(B.current,z)}function dr(z){const C=B.current;return B.current=null,Mf(C,z)}function qr(){const z=B.current;return B.current=null,z}function Rs(z={}){const C=D.current;if(!C||!Ne.current){Fe.current=!0;return}if(Me.current){Ds(z);return}if(j.current){Ds(z);return}const k=dr(z);if(!k.force&&!eu(C,me.current)){Mt();return}j.current=!0;const H=Q.current,ae=()=>{if(D.current!==C||Q.current!==H){j.current=!1;return}if(!k.force&&!eu(C,me.current)){j.current=!1,Mt();return}const pe=K.current,ke=P.current[pe];if(ke===void 0){j.current=!1,k.scrollToBottom&&js(C),Mt();const ge=qr();ge&&Rs(Mf(k,ge));return}K.current=pe+1,C.write(ke,ae)};ae()}function xn(){Re.current=!0}function Ki(){Zt(),Re.current=!1;const z=D.current;z&&ir(z)&&Rs({scrollToBottom:!0})}function js(z){Ii(()=>kS(z))&&(me.current=!1)}function _i(z,C){Ii(()=>(z.scrollToLine(C),!0))}function Ii(z){fe.current=!0;try{return z()}finally{fe.current=!1}}function Hs(){const z=D.current;if(!z)return;const C=()=>{kS(z),me.current=!1,Mt(),Rs({force:!0,scrollToBottom:!0}),Oi()};if(z.buffer.active.type==="alternate"){z.write(Fp,C);return}C()}function Ms(z){const C=D.current,k=O.current;if(!C||!k)return;const H=k.getBoundingClientRect();if(H.height<=0)return;const ae=Math.max(0,Math.min(1,(z-H.top)/H.height)),pe=Math.round(C.buffer.active.baseY*ae);xn();try{C.scrollToLine(pe)}finally{Ki()}me.current=!ir(C),Mt(),Ft(),pe<=3&&jt()}function At(z){z.preventDefault(),z.stopPropagation(),z.currentTarget.setPointerCapture?.(z.pointerId),Ms(z.clientY)}function Wr(z){(z.buttons&1)!==0&&(z.preventDefault(),z.stopPropagation(),Ms(z.clientY))}function $r(){const z=D.current,C=Y.current;if(!(!z||!C)&&!(document.visibilityState==="hidden"||!ne.current||O.current?.isConnected===!1))try{const k=eu(z,me.current);C.fit(),k&&js(z),z.refresh(0,Math.max(0,z.rows-1)),Mt();const H={cols:z.cols,rows:z.rows},ae=J.current;if(ae&&ae.cols===H.cols&&ae.rows===H.rows)return;Qi({type:"resize",terminalId:e.id,cols:H.cols,rows:H.rows})&&(J.current=H)}catch{}}function Qi(z){const C=F.current;return C?C(z):!1}function Ji(z){Rs({force:!0,scrollToBottom:!0}),Qi({type:"input",terminalId:e.id,data:z})&&bM(z)&&Ya()}function Ya(){!Ee.current||!we.current||(Di(),de.current=aM.map(z=>{const C=window.setTimeout(()=>{de.current=de.current.filter(k=>k!==C),Ee.current&&we.current&&Qi({type:"refresh_cwd",terminalId:e.id})},z);return C}))}function Oi(){D.current?.focus()}function Yr(){zs(z=>{const C=!z;return Oe.current=C,C}),Oi()}function Vr(z){Oe.current=z,zs(z)}function Fi(z){Oe.current&&Vr(!1),Ji(SR(z)),Oi()}return _.jsxs("section",{className:"terminal-pane","data-active":n,onMouseDown:()=>{n||f()},children:[_.jsx(hM,{terminal:e,canClose:o,tabId:h,transcriptSource:fi,onOpenTranscript:()=>xt(!0),onReload:ri,onClose:m}),_.jsx("div",{className:"xterm-container",ref:O}),_t?_.jsx("div",{className:"terminal-history-loader",role:"status","aria-label":"Loading older terminal output",children:_.jsx("span",{"aria-hidden":"true"})}):null,E&&Ci?_.jsxs("div",{className:"terminal-scroll-progress","data-active":Pe,"aria-hidden":"true",children:[Ci.current,"/",Ci.total]}):E&&bt?_.jsxs("div",{className:"terminal-scroll-progress","data-active":!1,"data-pending":"true","data-buffer":bt.alternate?"alternate":"normal","aria-hidden":"true",children:[bt.alternate?"alt ":"","0/?"]}):null,Ei?_.jsx("button",{type:"button",className:"terminal-scroll-bottom-button","aria-label":"Scroll terminal to bottom",title:"Scroll to bottom",onPointerDown:z=>z.stopPropagation(),onMouseDown:z=>z.stopPropagation(),onClick:z=>{z.stopPropagation(),Hs()},children:"↓"}):null,us?_.jsx("button",{type:"button",className:"terminal-scroll-handle","aria-label":"Drag terminal scroll handle",title:"Drag to scroll",onPointerDown:At,onPointerMove:Wr,children:_.jsx("span",{"aria-hidden":"true"})}):null,n&&e.status==="running"?Xs?_.jsx(yR,{ctrlActive:Pi,onCtrl:Yr,onStandaloneKey:Fi,onPreserveFocus:Oi,onHide:()=>hs(!1)}):_.jsx("button",{type:"button",className:"mobile-terminal-key-toggle","aria-label":"Show terminal control keys",title:"Show Ctrl / Esc / Tab / arrows",onMouseDown:z=>{z.stopPropagation(),Oi()},onPointerDown:z=>{z.stopPropagation(),Oi()},onClick:()=>hs(!0),children:"⌨"}):null,_.jsx(BR,{terminalId:e.id,onSubmit:Ji,disabled:e.status!=="running"}),pi&&fi?_.jsx(dM,{terminal:e,serverApi:t,source:fi,fontSize:w,onClose:()=>xt(!1)}):null]})}function CS(e){return{background:"#0a0d10",foreground:"#e2e8ee",cursor:T2(e),selectionBackground:k2(e)}}function hM({terminal:e,canClose:t,tabId:n,transcriptSource:a,onOpenTranscript:o,onReload:c,onClose:h}){const f=u0({id:`pane-${e.id}`,disabled:!n,...n?{data:{kind:"pane",sourceTabId:n,terminalId:e.id}}:{}}),m={cursor:n?"grab":"default",opacity:f.isDragging?.5:void 0};return _.jsxs("header",{ref:f.setNodeRef,className:"terminal-pane-header",style:m,"data-dragging":f.isDragging,...f.attributes,...f.listeners,children:[_.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),_.jsx("span",{className:"terminal-pane-cwd",title:e.cwd,children:e.cwd}),_.jsx("span",{className:"terminal-pane-spacer"}),a?_.jsx("button",{type:"button",className:"terminal-pane-transcript","data-provider":a.provider,title:`View ${Nu(a.provider)} transcript history`,"aria-label":`View ${Nu(a.provider)} transcript history`,onPointerDown:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),onClick:p=>{p.stopPropagation(),o()},children:"View history"}):null,_.jsx("span",{className:`terminal-pane-state terminal-pane-state-${e.status}`,children:e.status}),e.status==="running"?_.jsx("button",{type:"button",className:"terminal-pane-reload","aria-label":`Reload pane ${e.title}`,title:"Reload pane output",onPointerDown:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),onClick:p=>{p.stopPropagation(),c()},children:"↻"}):null,t?_.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(),h()},children:"x"}):null]})}function dM({terminal:e,serverApi:t,source:n,fontSize:a,onClose:o}){const c=g.useRef(null),h=g.useRef(0),f=g.useRef(!1),m=g.useRef(!1),p=g.useRef(null),b=g.useRef(""),[y,w]=g.useState([]),[x,E]=g.useState(!1),[T,O]=g.useState(""),[D,Y]=g.useState(-1),[F,G]=g.useState(null),[re,ee]=g.useState(!1),[J,oe]=g.useState(!0),[de,A]=g.useState(!1),[P,K]=g.useState(null);g.useEffect(()=>{h.current+=1;const fe=h.current;return f.current=!1,m.current=!0,p.current=null,w([]),G(null),ee(!1),K(null),se(null,"initial",fe),()=>{h.current===fe&&(h.current+=1)}},[t,x,n.provider,n.sessionId,e.id]),g.useLayoutEffect(()=>{const fe=c.current;if(!fe)return;if(m.current){if(J||y.length===0)return;m.current=!1;const Re=()=>{fe.scrollTop=fe.scrollHeight};Re(),window.requestAnimationFrame?.(Re);return}const Me=p.current;Me!==null&&(p.current=null,fe.scrollTop+=fe.scrollHeight-Me)},[y,J,x]);const j=Nu(n.provider),B=ES(y,x),Q=mM(B),N=gM(Q,T),I=N.length,X=I>0?D>=0&&D<I?D:0:-1,ve=X>=0?N[X]?.entryIndex??null:null,Se=X>=0?N[X]??null:null,R=B?B.split(`
|
|
33
|
-
`).length-1:0,V=T.trim()?I>0?`${X+1}/${I} ${I===1?"match":"matches"} · ${R} ${R===1?"line":"lines"}`:`0 matches · ${R} ${R===1?"line":"lines"}`:R>0?`${R} lines`:"0 lines";g.useEffect(()=>{const fe=T.trim().toLowerCase();Y(Me=>!fe||I===0?-1:b.current!==fe?0:Me>=0&&Me<I?Me:0),b.current=fe},[T,I]);async function se(fe,Me,Re=h.current){if(!f.current){f.current=!0,Me==="initial"?oe(!0):(A(!0),p.current=c.current?.scrollHeight??null),K(null);try{await he(fe,Me,Re)}catch(Ne){if(h.current!==Re)return;K(Ne instanceof Error?Ne.message:"Failed to load transcript history.")}finally{h.current===Re&&(f.current=!1,oe(!1),A(!1))}}}async function he(fe,Me,Re){let Ne=fe,Fe=0,Oe=[];for(;h.current===Re;){const we=await t.getTerminalTranscriptHistory(e.id,{...Ne?{cursor:Ne}:{},limit:zw,includeTools:x});if(h.current!==Re)return;const ne=CM(we.output,n.provider,{includeTools:x});if(G(we.cursor),ee(!!(we.hasMore&&we.cursor)),ne&&(Oe=[ne,...Oe],ES(Oe,x))){w(Ee=>Me==="older"?[...Oe,...Ee]:Oe);return}if(!we.hasMore||!we.cursor||Fe>=cM){Oe.length>0&&w(Ee=>Me==="older"?[...Oe,...Ee]:Oe);return}Ne=we.cursor,Fe+=1}}function ye(){const fe=c.current;!fe||fe.scrollTop>72||!re||!F||f.current||se(F,"older")}function me(fe){I!==0&&Y(Me=>{const Re=X>=0?X:fe>0?-1:0;return((Me>=0&&Me<I?Me:Re)+fe+I)%I})}return _.jsx("div",{className:"security-overlay transcript-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"transcript-dialog-title",onClick:o,children:_.jsxs("div",{className:"security-panel transcript-dialog",onClick:fe=>fe.stopPropagation(),children:[_.jsxs("header",{className:"security-panel-header",children:[_.jsxs("div",{className:"transcript-dialog-title",children:[_.jsxs("h2",{id:"transcript-dialog-title",children:[j," JSONL"]}),_.jsx("span",{title:n.sessionId,children:n.sessionId})]}),_.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:o,children:"×"})]}),_.jsxs("div",{className:"transcript-dialog-controls",children:[_.jsxs("label",{className:"auth-checkbox transcript-tool-toggle",children:[_.jsx("input",{type:"checkbox",checked:x,onChange:fe=>E(fe.currentTarget.checked)}),"Show tool output"]}),_.jsxs("label",{className:"transcript-search",children:[_.jsx("span",{children:"Search"}),_.jsx("input",{type:"search",value:T,"aria-label":"Search JSONL transcript",placeholder:"Find in history",onChange:fe=>O(fe.currentTarget.value),onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),me(fe.shiftKey?-1:1))}})]}),_.jsxs("div",{className:"transcript-search-actions","aria-label":"Search result navigation",children:[_.jsx("button",{type:"button",onClick:()=>me(-1),disabled:I===0,children:"Prev"}),_.jsx("button",{type:"button",onClick:()=>me(1),disabled:I===0,children:"Next"})]}),_.jsx("span",{className:"transcript-result-count",children:V})]}),_.jsxs("div",{ref:c,className:"transcript-dialog-scroll","aria-label":"JSONL transcript output",onScroll:ye,children:[de?_.jsx("div",{className:"transcript-dialog-status",children:"Loading older entries..."}):null,!J&&re?_.jsx("div",{className:"transcript-dialog-hint",children:"Scroll up for older entries"}):null,B?_.jsx(fM,{entries:Q,searchQuery:T,activeEntryIndex:ve,activeSearchMatch:Se,fontSize:a}):null,J?_.jsx("div",{className:"transcript-dialog-status",children:"Loading transcript..."}):null,!J&&!B&&!P?_.jsx("div",{className:"transcript-dialog-status",children:"No transcript entries found."}):null,P?_.jsx("div",{className:"transcript-dialog-error",children:P}):null]})]})})}function fM({entries:e,searchQuery:t,activeEntryIndex:n,activeSearchMatch:a,fontSize:o}){const c=g.useRef(new Map);return g.useEffect(()=>{if(n===null)return;const h=c.current.get(n);if(!h||typeof h.scrollIntoView!="function")return;const f=h.querySelectorAll(".transcript-search-hit");((a?.entryIndex===n?f[a.matchIndexInEntry]:null)??h).scrollIntoView({block:"center",inline:"nearest"})},[n,a,t]),_.jsx("div",{className:"transcript-output transcript-formatted-output",style:{fontSize:o},children:e.map((h,f)=>_.jsxs("section",{ref:m=>{m?c.current.set(f,m):c.current.delete(f)},className:`transcript-entry transcript-entry-${h.kind}${n===f?" transcript-entry-search-active":""}`,children:[h.header?_.jsx("div",{className:"transcript-entry-header",children:jw(h.header,t)}):null,h.body?_.jsx("div",{className:"transcript-entry-body",children:h.kind==="tool"?_.jsx(xS,{text:h.body,searchQuery:t}):_.jsx(ii.Suspense,{fallback:_.jsx(xS,{text:h.body,searchQuery:t}),children:_.jsx(uM,{text:h.body,searchQuery:t})})}):null]},`${h.header??"plain"}-${f}`))})}function xS({text:e,searchQuery:t}){const n=e.endsWith(`
|
|
34
|
-
`)?e.slice(0,-1).split(`
|
|
35
|
-
`):e.split(`
|
|
36
|
-
`);return _.jsx("pre",{className:"transcript-entry-pre",children:n.map((a,o)=>_.jsx("span",{className:`transcript-line transcript-line-${yM(a,o===0||n[o-1]?.trim()==="")}`,children:jw(a,t)},o))})}function jw(e,t){const n=t.trim();if(!n)return e||" ";const a=e.toLowerCase(),o=n.toLowerCase(),c=[];let h=0,f=a.indexOf(o);for(;f!==-1;){f>h&&c.push(e.slice(h,f));const m=f+n.length;c.push(_.jsx("mark",{className:"transcript-search-hit",children:e.slice(f,m)},`${f}-${m}`)),h=m,f=a.indexOf(o,h)}return h<e.length&&c.push(e.slice(h)),c.length>0?c:e||" "}function pM(e,t){const n=t.trim().toLowerCase();if(!n)return 0;const a=e.toLowerCase();let o=0,c=a.indexOf(n);for(;c!==-1;)o+=1,c=a.indexOf(n,c+n.length);return o}function mM(e){const t=e.endsWith(`
|
|
37
|
-
`)?e.slice(0,-1):e;if(!t)return[];const n=[];let a=null,o="plain",c=[];function h(){const f=_M(c).join(`
|
|
38
|
-
`);(a||f)&&n.push({header:a,body:f,kind:o}),a=null,o="plain",c=[]}for(const f of t.split(`
|
|
39
|
-
`)){const m=vM(f);m?(h(),a=f,o=m):c.push(f)}return h(),n}function _M(e){let t=e.length;for(;t>0&&(e[t-1]??"").trim()==="";)t-=1;return e.slice(0,t)}function vM(e){const t=/^\[[^\]]+\]\s+(.+)$/.exec(e.trimEnd());if(!t)return null;const n=t[1]??"";return n==="User"?"user":n==="Codex"||n==="Claude"?"assistant":n==="System"?"system":/^Tool (?:call(?::|$)|output$)/.test(n)?"tool":null}function gM(e,t){const n=[];for(let a=0;a<e.length;a+=1){const o=e[a];if(!o)continue;const c=o.header?`${o.header}
|
|
40
|
-
${o.body}`:o.body,h=pM(c,t);for(let f=0;f<h;f+=1)n.push({entryIndex:a,matchIndexInEntry:f})}return n}function yM(e,t){const n=e.trim();if(!n)return"blank";const a=n.replace(/^\[[^\]]+\]\s+/,""),o=/^\[[^\]]+\]\s+/.test(n);return(o||t)&&/^User$/.test(a)?"user":(o||t)&&/^(?:Codex|Claude)$/.test(a)?"assistant":(o||t)&&/^System$/.test(a)?"system":(o||t)&&(/^Tool (?:call(?::|$)|output$)/.test(a)||Pw(n))?"tool":/^(?:\$|>|❯|➜)\s+/.test(n)?"command":/^(?:✓|✔|PASS|passed\b|success\b)/i.test(n)?"success":/^(?:✗|✘|FAIL|failed\b|error\b|traceback\b)/i.test(n)?"error":/^\[[^\]]+\]/.test(n)||/^(?:info|debug|warn)\b/i.test(n)?"dim":"plain"}function bM(e){return e.includes("\r")||e.includes(`
|
|
41
|
-
`)}function Rf(e){return e instanceof bn&&e.status===404}function SM(e){if(!e)return!1;const t=e.replace(/^.*[\\/]/,"").toLowerCase();return t==="codex"||t==="codex.js"||t.startsWith("codex-")||t==="claude"||t==="claude.js"||t.startsWith("claude-")}function wM(e){if(SM(e))return!0;if(!e)return!1;const t=e.replace(/^.*[\\/]/,"").toLowerCase();return t==="node"||t==="nodejs"}function Nu(e){return e==="codex"?"Codex":"Claude"}function CM(e,t,n={}){const a=`[nterminal] ${Nu(t)} transcript archive ends here. Live terminal screen continues below.`,o=e.join("").replace(/\r\n/g,`
|
|
42
|
-
`).replace(/\r/g,`
|
|
43
|
-
`).replace(a,"").replace(/\n{3,}/g,`
|
|
44
|
-
|
|
45
|
-
`).trimEnd(),c=Hw(o),h=n.includeTools?c:Uw(c);return h?`${h}
|
|
46
|
-
`:""}function Hw(e){return e.replace(/^\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z)\]/gm,(t,n)=>{const a=xM(n);return a?`[${a}]`:t})}function xM(e){const t=new Date(e);if(!Number.isFinite(t.getTime()))return null;const n=t.getFullYear(),a=ql(t.getMonth()+1),o=ql(t.getDate()),c=ql(t.getHours()),h=ql(t.getMinutes()),f=ql(t.getSeconds());return`${n}-${a}-${o} ${c}:${h}:${f}`}function ql(e){return e.toString().padStart(2,"0")}function ES(e,t){return e.map(n=>t?n:Uw(n)).filter(Boolean).map(n=>n.endsWith(`
|
|
47
|
-
`)?n:`${n}
|
|
48
|
-
`).join("")}function Uw(e){if(!e)return"";const t=e.split(`
|
|
49
|
-
`),n=[];let a=!1,o=!1,c=!0;for(const h of t){const f=h.trim()==="",m=c?EM(h):null;if(m&&(a=m==="tool",o=!1),Pw(h)){o=!0,c=!1;continue}if(o){f?(o=!1,a||n.push(h),c=!0):c=!1;continue}a||n.push(h),c=f}return n.join(`
|
|
50
|
-
`).replace(/\n{3,}/g,`
|
|
51
|
-
|
|
52
|
-
`).trimEnd()}function EM(e){const t=e.replace(/^\[[^\]]+\]\s+/,"");return/^Tool (?:call(?::|$)|output$)/.test(t)?"tool":/^(?:User|Codex|Claude|System)$/.test(t)?"message":null}function Pw(e){return/^\[tool (?:call(?::|])|output\])/.test(e.trim())}function TM(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 TS(e){const t=[];for(const n of e){const a=Kw(n);a&&t.push(a)}return t}function Kw(e){return e.replace(/\x1b\[\?([0-9;:]*)([hl])/g,(t,n,a)=>{const o=n.split(";").filter(Boolean).filter(c=>!oM.has(c.split(":")[0]??""));return o.length>0?`\x1B[?${o.join(";")}${a}`:""})}function Mf(e,t={}){const n={};return(e?.force||t.force)&&(n.force=!0),(e?.scrollToBottom||t.scrollToBottom)&&(n.scrollToBottom=!0),n}function kM(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 ir(e){return e.buffer.active.viewportY>=Math.max(0,e.buffer.active.baseY-1)}function eu(e,t){return!t||ir(e)}function kS(e){return ir(e)?!1:(e.scrollToLine(Math.max(0,e.buffer.active.baseY)),!0)}function DM(e,t,n,a,o,c){const h=f=>{const m=MM(f);m!==0&&(f.cancelable&&f.preventDefault(),f.stopPropagation(),RM(t,m,n,a,o,c))};return e.addEventListener("wheel",h,{capture:!0,passive:!1}),()=>{e.removeEventListener("wheel",h,{capture:!0})}}function RM(e,t,n,a,o,c){const h=()=>{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(Fp,h);return}h()}function MM(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 NM(e,t,n,a,o,c,h){let f=null,m=0;const p={passive:!1};function b(x){f=Nf(x),m=0}function y(x){const E=Nf(x);if(E===null){f=null,m=0;return}if(f===null){f=E;return}const T=E.clientY-f.clientY;if(f=E,x.cancelable&&x.preventDefault(),T===0)return;if(AM(t)&&LM(t,E,-T)){m=0;return}m-=T/n();const O=m<0?Math.ceil(m):Math.floor(m);if(O!==0){m-=O,c();try{t.scrollLines(O)}finally{h()}a(),O<0&&t.buffer.active.viewportY<=3&&o(O)}}function w(x){if(x.touches.length>0){f=Nf(x);return}f=null,m=0}return e.addEventListener("touchstart",b,p),e.addEventListener("touchmove",y,p),e.addEventListener("touchend",w),e.addEventListener("touchcancel",w),()=>{e.removeEventListener("touchstart",b,p),e.removeEventListener("touchmove",y,p),e.removeEventListener("touchend",w),e.removeEventListener("touchcancel",w)}}function Nf(e){if(e.touches.length!==1)return null;const t=e.touches[0];return t?{clientX:t.clientX,clientY:t.clientY}:null}function AM(e){return e.buffer.active.type==="alternate"||e.modes.mouseTrackingMode!=="none"}function LM(e,t,n){const a=e.element;return a?(a.dispatchEvent(BM(t,n)),!0):!1}function BM(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 qp({node:e,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c=!0,refreshCwdOnEnter:h=!1,tabId:f,dropZoneActive:m=!1,draggingTerminalId:p=null,mobileFocusLeafKey:b=null,path:y=[],totalPanes:w,onSelect:x,onClose:E,onResize:T,onExit:O,onSnapshot:D,onCloseEditor:Y,onAuthClose:F}){const G=w??Wp(e);if(y.length===0&&b){const oe=$p(e),de=oe.some(A=>A.key===b)?b:oe[0]?.key;if(oe.length>1&&de)return _.jsx("div",{className:"mobile-focused-split",children:oe.map(A=>{const P=A.key===de;if(A.type==="editor"){const j=n[A.editorId];return _.jsx("div",{className:"mobile-focused-pane","data-active":P,"aria-hidden":!P,children:j?_.jsx(hb,{api:a,editor:j,canClose:G>1,onClose:()=>Y(A.editorId)}):_.jsx("div",{className:"missing-pane",children:"Editor unavailable"})},A.key)}const K=t[A.terminalId];return K?_.jsx("div",{className:"mobile-focused-pane","data-active":P,"aria-hidden":!P,children:_.jsx(wS,{terminal:K,serverApi:a,active:P,visible:c&&P,canClose:G>1,refreshCwdOnEnter:h&&P,tabId:f,onSelect:()=>x(A.terminalId),onClose:()=>E(A.terminalId),onExit:j=>O(A.terminalId,j),onSnapshot:D,...F?{onAuthClose:F}:{}})},A.key):_.jsx("div",{className:"mobile-focused-pane","data-active":P,"aria-hidden":!P,children:_.jsx("div",{className:"missing-pane",children:"Terminal unavailable"})},A.key)})})}if(e.type==="pane"){const oe=t[e.terminalId];if(!oe)return _.jsx("div",{className:"missing-pane",children:"Terminal unavailable"});const de=_.jsx(wS,{terminal:oe,serverApi:a,active:e.terminalId===o,visible:c,canClose:G>1,refreshCwdOnEnter:h&&e.terminalId===o,tabId:f,onSelect:()=>x(e.terminalId),onClose:()=>E(e.terminalId),onExit:P=>O(e.terminalId,P),onSnapshot:D,...F?{onAuthClose:F}:{}});return m&&p!==e.terminalId?_.jsxs("div",{className:"pane-drop-host",children:[de,_.jsx(tu,{terminalId:e.terminalId,side:"top"}),_.jsx(tu,{terminalId:e.terminalId,side:"right"}),_.jsx(tu,{terminalId:e.terminalId,side:"bottom"}),_.jsx(tu,{terminalId:e.terminalId,side:"left"})]}):de}if(e.type==="editor"){const oe=n[e.editorId];return oe?_.jsx(hb,{api:a,editor:oe,canClose:G>1,onClose:()=>Y(e.editorId)}):_.jsx("div",{className:"missing-pane",children:"Editor unavailable"})}const re=`${e.ratio*100}%`,ee=`${(1-e.ratio)*100}%`,J=e.direction==="vertical"?{gridTemplateColumns:`${re} 1px ${ee}`}:{gridTemplateRows:`${re} 1px ${ee}`};return _.jsxs("div",{className:"split-pane","data-direction":e.direction,style:J,children:[_.jsx("div",{className:"split-cell",children:_.jsx(qp,{node:e.first,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:m,draggingTerminalId:p,mobileFocusLeafKey:b,path:[...y,0],totalPanes:G,onSelect:x,onClose:E,onResize:T,onExit:O,onSnapshot:D,onCloseEditor:Y,...F?{onAuthClose:F}:{}})}),_.jsx(OM,{direction:e.direction,path:y,onResize:T}),_.jsx("div",{className:"split-cell",children:_.jsx(qp,{node:e.second,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:m,draggingTerminalId:p,mobileFocusLeafKey:b,path:[...y,1],totalPanes:G,onSelect:x,onClose:E,onResize:T,onExit:O,onSnapshot:D,onCloseEditor:Y,...F?{onAuthClose:F}:{}})})]})}function tu({terminalId:e,side:t}){const{setNodeRef:n,isOver:a}=h0({id:`pane-${e}-${t}`,data:{kind:"pane-zone",terminalId:e,side:t}});return _.jsx("div",{ref:n,className:`pane-drop-zone pane-drop-zone--${t}`,"data-over":a,"aria-hidden":"true"})}function OM({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 h=c.parentElement;if(!h)return;const f=h.getBoundingClientRect();function m(b){const y=e==="vertical"?(b.clientX-f.left)/f.width:(b.clientY-f.top)/f.height;n(t,Math.min(.9,Math.max(.1,y)))}function p(){window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),c.classList.remove("is-dragging"),document.body.style.cursor=""}window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)}return _.jsx("div",{"aria-label":"Resize panes","aria-orientation":e==="vertical"?"vertical":"horizontal",className:"split-divider","data-direction":e,onPointerDown:a,role:"separator",children:_.jsx("span",{className:"split-divider-handle","aria-hidden":"true"})})}function Wp(e){return e.type==="pane"||e.type==="editor"?1:Wp(e.first)+Wp(e.second)}function $p(e){return e.type==="pane"?[{key:zM(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:jM(e.editorId),type:"editor",editorId:e.editorId}]:[...$p(e.first),...$p(e.second)]}function zM(e){return`terminal:${e}`}function jM(e){return`editor:${e}`}const Ym="workspace-default",HM="NTerminal";function UM(){return{workspaces:[],activeWorkspaceId:null,terminals:{}}}function PM(e,t){switch(t.type){case"workspace.hydrated":return Yp(t.terminals,t.savedTabs,t.savedWorkspaces,t.savedActiveWorkspaceId);case"workspace.created":return KM(e,{id:t.workspaceId,title:t.title});case"workspace.closed":return FM(e,t.workspaceId);case"workspace.selected":return Iw(e,t.workspaceId);case"workspace.renamed":return IM(e,t.workspaceId,t.title);case"terminal.created":return Fw(e,t.terminal);case"terminal.split":return qM(e,t.terminal,t.direction);case"terminal.updated":return tN(e,t.terminal);case"terminal.exited":return iN(e,t.terminalId,t.exitCode);case"terminal.closed":return Ww(e,t.terminalId);case"terminal.detached":return sN(e,t.terminalId);case"editor.split":return WM(e,t.editorId,t.title,t.direction);case"editor.closed":return nN(e,t.editorId);case"pane.selected":return QM(e,t.terminalId);case"pane.resized":return JM(e,t.path,t.ratio);case"tab.selected":return YM(e,t.tabId);case"tab.renamed":return ZM(e,t.tabId,t.title);case"tab.reordered":return qw(e,t.sourceTabId,t.targetIndex);case"tab.dropped_into_pane":return VM(e,t.sourceTabId,t.sourceTerminalId,t.targetTerminalId,t.side);case"terminal.extracted_to_tab":return XM(e,t.sourceTabId,t.sourceTerminalId,t.targetIndex);case"activePane.closed":return $M(e);default:return e}}function KM(e,t){if(e.workspaces.some(a=>a.id===t.id))return Iw(e,t.id);const n={id:t.id,title:t.title,tabs:[],activeTabId:null};return{...e,workspaces:[...e.workspaces,n],activeWorkspaceId:n.id}}function Iw(e,t){return e.workspaces.some(n=>n.id===t)?{...e,activeWorkspaceId:t}:e}function IM(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(h=>h.id!==t||h.title===a?h:(o=!0,{...h,title:a}));return o?{...e,workspaces:c}:e}function FM(e,t){if(e.workspaces.length<=1||!e.workspaces.some(f=>f.id===t))return e;const n=e.workspaces.find(f=>f.id===t),a=new Set(n?eN(n):[]),o={...e.terminals};for(const f of a)delete o[f];const c=e.workspaces.filter(f=>f.id!==t),h=e.activeWorkspaceId===t?c[0]?.id??null:e.activeWorkspaceId;return{workspaces:c,activeWorkspaceId:h,terminals:o}}function Fw(e,t){const n=Yw(e),a=Fr(n)??Vu(),o=Vw(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 qM(e,t,n){const a=Fr(e),o=a?Yu(a):void 0;if(!a||!o)return Fw(e,t);const c=o.activeTerminalId,h=yo(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(f=>f.id===a.id?{...f,tabs:f.tabs.map(m=>m.id===o.id?{...m,root:h,activeTerminalId:t.id}:m)}:f)}}function WM(e,t,n,a){const o=Fr(e),c=o?Yu(o):void 0;if(!o||!c)return e;const h=c.activeTerminalId,f=yo(c.root,h,{type:"split",direction:a,ratio:.5,first:{type:"pane",terminalId:h},second:{type:"editor",editorId:t,title:n}});return{...e,workspaces:e.workspaces.map(m=>m.id===o.id?{...m,tabs:m.tabs.map(p=>p.id===c.id?{...p,root:f,activeTerminalId:h}:p)}:m)}}function $M(e){const t=Fr(e),n=t?Yu(t):void 0;return n?Ww(e,n.activeTerminalId):e}function YM(e,t){const n=Fr(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 qw(e,t,n){const a=e.workspaces.map(o=>{const c=o.tabs.findIndex(b=>b.id===t);if(c<0)return o;const h=o.tabs.slice(),[f]=h.splice(c,1);if(!f)return o;const m=Math.max(0,Math.min(h.length,n)),p=h.slice();return p.splice(m,0,f),GM(o.tabs,p)?o:{...o,tabs:p}});return a.every((o,c)=>o===e.workspaces[c])?e:{...e,workspaces:a}}function VM(e,t,n,a,o){if(n===a||!e.terminals[n]||!e.terminals[a])return e;let c=e.workspaces.map(m=>{const p=m.tabs.findIndex(E=>E.id===t);if(p<0)return m;const b=m.tabs[p];if(!b)return m;const y=bo(b.root,n);if(!y){const E=m.tabs.filter((T,O)=>O!==p);return{...m,tabs:E}}const w={...b,root:y,activeTerminalId:Ts(y)[0]??b.activeTerminalId},x=m.tabs.slice();return x[p]=w,{...m,tabs:x}});const h=o==="left"||o==="right"?"vertical":"horizontal",f=o==="left"||o==="top";return c=c.map(m=>{const p=m.tabs.findIndex(T=>Ts(T.root).includes(a));if(p<0)return m;const b=m.tabs[p];if(!b)return m;const y={type:"pane",terminalId:n},w={type:"split",direction:h,ratio:.5,first:f?y:{type:"pane",terminalId:a},second:f?{type:"pane",terminalId:a}:y},x=yo(b.root,a,w),E=m.tabs.slice();return E[p]={...b,root:x,activeTerminalId:n},{...m,tabs:E,activeTabId:b.id}}),Yw({...e,workspaces:c})}function XM(e,t,n,a){let o=-1,c=-1;for(let O=0;O<e.workspaces.length;O+=1){const D=e.workspaces[O].tabs.findIndex(Y=>Y.id===t);if(D>=0){o=O,c=D;break}}if(o<0)return e;const h=e.workspaces[o],f=h.tabs[c],m=Ts(f.root);if(!m.includes(n))return e;if(m.length===1)return qw(e,t,a);const p=bo(f.root,n);if(!p)return e;const b={...f,root:p,activeTerminalId:Ts(p)[0]??f.activeTerminalId},y=e.terminals[n],w={id:`tab-${Date.now().toString(36)}-${n.slice(0,8)}`,title:y?.title??"",activeTerminalId:n,root:{type:"pane",terminalId:n}},x=h.tabs.slice();x[c]=b;const E=Math.max(0,Math.min(x.length,a));x.splice(E,0,w);const T=e.workspaces.slice();return T[o]={...h,tabs:x,activeTabId:w.id},{...e,workspaces:T}}function GM(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 ZM(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(h=>{let f=!1;const m=h.tabs.map(p=>p.id!==t||p.title===a?p:(o=!0,f=!0,{...p,title:a}));return f?{...h,tabs:m}:h});return o?{...e,workspaces:c}:e}function QM(e,t){const n=e.workspaces.find(o=>o.tabs.some(c=>So(c.root,t))),a=n?.tabs.find(o=>So(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 JM(e,t,n){const a=Fr(e),o=a?Yu(a):void 0;if(!a||!o)return e;const c=Jp(o.root,t,Xw(n));return c===o.root?e:{...e,workspaces:e.workspaces.map(h=>h.id===a.id?{...h,tabs:h.tabs.map(f=>f.id===o.id?{...f,root:c}:f)}:h)}}function Yp(e,t,n,a){const o=Object.fromEntries(e.map(b=>[b.id,b])),c=new Set(e.map(b=>b.id)),h=new Set;let f=rN(t,n,c,h);f.length===0&&(f=[Vu()]);const m=typeof a=="string"&&f.some(b=>b.id===a)?a:f[0]?.id??null,p=m??f[0]?.id??Ym;for(const b of e){if(h.has(b.id))continue;const y=Vw(b);f=aN(f,p,y),h.add(b.id)}return{workspaces:f.map(Bo),activeWorkspaceId:m,terminals:o}}function $u(e){return Ts(e.root)}function Vp(e){return em(e.root)}function eN(e){return e.tabs.flatMap(t=>Ts(t.root))}function Af(e){const t=e.workspaces.map(n=>{const a=n.tabs.flatMap(o=>{const c=Zp(o.root);return c?[{...o,root:c}]:[]});return Bo({...n,tabs:a})});return{activeWorkspaceId:t.some(n=>n.id===e.activeWorkspaceId)?e.activeWorkspaceId:t[0]?.id??null,workspaces:t}}function tN(e,t){return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(n=>({...n,tabs:n.tabs.map(a=>So(a.root,t.id)?{...a,title:a.title||t.title}:a)}))}}function iN(e,t,n){const a=e.terminals[t];return a?{...e,terminals:{...e.terminals,[t]:{...a,status:"exited",exitCode:n}}}:e}function Ww(e,t){const n={...e.terminals};return delete n[t],$w(e,t,n)}function sN(e,t){return e.terminals[t]?$w(e,t,{...e.terminals}):e}function $w(e,t,n){const a=e.workspaces.map(c=>{const h=[];for(const f of c.tabs){const m=bo(f.root,t);if(!m)continue;const p=Ts(m),b=p.includes(f.activeTerminalId)?f.activeTerminalId:p[0];b&&h.push({...f,root:m,activeTerminalId:b})}return Bo({...c,tabs:h})}),o=a.some(c=>c.id===e.activeWorkspaceId);return{workspaces:a,activeWorkspaceId:o?e.activeWorkspaceId:a[0]?.id??null,terminals:n}}function nN(e,t){const n=e.workspaces.map(o=>{const c=[];for(const h of o.tabs){const f=Xp(h.root,t);if(!f)continue;const m=Ts(f),p=m.includes(h.activeTerminalId)?h.activeTerminalId:m[0];p&&c.push({...h,root:f,activeTerminalId:p})}return Bo({...o,tabs:c})}),a=n.some(o=>o.id===e.activeWorkspaceId);return{...e,workspaces:n,activeWorkspaceId:a?e.activeWorkspaceId:n[0]?.id??null}}function rN(e,t,n,a){if(t&&t.length>0){const o=[];for(const c of t)lN(c)&&o.push(DS(c,n,a));if(o.length>0)return o}return[DS({...Vu(),tabs:e??[]},n,a)]}function DS(e,t,n){const a=[];for(const o of e.tabs){if(!oN(o))continue;const c=Gp(o.root,t);if(!c)continue;const h=Ts(c);for(const m of h)n.add(m);const f=h.includes(o.activeTerminalId)?o.activeTerminalId:h[0];f&&a.push({...o,root:c,activeTerminalId:f})}return Bo({...e,tabs:a})}function Yw(e){return Fr(e)?e:{...e,workspaces:[Vu()],activeWorkspaceId:Ym}}function Fr(e){return e.workspaces.find(t=>t.id===e.activeWorkspaceId)??e.workspaces[0]}function Yu(e){return e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]}function Vu(){return{id:Ym,title:HM,tabs:[],activeTabId:null}}function Bo(e){const t=e.tabs.some(n=>n.id===e.activeTabId);return{...e,activeTabId:t?e.activeTabId:e.tabs[0]?.id??null}}function aN(e,t,n){return e.map(a=>a.id===t?{...a,tabs:[...a.tabs,n],activeTabId:a.activeTabId??n.id}:a)}function Vw(e){return{id:`tab-${e.id}`,title:e.title||e.id,root:{type:"pane",terminalId:e.id},activeTerminalId:e.id}}function yo(e,t,n){return e.type==="pane"?e.terminalId===t?n:e:e.type==="editor"?e:{...e,first:yo(e.first,t,n),second:yo(e.second,t,n)}}function bo(e,t){if(e.type==="pane")return e.terminalId===t?null:e;if(e.type==="editor")return e;const n=bo(e.first,t),a=bo(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function Xp(e,t){if(e.type==="editor")return e.editorId===t?null:e;if(e.type==="pane")return e;const n=Xp(e.first,t),a=Xp(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function Gp(e,t){if(e.type==="pane")return t.has(e.terminalId)?e:null;if(e.type==="editor")return null;const n=Gp(e.first,t),a=Gp(e.second,t);return n&&a?{...e,ratio:Xw(e.ratio),first:n,second:a}:n??a}function Zp(e){if(e.type==="editor")return null;if(e.type==="pane")return e;const t=Zp(e.first),n=Zp(e.second);return t&&n?{...e,first:t,second:n}:t??n}function lN(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 oN(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&typeof t.activeTerminalId=="string"&&Qp(t.root)}function Qp(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")&&Qp(t.first)&&Qp(t.second):!1}function Jp(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=Jp(e.first,o,n);return c===e.first?e:{...e,first:c}}if(a===1){const c=Jp(e.second,o,n);return c===e.second?e:{...e,second:c}}return e}function Xw(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}function So(e,t){return e.type==="pane"?e.terminalId===t:e.type==="editor"?!1:So(e.first,t)||So(e.second,t)}function Ts(e){return e.type==="pane"?[e.terminalId]:e.type==="editor"?[]:[...Ts(e.first),...Ts(e.second)]}function em(e){return e.type==="pane"||e.type==="editor"?1:em(e.first)+em(e.second)}const ur=new Map,wo=new Map,Co=new Map;function Wa(e){return e??"__local__"}function cN(e){return{agentId:e,state:UM(),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 It(e){const t=Wa(e);let n=ur.get(t);return n||(n=cN(e),ur.set(t,n)),n}function Gw(e,t){const n=Wa(e);let a=wo.get(n);return a||(a=new Set,wo.set(n,a)),a.add(t),()=>{a.delete(t)}}function uN(e){const t=Wa(e),n=wo.get(t);if(n)for(const a of Array.from(n))a()}function $a(e,t){ur.set(Wa(e),t),uN(e)}const tm=new Set;function hN(e){return tm.add(e),()=>{tm.delete(e)}}function Wl(e,t){const n=It(e),a=Wa(e);t.type==="workspace.hydrated"&&Co.delete(a);const o=PM(n.state,t);let c=n.unreadCompletions,h=null;if(t.type==="terminal.updated"){const p=n.state.terminals[t.terminal.id],b=p?.activity==="busy",y=t.terminal.activity==="busy",w=t.terminal.activity==="idle",x=gN(a);if(t.notifyCompletion===!0&&y&&x.add(t.terminal.id),t.notifyCompletion===!0&&b&&w&&x.has(t.terminal.id)){const E=dN(o,t.terminal.id);E&&(h={terminalId:t.terminal.id,tabId:E.tab.id,commandName:p?.currentCommand??null},E.workspace.activeTabId!==E.tab.id&&(c.has(E.tab.id)||(c=new Set(c),c.add(E.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 f=o!==n.state,m=c!==n.unreadCompletions;if((f||m)&&$a(e,{...n,state:o,unreadCompletions:c}),m&&Vm(),h)for(const p of Array.from(tm))p({agentId:e,...h})}function dN(e,t){for(const n of e.workspaces)for(const a of n.tabs)if(Ts(a.root).includes(t))return{workspace:n,tab:a};return null}const im=new Set;function fN(e){return im.add(e),()=>{im.delete(e)}}function pN(){let e=0;for(const t of ur.values())e+=t.unreadCompletions.size;return e}function Vm(){for(const e of Array.from(im))e()}function mN(e,t){const n=It(e);if(!n.unreadCompletions.has(t))return;const a=new Set(n.unreadCompletions);a.delete(t),$a(e,{...n,unreadCompletions:a}),Vm()}function RS(e,t){const n=It(e);t!==n.state&&$a(e,{...n,state:t})}function MS(e,t){const n=It(e),a=t(n.editors);a!==n.editors&&$a(e,{...n,editors:a})}function Ar(e,t,n){const a=It(e);a.loaded===t&&a.error===n||$a(e,{...a,loaded:t,error:n})}function iu(e,t,n){const a=It(e);a.layoutRevision===t&&a.lastPersistedLayoutJson===n||$a(e,{...a,layoutRevision:t,lastPersistedLayoutJson:n})}function _N(e){const t=It(e);return t.mutable.editorIdCounter+=1,t.mutable.editorIdCounter}function vN(e){const t=Wa(e),n=ur.get(t);n&&n.mutable.saveCoord.saveTimer!==null&&window.clearTimeout(n.mutable.saveCoord.saveTimer);const a=n?n.unreadCompletions.size>0:!1;ur.delete(t),wo.delete(t),Co.delete(t),a&&Vm()}function NS(){for(const e of ur.values()){const t=e.mutable.saveCoord.saveTimer;t!==null&&window.clearTimeout(t),e.unreadCompletions.size>0}ur.clear(),wo.clear(),Co.clear()}function gN(e){let t=Co.get(e);return t||(t=new Set,Co.set(e,t)),t}function sm(e,t){let n=!1,a=!1,o=null,c=!1;for(const h of $u(e)){const f=t[h];if(f){if(f.status==="exited"){c=!0,n=!0;continue}f.activity==="busy"?(a=!0,n=!0,!o&&f.currentCommand&&(o=f.currentCommand)):f.activity==="idle"&&(n=!0)}}return n?c?{state:"exited",commandName:null}:a?{state:"busy",commandName:o}:{state:"idle",commandName:null}:null}function Xm(e){return e?e.state==="busy"?e.commandName?`running: ${e.commandName}`:"running":e.state==="exited"?"exited":"idle":""}function nm(e,t){const n=t[e.activeTerminalId];return e.title||n?.title||e.activeTerminalId}function yN(e,t,n,a){return a?.state==="busy"?a.commandName?`running: ${a.commandName}`:"running":a?.state==="exited"?"exited":t[e.activeTerminalId]?.cwd||`${n} pane${n===1?"":"s"}`}function bN({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,onSelectTab:c,onCreateTab:h,onToggleWorkspaces:f,onCloseTerminals:m,onReattachTerminal:p,onDeleteTerminal:b,onSplitVertical:y,onSplitHorizontal:w,onRenameTab:x,activePaneAvailable:E}){const[T,O]=g.useState(null),[D,Y]=g.useState(!1),[F,G]=g.useState(null),re=g.useRef(null),ee=e.findIndex(B=>B.id===t),J=ee>=0?e[ee]:e[0]??null,oe=J?sm(J,n):null,de=J?Vp(J):0,A=J?nm(J,n):"No tab";g.useEffect(()=>{re.current?.focus(),re.current?.select()},[T?.tabId]),g.useEffect(()=>{if(!D)return;const B=Q=>{Q.key==="Escape"&&Y(!1)};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[D]),g.useEffect(()=>{D&&e.length===0&&Y(!1)},[D,e.length]);function P(B,Q){O({tabId:B,title:Q})}function K(){if(!T)return;const B=T.title.trim();B&&x(T.tabId,B),O(null)}function j(){return _.jsxs("div",{className:"terminal-pane-actions","aria-label":"Pane actions",children:[_.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split right",title:`Split right - ${g2()}`,onClick:y,disabled:!E,children:_.jsx("span",{className:"split-icon split-icon-right","aria-hidden":"true"})}),_.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split down",title:`Split down - ${y2()}`,onClick:w,disabled:!E,children:_.jsx("span",{className:"split-icon split-icon-down","aria-hidden":"true"})})]})}return _.jsxs(_.Fragment,{children:[_.jsxs("nav",{className:"terminal-tabs","aria-label":"Terminal tabs",children:[_.jsx("button",{type:"button",className:"mobile-menu-button","aria-label":"Toggle workspaces",title:"Workspaces",onClick:f,children:_.jsxs("span",{className:"hamburger-lines","aria-hidden":"true",children:[_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{})]})}),_.jsxs("button",{type:"button",className:"mobile-tab-current-button","aria-label":"Open tab switcher",title:A,onClick:()=>Y(!0),disabled:e.length===0,children:[oe?_.jsx("span",{className:"terminal-tab-status-dot","data-activity":oe.state,"aria-hidden":"true",title:Xm(oe)}):null,_.jsx("span",{children:A}),_.jsxs("small",{children:[ee>=0?ee+1:0,"/",e.length||0,de>1?` / ${de}`:""]})]}),_.jsxs("div",{className:"terminal-tab-list",children:[e.map((B,Q)=>{const N=$u(B),I=Vp(B),X=nm(B,n),ve=B.id===t,Se=T?.tabId===B.id,R=sm(B,n),V=a?.has(B.id)??!1;return _.jsxs(ii.Fragment,{children:[_.jsx(AS,{index:Q}),_.jsx(SN,{tab:B,active:ve,editing:Se,title:X,paneCount:I,terminalIds:N,canClose:e.length>1,editValue:Se?T.title:null,editInputRef:Se?re:null,activity:R,unread:V,onSelect:()=>c(B.id),onBeginRename:()=>P(B.id,X),onCloseAll:()=>m(N),onCommitRename:K,onCancelRename:()=>O(null),onRenameChange:se=>O({tabId:B.id,title:se})})]},B.id)}),_.jsx(AS,{index:e.length}),_.jsx("button",{type:"button",className:"tab-add-button","aria-label":"New tab",title:"New tab",onClick:h,children:"+"}),(o?.length??0)>0?_.jsx("div",{className:"terminal-detached-pills","aria-label":"Detached terminals",children:(o??[]).map(B=>_.jsx(CN,{terminal:B,onReattach:()=>p?.(B.id),onDelete:()=>G(B)},B.id))}):null]}),_.jsx("button",{type:"button",className:"mobile-tab-add-button","aria-label":"Create new tab",title:"New tab",onClick:h,children:"+"}),E?j():null]}),D?_.jsx(wN,{tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:T,editInputRef:re,onClose:()=>Y(!1),onSelectTab:B=>{c(B),Y(!1)},onCreateTab:()=>{h(),Y(!1)},onBeginRename:P,onCloseTerminals:B=>{m(B),Y(!1)},onCommitRename:K,onCancelRename:()=>O(null),onRenameChange:(B,Q)=>O({tabId:B,title:Q}),onReattachTerminal:B=>{p?.(B),Y(!1)},onDeleteTerminal:B=>{G(B),Y(!1)}}):null,F?_.jsx(xN,{terminal:F,onCancel:()=>G(null),onConfirm:()=>{b?.(F.id),G(null)}}):null]})}function SN({tab:e,active:t,editing:n,title:a,paneCount:o,canClose:c,editValue:h,editInputRef:f,activity:m,unread:p,onSelect:b,onBeginRename:y,onCloseAll:w,onCommitRename:x,onCancelRename:E,onRenameChange:T}){const{attributes:O,listeners:D,setNodeRef:Y,transform:F,isDragging:G}=u0({id:`tab-${e.id}`,data:{kind:"tab",tabId:e.id,terminalId:e.activeTerminalId},disabled:n}),re={transform:Of.Translate.toString(F),opacity:G?.4:void 0,zIndex:G?2:void 0};return _.jsxs("div",{ref:Y,className:"terminal-tab","data-active":t,"data-dragging":G,"data-unread":p?"true":void 0,style:re,...O,...D,children:[m?_.jsx("span",{className:"terminal-tab-status-dot","data-activity":m.state,"aria-hidden":"true",title:Xm(m)}):null,n&&f&&h!==null?_.jsxs("form",{className:"terminal-tab-editor",onSubmit:ee=>{ee.preventDefault(),x()},children:[_.jsx("input",{ref:f,"aria-label":`Rename ${a}`,value:h,onBlur:x,onChange:ee=>T(ee.target.value),onKeyDown:ee=>{if(ee.key==="Enter"){ee.preventDefault(),x();return}ee.key==="Escape"&&(ee.preventDefault(),E())}}),_.jsx("small",{children:o})]}):_.jsxs("button",{type:"button",className:"terminal-tab-select","aria-label":`Select ${a}`,title:a,onClick:b,onDoubleClick:ee=>{ee.preventDefault(),y()},children:[_.jsx("span",{children:a}),_.jsxs("small",{children:[o," pane",o===1?"":"s"]})]}),c&&!n?_.jsx("button",{type:"button",className:"icon-button","aria-label":`Close ${a}`,title:`Close ${a}`,onPointerDown:ee=>ee.stopPropagation(),onClick:ee=>{ee.stopPropagation(),w()},children:"x"}):null]})}function wN({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:c,editInputRef:h,onClose:f,onSelectTab:m,onCreateTab:p,onBeginRename:b,onCloseTerminals:y,onCommitRename:w,onCancelRename:x,onRenameChange:E,onReattachTerminal:T,onDeleteTerminal:O}){const D=g.useRef(null);return g.useEffect(()=>{D.current?.scrollIntoView?.({block:"nearest"})},[t]),_.jsx("div",{className:"mobile-tab-sheet-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"mobile-tab-sheet-title",onClick:f,children:_.jsxs("section",{className:"mobile-tab-sheet",onClick:Y=>Y.stopPropagation(),children:[_.jsxs("header",{children:[_.jsxs("div",{children:[_.jsx("strong",{id:"mobile-tab-sheet-title",children:"Switch Tabs"}),_.jsxs("small",{children:[e.length," open"]})]}),_.jsxs("div",{className:"mobile-tab-sheet-header-actions",children:[_.jsx("button",{type:"button","aria-label":"New tab",title:"New tab",onClick:p,children:"+"}),_.jsx("button",{type:"button","aria-label":"Close tab switcher",title:"Close",onClick:f,children:"×"})]})]}),_.jsxs("div",{className:"mobile-tab-sheet-list",children:[e.map((Y,F)=>{const G=$u(Y),re=Vp(Y),ee=nm(Y,n),J=Y.id===t,oe=c?.tabId===Y.id,de=sm(Y,n),A=a?.has(Y.id)??!1;return _.jsxs("div",{ref:J?D:null,className:"mobile-tab-sheet-row","data-active":J,"data-unread":A?"true":void 0,children:[oe&&c?_.jsx("form",{className:"mobile-tab-sheet-editor",onSubmit:P=>{P.preventDefault(),w()},children:_.jsx("input",{ref:h,"aria-label":`Rename ${ee}`,value:c.title,onBlur:w,onChange:P=>E(Y.id,P.target.value),onKeyDown:P=>{if(P.key==="Enter"){P.preventDefault(),w();return}P.key==="Escape"&&(P.preventDefault(),x())}})}):_.jsxs("button",{type:"button",className:"mobile-tab-sheet-select","aria-label":`Switch to ${ee}`,onClick:()=>m(Y.id),children:[_.jsx("span",{className:"mobile-tab-sheet-index",children:F+1}),_.jsxs("span",{className:"mobile-tab-sheet-copy",children:[_.jsx("strong",{children:ee}),_.jsx("small",{children:yN(Y,n,re,de)})]}),_.jsxs("span",{className:"mobile-tab-sheet-meta",children:[de?_.jsx("span",{className:"terminal-tab-status-dot","data-activity":de.state,"aria-hidden":"true",title:Xm(de)}):null,_.jsx("span",{children:re})]})]}),_.jsxs("div",{className:"mobile-tab-sheet-actions",children:[oe?_.jsx("button",{type:"button","aria-label":`Done renaming ${ee}`,onClick:w,children:"Done"}):_.jsx("button",{type:"button","aria-label":`Rename ${ee}`,onClick:()=>b(Y.id,ee),children:"Rename"}),e.length>1?_.jsx("button",{type:"button",className:"mobile-tab-sheet-close","aria-label":`Close ${ee}`,onClick:()=>y(G),children:"×"}):null]})]},Y.id)}),(o?.length??0)>0?_.jsxs("div",{className:"mobile-tab-sheet-detached","aria-label":"Detached terminals",children:[_.jsx("span",{children:"Detached"}),(o??[]).map(Y=>{const F=Y.title||Y.cwd||Y.id.slice(0,8);return _.jsxs("div",{className:"mobile-tab-sheet-row mobile-tab-sheet-row-detached",children:[_.jsxs("button",{type:"button",className:"mobile-tab-sheet-select","aria-label":`Re-open ${F}`,onClick:()=>T(Y.id),children:[_.jsx("span",{className:"mobile-tab-sheet-index",children:"+"}),_.jsxs("span",{className:"mobile-tab-sheet-copy",children:[_.jsx("strong",{children:F}),_.jsx("small",{children:Y.cwd})]}),_.jsx("span",{className:"mobile-tab-sheet-type",children:"detached"})]}),_.jsx("div",{className:"mobile-tab-sheet-actions",children:_.jsx("button",{type:"button",className:"mobile-tab-sheet-close","aria-label":`Delete ${F}`,onClick:()=>O(Y),children:"×"})})]},Y.id)})]}):null]})]})})}function AS({index:e}){const{setNodeRef:t,isOver:n}=h0({id:`tab-position-${e}`,data:{kind:"tab-position",index:e}});return _.jsx("div",{ref:t,className:"terminal-tab-drop-slot","data-over":n,"aria-hidden":"true"})}function CN({terminal:e,onReattach:t,onDelete:n}){const a=e.title||e.cwd||e.id.slice(0,8),o=`${e.title||"Terminal"}
|
|
53
|
-
${e.cwd}
|
|
54
|
-
(detached — click to re-open, × to delete)`;return _.jsxs("span",{className:"terminal-detached-pill",title:o,children:[_.jsx("button",{type:"button",className:"terminal-detached-pill-open","aria-label":`Re-open ${a}`,onClick:t,children:a}),_.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 xN({terminal:e,onCancel:t,onConfirm:n}){const a=e.title||e.cwd||e.id.slice(0,8);return _.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"delete-terminal-title",onClick:t,children:_.jsxs("div",{className:"security-panel terminal-delete-dialog",onClick:o=>o.stopPropagation(),children:[_.jsxs("header",{className:"security-panel-header",children:[_.jsx("h2",{id:"delete-terminal-title",children:"Delete Terminal"}),_.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:t,children:"×"})]}),_.jsxs("section",{className:"terminal-delete-dialog-body",children:[_.jsx("p",{children:"Delete this terminal?"}),_.jsx("span",{children:a}),_.jsx("small",{children:"The shell session and scrollback will be destroyed."})]}),_.jsxs("div",{className:"terminal-delete-dialog-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:t,children:"Cancel"}),_.jsx("button",{type:"button",className:"terminal-delete-confirm",onClick:n,children:"Delete"})]})]})})}function EN({uploads:e,onDismiss:t,onDismissAll:n,onRetry:a,onCancel:o}){if(e.length===0)return null;const h=e.some(m=>m.status==="failed"||m.status==="partial")?"alert":"status",f=e.filter(m=>m.status==="queued"||m.status==="uploading").length;return _.jsxs("aside",{className:`upload-toast upload-toast-${MN(e)}`,role:h,"aria-live":h==="alert"?"assertive":"polite",children:[_.jsxs("header",{className:"upload-toast-header",children:[_.jsx("strong",{children:e.length===1?du(e[0]):`Uploads ${f>0?`(${f} active)`:`(${e.length})`}`}),_.jsx("button",{type:"button","aria-label":"Dismiss upload status",onClick:n,children:"x"})]}),_.jsx("div",{className:"upload-toast-body upload-queue-body",children:e.map(m=>_.jsx(TN,{upload:m,compact:e.length>1,onDismiss:()=>t(m.id),onRetry:()=>a(m.id),onCancel:()=>o(m.id)},m.id))})]})}function TN({upload:e,compact:t,onDismiss:n,onRetry:a,onCancel:o}){const c="response"in e?e.response:void 0,h=e.status==="failed"||e.status==="partial",f=e.status==="queued"||e.status==="uploading";return _.jsxs("section",{className:"upload-queue-item","data-status":e.status,"aria-label":du(e),children:[_.jsxs("div",{className:"upload-queue-item-header",children:[_.jsx("strong",{children:du(e)}),_.jsxs("div",{className:"upload-queue-actions",children:[f?_.jsx("button",{type:"button",onClick:o,children:"Cancel"}):null,h?_.jsx("button",{type:"button",onClick:a,children:"Retry"}):null,_.jsx("button",{type:"button","aria-label":`Dismiss ${du(e)}`,onClick:n,children:"x"})]})]}),e.status==="queued"?_.jsx("p",{children:e.message??"Queued"}):null,e.status==="uploading"?_.jsx(kN,{toast:e}):null,c&&"message"in e&&e.message?_.jsx("p",{className:"upload-toast-muted",children:e.message}):null,c?_.jsx(DN,{response:c,compact:t}):null,e.status==="failed"&&!c&&e.message?_.jsx("p",{children:e.message}):null]})}function kN({toast:e}){const t=e.percent===null?NN(e.loaded):`${e.percent}%`;return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"upload-progress-row",children:[_.jsxs("span",{children:[e.fileCount," file",e.fileCount===1?"":"s"]}),_.jsx("span",{children:t})]}),_.jsx("div",{className:"upload-progress-track","aria-hidden":"true",children:_.jsx("span",{style:{width:e.percent===null?"100%":`${e.percent}%`}})})]})}function DN({response:e,compact:t}){const n=e.results.filter(h=>h.status==="failed"),a=e.results.filter(h=>h.status==="uploaded"),o=t?3:6,c=[...n,...a].slice(0,o);return _.jsxs(_.Fragment,{children:[_.jsx("p",{className:"upload-toast-destination",children:e.destinationCwd}),c.length>0?_.jsx("ul",{className:"upload-result-list",children:c.map((h,f)=>_.jsx(RN,{result:h},`${h.relativePath}-${f}`))}):null,e.results.length>c.length?_.jsxs("p",{className:"upload-toast-muted",children:["+",e.results.length-c.length," more"]}):null]})}function RN({result:e}){const t=e.savedRelativePath??e.relativePath,n=e.status==="uploaded"&&e.savedRelativePath!==void 0&&e.savedRelativePath!==e.relativePath;return _.jsxs("li",{"data-status":e.status,children:[_.jsx("span",{className:"upload-result-path",children:t}),n?_.jsx("span",{className:"upload-result-renamed",children:"renamed"}):null,e.status==="failed"&&e.error?_.jsx("span",{className:"upload-result-error",children:e.error}):null]})}function du(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 MN(e){return e.some(t=>t.status==="failed")?"failed":e.some(t=>t.status==="partial")?"partial":e.some(t=>t.status==="uploading")?"uploading":e.some(t=>t.status==="queued")?"queued":"success"}function NN(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`}function AN({toast:e,onActivate:t,onDismiss:n}){if(!e)return null;const a=e,o=a.commandName?`${a.commandName} finished`:"Command finished";function c(f){f.stopPropagation(),n()}function h(f){f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),t(a))}return _.jsxs("aside",{className:"completion-toast",role:"status","aria-live":"polite",tabIndex:0,onClick:()=>t(a),onKeyDown:h,children:[_.jsx("video",{className:"completion-toast-character",src:a.assetSrc,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),_.jsxs("div",{className:"completion-toast-copy",children:[_.jsx("strong",{children:a.tabTitle}),_.jsx("span",{children:o})]}),_.jsx("button",{type:"button","aria-label":"Dismiss completion alert",onClick:c,children:"x"})]})}const LN=to(0,0,1,1),gn=1e-6;function BN(e){return Zw(e).map(t=>t.terminalId)}function Zw(e){return eo(e,LN).sort(HN).map((t,n)=>({...t,index:n+1}))}function ON(e,t,n){const a=Zw(e),o=a.find(h=>h.terminalId===t);return o?a.filter(h=>h.terminalId!==t).map(h=>jN(o,h,n)).filter(h=>h!==null).sort(UN)[0]?.entry.terminalId??null:null}function zN(e,t){return!Number.isInteger(t)||t<1?null:BN(e)[t-1]??null}function eo(e,t){if(e.type==="pane")return[{terminalId:e.terminalId,bounds:t}];if(e.type==="editor")return[];const n=PN(e.ratio);if(e.direction==="vertical"){const o=t.left+(t.right-t.left)*n;return[...eo(e.first,to(t.left,t.top,o,t.bottom)),...eo(e.second,to(o,t.top,t.right,t.bottom))]}const a=t.top+(t.bottom-t.top)*n;return[...eo(e.first,to(t.left,t.top,t.right,a)),...eo(e.second,to(t.left,a,t.right,t.bottom))]}function jN(e,t,n){const a=e.bounds,o=t.bounds,c=LS(a.left,a.right,o.left,o.right),h=LS(a.top,a.bottom,o.top,o.bottom);switch(n){case"left":return o.centerX>=a.centerX-gn||h<=gn?null:{entry:t,primaryDistance:Math.max(0,a.left-o.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:h};case"right":return o.centerX<=a.centerX+gn||h<=gn?null:{entry:t,primaryDistance:Math.max(0,o.left-a.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:h};case"up":return o.centerY>=a.centerY-gn||c<=gn?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+gn||c<=gn?null:{entry:t,primaryDistance:Math.max(0,o.top-a.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};default:return null}}function HN(e,t){return Ba(e.bounds.top,t.bounds.top)||Ba(e.bounds.left,t.bounds.left)}function UN(e,t){return Ba(e.primaryDistance,t.primaryDistance)||Ba(e.perpendicularDistance,t.perpendicularDistance)||Ba(t.overlap,e.overlap)||Ba(e.entry.index,t.entry.index)}function Ba(e,t){const n=e-t;return Math.abs(n)<=gn?0:n}function LS(e,t,n,a){return Math.max(0,Math.min(t,a)-Math.max(e,n))}function to(e,t,n,a){return{left:e,top:t,right:n,bottom:a,centerX:e+(n-e)/2,centerY:t+(a-t)/2}}function PN(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}class KN extends Error{constructor(t){super(t),this.name="UploadDropError"}}function BS(e){return e?Array.from(e.types??[]).includes("Files")||t1(e.items).some(n=>n.kind==="file")?!0:i1(e.files).length>0:!1}async function IN(e){const t=t1(e.items).filter(n=>n.kind==="file");return t.length>0?FN(t):qN(e.files)}async function FN(e){const t=[];for(const n of e){const a=VN(n);if(a){await Qw(a,"",t);continue}const o=n.getAsFile();if(o){t.push({relativePath:Jw(o),file:o});continue}throw new KN("Folder upload is not supported by this browser.")}return t}function qN(e){return i1(e).map(t=>({relativePath:Jw(t),file:t}))}async function Qw(e,t,n){const a=GN(t,e.name);if(e.isFile){const h=await WN(e);n.push({relativePath:a,file:h});return}if(!e.isDirectory)return;const o=e.createReader(),c=await $N(o);for(const h of c)await Qw(h,a,n)}function WN(e){return new Promise((t,n)=>{e.file(t,a=>n(a))})}async function $N(e){const t=[];for(;;){const n=await YN(e);if(n.length===0)return t;t.push(...n)}}function YN(e){return new Promise((t,n)=>{e.readEntries(t,a=>n(a))})}function Jw(e){const t=e.webkitRelativePath;return e1(typeof t=="string"&&t?t:e.name)}function VN(e){const t=e.webkitGetAsEntry?.();return XN(t)?t:null}function XN(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 GN(e,t){return e1(e?`${e}/${t}`:t)}function e1(e){return e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).join("/")}function t1(e){return e?Array.from(e):[]}function i1(e){return e?Array.from(e):[]}const OS="nterminal.terminalWorkspaces.v2",s1="nterminal.sidebarCollapsed.v1",ZN=75,zS=f0.map(e=>e.url),QN=f0[0].url;function JN({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a,sessionExpiresAt:o=null,onLogout:c=async()=>{},onSessionInvalid:h}){const f=g.useMemo(()=>e??Bu(),[e]),m=g.useMemo(()=>t??co(null),[t]),p=g.useMemo(()=>dA(n),[n]),b=g.useMemo(()=>C=>Gw(n,C),[n]),y=g.useMemo(()=>()=>It(n),[n]),w=g.useSyncExternalStore(b,y,y),x=w.state,E=w.editors,T=!w.loaded,O=w.error,[D,Y]=g.useState(!1),[F,G]=g.useState(()=>vA()),[re,ee]=g.useState("servers"),[J,oe]=g.useState(!1),de=g.useSyncExternalStore(A2,lb,lb);g.useSyncExternalStore(E0,ab,ab);const[A,P]=g.useState(0),[K,j]=g.useState(()=>[null]),[B,Q]=g.useState(0),[N,I]=g.useState(()=>[n]),[X,ve]=g.useState(()=>new Set),[Se,R]=g.useState({}),[V,se]=g.useState(null),he=g.useRef(null);g.useRef(!1);const ye=g.useRef(0),[me,fe]=g.useState(null),Me=zx(Ky(r0,{activationConstraint:{distance:8}}),Ky(a0,{activationConstraint:{delay:250,tolerance:5}}));g.useEffect(()=>L2(f),[f]);function Re(C){const k=C.active.data.current;if(k){if(k.kind==="tab"&&typeof k.tabId=="string"&&typeof k.terminalId=="string"){fe({tabId:k.tabId,terminalId:k.terminalId});return}k.kind==="pane"&&typeof k.sourceTabId=="string"&&typeof k.terminalId=="string"&&fe({tabId:k.sourceTabId,terminalId:k.terminalId})}}function Ne(C){fe(null);const k=C.active.data.current,H=C.over?.data.current;if(!(!k||!H||typeof k.terminalId!="string")){if(k.kind==="tab"&&typeof k.tabId=="string"){if(H.kind==="tab-position"&&typeof H.index=="number"){st({type:"tab.reordered",sourceTabId:k.tabId,targetIndex:H.index});return}H.kind==="pane-zone"&&typeof H.terminalId=="string"&&(H.side==="top"||H.side==="right"||H.side==="bottom"||H.side==="left")&&st({type:"tab.dropped_into_pane",sourceTabId:k.tabId,sourceTerminalId:k.terminalId,targetTerminalId:H.terminalId,side:H.side});return}if(k.kind==="pane"&&typeof k.sourceTabId=="string"){if(H.kind==="tab-position"&&typeof H.index=="number"){st({type:"terminal.extracted_to_tab",sourceTabId:k.sourceTabId,sourceTerminalId:k.terminalId,targetIndex:H.index});return}H.kind==="pane-zone"&&typeof H.terminalId=="string"&&(H.side==="top"||H.side==="right"||H.side==="bottom"||H.side==="left")&&st({type:"tab.dropped_into_pane",sourceTabId:k.sourceTabId,sourceTerminalId:k.terminalId,targetTerminalId:H.terminalId,side:H.side})}}}function Fe(){fe(null)}const Oe=x.workspaces.find(C=>C.id===x.activeWorkspaceId)??x.workspaces[0],we=Oe?.tabs.find(C=>C.id===Oe.activeTabId)??Oe?.tabs[0],ne=we?.activeTerminalId??null,Ee=ne?x.terminals[ne]:void 0,Te=cA("(max-width: 760px)"),je=g.useMemo(()=>we?Au(we.root):[],[we]),Ue=Oe&&we?pu(n,Oe.id,we.id):null,_t=we?n1(je,we.activeTerminalId,Ue?Se[Ue]:void 0):null,rt=Te&&je.length>1,Ci=g.useMemo(()=>{const C=new Set;for(const k of x.workspaces)for(const H of k.tabs)for(const ae of $u(H))C.add(ae);return Object.values(x.terminals).filter(k=>!C.has(k.id))},[x.terminals,x.workspaces]),[te,Pe]=g.useState([]),Le=g.useRef([]),bt=g.useRef(null),[xi,Ei]=g.useState(null),[ni,us]=g.useState([]),[Li,Pi]=g.useState(()=>Hr()),zs=g.useRef(0),fi=g.useRef(n),Ct=g.useRef(zS),pi=g.useRef(Li),xt=g.useRef(()=>{});xt.current=Zt;const Xs=g.useCallback(async()=>{try{const C=await f.listNotificationAssets();us(C.assets.filter(k=>k.enabled).map(k=>k.url))}catch{us([])}},[f]);g.useEffect(()=>{I(C=>C.some(k=>_n(k,n))?C:[...C,n])},[n]);const hs=g.useCallback(C=>{const k=It(C),H=co(C);for(const ae of Object.keys(k.state.terminals))Ip(H.createWebSocketUrl(ae)),dS(ae);vN(C),I(ae=>ae.filter(pe=>!_n(pe,C))),ve(ae=>{const pe=`${fu(C)}:`;let ke=!1;const ge=new Set;for(const Qe of ae){if(Qe.startsWith(pe)){ke=!0;continue}ge.add(Qe)}return ke?ge:ae}),R(ae=>{const pe=`${fu(C)}:`;let ke=!1;const ge={};for(const[Qe,Je]of Object.entries(ae)){if(Qe.startsWith(pe)){ke=!0;continue}ge[Qe]=Je}return ke?ge:ae})},[]);g.useEffect(()=>{let C=!1;return f.listAgents().then(k=>{if(!C){const H=k.agents.map(pe=>pe.id),ae=[null,...H];n!==null&&!H.includes(n)&&(hs(n),a?.(null)),j(ae)}}).catch(()=>{}),()=>{C=!0}},[n,f,hs,a,B]);const hr=g.useCallback(C=>{hs(C),Q(k=>k+1),_n(C,fi.current)&&a?.(null)},[hs,a]);g.useEffect(()=>{j(C=>C.some(k=>_n(k,n))?C:[...C,n])},[n]),g.useEffect(()=>{fi.current=n},[n]),g.useEffect(()=>{Xs()},[Xs]),g.useEffect(()=>v0(()=>Pi(Hr())),[]),g.useEffect(()=>{const C=k=>{xt.current(k)};return window.addEventListener("keydown",C,!0),()=>window.removeEventListener("keydown",C,!0)},[]),g.useEffect(()=>{Ct.current=ni.length>0?ni:zS},[ni]),g.useEffect(()=>{pi.current=Li},[Li]),g.useEffect(()=>{if(!w.loaded||!Oe||!we)return;const C=pu(n,Oe.id,we.id);ve(k=>{if(k.has(C))return k;const H=new Set(k);return H.add(C),H})},[n,w.loaded,Oe?.id,we?.id]),g.useEffect(()=>()=>{Ya()},[]),g.useEffect(()=>hN(C=>{const k=It(C.agentId).state,H=k.workspaces.flatMap(ge=>ge.tabs).find(ge=>ge.id===C.tabId),ae=k.terminals[C.terminalId],pe=H?.title?.trim()||ae?.title||C.commandName||"terminal",ke=document.visibilityState==="visible"&&_n(C.agentId,fi.current)&&C.tabId===hA(k);if(ke||o2({tabTitle:pe,commandName:C.commandName,terminalId:C.terminalId}),!ke&&document.visibilityState==="visible"&&pi.current.enabled){const ge=zs.current+1;zs.current=ge;const Qe=Ct.current;Ei({id:ge,agentId:C.agentId,terminalId:C.terminalId,tabId:C.tabId,tabTitle:pe,commandName:C.commandName,assetSrc:Qe[Math.floor(Math.random()*Qe.length)]??QN})}}),[]),g.useEffect(()=>{if(!xi||Li.persistUntilDismissed)return;const C=window.setTimeout(()=>{Ei(k=>k?.id===xi.id?null:k)},Li.durationSeconds*1e3);return()=>window.clearTimeout(C)},[xi,Li]),g.useEffect(()=>{he.current?.focus(),he.current?.select()},[V?.workspaceId]),g.useEffect(()=>{gA(F),F&&se(null)},[F]),g.useEffect(()=>{let C=!1;async function k(){if(!It(n).loaded){Ar(n,!1,null);try{const ae=fA(p),[pe,ke]=await Promise.all([m.listTerminals(),m.getTerminalLayout()]),ge=pe.terminals.length>0?pe.terminals:[(await m.createTerminal({cols:80,rows:24})).terminal];if(!C){const Qe=ke.layout?a1(ke.layout):null,Je=Qe??ae??{},Ri=Yp(ge,void 0,Je.savedWorkspaces,Je.savedActiveWorkspaceId),vi=Af(Ri);RS(n,Ri),iu(n,ke.revision,JSON.stringify(vi)),Ar(n,!0,null),!Qe&&ae&&Oi(vi,{baseRevision:ke.revision})}}catch(ae){!C&&!it(ae)&&Ar(n,!0,Yl(ae))}}}return k(),()=>{C=!0}},[n,m,A]);function ks(){Ar(n,!1,null),P(C=>C+1)}async function Bi(){await Rt(async()=>{const C=await m.createTerminal({cols:80,rows:24});st({type:"terminal.created",terminal:C.terminal})})}async function dt(C){await Rt(async()=>{const k=ne?{parentTerminalId:ne,cols:80,rows:24}:{cols:80,rows:24},H=await m.createTerminal(k);st({type:"terminal.split",terminal:H.terminal,direction:C})})}async function mt(C){if(!ne)throw new Error("No active pane is available.");const k=await m.readFile(C),H=`editor-${Date.now().toString(36)}-${_N(n)}`,ae=_A(k.path);MS(n,pe=>({...pe,[H]:{id:H,title:ae,rootToken:C.rootToken,path:k.path,read:k}})),Ue&&R(pe=>({...pe,[Ue]:r1(H)})),st({type:"editor.split",editorId:H,title:ae,direction:"vertical"})}function Et(C){MS(n,k=>{const H={...k};return delete H[C],H}),st({type:"editor.closed",editorId:C})}function jt(C){Gt([C])}function Gt(C){for(const k of C)st({type:"terminal.detached",terminalId:k})}async function Ht(C){await Rt(async()=>{await Tt(C),Ip(m.createWebSocketUrl(C)),dS(C),st({type:"terminal.closed",terminalId:C})})}async function ri(C,k){const H=k.trim();if(!H)return;let ae=null;for(const pe of x.workspaces){const ke=pe.tabs.find(ge=>ge.id===C);if(ke){ae=ke.activeTerminalId;break}}if(st({type:"tab.renamed",tabId:C,title:H}),!!ae)try{const pe=await m.renameTerminal(ae,H);Di({type:"terminal.updated",terminal:pe.terminal})}catch(pe){Ar(n,!0,Yl(pe))}}function Ti(C){const k=x.terminals[C];k&&st({type:"terminal.created",terminal:k})}async function Tt(C){try{await m.closeTerminal(C)}catch(k){if(k instanceof bn&&k.status===404)return;throw k}}async function ki(){await Rt(async()=>{await c()})}async function Rt(C){Ar(n,!0,null);try{await C()}catch(k){if(it(k))return;Ar(n,!0,Yl(k))}}function it(C){return C instanceof bn&&C.status===401&&!m.isAgent&&h?(h(),!0):!1}function st(C){Wl(n,C);const k=It(n),H=k.state;if(!k.loaded||H.workspaces.length===0)return;const ae=Af(H);JSON.stringify(ae)!==k.lastPersistedLayoutJson&&Ji(ae)}function Di(C){Wl(n,C)}function Ft(C,k,H,ae){const pe=pu(C,k,H);R(ke=>({...ke,[pe]:ae}))}function Mt(C){Ue&&R(k=>({...k,[Ue]:C}))}function mi(C,k){const H=Lu(C);k?Ft(n,k.workspaceId,k.tabId,H):Mt(H),st({type:"pane.selected",terminalId:C})}function Nt(C){Mt(C.key),C.type==="terminal"&&st({type:"pane.selected",terminalId:C.terminalId})}function Zt(C){if(J||C.isComposing||C.key==="Process"||rA(C.target))return;const k=tA(C);if(!k)return;if(C.preventDefault(),C.stopPropagation(),k.type==="server.previous"||k.type==="server.next"){Ds(k.type==="server.next"?1:-1);return}const H=It(n).state,ae=H.workspaces.find(ge=>ge.id===H.activeWorkspaceId)??H.workspaces[0],pe=ae?.tabs.find(ge=>ge.id===ae.activeTabId)??ae?.tabs[0];if(k.type==="split"){if(!pe)return;dt(k.direction);return}if(!ae||!pe)return;if(k.type==="tab.previous"||k.type==="tab.next"){const ge=nA(ae.tabs,pe.id,k.type==="tab.next"?1:-1);ge&&st({type:"tab.selected",tabId:ge.id});return}if(k.type==="tab.index"){const ge=ae.tabs[k.index-1];ge&&st({type:"tab.selected",tabId:ge.id});return}const ke=iA(pe.root,pe.activeTerminalId,k);ke&&mi(ke,{workspaceId:ae.id,tabId:pe.id})}function Ds(C){if(!a||K.length===0)return;const k=K.findIndex(ke=>_n(ke,n)),ae=((k===-1?0:k)+C+K.length)%K.length,pe=K[ae]??null;_n(pe,n)||a(pe)}function dr(C){BS(C.dataTransfer)&&(C.preventDefault(),C.dataTransfer.dropEffect="copy")}function qr(C){if(!BS(C.dataTransfer))return;C.preventDefault();const k=pA(It(n).state),H=ye.current+1;if(ye.current=H,!k){js({id:H,status:"failed",fileCount:0,message:"No active running terminal is available for upload."});return}js({id:H,status:"queued",fileCount:0,terminalId:k.id,message:"Preparing upload..."}),Rs(H,k.id,C.dataTransfer)}async function Rs(C,k,H){try{const ae=await IN(H);if(ae.length===0)throw new Error("No files were found in the drop.");_i(C,{id:C,status:"queued",fileCount:ae.length,message:"Queued"},{terminalId:k,files:ae})}catch(ae){_i(C,{id:C,status:"failed",fileCount:0,message:Yl(ae)},{terminalId:k})}finally{Ki()}}async function xn(C){const k=Le.current.find(ke=>ke.id===C);if(!k?.terminalId||!k.files||k.files.length===0)return;const H=k.terminalId,ae=k.files,pe=new AbortController;bt.current=C,_i(C,{id:C,status:"uploading",fileCount:ae.length,loaded:0,total:null,percent:null},{terminalId:H,files:ae,abortController:pe});try{const ke=await q2({terminalId:H,files:ae,signal:pe.signal,onProgress:Ri=>{_i(C,{id:C,status:"uploading",fileCount:ae.length,loaded:Ri.loaded,total:Ri.total,percent:Ri.percent},{terminalId:H,files:ae,abortController:pe})}}),ge=ke.failed>0?ke.uploaded>0?"partial":"failed":"success",Qe=ke.failed>0?mA(ke):void 0,Je={id:C,status:ge,fileCount:ae.length,response:ke};Qe&&(Je.message=Qe),_i(C,Je,{terminalId:H,files:ae})}catch(ke){_i(C,{id:C,status:"failed",fileCount:ae.length,message:pe.signal.aborted?"Upload canceled.":Yl(ke)},{terminalId:H,files:ae})}finally{bt.current===C&&(bt.current=null),Ki()}}function Ki(){if(bt.current!==null)return;const C=Le.current.find(k=>k.status==="queued");C?.terminalId&&C.files&&C.files.length>0&&xn(C.id)}function js(C){Ii(k=>[...k,C])}function _i(C,k,H={}){Ii(ae=>ae.map(pe=>{if(pe.id!==C)return pe;const ke={...k},ge=H.terminalId??pe.terminalId,Qe=H.files??pe.files;return ge!==void 0&&(ke.terminalId=ge),Qe!==void 0&&(ke.files=Qe),H.abortController!==void 0&&(ke.abortController=H.abortController),ke}))}function Ii(C){const k=C(Le.current);Le.current=k,Pe(k)}function Hs(C){Le.current.find(H=>H.id===C)?.abortController?.abort(),bt.current===C&&(bt.current=null),Ii(H=>H.filter(ae=>ae.id!==C)),Ki()}function Ms(){for(const C of Le.current)C.abortController?.abort();bt.current=null,Ii(()=>[])}function At(C){const k=Le.current.find(H=>H.id===C);if(k){if(k.status==="queued"){Hs(C);return}k.abortController?.abort()}}function Wr(C){const k=Le.current.find(ae=>ae.id===C);if(!k?.terminalId||!k.files||k.files.length===0)return;const H=$r(k);if(H.length===0){_i(C,{id:C,status:"failed",fileCount:k.fileCount,message:"No failed files are available to retry."},{terminalId:k.terminalId,files:k.files});return}_i(C,{id:C,status:"queued",fileCount:H.length,message:"Queued"},{terminalId:k.terminalId,files:H}),Ki()}function $r(C){const k=C.files??[],H="response"in C?C.response:void 0;if(!H)return k;const ae=H.results.filter(ge=>ge.status==="failed").map(ge=>ge.relativePath);if(ae.length===0)return[];const pe=new Map;for(const ge of k){const Qe=pe.get(ge.relativePath)??[];Qe.push(ge),pe.set(ge.relativePath,Qe)}const ke=[];for(const ge of ae){const Je=pe.get(ge)?.shift();Je&&ke.push(Je)}return ke}function Qi(C){const H=It(C.agentId).state.workspaces.find(ae=>ae.tabs.some(pe=>pe.id===C.tabId));H&&Ft(C.agentId,H.id,C.tabId,Lu(C.terminalId)),Wl(C.agentId,{type:"pane.selected",terminalId:C.terminalId}),mN(C.agentId,C.tabId),_n(C.agentId,n)||a?.(C.agentId),Ei(null)}function Ji(C){const k=It(n).mutable.saveCoord;k.pendingLayoutSave=C,$l(C,p),k.saveTimer!==null&&window.clearTimeout(k.saveTimer),k.saveTimer=window.setTimeout(()=>{k.saveTimer=null;const H=k.pendingLayoutSave;k.pendingLayoutSave=null,H&&Oi(H)},ZN)}function Ya(){const C=It(n).mutable.saveCoord;C.saveTimer!==null&&(window.clearTimeout(C.saveTimer),C.saveTimer=null);const k=C.pendingLayoutSave;C.pendingLayoutSave=null,k&&($l(k,p),Oi(k))}function Oi(C,k={}){const H=It(n).mutable.saveCoord;H.nextPersistLayout=C,k.baseRevision!==void 0&&(H.queuedBaseRevision=k.baseRevision),!H.nextPersistQueued&&(H.nextPersistQueued=!0,H.persistChain=H.persistChain.then(async()=>{H.nextPersistQueued=!1;const ae=H.nextPersistLayout,pe=H.queuedBaseRevision;H.nextPersistLayout=null,H.queuedBaseRevision=void 0,ae&&await Yr(ae,pe!==void 0?{baseRevision:pe}:{})}))}async function Yr(C,k={}){const H=It(n),ae=k.baseRevision??H.layoutRevision,pe={layout:C,...typeof ae=="number"?{baseRevision:ae}:{}};try{const ke=await m.saveTerminalLayout(pe),ge=ke.layout??C;iu(n,ke.revision,JSON.stringify(ge)),$l(ge,p);return}catch(ke){if(ke instanceof bn&&ke.status===409)try{const ge=await m.getTerminalLayout();if(ge.layout){const Qe=It(n).state,Je=Yp(Object.values(Qe.terminals),void 0,ge.layout.workspaces,ge.layout.activeWorkspaceId),Ri=Af(Je);RS(n,Je),iu(n,ge.revision,JSON.stringify(Ri)),$l(Ri,p)}else iu(n,ge.revision,H.lastPersistedLayoutJson);return}catch{}$l(C,p)}}const Vr=yA(o),Fi=!F||D,z=Fi?re:"servers";return _.jsx(zE,{sensors:Me,onDragStart:Re,onDragEnd:Ne,onDragCancel:Fe,children:_.jsxs("main",{className:"terminal-shell","data-collapsed":F,"data-sidebar-open":D,onDragOver:dr,onDrop:qr,children:[_.jsx("button",{type:"button",className:"workspace-backdrop","aria-label":"Close workspaces",onClick:()=>Y(!1)}),_.jsxs("aside",{className:"workspace-sidebar",children:[_.jsxs("header",{className:"workspace-brand",children:[Fi?_.jsx(qS,{height:20}):_.jsx(FS,{size:24}),_.jsx("button",{type:"button",className:"sidebar-collapse-button","aria-label":F?"Expand sidebar":"Collapse sidebar",title:F?"Expand sidebar":"Collapse sidebar",onClick:()=>G(C=>!C),children:F?">":"<"}),_.jsx("button",{type:"button",className:"sidebar-drawer-close-button","aria-label":"Close workspaces",title:"Close workspaces",onClick:()=>Y(!1),children:"x"})]}),_.jsxs("div",{className:`workspace-sidebar-content workspace-sidebar-content--${z==="files"?"files":"servers"}`,children:[Fi?_.jsxs("div",{className:"workspace-sidebar-tabs",role:"tablist","aria-label":"Sidebar mode",children:[_.jsx("button",{type:"button",role:"tab","aria-selected":re==="servers",onClick:()=>{ee("servers"),se(null)},children:"Servers"}),_.jsx("button",{type:"button",role:"tab","aria-selected":re==="files",onClick:()=>{ee("files"),se(null)},children:"Files"})]}):null,z==="servers"&&Fi?_.jsx("nav",{className:"workspace-nav","aria-label":"Servers",children:_.jsx(uf,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:B})}):null,Fi?null:_.jsx("nav",{className:"workspace-nav workspace-nav--collapsed","aria-label":"Servers",children:_.jsx(uf,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:B,compact:!0})}),z==="files"?_.jsxs(_.Fragment,{children:[Fi?_.jsx("nav",{className:"workspace-nav workspace-nav--compact","aria-label":"Servers",children:_.jsx(uf,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:B})}):null,_.jsx(X2,{api:m,activeTerminalId:ne,activeTerminalCwd:Ee?.cwd??null,onOpenFile:mt})]}):null]}),Fi?_.jsxs("div",{className:"workspace-sidebar-footer",children:[_.jsx("span",{children:Vr}),_.jsxs("div",{className:"workspace-sidebar-footer-actions",children:[_.jsxs("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"settings",title:"Settings",onClick:()=>oe(!0),children:[_.jsx(HS,{name:"settings"}),de.hasUpdates?_.jsx("span",{className:"update-pulse-dot","aria-hidden":"true"}):null]}),_.jsx("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"logout",title:"Logout",onClick:()=>{ki()},children:_.jsx(HS,{name:"logout"})})]})]}):null]}),J?_.jsx(I2,{api:f,onClose:()=>oe(!1),updateAvailable:de.hasUpdates,onNotificationAssetsChanged:()=>{Xs()},onAgentRemoved:hr}):null,_.jsxs("section",{className:"terminal-main","aria-label":"Terminal workspace","data-mobile-pane-switcher":rt?"true":void 0,children:[_.jsx(bN,{tabs:Oe?.tabs??[],activeTabId:Oe?.activeTabId??null,terminals:x.terminals,unreadCompletionTabIds:w.unreadCompletions,detachedTerminals:Ci,onSelectTab:C=>st({type:"tab.selected",tabId:C}),onCreateTab:()=>{Bi()},onToggleWorkspaces:()=>Y(C=>!C),onCloseTerminals:C=>Gt(C),onReattachTerminal:C=>Ti(C),onDeleteTerminal:C=>{Ht(C)},onSplitVertical:()=>{dt("vertical")},onSplitHorizontal:()=>{dt("horizontal")},onRenameTab:(C,k)=>{ri(C,k)},activePaneAvailable:!!ne}),rt?_.jsx(lA,{targets:je,activeLeafKey:_t,terminals:x.terminals,editors:E,onSelect:Nt}):null,O?_.jsxs("div",{className:"workspace-error",role:"alert",children:[_.jsx("span",{children:O}),_.jsxs("div",{className:"workspace-error-actions",children:[_.jsx("button",{type:"button",onClick:ks,children:"Retry"}),n!==null&&a?_.jsx("button",{type:"button",onClick:()=>a(null),children:"Main server"}):null]})]}):null,_.jsxs("section",{className:"workspace-body","aria-busy":T,children:[T?_.jsx("div",{className:"workspace-placeholder",children:"Opening shell..."}):null,!T&&!we?_.jsx(aA,{onCreate:()=>{Bi()}}):null,N.map(C=>{const k=_n(C,n);return _.jsx(eA,{agentId:C,active:k,activeServerApi:k?m:void 0,visitedTabKeys:X,refreshCwdOnEnter:k&&z==="files",draggingTab:k?me:null,mobileSplitFocus:Te,mobileFocusedLeafByTabKey:Se,onSelect:H=>{k&&mi(H)},onClose:H=>{k&&jt(H)},onCloseEditor:H=>{k&&Et(H)},onResize:(H,ae)=>{k&&st({type:"pane.resized",path:H,ratio:ae})},onExit:(H,ae)=>{k?Di({type:"terminal.exited",terminalId:H,exitCode:ae}):Wl(C,{type:"terminal.exited",terminalId:H,exitCode:ae})},onSnapshot:(H,ae)=>{const pe={type:"terminal.updated",terminal:H,notifyCompletion:ae?.notifyCompletion===!0};k?Di(pe):Wl(C,pe)},...C===null&&h?{onAuthClose:h}:{}},fu(C))})]}),_.jsx(AN,{toast:xi,onActivate:Qi,onDismiss:()=>Ei(null)}),_.jsx(EN,{uploads:te,onDismiss:Hs,onDismissAll:Ms,onRetry:Wr,onCancel:At})]})]})})}function eA({agentId:e,active:t,activeServerApi:n,visitedTabKeys:a,refreshCwdOnEnter:o,draggingTab:c,mobileSplitFocus:h,mobileFocusedLeafByTabKey:f,onSelect:m,onClose:p,onCloseEditor:b,onResize:y,onExit:w,onSnapshot:x,onAuthClose:E}){const T=g.useMemo(()=>de=>Gw(e,de),[e]),O=g.useMemo(()=>()=>It(e),[e]),D=g.useSyncExternalStore(T,O,O),Y=g.useMemo(()=>co(e),[e]),F=n??Y,G=D.state,re=G.workspaces.find(de=>de.id===G.activeWorkspaceId)??G.workspaces[0],ee=re?.id??null,oe=(re?.tabs.find(de=>de.id===re.activeTabId)??re?.tabs[0])?.id??null;return!D.loaded||G.workspaces.length===0?null:_.jsx("div",{className:"workspace-server-surface","data-active":t,"aria-hidden":!t,children:G.workspaces.flatMap(de=>de.tabs.map(A=>{const P=t&&de.id===ee&&A.id===oe,K=pu(e,de.id,A.id),j=Au(A.root),B=h&&j.length>1?n1(j,A.activeTerminalId,f[K]):null;return!P&&!a.has(K)?null:_.jsx("div",{className:"workspace-tab-surface","data-active":P,"aria-hidden":!P,children:_.jsx(qp,{node:A.root,terminals:G.terminals,editors:D.editors,api:F,activeTerminalId:A.activeTerminalId,visible:P,refreshCwdOnEnter:P&&o,tabId:A.id,dropZoneActive:P&&c!==null,draggingTerminalId:P?c?.terminalId??null:null,mobileFocusLeafKey:B,onSelect:m,onClose:p,onCloseEditor:b,onResize:y,onExit:w,onSnapshot:x,...E?{onAuthClose:E}:{}})},`${de.id}:${A.id}`)}))})}function tA(e){const t=v2(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=sA(e.key);return n?{type:"pane.direction",direction:n}:null}return null}function iA(e,t,n){switch(n.type){case"pane.direction":return ON(e,t,n.direction);case"pane.index":return zN(e,n.index);default:return null}}function sA(e){switch(e){case"ArrowLeft":return"left";case"ArrowRight":return"right";case"ArrowUp":return"up";case"ArrowDown":return"down";default:return null}}function nA(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 Au(e){return e.type==="pane"?[{key:Lu(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:r1(e.editorId),type:"editor",editorId:e.editorId,title:e.title}]:[...Au(e.first),...Au(e.second)]}function n1(e,t,n){if(n&&e.some(o=>o.key===n))return n;const a=t?Lu(t):null;return a&&e.some(o=>o.key===a)?a:e[0]?.key??null}function Lu(e){return`terminal:${e}`}function r1(e){return`editor:${e}`}function rA(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 aA({onCreate:e}){return _.jsxs("div",{className:"empty-workspace",children:[_.jsx("span",{children:"No terminal is open."}),_.jsx("button",{type:"button",onClick:e,children:"New tab"})]})}function lA({targets:e,activeLeafKey:t,terminals:n,editors:a,onSelect:o}){const[c,h]=g.useState(!1);if(e.length<=1)return null;const f=t?e.findIndex(w=>w.key===t):-1,m=f>=0?f:0,p=e[m]??e[0],b=jS(p,n,a);function y(w){const x=(m+w+e.length)%e.length,E=e[x];E&&o(E)}return _.jsxs("div",{className:"mobile-pane-switcher",role:"group","aria-label":"Pane switcher",children:[_.jsx("button",{type:"button","aria-label":"Previous pane",onClick:()=>y(-1),children:"<"}),_.jsxs("button",{type:"button",className:"mobile-pane-current","aria-label":"Open pane switcher","aria-haspopup":"dialog","aria-expanded":c,title:b,onClick:()=>h(!0),children:["Pane ",m+1,"/",e.length," | ",b]}),_.jsx("button",{type:"button","aria-label":"Next pane",onClick:()=>y(1),children:">"}),c?_.jsx("div",{className:"mobile-pane-sheet-backdrop",onClick:()=>h(!1),children:_.jsxs("section",{className:"mobile-pane-sheet",role:"dialog","aria-modal":"true","aria-label":"Pane switcher",onClick:w=>w.stopPropagation(),children:[_.jsxs("header",{children:[_.jsx("strong",{children:"Panes"}),_.jsx("button",{type:"button","aria-label":"Close pane switcher",onClick:()=>h(!1),children:"x"})]}),_.jsx("div",{className:"mobile-pane-sheet-list",children:e.map((w,x)=>{const E=jS(w,n,a),T=oA(w,n,a),O=w.key===p.key;return _.jsxs("button",{type:"button","data-active":O,onClick:()=>{o(w),h(!1)},children:[_.jsx("span",{className:"mobile-pane-sheet-index",children:x+1}),_.jsxs("span",{className:"mobile-pane-sheet-copy",children:[_.jsx("strong",{children:E}),_.jsx("small",{children:T})]}),_.jsx("span",{className:"mobile-pane-sheet-type",children:w.type})]},w.key)})})]})}):null]})}function jS(e,t,n){if(e.type==="editor")return n[e.editorId]?.title||e.title||e.editorId;const a=t[e.terminalId];return a?.title||a?.cwd||e.terminalId}function oA(e,t,n){if(e.type==="editor"){const c=n[e.editorId];return c?.path?`editor | ${c.path}`:"editor"}const a=t[e.terminalId];return a?`${a.activity==="busy"?`busy${a.currentCommand?`: ${a.currentCommand}`:""}`:a.activity==="idle"?"idle":a.status} | ${a.cwd}`:"terminal"}function cA(e){const[t,n]=g.useState(()=>uA(e));return g.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function"){n(!1);return}const a=window.matchMedia(e),o=()=>n(a.matches);return o(),typeof a.addEventListener=="function"?(a.addEventListener("change",o),()=>a.removeEventListener("change",o)):(a.addListener(o),()=>a.removeListener(o))},[e]),t}function uA(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function _n(e,t){return e===t}function hA(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 fu(e){return e??"__local__"}function pu(e,t,n){return`${fu(e)}:${t}:${n}`}function dA(e){return e?{workspaceKey:`${OS}:${e}`}:{workspaceKey:OS}}function fA(e){const t=localStorage.getItem(e.workspaceKey);if(!t)return null;try{const n=JSON.parse(t),a=d0(n);return a?a1(a):null}catch{return null}}function a1(e){const t=d0(e);return t?{savedWorkspaces:t.workspaces,savedActiveWorkspaceId:t.activeWorkspaceId}:null}function $l(e,t){if(e.workspaces.length>0){localStorage.setItem(t.workspaceKey,JSON.stringify(e));return}localStorage.removeItem(t.workspaceKey)}function pA(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 mA(e){return e.results.find(t=>t.status==="failed"&&t.error)?.error}function _A(e){return e.split("/").filter(Boolean).pop()??e}function vA(){try{return localStorage.getItem(s1)==="true"}catch{return!1}}function gA(e){try{localStorage.setItem(s1,e?"true":"false")}catch{}}function yA(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 HS({name:e}){return _.jsxs("svg",{className:"workspace-footer-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[e==="settings"?_.jsxs(_.Fragment,{children:[_.jsx("path",{d:"M4 7h9"}),_.jsx("path",{d:"M17 7h3"}),_.jsx("circle",{cx:"15",cy:"7",r:"2"}),_.jsx("path",{d:"M4 12h3"}),_.jsx("path",{d:"M11 12h9"}),_.jsx("circle",{cx:"9",cy:"12",r:"2"}),_.jsx("path",{d:"M4 17h9"}),_.jsx("path",{d:"M17 17h3"}),_.jsx("circle",{cx:"15",cy:"17",r:"2"})]}):null,e==="logout"?_.jsxs(_.Fragment,{children:[_.jsx("path",{d:"M10 6H6v12h4"}),_.jsx("path",{d:"M13 8l4 4-4 4"}),_.jsx("path",{d:"M8 12h9"})]}):null]})}function Yl(e){return e instanceof Error?e.message:"Request failed"}function bA({api:e,onDone:t}){const[n,a]=g.useState(null),[o,c]=g.useState(null),[h,f]=g.useState(""),[m,p]=g.useState(!1),[b,y]=g.useState(null),[w,x]=g.useState(null);g.useEffect(()=>{let T=!1;return e.setupTotp().then(O=>{T||(a(O.qrDataUrl),c(O.secret))}).catch(O=>{T||x(O instanceof Error?O.message:"Failed to generate QR code")}),()=>{T=!0}},[e]);async function E(T){if(T.preventDefault(),!!o){p(!0),y(null);try{await e.activateTotp({secret:o,otp:h}),t()}catch(O){y(O instanceof Error?O.message:"Verification failed")}finally{p(!1)}}}return w?_.jsx("p",{className:"form-error",children:w}):!n||!o?_.jsx("p",{className:"muted",children:"Generating authenticator setup..."}):_.jsxs("div",{className:"totp-setup",children:[_.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."}),_.jsx("div",{className:"totp-qr-container",children:_.jsx("img",{src:n,alt:"TOTP QR code",width:192,height:192})}),_.jsxs("details",{className:"totp-secret-details",children:[_.jsx("summary",{children:"Can't scan? Enter manually"}),_.jsx("p",{className:"totp-secret-text",children:o})]}),_.jsxs("form",{className:"auth-form",onSubmit:E,children:[_.jsxs("label",{children:["Verification code",_.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:h,onChange:T=>f(T.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),b?_.jsx("p",{className:"form-error",children:b}):null,_.jsx("button",{type:"submit",disabled:m||h.length!==6,children:"Activate 2FA"})]})]})}function SA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a}){const o=g.useMemo(()=>e??Bu(),[e]),c=g.useMemo(()=>t??co(null),[t]),[h,f]=g.useState(null),[m,p]=g.useState(null);g.useEffect(()=>{let E=!1;return o.getSession().then(T=>{E||(f(T),p(null))}).catch(T=>{E||(p(xo(T)),f(null))}),()=>{E=!0}},[o]);const b=EA(h);async function y(){const E=await o.getSession();f(E),p(null)}async function w(){gS(),NS(),AR(),p(null),f(null);try{await y()}catch(E){p(xo(E))}}if(b==="workspace")return _.jsx(JN,{api:o,serverApi:c,activeAgentId:n,onSelectServer:a,sessionExpiresAt:h?.expiresAt??null,onSessionInvalid:()=>{w()},onLogout:async()=>{gS(),NS();const E=await o.logout();f(E)}});const x={loading:"Terminal",setup_password:"Set password",setup_totp:"Set up 2FA",login:"Unlock terminal",reauth:"Verify it’s you",workspace:"Terminal"};return _.jsxs("main",{className:"auth-screen",children:[_.jsxs("div",{className:"auth-background","aria-hidden":"true",children:[_.jsx("div",{className:"auth-grid"}),_.jsx("div",{className:"auth-glow"})]}),_.jsxs("section",{className:"auth-panel","aria-busy":b==="loading",children:[_.jsxs("header",{className:"auth-header",children:[_.jsxs("div",{className:"auth-brand",children:[_.jsx(FS,{size:26}),_.jsxs("div",{children:[_.jsx(qS,{height:17}),_.jsx("p",{className:"auth-host",children:"local terminal"})]})]}),_.jsx("h1",{children:x[b]})]}),m?_.jsx("p",{className:"form-error",children:m}):null,b==="loading"?_.jsx("p",{className:"muted",children:"Checking session..."}):null,b==="loading"&&m?_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{w()},children:"Retry"}):null,b==="setup_password"?_.jsx(wA,{api:o,onSession:E=>{f(E)}}):null,b==="setup_totp"?_.jsx(bA,{api:o,onDone:()=>{y()}}):null,b==="login"?_.jsx(CA,{api:o,session:h,onSession:f,onRefresh:y}):null,b==="reauth"?_.jsx(xA,{api:o,session:h,onSession:f,onFullLogin:()=>f(E=>E&&{...E,deviceTrusted:!1})}):null]})]})}function wA({api:e,onSession:t}){const[n,a]=g.useState(""),[o,c]=g.useState(""),[h,f]=g.useState(!1),[m,p]=g.useState(null);async function b(y){y.preventDefault(),f(!0),p(null);try{if(n!==o){p("Passwords do not match");return}t(await e.setupPassword({password:n}))}catch(w){p(xo(w))}finally{f(!1)}}return _.jsxs("form",{className:"auth-form",onSubmit:b,children:[_.jsxs("label",{children:["Password",_.jsx("input",{autoFocus:!0,value:n,onChange:y=>a(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),_.jsxs("label",{children:["Confirm password",_.jsx("input",{value:o,onChange:y=>c(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),m?_.jsx("p",{className:"form-error",children:m}):null,_.jsx("button",{type:"submit",disabled:h||n.length<8||o.length<8,children:"Set password"})]})}function CA({api:e,session:t,onSession:n,onRefresh:a}){const[o,c]=g.useState(""),[h,f]=g.useState(""),[m,p]=g.useState(!1),[b,y]=g.useState(!1),[w,x]=g.useState(null),E=t?.totpEnabled??!1,T=t?.currentIpWhitelisted??!1;async function O(D){D.preventDefault(),y(!0),x(null);try{n(await e.login({password:o,...E?{otp:h}:{},rememberNetwork:m}))}catch(Y){x(xo(Y))}finally{y(!1)}}return _.jsxs("form",{className:"auth-form",onSubmit:O,children:[_.jsxs("label",{children:["Password",_.jsx("input",{autoFocus:!0,type:"password",value:o,onChange:D=>c(D.currentTarget.value),required:!0})]}),E?_.jsxs("label",{children:["Authenticator code",_.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:h,onChange:D=>f(D.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}):null,T?null:_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:m,onChange:D=>p(D.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),w?_.jsx("p",{className:"form-error",children:w}):null,_.jsxs("div",{className:"button-row",children:[_.jsx("button",{type:"submit",disabled:b||o.length===0||E&&h.length!==6,children:"Unlock"}),_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a()},disabled:b,children:"Refresh"})]})]})}function xA({api:e,session:t,onSession:n,onFullLogin:a}){const o=t?.currentIpWhitelisted??!1,[c,h]=g.useState(""),[f,m]=g.useState(!1),[p,b]=g.useState(!1),[y,w]=g.useState(null),x=ii.useRef(!1),E=ii.useCallback(async(O,D)=>{b(!0),w(null);try{n(await e.reauth({...O?{otp:O}:{},rememberNetwork:D}))}catch(Y){w(xo(Y))}finally{b(!1)}},[e,n]);g.useEffect(()=>{o&&!x.current&&(x.current=!0,E(void 0,!1))},[o,E]);async function T(O){O.preventDefault(),await E(c,f)}return o&&!y?_.jsx("p",{className:"muted",children:"Reconnecting from a trusted network…"}):_.jsxs("form",{className:"auth-form",onSubmit:T,children:[_.jsx("p",{className:"muted",children:"This device is remembered. Enter your authenticator code to continue."}),_.jsxs("label",{children:["Authenticator code",_.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:c,onChange:O=>h(O.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:f,onChange:O=>m(O.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),y?_.jsx("p",{className:"form-error",children:y}):null,_.jsxs("div",{className:"button-row",children:[_.jsx("button",{type:"submit",disabled:p||c.length!==6,children:"Continue"}),_.jsx("button",{type:"button",className:"secondary-button",onClick:a,disabled:p,children:"Use password instead"})]})]})}function EA(e){return e?e.passwordSet?e.authenticated&&!e.totpEnabled?"setup_totp":e.authenticated?"workspace":e.deviceTrusted&&e.totpEnabled?"reauth":"login":"setup_password":"loading"}function xo(e){return e instanceof Error?e.message:"Request failed"}const US="NTerminal",rm="nterminal.activeAgentId";function TA(){const[e,t]=g.useState(()=>kA()),n=g.useMemo(()=>Bu(),[]),a=g.useMemo(()=>co(e),[e]);g.useEffect(()=>{const c=()=>{const h=pN();document.title=h>0?`(${h}) ${US}`:US};return c(),fN(c)},[]);function o(c){DA(c),t(c)}return _.jsx(SA,{api:n,activeAgentId:e,serverApi:a,onSelectServer:o})}function kA(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(rm);return e&&e.trim()?e:null}catch{return null}}function DA(e){if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(rm,e);return}window.localStorage.removeItem(rm)}catch{}}const PS=["gesturestart","gesturechange","gestureend"],RA=[".workspace-list",".workspace-nav",".server-list",".terminal-tab-list",".mobile-terminal-key-bar",".upload-toast-body",".file-tree",".file-detail",".file-editor",".file-markdown-preview",".editor-markdown-preview",".settings-content",".settings-nav",".transcript-dialog-scroll",".transcript-filter-group"].join(",");function MA(e=window){if(!AA(e))return()=>{};const t={passive:!1},n=e.document;function a(c){c.cancelable&&c.preventDefault()}function o(c){if(c.defaultPrevented)return;const h=c.touches;!h||h.length===0||(h.length>1||!NA(c.target))&&a(c)}for(const c of PS)n.addEventListener(c,a,t);return n.addEventListener("touchmove",o,t),n.addEventListener("dblclick",a,t),()=>{for(const c of PS)n.removeEventListener(c,a,t);n.removeEventListener("touchmove",o,t),n.removeEventListener("dblclick",a,t)}}function NA(e){return e instanceof Element&&e.closest(RA)!==null}function AA(e){return e.navigator.maxTouchPoints>0?!0:typeof e.matchMedia=="function"&&e.matchMedia("(pointer: coarse)").matches}xR();MA();Dm();Sx.createRoot(document.getElementById("root")).render(_.jsx(ii.StrictMode,{children:_.jsx(TA,{})}));export{ii as R,dx as g,_ as j};
|