nterminal 1.2.53 → 1.2.55
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/README.md +4 -1
- package/SECURITY.md +1 -1
- package/bin/nterminal.js +4 -0
- package/dist/client/assets/MarkdownPreview-CCE_ITdh.js +1 -0
- package/dist/client/assets/{TranscriptMarkdownBody-DJbLRp61.js → TranscriptMarkdownBody-CZrc3zaR.js} +1 -1
- package/dist/client/assets/{index-BEv9DwQ7.css → index-EhJZer0I.css} +1 -1
- package/dist/client/assets/index-LXA2msdF.js +54 -0
- package/dist/client/assets/{index-Bj8e-m7A.js → index-WieImnbS.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/scripts/distcall.js +436 -0
- package/dist/scripts/distcall.js.map +1 -0
- package/dist/scripts/onboarding.js +3 -3
- package/dist/scripts/onboarding.js.map +1 -1
- package/dist/server/agent/agentRoutes.js +124 -2
- package/dist/server/agent/agentRoutes.js.map +1 -1
- package/dist/server/auth/authService.d.ts +3 -0
- package/dist/server/auth/authService.js +51 -7
- package/dist/server/auth/authService.js.map +1 -1
- package/dist/server/distcall/envelope.d.ts +6 -0
- package/dist/server/distcall/envelope.js +56 -0
- package/dist/server/distcall/envelope.js.map +1 -0
- package/dist/server/distcall/executor.d.ts +23 -0
- package/dist/server/distcall/executor.js +316 -0
- package/dist/server/distcall/executor.js.map +1 -0
- package/dist/server/files/rootToken.d.ts +4 -2
- package/dist/server/files/rootToken.js +9 -4
- package/dist/server/files/rootToken.js.map +1 -1
- package/dist/server/http.d.ts +2 -1
- package/dist/server/http.js +2 -0
- package/dist/server/http.js.map +1 -1
- package/dist/server/routes/agentManagementRoutes.js +14 -2
- package/dist/server/routes/agentManagementRoutes.js.map +1 -1
- package/dist/server/routes/distributedCallRoutes.d.ts +9 -0
- package/dist/server/routes/distributedCallRoutes.js +305 -0
- package/dist/server/routes/distributedCallRoutes.js.map +1 -0
- package/dist/server/routes/fileRoutes.js +32 -3
- package/dist/server/routes/fileRoutes.js.map +1 -1
- package/dist/server/routes/terminalLayoutRoutes.js +12 -8
- package/dist/server/routes/terminalLayoutRoutes.js.map +1 -1
- package/dist/server/storage/fileStore.d.ts +8 -1
- package/dist/server/storage/fileStore.js +49 -2
- package/dist/server/storage/fileStore.js.map +1 -1
- package/dist/shared/layoutState.d.ts +3 -0
- package/dist/shared/layoutState.js +49 -0
- package/dist/shared/layoutState.js.map +1 -1
- package/dist/shared/protocol.d.ts +74 -2
- package/dist/shared/protocol.js.map +1 -1
- package/dist/shared/types.d.ts +2 -0
- package/docs/features.md +4 -3
- package/docs/operations.md +1 -1
- package/package.json +1 -1
- package/dist/client/assets/MarkdownPreview-DvW1iSJP.js +0 -1
- package/dist/client/assets/index-DaKyipYG.js +0 -54
- package/docs/assets/nterminal-workspace.png +0 -0
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPreview-DvW1iSJP.js","assets/index-Bj8e-m7A.js","assets/TranscriptMarkdownBody-DJbLRp61.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 s(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=s(o);fetch(o.href,c)}})();function Lx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mf={exports:{}},Ql={};var Zy;function Bx(){if(Zy)return Ql;Zy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(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 Ql.Fragment=t,Ql.jsx=s,Ql.jsxs=s,Ql}var Qy;function Ox(){return Qy||(Qy=1,mf.exports=Bx()),mf.exports}var m=Ox(),gf={exports:{}},Fe={};var Jy;function zx(){if(Jy)return Fe;Jy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=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"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),S=Symbol.iterator;function C(k){return k===null||typeof k!="object"?null:(k=S&&k[S]||k["@@iterator"],typeof k=="function"?k:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,L={};function D(k,Q,le){this.props=k,this.context=Q,this.refs=L,this.updater=le||x}D.prototype.isReactComponent={},D.prototype.setState=function(k,Q){if(typeof k!="object"&&typeof k!="function"&&k!=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,k,Q,"setState")},D.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function j(){}j.prototype=D.prototype;function U(k,Q,le){this.props=k,this.context=Q,this.refs=L,this.updater=le||x}var Z=U.prototype=new j;Z.constructor=U,E(Z,D.prototype),Z.isPureReactComponent=!0;var ie=Array.isArray;function ne(){}var ae={H:null,A:null,T:null,S:null},oe=Object.prototype.hasOwnProperty;function pe(k,Q,le){var fe=le.ref;return{$$typeof:e,type:k,key:Q,ref:fe!==void 0?fe:null,props:le}}function I(k,Q){return pe(k.type,Q,k.props)}function q(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function K(k){var Q={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(le){return Q[le]})}var z=/\/+/g;function O(k,Q){return typeof k=="object"&&k!==null&&k.key!=null?K(""+k.key):Q.toString(36)}function se(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(ne,ne):(k.status="pending",k.then(function(Q){k.status==="pending"&&(k.status="fulfilled",k.value=Q)},function(Q){k.status==="pending"&&(k.status="rejected",k.reason=Q)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function M(k,Q,le,fe,we){var Ce=typeof k;(Ce==="undefined"||Ce==="boolean")&&(k=null);var ke=!1;if(k===null)ke=!0;else switch(Ce){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(k.$$typeof){case e:case t:ke=!0;break;case b:return ke=k._init,M(ke(k._payload),Q,le,fe,we)}}if(ke)return we=we(k),ke=fe===""?"."+O(k,0):fe,ie(we)?(le="",ke!=null&&(le=ke.replace(z,"$&/")+"/"),M(we,Q,le,"",function(J){return J})):we!=null&&(q(we)&&(we=I(we,le+(we.key==null||k&&k.key===we.key?"":(""+we.key).replace(z,"$&/")+"/")+ke)),Q.push(we)),1;ke=0;var Ie=fe===""?".":fe+":";if(ie(k))for(var H=0;H<k.length;H++)fe=k[H],Ce=Ie+O(fe,H),ke+=M(fe,Q,le,Ce,we);else if(H=C(k),typeof H=="function")for(k=H.call(k),H=0;!(fe=k.next()).done;)fe=fe.value,Ce=Ie+O(fe,H++),ke+=M(fe,Q,le,Ce,we);else if(Ce==="object"){if(typeof k.then=="function")return M(se(k),Q,le,fe,we);throw Q=String(k),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return ke}function X(k,Q,le){if(k==null)return k;var fe=[],we=0;return M(k,fe,"","",function(Ce){return Q.call(le,Ce,we++)}),fe}function V(k){if(k._status===-1){var Q=k._result;Q=Q(),Q.then(function(le){(k._status===0||k._status===-1)&&(k._status=1,k._result=le)},function(le){(k._status===0||k._status===-1)&&(k._status=2,k._result=le)}),k._status===-1&&(k._status=0,k._result=Q)}if(k._status===1)return k._result.default;throw k._result}var ye=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},xe={map:X,forEach:function(k,Q,le){X(k,function(){Q.apply(this,arguments)},le)},count:function(k){var Q=0;return X(k,function(){Q++}),Q},toArray:function(k){return X(k,function(Q){return Q})||[]},only:function(k){if(!q(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return Fe.Activity=y,Fe.Children=xe,Fe.Component=D,Fe.Fragment=s,Fe.Profiler=o,Fe.PureComponent=U,Fe.StrictMode=a,Fe.Suspense=g,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ae,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(k){return ae.H.useMemoCache(k)}},Fe.cache=function(k){return function(){return k.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(k,Q,le){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var fe=E({},k.props),we=k.key;if(Q!=null)for(Ce in Q.key!==void 0&&(we=""+Q.key),Q)!oe.call(Q,Ce)||Ce==="key"||Ce==="__self"||Ce==="__source"||Ce==="ref"&&Q.ref===void 0||(fe[Ce]=Q[Ce]);var Ce=arguments.length-2;if(Ce===1)fe.children=le;else if(1<Ce){for(var ke=Array(Ce),Ie=0;Ie<Ce;Ie++)ke[Ie]=arguments[Ie+2];fe.children=ke}return pe(k.type,we,fe)},Fe.createContext=function(k){return k={$$typeof:h,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:c,_context:k},k},Fe.createElement=function(k,Q,le){var fe,we={},Ce=null;if(Q!=null)for(fe in Q.key!==void 0&&(Ce=""+Q.key),Q)oe.call(Q,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(we[fe]=Q[fe]);var ke=arguments.length-2;if(ke===1)we.children=le;else if(1<ke){for(var Ie=Array(ke),H=0;H<ke;H++)Ie[H]=arguments[H+2];we.children=Ie}if(k&&k.defaultProps)for(fe in ke=k.defaultProps,ke)we[fe]===void 0&&(we[fe]=ke[fe]);return pe(k,Ce,we)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(k){return{$$typeof:f,render:k}},Fe.isValidElement=q,Fe.lazy=function(k){return{$$typeof:b,_payload:{_status:-1,_result:k},_init:V}},Fe.memo=function(k,Q){return{$$typeof:p,type:k,compare:Q===void 0?null:Q}},Fe.startTransition=function(k){var Q=ae.T,le={};ae.T=le;try{var fe=k(),we=ae.S;we!==null&&we(le,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then(ne,ye)}catch(Ce){ye(Ce)}finally{Q!==null&&le.types!==null&&(Q.types=le.types),ae.T=Q}},Fe.unstable_useCacheRefresh=function(){return ae.H.useCacheRefresh()},Fe.use=function(k){return ae.H.use(k)},Fe.useActionState=function(k,Q,le){return ae.H.useActionState(k,Q,le)},Fe.useCallback=function(k,Q){return ae.H.useCallback(k,Q)},Fe.useContext=function(k){return ae.H.useContext(k)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(k,Q){return ae.H.useDeferredValue(k,Q)},Fe.useEffect=function(k,Q){return ae.H.useEffect(k,Q)},Fe.useEffectEvent=function(k){return ae.H.useEffectEvent(k)},Fe.useId=function(){return ae.H.useId()},Fe.useImperativeHandle=function(k,Q,le){return ae.H.useImperativeHandle(k,Q,le)},Fe.useInsertionEffect=function(k,Q){return ae.H.useInsertionEffect(k,Q)},Fe.useLayoutEffect=function(k,Q){return ae.H.useLayoutEffect(k,Q)},Fe.useMemo=function(k,Q){return ae.H.useMemo(k,Q)},Fe.useOptimistic=function(k,Q){return ae.H.useOptimistic(k,Q)},Fe.useReducer=function(k,Q,le){return ae.H.useReducer(k,Q,le)},Fe.useRef=function(k){return ae.H.useRef(k)},Fe.useState=function(k){return ae.H.useState(k)},Fe.useSyncExternalStore=function(k,Q,le){return ae.H.useSyncExternalStore(k,Q,le)},Fe.useTransition=function(){return ae.H.useTransition()},Fe.version="19.2.6",Fe}var eb;function km(){return eb||(eb=1,gf.exports=zx()),gf.exports}var v=km();const mi=Lx(v);var _f={exports:{}},Jl={},vf={exports:{}},yf={};var tb;function jx(){return tb||(tb=1,(function(e){function t(M,X){var V=M.length;M.push(X);e:for(;0<V;){var ye=V-1>>>1,xe=M[ye];if(0<o(xe,X))M[ye]=X,M[V]=xe,V=ye;else break e}}function s(M){return M.length===0?null:M[0]}function a(M){if(M.length===0)return null;var X=M[0],V=M.pop();if(V!==X){M[0]=V;e:for(var ye=0,xe=M.length,k=xe>>>1;ye<k;){var Q=2*(ye+1)-1,le=M[Q],fe=Q+1,we=M[fe];if(0>o(le,V))fe<xe&&0>o(we,le)?(M[ye]=we,M[fe]=V,ye=fe):(M[ye]=le,M[Q]=V,ye=Q);else if(fe<xe&&0>o(we,V))M[ye]=we,M[fe]=V,ye=fe;else break e}}return X}function o(M,X){var V=M.sortIndex-X.sortIndex;return V!==0?V:M.id-X.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 g=[],p=[],b=1,y=null,S=3,C=!1,x=!1,E=!1,L=!1,D=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function Z(M){for(var X=s(p);X!==null;){if(X.callback===null)a(p);else if(X.startTime<=M)a(p),X.sortIndex=X.expirationTime,t(g,X);else break;X=s(p)}}function ie(M){if(E=!1,Z(M),!x)if(s(g)!==null)x=!0,ne||(ne=!0,K());else{var X=s(p);X!==null&&se(ie,X.startTime-M)}}var ne=!1,ae=-1,oe=5,pe=-1;function I(){return L?!0:!(e.unstable_now()-pe<oe)}function q(){if(L=!1,ne){var M=e.unstable_now();pe=M;var X=!0;try{e:{x=!1,E&&(E=!1,j(ae),ae=-1),C=!0;var V=S;try{t:{for(Z(M),y=s(g);y!==null&&!(y.expirationTime>M&&I());){var ye=y.callback;if(typeof ye=="function"){y.callback=null,S=y.priorityLevel;var xe=ye(y.expirationTime<=M);if(M=e.unstable_now(),typeof xe=="function"){y.callback=xe,Z(M),X=!0;break t}y===s(g)&&a(g),Z(M)}else a(g);y=s(g)}if(y!==null)X=!0;else{var k=s(p);k!==null&&se(ie,k.startTime-M),X=!1}}break e}finally{y=null,S=V,C=!1}X=void 0}}finally{X?K():ne=!1}}}var K;if(typeof U=="function")K=function(){U(q)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,O=z.port2;z.port1.onmessage=q,K=function(){O.postMessage(null)}}else K=function(){D(q,0)};function se(M,X){ae=D(function(){M(e.unstable_now())},X)}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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):oe=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(M){switch(S){case 1:case 2:case 3:var X=3;break;default:X=S}var V=S;S=X;try{return M()}finally{S=V}},e.unstable_requestPaint=function(){L=!0},e.unstable_runWithPriority=function(M,X){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var V=S;S=M;try{return X()}finally{S=V}},e.unstable_scheduleCallback=function(M,X,V){var ye=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?ye+V:ye):V=ye,M){case 1:var xe=-1;break;case 2:xe=250;break;case 5:xe=1073741823;break;case 4:xe=1e4;break;default:xe=5e3}return xe=V+xe,M={id:b++,callback:X,priorityLevel:M,startTime:V,expirationTime:xe,sortIndex:-1},V>ye?(M.sortIndex=V,t(p,M),s(g)===null&&M===s(p)&&(E?(j(ae),ae=-1):E=!0,se(ie,V-ye))):(M.sortIndex=xe,t(g,M),x||C||(x=!0,ne||(ne=!0,K()))),M},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(M){var X=S;return function(){var V=S;S=X;try{return M.apply(this,arguments)}finally{S=V}}}})(yf)),yf}var ib;function Hx(){return ib||(ib=1,vf.exports=jx()),vf.exports}var bf={exports:{}},Ii={};var nb;function Ux(){if(nb)return Ii;nb=1;var e=km();function t(g){var p="https://react.dev/errors/"+g;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 #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var a={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(g,p,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:g,containerInfo:p,implementation:b}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ii.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Ii.createPortal=function(g,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(g,p,null,b)},Ii.flushSync=function(g){var p=h.T,b=a.p;try{if(h.T=null,a.p=2,g)return g()}finally{h.T=p,a.p=b,a.d.f()}},Ii.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(g,p))},Ii.prefetchDNS=function(g){typeof g=="string"&&a.d.D(g)},Ii.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var b=p.as,y=f(b,p.crossOrigin),S=typeof p.integrity=="string"?p.integrity:void 0,C=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?a.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:S,fetchPriority:C}):b==="script"&&a.d.X(g,{crossOrigin:y,integrity:S,fetchPriority:C,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ii.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=f(p.as,p.crossOrigin);a.d.M(g,{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(g)},Ii.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,y=f(b,p.crossOrigin);a.d.L(g,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})}},Ii.preloadModule=function(g,p){if(typeof g=="string")if(p){var b=f(p.as,p.crossOrigin);a.d.m(g,{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(g)},Ii.requestFormReset=function(g){a.d.r(g)},Ii.unstable_batchedUpdates=function(g,p){return g(p)},Ii.useFormState=function(g,p,b){return h.H.useFormState(g,p,b)},Ii.useFormStatus=function(){return h.H.useHostTransitionStatus()},Ii.version="19.2.6",Ii}var sb;function a0(){if(sb)return bf.exports;sb=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(),bf.exports=Ux(),bf.exports}var rb;function Px(){if(rb)return Jl;rb=1;var e=Hx(),t=km(),s=a0();function a(i){var n="https://react.dev/errors/"+i;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+i+"; visit "+n+" 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 n=i,r=i;if(i.alternate)for(;n.return;)n=n.return;else{i=n;do n=i,(n.flags&4098)!==0&&(r=n.return),i=n.return;while(i)}return n.tag===3?r:null}function h(i){if(i.tag===13){var n=i.memoizedState;if(n===null&&(i=i.alternate,i!==null&&(n=i.memoizedState)),n!==null)return n.dehydrated}return null}function f(i){if(i.tag===31){var n=i.memoizedState;if(n===null&&(i=i.alternate,i!==null&&(n=i.memoizedState)),n!==null)return n.dehydrated}return null}function g(i){if(c(i)!==i)throw Error(a(188))}function p(i){var n=i.alternate;if(!n){if(n=c(i),n===null)throw Error(a(188));return n!==i?null:i}for(var r=i,l=n;;){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 g(u),i;if(d===l)return g(u),n;d=d.sibling}throw Error(a(188))}if(r.return!==l.return)r=u,l=d;else{for(var _=!1,w=u.child;w;){if(w===r){_=!0,r=u,l=d;break}if(w===l){_=!0,l=u,r=d;break}w=w.sibling}if(!_){for(w=d.child;w;){if(w===r){_=!0,r=d,l=u;break}if(w===l){_=!0,l=d,r=u;break}w=w.sibling}if(!_)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:n}function b(i){var n=i.tag;if(n===5||n===26||n===27||n===6)return i;for(i=i.child;i!==null;){if(n=b(i),n!==null)return n;i=i.sibling}return null}var y=Object.assign,S=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),U=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),ie=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),pe=Symbol.for("react.activity"),I=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function K(i){return i===null||typeof i!="object"?null:(i=q&&i[q]||i["@@iterator"],typeof i=="function"?i:null)}var z=Symbol.for("react.client.reference");function O(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===z?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case E:return"Fragment";case D:return"Profiler";case L:return"StrictMode";case ie:return"Suspense";case ne:return"SuspenseList";case pe:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case x:return"Portal";case U:return i.displayName||"Context";case j:return(i._context.displayName||"Context")+".Consumer";case Z:var n=i.render;return i=i.displayName,i||(i=n.displayName||n.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ae:return n=i.displayName||null,n!==null?n:O(i.type)||"Memo";case oe:n=i._payload,i=i._init;try{return O(i(n))}catch{}}return null}var se=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},ye=[],xe=-1;function k(i){return{current:i}}function Q(i){0>xe||(i.current=ye[xe],ye[xe]=null,xe--)}function le(i,n){xe++,ye[xe]=i.current,i.current=n}var fe=k(null),we=k(null),Ce=k(null),ke=k(null);function Ie(i,n){switch(le(Ce,n),le(we,i),le(fe,null),n.nodeType){case 9:case 11:i=(i=n.documentElement)&&(i=i.namespaceURI)?by(i):0;break;default:if(i=n.tagName,n=n.namespaceURI)n=by(n),i=Sy(n,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}Q(fe),le(fe,i)}function H(){Q(fe),Q(we),Q(Ce)}function J(i){i.memoizedState!==null&&le(ke,i);var n=fe.current,r=Sy(n,i.type);n!==r&&(le(we,i),le(fe,r))}function Ee(i){we.current===i&&(Q(fe),Q(we)),ke.current===i&&(Q(ke),Vl._currentValue=V)}var ve,ge;function F(i){if(ve===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);ve=n&&n[1]||"",ge=-1<r.stack.indexOf(`
|
|
3
|
-
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
|
-
`+ve+i+ge}var me=!1;function Se(i,n){if(!i||me)return"";me=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ee){var G=ee}Reflect.construct(i,[],ue)}else{try{ue.call()}catch(ee){G=ee}i.call(ue.prototype)}}else{try{throw Error()}catch(ee){G=ee}(ue=i())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ee){if(ee&&G&&typeof ee.stack=="string")return[ee.stack,G.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(),_=d[0],w=d[1];if(_&&w){var R=_.split(`
|
|
5
|
-
`),Y=w.split(`
|
|
6
|
-
`);for(u=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;u<Y.length&&!Y[u].includes("DetermineComponentFrameRoot");)u++;if(l===R.length||u===Y.length)for(l=R.length-1,u=Y.length-1;1<=l&&0<=u&&R[l]!==Y[u];)u--;for(;1<=l&&0<=u;l--,u--)if(R[l]!==Y[u]){if(l!==1||u!==1)do if(l--,u--,0>u||R[l]!==Y[u]){var re=`
|
|
7
|
-
`+R[l].replace(" at new "," at ");return i.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",i.displayName)),re}while(1<=l&&0<=u);break}}}finally{me=!1,Error.prepareStackTrace=r}return(r=i?i.displayName||i.name:"")?F(r):""}function Le(i,n){switch(i.tag){case 26:case 27:case 5:return F(i.type);case 16:return F("Lazy");case 13:return i.child!==n&&n!==null?F("Suspense Fallback"):F("Suspense");case 19:return F("SuspenseList");case 0:case 15:return Se(i.type,!1);case 11:return Se(i.type.render,!1);case 1:return Se(i.type,!0);case 31:return F("Activity");default:return""}}function qe(i){try{var n="",r=null;do n+=Le(i,r),r=i,i=i.return;while(i);return n}catch(l){return`
|
|
8
|
-
Error generating stack: `+l.message+`
|
|
9
|
-
`+l.stack}}var st=Object.prototype.hasOwnProperty,Ke=e.unstable_scheduleCallback,St=e.unstable_cancelCallback,Hi=e.unstable_shouldYield,Yn=e.unstable_requestPaint,lt=e.unstable_now,li=e.unstable_getCurrentPriorityLevel,Zi=e.unstable_ImmediatePriority,_i=e.unstable_UserBlockingPriority,jt=e.unstable_NormalPriority,Ui=e.unstable_LowPriority,vi=e.unstable_IdlePriority,$=e.log,He=e.unstable_setDisableYieldValue,et=null,ct=null;function Jt(i){if(typeof $=="function"&&He(i),ct&&typeof ct.setStrictMode=="function")try{ct.setStrictMode(et,i)}catch{}}var Ht=Math.clz32?Math.clz32:as,oi=Math.log,Fi=Math.LN2;function as(i){return i>>>=0,i===0?32:31-(oi(i)/Fi|0)|0}var on=256,wn=262144,wt=4194304;function Et(i){var n=i&42;if(n!==0)return n;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 Ut(i,n,r){var l=i.pendingLanes;if(l===0)return 0;var u=0,d=i.suspendedLanes,_=i.pingedLanes;i=i.warmLanes;var w=l&134217727;return w!==0?(l=w&~d,l!==0?u=Et(l):(_&=w,_!==0?u=Et(_):r||(r=w&~i,r!==0&&(u=Et(r))))):(w=l&~d,w!==0?u=Et(w):_!==0?u=Et(_):r||(r=l&~i,r!==0&&(u=Et(r)))),u===0?0:n!==0&&n!==u&&(n&d)===0&&(d=u&-u,r=n&-n,d>=r||d===32&&(r&4194048)!==0)?n:u}function ci(i,n){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&n)===0}function Yt(i,n){switch(i){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 ei(){var i=wt;return wt<<=1,(wt&62914560)===0&&(wt=4194304),i}function ui(i){for(var n=[],r=0;31>r;r++)n.push(i);return n}function Ni(i,n){i.pendingLanes|=n,n!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Tt(i,n,r,l,u,d){var _=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 w=i.entanglements,R=i.expirationTimes,Y=i.hiddenUpdates;for(r=_&~r;0<r;){var re=31-Ht(r),ue=1<<re;w[re]=0,R[re]=-1;var G=Y[re];if(G!==null)for(Y[re]=null,re=0;re<G.length;re++){var ee=G[re];ee!==null&&(ee.lane&=-536870913)}r&=~ue}l!==0&&qi(i,l,0),d!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=d&~(_&~n))}function qi(i,n,r){i.pendingLanes|=n,i.suspendedLanes&=~n;var l=31-Ht(n);i.entangledLanes|=n,i.entanglements[l]=i.entanglements[l]|1073741824|r&261930}function Vt(i,n){var r=i.entangledLanes|=n;for(i=i.entanglements;r;){var l=31-Ht(r),u=1<<l;u&n|i[l]&n&&(i[l]|=n),r&=~u}}function Ai(i,n){var r=n&-n;return r=(r&42)!==0?1:ut(r),(r&(i.suspendedLanes|n))!==0?0:r}function ut(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 Pi(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function yi(){var i=X.p;return i!==0?i:(i=window.event,i===void 0?32:qy(i.type))}function dt(i,n){var r=X.p;try{return X.p=i,n()}finally{X.p=r}}var bi=Math.random().toString(36).slice(2),Pt="__reactFiber$"+bi,It="__reactProps$"+bi,Mt="__reactContainer$"+bi,br="__reactEvents$"+bi,aa="__reactListeners$"+bi,la="__reactHandles$"+bi,Sr="__reactResources$"+bi,Cn="__reactMarker$"+bi;function ls(i){delete i[Pt],delete i[It],delete i[br],delete i[aa],delete i[la]}function Lt(i){var n=i[Pt];if(n)return n;for(var r=i.parentNode;r;){if(n=r[Mt]||r[Pt]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(i=Dy(i);i!==null;){if(r=i[Pt])return r;i=Dy(i)}return n}i=r,r=i.parentNode}return null}function Wi(i){if(i=i[Pt]||i[Mt]){var n=i.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return i}return null}function Vn(i){var n=i.tag;if(n===5||n===26||n===27||n===6)return i.stateNode;throw Error(a(33))}function Pn(i){var n=i[Sr];return n||(n=i[Sr]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Kt(i){i[Cn]=!0}var wr=new Set,Os={};function cn(i,n){xn(i,n),xn(i+"Capture",n)}function xn(i,n){for(Os[i]=n,i=0;i<n.length;i++)wr.add(n[i])}var ul=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]*$"),os={},oa={};function ca(i){return st.call(oa,i)?!0:st.call(os,i)?!1:ul.test(i)?oa[i]=!0:(os[i]=!0,!1)}function $i(i,n,r){if(ca(n))if(r===null)i.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":i.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){i.removeAttribute(n);return}}i.setAttribute(n,""+r)}}function In(i,n,r){if(r===null)i.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(n);return}i.setAttribute(n,""+r)}}function T(i,n,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(n,r,""+l)}}function B(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function te(i){var n=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function _e(i,n,r){var l=Object.getOwnPropertyDescriptor(i.constructor.prototype,n);if(!i.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var u=l.get,d=l.set;return Object.defineProperty(i,n,{configurable:!0,get:function(){return u.call(this)},set:function(_){r=""+_,d.call(this,_)}}),Object.defineProperty(i,n,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(_){r=""+_},stopTracking:function(){i._valueTracker=null,delete i[n]}}}}function Te(i){if(!i._valueTracker){var n=te(i)?"checked":"value";i._valueTracker=_e(i,n,""+i[n])}}function Oe(i){if(!i)return!1;var n=i._valueTracker;if(!n)return!0;var r=n.getValue(),l="";return i&&(l=te(i)?i.checked?"true":"false":i.value),i=l,i!==r?(n.setValue(i),!0):!1}function Ae(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 mt=/[\n"\\]/g;function gt(i){return i.replace(mt,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function N(i,n,r,l,u,d,_,w){i.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?i.type=_:i.removeAttribute("type"),n!=null?_==="number"?(n===0&&i.value===""||i.value!=n)&&(i.value=""+B(n)):i.value!==""+B(n)&&(i.value=""+B(n)):_!=="submit"&&_!=="reset"||i.removeAttribute("value"),n!=null?Ue(i,_,B(n)):r!=null?Ue(i,_,B(r)):l!=null&&i.removeAttribute("value"),u==null&&d!=null&&(i.defaultChecked=!!d),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+B(w):i.removeAttribute("name")}function de(i,n,r,l,u,d,_,w){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(i.type=d),n!=null||r!=null){if(!(d!=="submit"&&d!=="reset"||n!=null)){Te(i);return}r=r!=null?""+B(r):"",n=n!=null?""+B(n):r,w||n===i.value||(i.value=n),i.defaultValue=n}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=w?i.checked:!!l,i.defaultChecked=!!l,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(i.name=_),Te(i)}function Ue(i,n,r){n==="number"&&Ae(i.ownerDocument)===i||i.defaultValue===""+r||(i.defaultValue=""+r)}function ze(i,n,r,l){if(i=i.options,n){n={};for(var u=0;u<r.length;u++)n["$"+r[u]]=!0;for(r=0;r<i.length;r++)u=n.hasOwnProperty("$"+i[r].value),i[r].selected!==u&&(i[r].selected=u),u&&l&&(i[r].defaultSelected=!0)}else{for(r=""+B(r),n=null,u=0;u<i.length;u++){if(i[u].value===r){i[u].selected=!0,l&&(i[u].defaultSelected=!0);return}n!==null||i[u].disabled||(n=i[u])}n!==null&&(n.selected=!0)}}function Ge(i,n,r){if(n!=null&&(n=""+B(n),n!==i.value&&(i.value=n),r==null)){i.defaultValue!==n&&(i.defaultValue=n);return}i.defaultValue=r!=null?""+B(r):""}function ht(i,n,r,l){if(n==null){if(l!=null){if(r!=null)throw Error(a(92));if(se(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),n=r}r=B(n),i.defaultValue=r,l=i.textContent,l===r&&l!==""&&l!==null&&(i.value=l),Te(i)}function Bt(i,n){if(n){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=n;return}}i.textContent=n}var Si=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 Qi(i,n,r){var l=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?i.setProperty(n,""):n==="float"?i.cssFloat="":i[n]="":l?i.setProperty(n,r):typeof r!="number"||r===0||Si.has(n)?n==="float"?i.cssFloat=r:i[n]=(""+r).trim():i[n]=r+"px"}function Xn(i,n,r){if(n!=null&&typeof n!="object")throw Error(a(62));if(i=i.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var u in n)l=n[u],n.hasOwnProperty(u)&&r[u]!==l&&Qi(i,u,l)}else for(var d in n)n.hasOwnProperty(d)&&Qi(i,d,n[d])}function cs(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 un=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"]]),Zo=/^[\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 ua(i){return Zo.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function wi(){}var ha=null;function da(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var fa=null,pa=null;function yg(i){var n=Wi(i);if(n&&(i=n.stateNode)){var r=i[It]||null;e:switch(i=n.stateNode,n.type){case"input":if(N(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=i;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+gt(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var l=r[n];if(l!==i&&l.form===i.form){var u=l[It]||null;if(!u)throw Error(a(90));N(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<r.length;n++)l=r[n],l.form===i.form&&Oe(l)}break e;case"textarea":Ge(i,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&ze(i,!!r.multiple,n,!1)}}}var fh=!1;function bg(i,n,r){if(fh)return i(n,r);fh=!0;try{var l=i(n);return l}finally{if(fh=!1,(fa!==null||pa!==null)&&(Hc(),fa&&(n=fa,i=pa,pa=fa=null,yg(n),i)))for(n=0;n<i.length;n++)yg(i[n])}}function hl(i,n){var r=i.stateNode;if(r===null)return null;var l=r[It]||null;if(l===null)return null;r=l[n];e:switch(n){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,n,typeof r));return r}var us=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ph=!1;if(us)try{var dl={};Object.defineProperty(dl,"passive",{get:function(){ph=!0}}),window.addEventListener("test",dl,dl),window.removeEventListener("test",dl,dl)}catch{ph=!1}var zs=null,mh=null,Qo=null;function Sg(){if(Qo)return Qo;var i,n=mh,r=n.length,l,u="value"in zs?zs.value:zs.textContent,d=u.length;for(i=0;i<r&&n[i]===u[i];i++);var _=r-i;for(l=1;l<=_&&n[r-l]===u[d-l];l++);return Qo=u.slice(i,1<l?1-l:void 0)}function Jo(i){var n=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&n===13&&(i=13)):i=n,i===10&&(i=13),32<=i||i===13?i:0}function ec(){return!0}function wg(){return!1}function Ji(i){function n(r,l,u,d,_){this._reactName=r,this._targetInst=u,this.type=l,this.nativeEvent=d,this.target=_,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(r=i[w],this[w]=r?r(d):d[w]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?ec:wg,this.isPropagationStopped=wg,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=ec)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=ec)},persist:function(){},isPersistent:ec}),n}var Cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},tc=Ji(Cr),fl=y({},Cr,{view:0,detail:0}),N1=Ji(fl),gh,_h,pl,ic=y({},fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yh,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!==pl&&(pl&&i.type==="mousemove"?(gh=i.screenX-pl.screenX,_h=i.screenY-pl.screenY):_h=gh=0,pl=i),gh)},movementY:function(i){return"movementY"in i?i.movementY:_h}}),Cg=Ji(ic),A1=y({},ic,{dataTransfer:0}),L1=Ji(A1),B1=y({},fl,{relatedTarget:0}),vh=Ji(B1),O1=y({},Cr,{animationName:0,elapsedTime:0,pseudoElement:0}),z1=Ji(O1),j1=y({},Cr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),H1=Ji(j1),U1=y({},Cr,{data:0}),xg=Ji(U1),P1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},I1={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"},K1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function F1(i){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(i):(i=K1[i])?!!n[i]:!1}function yh(){return F1}var q1=y({},fl,{key:function(i){if(i.key){var n=P1[i.key]||i.key;if(n!=="Unidentified")return n}return i.type==="keypress"?(i=Jo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?I1[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yh,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}}),W1=Ji(q1),$1=y({},ic,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Eg=Ji($1),Y1=y({},fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yh}),V1=Ji(Y1),X1=y({},Cr,{propertyName:0,elapsedTime:0,pseudoElement:0}),G1=Ji(X1),Z1=y({},ic,{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}),Q1=Ji(Z1),J1=y({},Cr,{newState:0,oldState:0}),eC=Ji(J1),tC=[9,13,27,32],bh=us&&"CompositionEvent"in window,ml=null;us&&"documentMode"in document&&(ml=document.documentMode);var iC=us&&"TextEvent"in window&&!ml,Tg=us&&(!bh||ml&&8<ml&&11>=ml),kg=" ",Dg=!1;function Rg(i,n){switch(i){case"keyup":return tC.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mg(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ma=!1;function nC(i,n){switch(i){case"compositionend":return Mg(n);case"keypress":return n.which!==32?null:(Dg=!0,kg);case"textInput":return i=n.data,i===kg&&Dg?null:i;default:return null}}function sC(i,n){if(ma)return i==="compositionend"||!bh&&Rg(i,n)?(i=Sg(),Qo=mh=zs=null,ma=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Tg&&n.locale!=="ko"?null:n.data;default:return null}}var rC={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 Ng(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n==="input"?!!rC[i.type]:n==="textarea"}function Ag(i,n,r,l){fa?pa?pa.push(l):pa=[l]:fa=l,n=Wc(n,"onChange"),0<n.length&&(r=new tc("onChange","change",null,r,l),i.push({event:r,listeners:n}))}var gl=null,_l=null;function aC(i){py(i,0)}function nc(i){var n=Vn(i);if(Oe(n))return i}function Lg(i,n){if(i==="change")return n}var Bg=!1;if(us){var Sh;if(us){var wh="oninput"in document;if(!wh){var Og=document.createElement("div");Og.setAttribute("oninput","return;"),wh=typeof Og.oninput=="function"}Sh=wh}else Sh=!1;Bg=Sh&&(!document.documentMode||9<document.documentMode)}function zg(){gl&&(gl.detachEvent("onpropertychange",jg),_l=gl=null)}function jg(i){if(i.propertyName==="value"&&nc(_l)){var n=[];Ag(n,_l,i,da(i)),bg(aC,n)}}function lC(i,n,r){i==="focusin"?(zg(),gl=n,_l=r,gl.attachEvent("onpropertychange",jg)):i==="focusout"&&zg()}function oC(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return nc(_l)}function cC(i,n){if(i==="click")return nc(n)}function uC(i,n){if(i==="input"||i==="change")return nc(n)}function hC(i,n){return i===n&&(i!==0||1/i===1/n)||i!==i&&n!==n}var hn=typeof Object.is=="function"?Object.is:hC;function vl(i,n){if(hn(i,n))return!0;if(typeof i!="object"||i===null||typeof n!="object"||n===null)return!1;var r=Object.keys(i),l=Object.keys(n);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var u=r[l];if(!st.call(n,u)||!hn(i[u],n[u]))return!1}return!0}function Hg(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Ug(i,n){var r=Hg(i);i=0;for(var l;r;){if(r.nodeType===3){if(l=i+r.textContent.length,i<=n&&l>=n)return{node:r,offset:n-i};i=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Hg(r)}}function Pg(i,n){return i&&n?i===n?!0:i&&i.nodeType===3?!1:n&&n.nodeType===3?Pg(i,n.parentNode):"contains"in i?i.contains(n):i.compareDocumentPosition?!!(i.compareDocumentPosition(n)&16):!1:!1}function Ig(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var n=Ae(i.document);n instanceof i.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)i=n.contentWindow;else break;n=Ae(i.document)}return n}function Ch(i){var n=i&&i.nodeName&&i.nodeName.toLowerCase();return n&&(n==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||n==="textarea"||i.contentEditable==="true")}var dC=us&&"documentMode"in document&&11>=document.documentMode,ga=null,xh=null,yl=null,Eh=!1;function Kg(i,n,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Eh||ga==null||ga!==Ae(l)||(l=ga,"selectionStart"in l&&Ch(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}),yl&&vl(yl,l)||(yl=l,l=Wc(xh,"onSelect"),0<l.length&&(n=new tc("onSelect","select",null,n,r),i.push({event:n,listeners:l}),n.target=ga)))}function xr(i,n){var r={};return r[i.toLowerCase()]=n.toLowerCase(),r["Webkit"+i]="webkit"+n,r["Moz"+i]="moz"+n,r}var _a={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionrun:xr("Transition","TransitionRun"),transitionstart:xr("Transition","TransitionStart"),transitioncancel:xr("Transition","TransitionCancel"),transitionend:xr("Transition","TransitionEnd")},Th={},Fg={};us&&(Fg=document.createElement("div").style,"AnimationEvent"in window||(delete _a.animationend.animation,delete _a.animationiteration.animation,delete _a.animationstart.animation),"TransitionEvent"in window||delete _a.transitionend.transition);function Er(i){if(Th[i])return Th[i];if(!_a[i])return i;var n=_a[i],r;for(r in n)if(n.hasOwnProperty(r)&&r in Fg)return Th[i]=n[r];return i}var qg=Er("animationend"),Wg=Er("animationiteration"),$g=Er("animationstart"),fC=Er("transitionrun"),pC=Er("transitionstart"),mC=Er("transitioncancel"),Yg=Er("transitionend"),Vg=new Map,kh="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(" ");kh.push("scrollEnd");function Kn(i,n){Vg.set(i,n),cn(n,[i])}var sc=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},En=[],va=0,Dh=0;function rc(){for(var i=va,n=Dh=va=0;n<i;){var r=En[n];En[n++]=null;var l=En[n];En[n++]=null;var u=En[n];En[n++]=null;var d=En[n];if(En[n++]=null,l!==null&&u!==null){var _=l.pending;_===null?u.next=u:(u.next=_.next,_.next=u),l.pending=u}d!==0&&Xg(r,u,d)}}function ac(i,n,r,l){En[va++]=i,En[va++]=n,En[va++]=r,En[va++]=l,Dh|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function Rh(i,n,r,l){return ac(i,n,r,l),lc(i)}function Tr(i,n){return ac(i,null,null,n),lc(i)}function Xg(i,n,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&&n!==null&&(u=31-Ht(r),i=d.hiddenUpdates,l=i[u],l===null?i[u]=[n]:l.push(n),n.lane=r|536870912),d):null}function lc(i){if(50<Il)throw Il=0,Hd=null,Error(a(185));for(var n=i.return;n!==null;)i=n,n=i.return;return i.tag===3?i.stateNode:null}var ya={};function gC(i,n,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=n,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 dn(i,n,r,l){return new gC(i,n,r,l)}function Mh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function hs(i,n){var r=i.alternate;return r===null?(r=dn(i.tag,n,i.key,i.mode),r.elementType=i.elementType,r.type=i.type,r.stateNode=i.stateNode,r.alternate=i,i.alternate=r):(r.pendingProps=n,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,n=i.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=i.sibling,r.index=i.index,r.ref=i.ref,r.refCleanup=i.refCleanup,r}function Gg(i,n){i.flags&=65011714;var r=i.alternate;return r===null?(i.childLanes=0,i.lanes=n,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,n=r.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),i}function oc(i,n,r,l,u,d){var _=0;if(l=i,typeof i=="function")Mh(i)&&(_=1);else if(typeof i=="string")_=Sx(i,r,fe.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case pe:return i=dn(31,r,n,u),i.elementType=pe,i.lanes=d,i;case E:return kr(r.children,u,d,n);case L:_=8,u|=24;break;case D:return i=dn(12,r,n,u|2),i.elementType=D,i.lanes=d,i;case ie:return i=dn(13,r,n,u),i.elementType=ie,i.lanes=d,i;case ne:return i=dn(19,r,n,u),i.elementType=ne,i.lanes=d,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case U:_=10;break e;case j:_=9;break e;case Z:_=11;break e;case ae:_=14;break e;case oe:_=16,l=null;break e}_=29,r=Error(a(130,i===null?"null":typeof i,"")),l=null}return n=dn(_,r,n,u),n.elementType=i,n.type=l,n.lanes=d,n}function kr(i,n,r,l){return i=dn(7,i,l,n),i.lanes=r,i}function Nh(i,n,r){return i=dn(6,i,null,n),i.lanes=r,i}function Zg(i){var n=dn(18,null,null,0);return n.stateNode=i,n}function Ah(i,n,r){return n=dn(4,i.children!==null?i.children:[],i.key,n),n.lanes=r,n.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},n}var Qg=new WeakMap;function Tn(i,n){if(typeof i=="object"&&i!==null){var r=Qg.get(i);return r!==void 0?r:(n={value:i,source:n,stack:qe(n)},Qg.set(i,n),n)}return{value:i,source:n,stack:qe(n)}}var ba=[],Sa=0,cc=null,bl=0,kn=[],Dn=0,js=null,Gn=1,Zn="";function ds(i,n){ba[Sa++]=bl,ba[Sa++]=cc,cc=i,bl=n}function Jg(i,n,r){kn[Dn++]=Gn,kn[Dn++]=Zn,kn[Dn++]=js,js=i;var l=Gn;i=Zn;var u=32-Ht(l)-1;l&=~(1<<u),r+=1;var d=32-Ht(n)+u;if(30<d){var _=u-u%5;d=(l&(1<<_)-1).toString(32),l>>=_,u-=_,Gn=1<<32-Ht(n)+u|r<<u|l,Zn=d+i}else Gn=1<<d|r<<u|l,Zn=i}function Lh(i){i.return!==null&&(ds(i,1),Jg(i,1,0))}function Bh(i){for(;i===cc;)cc=ba[--Sa],ba[Sa]=null,bl=ba[--Sa],ba[Sa]=null;for(;i===js;)js=kn[--Dn],kn[Dn]=null,Zn=kn[--Dn],kn[Dn]=null,Gn=kn[--Dn],kn[Dn]=null}function e_(i,n){kn[Dn++]=Gn,kn[Dn++]=Zn,kn[Dn++]=js,Gn=n.id,Zn=n.overflow,js=i}var Li=null,kt=null,nt=!1,Hs=null,Rn=!1,Oh=Error(a(519));function Us(i){var n=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Sl(Tn(n,i)),Oh}function t_(i){var n=i.stateNode,r=i.type,l=i.memoizedProps;switch(n[Pt]=i,n[It]=l,r){case"dialog":Qe("cancel",n),Qe("close",n);break;case"iframe":case"object":case"embed":Qe("load",n);break;case"video":case"audio":for(r=0;r<Fl.length;r++)Qe(Fl[r],n);break;case"source":Qe("error",n);break;case"img":case"image":case"link":Qe("error",n),Qe("load",n);break;case"details":Qe("toggle",n);break;case"input":Qe("invalid",n),de(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Qe("invalid",n);break;case"textarea":Qe("invalid",n),ht(n,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||l.suppressHydrationWarning===!0||vy(n.textContent,r)?(l.popover!=null&&(Qe("beforetoggle",n),Qe("toggle",n)),l.onScroll!=null&&Qe("scroll",n),l.onScrollEnd!=null&&Qe("scrollend",n),l.onClick!=null&&(n.onclick=wi),n=!0):n=!1,n||Us(i,!0)}function i_(i){for(Li=i.return;Li;)switch(Li.tag){case 5:case 31:case 13:Rn=!1;return;case 27:case 3:Rn=!0;return;default:Li=Li.return}}function wa(i){if(i!==Li)return!1;if(!nt)return i_(i),nt=!0,!1;var n=i.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=i.type,r=!(r!=="form"&&r!=="button")||Jd(i.type,i.memoizedProps)),r=!r),r&&kt&&Us(i),i_(i),n===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));kt=ky(i)}else if(n===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));kt=ky(i)}else n===27?(n=kt,Js(i.type)?(i=rf,rf=null,kt=i):kt=n):kt=Li?Nn(i.stateNode.nextSibling):null;return!0}function Dr(){kt=Li=null,nt=!1}function zh(){var i=Hs;return i!==null&&(sn===null?sn=i:sn.push.apply(sn,i),Hs=null),i}function Sl(i){Hs===null?Hs=[i]:Hs.push(i)}var jh=k(null),Rr=null,fs=null;function Ps(i,n,r){le(jh,n._currentValue),n._currentValue=r}function ps(i){i._currentValue=jh.current,Q(jh)}function Hh(i,n,r){for(;i!==null;){var l=i.alternate;if((i.childLanes&n)!==n?(i.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),i===r)break;i=i.return}}function Uh(i,n,r,l){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var d=u.dependencies;if(d!==null){var _=u.child;d=d.firstContext;e:for(;d!==null;){var w=d;d=u;for(var R=0;R<n.length;R++)if(w.context===n[R]){d.lanes|=r,w=d.alternate,w!==null&&(w.lanes|=r),Hh(d.return,r,i),l||(_=null);break e}d=w.next}}else if(u.tag===18){if(_=u.return,_===null)throw Error(a(341));_.lanes|=r,d=_.alternate,d!==null&&(d.lanes|=r),Hh(_,r,i),_=null}else _=u.child;if(_!==null)_.return=u;else for(_=u;_!==null;){if(_===i){_=null;break}if(u=_.sibling,u!==null){u.return=_.return,_=u;break}_=_.return}u=_}}function Ca(i,n,r,l){i=null;for(var u=n,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 _=u.alternate;if(_===null)throw Error(a(387));if(_=_.memoizedProps,_!==null){var w=u.type;hn(u.pendingProps.value,_.value)||(i!==null?i.push(w):i=[w])}}else if(u===ke.current){if(_=u.alternate,_===null)throw Error(a(387));_.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(Vl):i=[Vl])}u=u.return}i!==null&&Uh(n,i,r,l),n.flags|=262144}function uc(i){for(i=i.firstContext;i!==null;){if(!hn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Mr(i){Rr=i,fs=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Bi(i){return n_(Rr,i)}function hc(i,n){return Rr===null&&Mr(i),n_(i,n)}function n_(i,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},fs===null){if(i===null)throw Error(a(308));fs=n,i.dependencies={lanes:0,firstContext:n},i.flags|=524288}else fs=fs.next=n;return r}var _C=typeof AbortController<"u"?AbortController:function(){var i=[],n=this.signal={aborted:!1,addEventListener:function(r,l){i.push(l)}};this.abort=function(){n.aborted=!0,i.forEach(function(r){return r()})}},vC=e.unstable_scheduleCallback,yC=e.unstable_NormalPriority,ti={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ph(){return{controller:new _C,data:new Map,refCount:0}}function wl(i){i.refCount--,i.refCount===0&&vC(yC,function(){i.controller.abort()})}var Cl=null,Ih=0,xa=0,Ea=null;function bC(i,n){if(Cl===null){var r=Cl=[];Ih=0,xa=qd(),Ea={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Ih++,n.then(s_,s_),n}function s_(){if(--Ih===0&&Cl!==null){Ea!==null&&(Ea.status="fulfilled");var i=Cl;Cl=null,xa=0,Ea=null;for(var n=0;n<i.length;n++)(0,i[n])()}}function SC(i,n){var r=[],l={status:"pending",value:null,reason:null,then:function(u){r.push(u)}};return i.then(function(){l.status="fulfilled",l.value=n;for(var u=0;u<r.length;u++)(0,r[u])(n)},function(u){for(l.status="rejected",l.reason=u,u=0;u<r.length;u++)(0,r[u])(void 0)}),l}var r_=M.S;M.S=function(i,n){Kv=lt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&bC(i,n),r_!==null&&r_(i,n)};var Nr=k(null);function Kh(){var i=Nr.current;return i!==null?i:Ct.pooledCache}function dc(i,n){n===null?le(Nr,Nr.current):le(Nr,n.pool)}function a_(){var i=Kh();return i===null?null:{parent:ti._currentValue,pool:i}}var Ta=Error(a(460)),Fh=Error(a(474)),fc=Error(a(542)),pc={then:function(){}};function l_(i){return i=i.status,i==="fulfilled"||i==="rejected"}function o_(i,n,r){switch(r=i[r],r===void 0?i.push(n):r!==n&&(n.then(wi,wi),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw i=n.reason,u_(i),i;default:if(typeof n.status=="string")n.then(wi,wi);else{if(i=Ct,i!==null&&100<i.shellSuspendCounter)throw Error(a(482));i=n,i.status="pending",i.then(function(l){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=l}},function(l){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw i=n.reason,u_(i),i}throw Lr=n,Ta}}function Ar(i){try{var n=i._init;return n(i._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Lr=r,Ta):r}}var Lr=null;function c_(){if(Lr===null)throw Error(a(459));var i=Lr;return Lr=null,i}function u_(i){if(i===Ta||i===fc)throw Error(a(483))}var ka=null,xl=0;function mc(i){var n=xl;return xl+=1,ka===null&&(ka=[]),o_(ka,i,n)}function El(i,n){n=n.props.ref,i.ref=n!==void 0?n:null}function gc(i,n){throw n.$$typeof===S?Error(a(525)):(i=Object.prototype.toString.call(n),Error(a(31,i==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":i)))}function h_(i){function n(P,A){if(i){var W=P.deletions;W===null?(P.deletions=[A],P.flags|=16):W.push(A)}}function r(P,A){if(!i)return null;for(;A!==null;)n(P,A),A=A.sibling;return null}function l(P){for(var A=new Map;P!==null;)P.key!==null?A.set(P.key,P):A.set(P.index,P),P=P.sibling;return A}function u(P,A){return P=hs(P,A),P.index=0,P.sibling=null,P}function d(P,A,W){return P.index=W,i?(W=P.alternate,W!==null?(W=W.index,W<A?(P.flags|=67108866,A):W):(P.flags|=67108866,A)):(P.flags|=1048576,A)}function _(P){return i&&P.alternate===null&&(P.flags|=67108866),P}function w(P,A,W,ce){return A===null||A.tag!==6?(A=Nh(W,P.mode,ce),A.return=P,A):(A=u(A,W),A.return=P,A)}function R(P,A,W,ce){var Be=W.type;return Be===E?re(P,A,W.props.children,ce,W.key):A!==null&&(A.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===oe&&Ar(Be)===A.type)?(A=u(A,W.props),El(A,W),A.return=P,A):(A=oc(W.type,W.key,W.props,null,P.mode,ce),El(A,W),A.return=P,A)}function Y(P,A,W,ce){return A===null||A.tag!==4||A.stateNode.containerInfo!==W.containerInfo||A.stateNode.implementation!==W.implementation?(A=Ah(W,P.mode,ce),A.return=P,A):(A=u(A,W.children||[]),A.return=P,A)}function re(P,A,W,ce,Be){return A===null||A.tag!==7?(A=kr(W,P.mode,ce,Be),A.return=P,A):(A=u(A,W),A.return=P,A)}function ue(P,A,W){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=Nh(""+A,P.mode,W),A.return=P,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case C:return W=oc(A.type,A.key,A.props,null,P.mode,W),El(W,A),W.return=P,W;case x:return A=Ah(A,P.mode,W),A.return=P,A;case oe:return A=Ar(A),ue(P,A,W)}if(se(A)||K(A))return A=kr(A,P.mode,W,null),A.return=P,A;if(typeof A.then=="function")return ue(P,mc(A),W);if(A.$$typeof===U)return ue(P,hc(P,A),W);gc(P,A)}return null}function G(P,A,W,ce){var Be=A!==null?A.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Be!==null?null:w(P,A,""+W,ce);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case C:return W.key===Be?R(P,A,W,ce):null;case x:return W.key===Be?Y(P,A,W,ce):null;case oe:return W=Ar(W),G(P,A,W,ce)}if(se(W)||K(W))return Be!==null?null:re(P,A,W,ce,null);if(typeof W.then=="function")return G(P,A,mc(W),ce);if(W.$$typeof===U)return G(P,A,hc(P,W),ce);gc(P,W)}return null}function ee(P,A,W,ce,Be){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return P=P.get(W)||null,w(A,P,""+ce,Be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case C:return P=P.get(ce.key===null?W:ce.key)||null,R(A,P,ce,Be);case x:return P=P.get(ce.key===null?W:ce.key)||null,Y(A,P,ce,Be);case oe:return ce=Ar(ce),ee(P,A,W,ce,Be)}if(se(ce)||K(ce))return P=P.get(W)||null,re(A,P,ce,Be,null);if(typeof ce.then=="function")return ee(P,A,W,mc(ce),Be);if(ce.$$typeof===U)return ee(P,A,W,hc(A,ce),Be);gc(A,ce)}return null}function Re(P,A,W,ce){for(var Be=null,rt=null,Ne=A,$e=A=0,it=null;Ne!==null&&$e<W.length;$e++){Ne.index>$e?(it=Ne,Ne=null):it=Ne.sibling;var at=G(P,Ne,W[$e],ce);if(at===null){Ne===null&&(Ne=it);break}i&&Ne&&at.alternate===null&&n(P,Ne),A=d(at,A,$e),rt===null?Be=at:rt.sibling=at,rt=at,Ne=it}if($e===W.length)return r(P,Ne),nt&&ds(P,$e),Be;if(Ne===null){for(;$e<W.length;$e++)Ne=ue(P,W[$e],ce),Ne!==null&&(A=d(Ne,A,$e),rt===null?Be=Ne:rt.sibling=Ne,rt=Ne);return nt&&ds(P,$e),Be}for(Ne=l(Ne);$e<W.length;$e++)it=ee(Ne,P,$e,W[$e],ce),it!==null&&(i&&it.alternate!==null&&Ne.delete(it.key===null?$e:it.key),A=d(it,A,$e),rt===null?Be=it:rt.sibling=it,rt=it);return i&&Ne.forEach(function(sr){return n(P,sr)}),nt&&ds(P,$e),Be}function je(P,A,W,ce){if(W==null)throw Error(a(151));for(var Be=null,rt=null,Ne=A,$e=A=0,it=null,at=W.next();Ne!==null&&!at.done;$e++,at=W.next()){Ne.index>$e?(it=Ne,Ne=null):it=Ne.sibling;var sr=G(P,Ne,at.value,ce);if(sr===null){Ne===null&&(Ne=it);break}i&&Ne&&sr.alternate===null&&n(P,Ne),A=d(sr,A,$e),rt===null?Be=sr:rt.sibling=sr,rt=sr,Ne=it}if(at.done)return r(P,Ne),nt&&ds(P,$e),Be;if(Ne===null){for(;!at.done;$e++,at=W.next())at=ue(P,at.value,ce),at!==null&&(A=d(at,A,$e),rt===null?Be=at:rt.sibling=at,rt=at);return nt&&ds(P,$e),Be}for(Ne=l(Ne);!at.done;$e++,at=W.next())at=ee(Ne,P,$e,at.value,ce),at!==null&&(i&&at.alternate!==null&&Ne.delete(at.key===null?$e:at.key),A=d(at,A,$e),rt===null?Be=at:rt.sibling=at,rt=at);return i&&Ne.forEach(function(Ax){return n(P,Ax)}),nt&&ds(P,$e),Be}function yt(P,A,W,ce){if(typeof W=="object"&&W!==null&&W.type===E&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case C:e:{for(var Be=W.key;A!==null;){if(A.key===Be){if(Be=W.type,Be===E){if(A.tag===7){r(P,A.sibling),ce=u(A,W.props.children),ce.return=P,P=ce;break e}}else if(A.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===oe&&Ar(Be)===A.type){r(P,A.sibling),ce=u(A,W.props),El(ce,W),ce.return=P,P=ce;break e}r(P,A);break}else n(P,A);A=A.sibling}W.type===E?(ce=kr(W.props.children,P.mode,ce,W.key),ce.return=P,P=ce):(ce=oc(W.type,W.key,W.props,null,P.mode,ce),El(ce,W),ce.return=P,P=ce)}return _(P);case x:e:{for(Be=W.key;A!==null;){if(A.key===Be)if(A.tag===4&&A.stateNode.containerInfo===W.containerInfo&&A.stateNode.implementation===W.implementation){r(P,A.sibling),ce=u(A,W.children||[]),ce.return=P,P=ce;break e}else{r(P,A);break}else n(P,A);A=A.sibling}ce=Ah(W,P.mode,ce),ce.return=P,P=ce}return _(P);case oe:return W=Ar(W),yt(P,A,W,ce)}if(se(W))return Re(P,A,W,ce);if(K(W)){if(Be=K(W),typeof Be!="function")throw Error(a(150));return W=Be.call(W),je(P,A,W,ce)}if(typeof W.then=="function")return yt(P,A,mc(W),ce);if(W.$$typeof===U)return yt(P,A,hc(P,W),ce);gc(P,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,A!==null&&A.tag===6?(r(P,A.sibling),ce=u(A,W),ce.return=P,P=ce):(r(P,A),ce=Nh(W,P.mode,ce),ce.return=P,P=ce),_(P)):r(P,A)}return function(P,A,W,ce){try{xl=0;var Be=yt(P,A,W,ce);return ka=null,Be}catch(Ne){if(Ne===Ta||Ne===fc)throw Ne;var rt=dn(29,Ne,null,P.mode);return rt.lanes=ce,rt.return=P,rt}}}var Br=h_(!0),d_=h_(!1),Is=!1;function qh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wh(i,n){i=i.updateQueue,n.updateQueue===i&&(n.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Ks(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Fs(i,n,r){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(ot&2)!==0){var u=l.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),l.pending=n,n=lc(i),Xg(i,null,r),n}return ac(i,l,n,r),lc(i)}function Tl(i,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var l=n.lanes;l&=i.pendingLanes,r|=l,n.lanes=r,Vt(i,r)}}function $h(i,n){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 _={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};d===null?u=d=_:d=d.next=_,r=r.next}while(r!==null);d===null?u=d=n:d=d.next=n}else u=d=n;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=n:i.next=n,r.lastBaseUpdate=n}var Yh=!1;function kl(){if(Yh){var i=Ea;if(i!==null)throw i}}function Dl(i,n,r,l){Yh=!1;var u=i.updateQueue;Is=!1;var d=u.firstBaseUpdate,_=u.lastBaseUpdate,w=u.shared.pending;if(w!==null){u.shared.pending=null;var R=w,Y=R.next;R.next=null,_===null?d=Y:_.next=Y,_=R;var re=i.alternate;re!==null&&(re=re.updateQueue,w=re.lastBaseUpdate,w!==_&&(w===null?re.firstBaseUpdate=Y:w.next=Y,re.lastBaseUpdate=R))}if(d!==null){var ue=u.baseState;_=0,re=Y=R=null,w=d;do{var G=w.lane&-536870913,ee=G!==w.lane;if(ee?(tt&G)===G:(l&G)===G){G!==0&&G===xa&&(Yh=!0),re!==null&&(re=re.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Re=i,je=w;G=n;var yt=r;switch(je.tag){case 1:if(Re=je.payload,typeof Re=="function"){ue=Re.call(yt,ue,G);break e}ue=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=je.payload,G=typeof Re=="function"?Re.call(yt,ue,G):Re,G==null)break e;ue=y({},ue,G);break e;case 2:Is=!0}}G=w.callback,G!==null&&(i.flags|=64,ee&&(i.flags|=8192),ee=u.callbacks,ee===null?u.callbacks=[G]:ee.push(G))}else ee={lane:G,tag:w.tag,payload:w.payload,callback:w.callback,next:null},re===null?(Y=re=ee,R=ue):re=re.next=ee,_|=G;if(w=w.next,w===null){if(w=u.shared.pending,w===null)break;ee=w,w=ee.next,ee.next=null,u.lastBaseUpdate=ee,u.shared.pending=null}}while(!0);re===null&&(R=ue),u.baseState=R,u.firstBaseUpdate=Y,u.lastBaseUpdate=re,d===null&&(u.shared.lanes=0),Vs|=_,i.lanes=_,i.memoizedState=ue}}function f_(i,n){if(typeof i!="function")throw Error(a(191,i));i.call(n)}function p_(i,n){var r=i.callbacks;if(r!==null)for(i.callbacks=null,i=0;i<r.length;i++)f_(r[i],n)}var Da=k(null),_c=k(0);function m_(i,n){i=Cs,le(_c,i),le(Da,n),Cs=i|n.baseLanes}function Vh(){le(_c,Cs),le(Da,Da.current)}function Xh(){Cs=_c.current,Q(Da),Q(_c)}var fn=k(null),Mn=null;function qs(i){var n=i.alternate;le(Xt,Xt.current&1),le(fn,i),Mn===null&&(n===null||Da.current!==null||n.memoizedState!==null)&&(Mn=i)}function Gh(i){le(Xt,Xt.current),le(fn,i),Mn===null&&(Mn=i)}function g_(i){i.tag===22?(le(Xt,Xt.current),le(fn,i),Mn===null&&(Mn=i)):Ws()}function Ws(){le(Xt,Xt.current),le(fn,fn.current)}function pn(i){Q(fn),Mn===i&&(Mn=null),Q(Xt)}var Xt=k(0);function vc(i){for(var n=i;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||nf(r)||sf(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ms=0,We=null,_t=null,ii=null,yc=!1,Ra=!1,Or=!1,bc=0,Rl=0,Ma=null,wC=0;function Ft(){throw Error(a(321))}function Zh(i,n){if(n===null)return!1;for(var r=0;r<n.length&&r<i.length;r++)if(!hn(i[r],n[r]))return!1;return!0}function Qh(i,n,r,l,u,d){return ms=d,We=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,M.H=i===null||i.memoizedState===null?J_:fd,Or=!1,d=r(l,u),Or=!1,Ra&&(d=v_(n,r,l,u)),__(i),d}function __(i){M.H=Al;var n=_t!==null&&_t.next!==null;if(ms=0,ii=_t=We=null,yc=!1,Rl=0,Ma=null,n)throw Error(a(300));i===null||ni||(i=i.dependencies,i!==null&&uc(i)&&(ni=!0))}function v_(i,n,r,l){We=i;var u=0;do{if(Ra&&(Ma=null),Rl=0,Ra=!1,25<=u)throw Error(a(301));if(u+=1,ii=_t=null,i.updateQueue!=null){var d=i.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}M.H=ev,d=n(r,l)}while(Ra);return d}function CC(){var i=M.H,n=i.useState()[0];return n=typeof n.then=="function"?Ml(n):n,i=i.useState()[0],(_t!==null?_t.memoizedState:null)!==i&&(We.flags|=1024),n}function Jh(){var i=bc!==0;return bc=0,i}function ed(i,n,r){n.updateQueue=i.updateQueue,n.flags&=-2053,i.lanes&=~r}function td(i){if(yc){for(i=i.memoizedState;i!==null;){var n=i.queue;n!==null&&(n.pending=null),i=i.next}yc=!1}ms=0,ii=_t=We=null,Ra=!1,Rl=bc=0,Ma=null}function Yi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ii===null?We.memoizedState=ii=i:ii=ii.next=i,ii}function Gt(){if(_t===null){var i=We.alternate;i=i!==null?i.memoizedState:null}else i=_t.next;var n=ii===null?We.memoizedState:ii.next;if(n!==null)ii=n,_t=i;else{if(i===null)throw We.alternate===null?Error(a(467)):Error(a(310));_t=i,i={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},ii===null?We.memoizedState=ii=i:ii=ii.next=i}return ii}function Sc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ml(i){var n=Rl;return Rl+=1,Ma===null&&(Ma=[]),i=o_(Ma,i,n),n=We,(ii===null?n.memoizedState:ii.next)===null&&(n=n.alternate,M.H=n===null||n.memoizedState===null?J_:fd),i}function wc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Ml(i);if(i.$$typeof===U)return Bi(i)}throw Error(a(438,String(i)))}function id(i){var n=null,r=We.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var l=We.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=Sc(),We.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(i),l=0;l<i;l++)r[l]=I;return n.index++,r}function gs(i,n){return typeof n=="function"?n(i):n}function Cc(i){var n=Gt();return nd(n,_t,i)}function nd(i,n,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 _=u.next;u.next=d.next,d.next=_}n.baseQueue=u=d,l.pending=null}if(d=i.baseState,u===null)i.memoizedState=d;else{n=u.next;var w=_=null,R=null,Y=n,re=!1;do{var ue=Y.lane&-536870913;if(ue!==Y.lane?(tt&ue)===ue:(ms&ue)===ue){var G=Y.revertLane;if(G===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),ue===xa&&(re=!0);else if((ms&G)===G){Y=Y.next,G===xa&&(re=!0);continue}else ue={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},R===null?(w=R=ue,_=d):R=R.next=ue,We.lanes|=G,Vs|=G;ue=Y.action,Or&&r(d,ue),d=Y.hasEagerState?Y.eagerState:r(d,ue)}else G={lane:ue,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},R===null?(w=R=G,_=d):R=R.next=G,We.lanes|=ue,Vs|=ue;Y=Y.next}while(Y!==null&&Y!==n);if(R===null?_=d:R.next=w,!hn(d,i.memoizedState)&&(ni=!0,re&&(r=Ea,r!==null)))throw r;i.memoizedState=d,i.baseState=_,i.baseQueue=R,l.lastRenderedState=d}return u===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function sd(i){var n=Gt(),r=n.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=i;var l=r.dispatch,u=r.pending,d=n.memoizedState;if(u!==null){r.pending=null;var _=u=u.next;do d=i(d,_.action),_=_.next;while(_!==u);hn(d,n.memoizedState)||(ni=!0),n.memoizedState=d,n.baseQueue===null&&(n.baseState=d),r.lastRenderedState=d}return[d,l]}function y_(i,n,r){var l=We,u=Gt(),d=nt;if(d){if(r===void 0)throw Error(a(407));r=r()}else r=n();var _=!hn((_t||u).memoizedState,r);if(_&&(u.memoizedState=r,ni=!0),u=u.queue,ld(w_.bind(null,l,u,i),[i]),u.getSnapshot!==n||_||ii!==null&&ii.memoizedState.tag&1){if(l.flags|=2048,Na(9,{destroy:void 0},S_.bind(null,l,u,r,n),null),Ct===null)throw Error(a(349));d||(ms&127)!==0||b_(l,n,r)}return r}function b_(i,n,r){i.flags|=16384,i={getSnapshot:n,value:r},n=We.updateQueue,n===null?(n=Sc(),We.updateQueue=n,n.stores=[i]):(r=n.stores,r===null?n.stores=[i]:r.push(i))}function S_(i,n,r,l){n.value=r,n.getSnapshot=l,C_(n)&&x_(i)}function w_(i,n,r){return r(function(){C_(n)&&x_(i)})}function C_(i){var n=i.getSnapshot;i=i.value;try{var r=n();return!hn(i,r)}catch{return!0}}function x_(i){var n=Tr(i,2);n!==null&&rn(n,i,2)}function rd(i){var n=Yi();if(typeof i=="function"){var r=i;if(i=r(),Or){Jt(!0);try{r()}finally{Jt(!1)}}}return n.memoizedState=n.baseState=i,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:i},n}function E_(i,n,r,l){return i.baseState=r,nd(i,_t,typeof l=="function"?l:gs)}function xC(i,n,r,l,u){if(Tc(i))throw Error(a(485));if(i=n.action,i!==null){var d={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){d.listeners.push(_)}};M.T!==null?r(!0):d.isTransition=!1,l(d),r=n.pending,r===null?(d.next=n.pending=d,T_(n,d)):(d.next=r.next,n.pending=r.next=d)}}function T_(i,n){var r=n.action,l=n.payload,u=i.state;if(n.isTransition){var d=M.T,_={};M.T=_;try{var w=r(u,l),R=M.S;R!==null&&R(_,w),k_(i,n,w)}catch(Y){ad(i,n,Y)}finally{d!==null&&_.types!==null&&(d.types=_.types),M.T=d}}else try{d=r(u,l),k_(i,n,d)}catch(Y){ad(i,n,Y)}}function k_(i,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){D_(i,n,l)},function(l){return ad(i,n,l)}):D_(i,n,r)}function D_(i,n,r){n.status="fulfilled",n.value=r,R_(n),i.state=r,n=i.pending,n!==null&&(r=n.next,r===n?i.pending=null:(r=r.next,n.next=r,T_(i,r)))}function ad(i,n,r){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=r,R_(n),n=n.next;while(n!==l)}i.action=null}function R_(i){i=i.listeners;for(var n=0;n<i.length;n++)(0,i[n])()}function M_(i,n){return n}function N_(i,n){if(nt){var r=Ct.formState;if(r!==null){e:{var l=We;if(nt){if(kt){t:{for(var u=kt,d=Rn;u.nodeType!==8;){if(!d){u=null;break t}if(u=Nn(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){kt=Nn(u.nextSibling),l=u.data==="F!";break e}}Us(l)}l=!1}l&&(n=r[0])}}return r=Yi(),r.memoizedState=r.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:M_,lastRenderedState:n},r.queue=l,r=G_.bind(null,We,l),l.dispatch=r,l=rd(!1),d=dd.bind(null,We,!1,l.queue),l=Yi(),u={state:n,dispatch:null,action:i,pending:null},l.queue=u,r=xC.bind(null,We,u,d,r),u.dispatch=r,l.memoizedState=i,[n,r,!1]}function A_(i){var n=Gt();return L_(n,_t,i)}function L_(i,n,r){if(n=nd(i,n,M_)[0],i=Cc(gs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=Ml(n)}catch(_){throw _===Ta?fc:_}else l=n;n=Gt();var u=n.queue,d=u.dispatch;return r!==n.memoizedState&&(We.flags|=2048,Na(9,{destroy:void 0},EC.bind(null,u,r),null)),[l,d,i]}function EC(i,n){i.action=n}function B_(i){var n=Gt(),r=_t;if(r!==null)return L_(n,r,i);Gt(),n=n.memoizedState,r=Gt();var l=r.queue.dispatch;return r.memoizedState=i,[n,l,!1]}function Na(i,n,r,l){return i={tag:i,create:r,deps:l,inst:n,next:null},n=We.updateQueue,n===null&&(n=Sc(),We.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=i.next=i:(l=r.next,r.next=i,i.next=l,n.lastEffect=i),i}function O_(){return Gt().memoizedState}function xc(i,n,r,l){var u=Yi();We.flags|=i,u.memoizedState=Na(1|n,{destroy:void 0},r,l===void 0?null:l)}function Ec(i,n,r,l){var u=Gt();l=l===void 0?null:l;var d=u.memoizedState.inst;_t!==null&&l!==null&&Zh(l,_t.memoizedState.deps)?u.memoizedState=Na(n,d,r,l):(We.flags|=i,u.memoizedState=Na(1|n,d,r,l))}function z_(i,n){xc(8390656,8,i,n)}function ld(i,n){Ec(2048,8,i,n)}function TC(i){We.flags|=4;var n=We.updateQueue;if(n===null)n=Sc(),We.updateQueue=n,n.events=[i];else{var r=n.events;r===null?n.events=[i]:r.push(i)}}function j_(i){var n=Gt().memoizedState;return TC({ref:n,nextImpl:i}),function(){if((ot&2)!==0)throw Error(a(440));return n.impl.apply(void 0,arguments)}}function H_(i,n){return Ec(4,2,i,n)}function U_(i,n){return Ec(4,4,i,n)}function P_(i,n){if(typeof n=="function"){i=i();var r=n(i);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return i=i(),n.current=i,function(){n.current=null}}function I_(i,n,r){r=r!=null?r.concat([i]):null,Ec(4,4,P_.bind(null,n,i),r)}function od(){}function K_(i,n){var r=Gt();n=n===void 0?null:n;var l=r.memoizedState;return n!==null&&Zh(n,l[1])?l[0]:(r.memoizedState=[i,n],i)}function F_(i,n){var r=Gt();n=n===void 0?null:n;var l=r.memoizedState;if(n!==null&&Zh(n,l[1]))return l[0];if(l=i(),Or){Jt(!0);try{i()}finally{Jt(!1)}}return r.memoizedState=[l,n],l}function cd(i,n,r){return r===void 0||(ms&1073741824)!==0&&(tt&261930)===0?i.memoizedState=n:(i.memoizedState=r,i=qv(),We.lanes|=i,Vs|=i,r)}function q_(i,n,r,l){return hn(r,n)?r:Da.current!==null?(i=cd(i,r,l),hn(i,n)||(ni=!0),i):(ms&42)===0||(ms&1073741824)!==0&&(tt&261930)===0?(ni=!0,i.memoizedState=r):(i=qv(),We.lanes|=i,Vs|=i,n)}function W_(i,n,r,l,u){var d=X.p;X.p=d!==0&&8>d?d:8;var _=M.T,w={};M.T=w,dd(i,!1,n,r);try{var R=u(),Y=M.S;if(Y!==null&&Y(w,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var re=SC(R,l);Nl(i,n,re,_n(i))}else Nl(i,n,l,_n(i))}catch(ue){Nl(i,n,{then:function(){},status:"rejected",reason:ue},_n())}finally{X.p=d,_!==null&&w.types!==null&&(_.types=w.types),M.T=_}}function kC(){}function ud(i,n,r,l){if(i.tag!==5)throw Error(a(476));var u=$_(i).queue;W_(i,u,n,V,r===null?kC:function(){return Y_(i),r(l)})}function $_(i){var n=i.memoizedState;if(n!==null)return n;n={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:V},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:r},next:null},i.memoizedState=n,i=i.alternate,i!==null&&(i.memoizedState=n),n}function Y_(i){var n=$_(i);n.next===null&&(n=i.alternate.memoizedState),Nl(i,n.next.queue,{},_n())}function hd(){return Bi(Vl)}function V_(){return Gt().memoizedState}function X_(){return Gt().memoizedState}function DC(i){for(var n=i.return;n!==null;){switch(n.tag){case 24:case 3:var r=_n();i=Ks(r);var l=Fs(n,i,r);l!==null&&(rn(l,n,r),Tl(l,n,r)),n={cache:Ph()},i.payload=n;return}n=n.return}}function RC(i,n,r){var l=_n();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Tc(i)?Z_(n,r):(r=Rh(i,n,r,l),r!==null&&(rn(r,i,l),Q_(r,n,l)))}function G_(i,n,r){var l=_n();Nl(i,n,r,l)}function Nl(i,n,r,l){var u={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Tc(i))Z_(n,u);else{var d=i.alternate;if(i.lanes===0&&(d===null||d.lanes===0)&&(d=n.lastRenderedReducer,d!==null))try{var _=n.lastRenderedState,w=d(_,r);if(u.hasEagerState=!0,u.eagerState=w,hn(w,_))return ac(i,n,u,0),Ct===null&&rc(),!1}catch{}if(r=Rh(i,n,u,l),r!==null)return rn(r,i,l),Q_(r,n,l),!0}return!1}function dd(i,n,r,l){if(l={lane:2,revertLane:qd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Tc(i)){if(n)throw Error(a(479))}else n=Rh(i,r,l,2),n!==null&&rn(n,i,2)}function Tc(i){var n=i.alternate;return i===We||n!==null&&n===We}function Z_(i,n){Ra=yc=!0;var r=i.pending;r===null?n.next=n:(n.next=r.next,r.next=n),i.pending=n}function Q_(i,n,r){if((r&4194048)!==0){var l=n.lanes;l&=i.pendingLanes,r|=l,n.lanes=r,Vt(i,r)}}var Al={readContext:Bi,use:wc,useCallback:Ft,useContext:Ft,useEffect:Ft,useImperativeHandle:Ft,useLayoutEffect:Ft,useInsertionEffect:Ft,useMemo:Ft,useReducer:Ft,useRef:Ft,useState:Ft,useDebugValue:Ft,useDeferredValue:Ft,useTransition:Ft,useSyncExternalStore:Ft,useId:Ft,useHostTransitionStatus:Ft,useFormState:Ft,useActionState:Ft,useOptimistic:Ft,useMemoCache:Ft,useCacheRefresh:Ft};Al.useEffectEvent=Ft;var J_={readContext:Bi,use:wc,useCallback:function(i,n){return Yi().memoizedState=[i,n===void 0?null:n],i},useContext:Bi,useEffect:z_,useImperativeHandle:function(i,n,r){r=r!=null?r.concat([i]):null,xc(4194308,4,P_.bind(null,n,i),r)},useLayoutEffect:function(i,n){return xc(4194308,4,i,n)},useInsertionEffect:function(i,n){xc(4,2,i,n)},useMemo:function(i,n){var r=Yi();n=n===void 0?null:n;var l=i();if(Or){Jt(!0);try{i()}finally{Jt(!1)}}return r.memoizedState=[l,n],l},useReducer:function(i,n,r){var l=Yi();if(r!==void 0){var u=r(n);if(Or){Jt(!0);try{r(n)}finally{Jt(!1)}}}else u=n;return l.memoizedState=l.baseState=u,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:u},l.queue=i,i=i.dispatch=RC.bind(null,We,i),[l.memoizedState,i]},useRef:function(i){var n=Yi();return i={current:i},n.memoizedState=i},useState:function(i){i=rd(i);var n=i.queue,r=G_.bind(null,We,n);return n.dispatch=r,[i.memoizedState,r]},useDebugValue:od,useDeferredValue:function(i,n){var r=Yi();return cd(r,i,n)},useTransition:function(){var i=rd(!1);return i=W_.bind(null,We,i.queue,!0,!1),Yi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,n,r){var l=We,u=Yi();if(nt){if(r===void 0)throw Error(a(407));r=r()}else{if(r=n(),Ct===null)throw Error(a(349));(tt&127)!==0||b_(l,n,r)}u.memoizedState=r;var d={value:r,getSnapshot:n};return u.queue=d,z_(w_.bind(null,l,d,i),[i]),l.flags|=2048,Na(9,{destroy:void 0},S_.bind(null,l,d,r,n),null),r},useId:function(){var i=Yi(),n=Ct.identifierPrefix;if(nt){var r=Zn,l=Gn;r=(l&~(1<<32-Ht(l)-1)).toString(32)+r,n="_"+n+"R_"+r,r=bc++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=wC++,n="_"+n+"r_"+r.toString(32)+"_";return i.memoizedState=n},useHostTransitionStatus:hd,useFormState:N_,useActionState:N_,useOptimistic:function(i){var n=Yi();n.memoizedState=n.baseState=i;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=dd.bind(null,We,!0,r),r.dispatch=n,[i,n]},useMemoCache:id,useCacheRefresh:function(){return Yi().memoizedState=DC.bind(null,We)},useEffectEvent:function(i){var n=Yi(),r={impl:i};return n.memoizedState=r,function(){if((ot&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},fd={readContext:Bi,use:wc,useCallback:K_,useContext:Bi,useEffect:ld,useImperativeHandle:I_,useInsertionEffect:H_,useLayoutEffect:U_,useMemo:F_,useReducer:Cc,useRef:O_,useState:function(){return Cc(gs)},useDebugValue:od,useDeferredValue:function(i,n){var r=Gt();return q_(r,_t.memoizedState,i,n)},useTransition:function(){var i=Cc(gs)[0],n=Gt().memoizedState;return[typeof i=="boolean"?i:Ml(i),n]},useSyncExternalStore:y_,useId:V_,useHostTransitionStatus:hd,useFormState:A_,useActionState:A_,useOptimistic:function(i,n){var r=Gt();return E_(r,_t,i,n)},useMemoCache:id,useCacheRefresh:X_};fd.useEffectEvent=j_;var ev={readContext:Bi,use:wc,useCallback:K_,useContext:Bi,useEffect:ld,useImperativeHandle:I_,useInsertionEffect:H_,useLayoutEffect:U_,useMemo:F_,useReducer:sd,useRef:O_,useState:function(){return sd(gs)},useDebugValue:od,useDeferredValue:function(i,n){var r=Gt();return _t===null?cd(r,i,n):q_(r,_t.memoizedState,i,n)},useTransition:function(){var i=sd(gs)[0],n=Gt().memoizedState;return[typeof i=="boolean"?i:Ml(i),n]},useSyncExternalStore:y_,useId:V_,useHostTransitionStatus:hd,useFormState:B_,useActionState:B_,useOptimistic:function(i,n){var r=Gt();return _t!==null?E_(r,_t,i,n):(r.baseState=i,[i,r.queue.dispatch])},useMemoCache:id,useCacheRefresh:X_};ev.useEffectEvent=j_;function pd(i,n,r,l){n=i.memoizedState,r=r(l,n),r=r==null?n:y({},n,r),i.memoizedState=r,i.lanes===0&&(i.updateQueue.baseState=r)}var md={enqueueSetState:function(i,n,r){i=i._reactInternals;var l=_n(),u=Ks(l);u.payload=n,r!=null&&(u.callback=r),n=Fs(i,u,l),n!==null&&(rn(n,i,l),Tl(n,i,l))},enqueueReplaceState:function(i,n,r){i=i._reactInternals;var l=_n(),u=Ks(l);u.tag=1,u.payload=n,r!=null&&(u.callback=r),n=Fs(i,u,l),n!==null&&(rn(n,i,l),Tl(n,i,l))},enqueueForceUpdate:function(i,n){i=i._reactInternals;var r=_n(),l=Ks(r);l.tag=2,n!=null&&(l.callback=n),n=Fs(i,l,r),n!==null&&(rn(n,i,r),Tl(n,i,r))}};function tv(i,n,r,l,u,d,_){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,d,_):n.prototype&&n.prototype.isPureReactComponent?!vl(r,l)||!vl(u,d):!0}function iv(i,n,r,l){i=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,l),n.state!==i&&md.enqueueReplaceState(n,n.state,null)}function zr(i,n){var r=n;if("ref"in n){r={};for(var l in n)l!=="ref"&&(r[l]=n[l])}if(i=i.defaultProps){r===n&&(r=y({},r));for(var u in i)r[u]===void 0&&(r[u]=i[u])}return r}function nv(i){sc(i)}function sv(i){console.error(i)}function rv(i){sc(i)}function kc(i,n){try{var r=i.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function av(i,n,r){try{var l=i.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function gd(i,n,r){return r=Ks(r),r.tag=3,r.payload={element:null},r.callback=function(){kc(i,n)},r}function lv(i){return i=Ks(i),i.tag=3,i}function ov(i,n,r,l){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var d=l.value;i.payload=function(){return u(d)},i.callback=function(){av(n,r,l)}}var _=r.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(i.callback=function(){av(n,r,l),typeof u!="function"&&(Xs===null?Xs=new Set([this]):Xs.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function MC(i,n,r,l,u){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=r.alternate,n!==null&&Ca(n,r,u,!0),r=fn.current,r!==null){switch(r.tag){case 31:case 13:return Mn===null?Uc():r.alternate===null&&qt===0&&(qt=3),r.flags&=-257,r.flags|=65536,r.lanes=u,l===pc?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([l]):n.add(l),Id(i,l,u)),!1;case 22:return r.flags|=65536,l===pc?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([l]):r.add(l)),Id(i,l,u)),!1}throw Error(a(435,r.tag))}return Id(i,l,u),Uc(),!1}if(nt)return n=fn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,l!==Oh&&(i=Error(a(422),{cause:l}),Sl(Tn(i,r)))):(l!==Oh&&(n=Error(a(423),{cause:l}),Sl(Tn(n,r))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,l=Tn(l,r),u=gd(i.stateNode,l,u),$h(i,u),qt!==4&&(qt=2)),!1;var d=Error(a(520),{cause:l});if(d=Tn(d,r),Pl===null?Pl=[d]:Pl.push(d),qt!==4&&(qt=2),n===null)return!0;l=Tn(l,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,i=u&-u,r.lanes|=i,i=gd(r.stateNode,l,i),$h(r,i),!1;case 1:if(n=r.type,d=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Xs===null||!Xs.has(d))))return r.flags|=65536,u&=-u,r.lanes|=u,u=lv(u),ov(u,i,r,l),$h(r,u),!1}r=r.return}while(r!==null);return!1}var _d=Error(a(461)),ni=!1;function Oi(i,n,r,l){n.child=i===null?d_(n,null,r,l):Br(n,i.child,r,l)}function cv(i,n,r,l,u){r=r.render;var d=n.ref;if("ref"in l){var _={};for(var w in l)w!=="ref"&&(_[w]=l[w])}else _=l;return Mr(n),l=Qh(i,n,r,_,d,u),w=Jh(),i!==null&&!ni?(ed(i,n,u),_s(i,n,u)):(nt&&w&&Lh(n),n.flags|=1,Oi(i,n,l,u),n.child)}function uv(i,n,r,l,u){if(i===null){var d=r.type;return typeof d=="function"&&!Mh(d)&&d.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=d,hv(i,n,d,l,u)):(i=oc(r.type,null,l,n,n.mode,u),i.ref=n.ref,i.return=n,n.child=i)}if(d=i.child,!Ed(i,u)){var _=d.memoizedProps;if(r=r.compare,r=r!==null?r:vl,r(_,l)&&i.ref===n.ref)return _s(i,n,u)}return n.flags|=1,i=hs(d,l),i.ref=n.ref,i.return=n,n.child=i}function hv(i,n,r,l,u){if(i!==null){var d=i.memoizedProps;if(vl(d,l)&&i.ref===n.ref)if(ni=!1,n.pendingProps=l=d,Ed(i,u))(i.flags&131072)!==0&&(ni=!0);else return n.lanes=i.lanes,_s(i,n,u)}return vd(i,n,r,l,u)}function dv(i,n,r,l){var u=l.children,d=i!==null?i.memoizedState:null;if(i===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(d=d!==null?d.baseLanes|r:r,i!==null){for(l=n.child=i.child,u=0;l!==null;)u=u|l.lanes|l.childLanes,l=l.sibling;l=u&~d}else l=0,n.child=null;return fv(i,n,d,r,l)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},i!==null&&dc(n,d!==null?d.cachePool:null),d!==null?m_(n,d):Vh(),g_(n);else return l=n.lanes=536870912,fv(i,n,d!==null?d.baseLanes|r:r,r,l)}else d!==null?(dc(n,d.cachePool),m_(n,d),Ws(),n.memoizedState=null):(i!==null&&dc(n,null),Vh(),Ws());return Oi(i,n,u,r),n.child}function Ll(i,n){return i!==null&&i.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function fv(i,n,r,l,u){var d=Kh();return d=d===null?null:{parent:ti._currentValue,pool:d},n.memoizedState={baseLanes:r,cachePool:d},i!==null&&dc(n,null),Vh(),g_(n),i!==null&&Ca(i,n,l,!0),n.childLanes=u,null}function Dc(i,n){return n=Mc({mode:n.mode,children:n.children},i.mode),n.ref=i.ref,i.child=n,n.return=i,n}function pv(i,n,r){return Br(n,i.child,null,r),i=Dc(n,n.pendingProps),i.flags|=2,pn(n),n.memoizedState=null,i}function NC(i,n,r){var l=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,i===null){if(nt){if(l.mode==="hidden")return i=Dc(n,l),n.lanes=536870912,Ll(null,i);if(Gh(n),(i=kt)?(i=Ty(i,Rn),i=i!==null&&i.data==="&"?i:null,i!==null&&(n.memoizedState={dehydrated:i,treeContext:js!==null?{id:Gn,overflow:Zn}:null,retryLane:536870912,hydrationErrors:null},r=Zg(i),r.return=n,n.child=r,Li=n,kt=null)):i=null,i===null)throw Us(n);return n.lanes=536870912,null}return Dc(n,l)}var d=i.memoizedState;if(d!==null){var _=d.dehydrated;if(Gh(n),u)if(n.flags&256)n.flags&=-257,n=pv(i,n,r);else if(n.memoizedState!==null)n.child=i.child,n.flags|=128,n=null;else throw Error(a(558));else if(ni||Ca(i,n,r,!1),u=(r&i.childLanes)!==0,ni||u){if(l=Ct,l!==null&&(_=Ai(l,r),_!==0&&_!==d.retryLane))throw d.retryLane=_,Tr(i,_),rn(l,i,_),_d;Uc(),n=pv(i,n,r)}else i=d.treeContext,kt=Nn(_.nextSibling),Li=n,nt=!0,Hs=null,Rn=!1,i!==null&&e_(n,i),n=Dc(n,l),n.flags|=4096;return n}return i=hs(i.child,{mode:l.mode,children:l.children}),i.ref=n.ref,n.child=i,i.return=n,i}function Rc(i,n){var r=n.ref;if(r===null)i!==null&&i.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(i===null||i.ref!==r)&&(n.flags|=4194816)}}function vd(i,n,r,l,u){return Mr(n),r=Qh(i,n,r,l,void 0,u),l=Jh(),i!==null&&!ni?(ed(i,n,u),_s(i,n,u)):(nt&&l&&Lh(n),n.flags|=1,Oi(i,n,r,u),n.child)}function mv(i,n,r,l,u,d){return Mr(n),n.updateQueue=null,r=v_(n,l,r,u),__(i),l=Jh(),i!==null&&!ni?(ed(i,n,d),_s(i,n,d)):(nt&&l&&Lh(n),n.flags|=1,Oi(i,n,r,d),n.child)}function gv(i,n,r,l,u){if(Mr(n),n.stateNode===null){var d=ya,_=r.contextType;typeof _=="object"&&_!==null&&(d=Bi(_)),d=new r(l,d),n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=md,n.stateNode=d,d._reactInternals=n,d=n.stateNode,d.props=l,d.state=n.memoizedState,d.refs={},qh(n),_=r.contextType,d.context=typeof _=="object"&&_!==null?Bi(_):ya,d.state=n.memoizedState,_=r.getDerivedStateFromProps,typeof _=="function"&&(pd(n,r,_,l),d.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(_=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),_!==d.state&&md.enqueueReplaceState(d,d.state,null),Dl(n,l,d,u),kl(),d.state=n.memoizedState),typeof d.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(i===null){d=n.stateNode;var w=n.memoizedProps,R=zr(r,w);d.props=R;var Y=d.context,re=r.contextType;_=ya,typeof re=="object"&&re!==null&&(_=Bi(re));var ue=r.getDerivedStateFromProps;re=typeof ue=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,re||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||Y!==_)&&iv(n,d,l,_),Is=!1;var G=n.memoizedState;d.state=G,Dl(n,l,d,u),kl(),Y=n.memoizedState,w||G!==Y||Is?(typeof ue=="function"&&(pd(n,r,ue,l),Y=n.memoizedState),(R=Is||tv(n,r,R,l,G,Y,_))?(re||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"&&(n.flags|=4194308)):(typeof d.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=Y),d.props=l,d.state=Y,d.context=_,l=R):(typeof d.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{d=n.stateNode,Wh(i,n),_=n.memoizedProps,re=zr(r,_),d.props=re,ue=n.pendingProps,G=d.context,Y=r.contextType,R=ya,typeof Y=="object"&&Y!==null&&(R=Bi(Y)),w=r.getDerivedStateFromProps,(Y=typeof w=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(_!==ue||G!==R)&&iv(n,d,l,R),Is=!1,G=n.memoizedState,d.state=G,Dl(n,l,d,u),kl();var ee=n.memoizedState;_!==ue||G!==ee||Is||i!==null&&i.dependencies!==null&&uc(i.dependencies)?(typeof w=="function"&&(pd(n,r,w,l),ee=n.memoizedState),(re=Is||tv(n,r,re,l,G,ee,R)||i!==null&&i.dependencies!==null&&uc(i.dependencies))?(Y||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,ee,R),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,ee,R)),typeof d.componentDidUpdate=="function"&&(n.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof d.componentDidUpdate!="function"||_===i.memoizedProps&&G===i.memoizedState||(n.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||_===i.memoizedProps&&G===i.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=ee),d.props=l,d.state=ee,d.context=R,l=re):(typeof d.componentDidUpdate!="function"||_===i.memoizedProps&&G===i.memoizedState||(n.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||_===i.memoizedProps&&G===i.memoizedState||(n.flags|=1024),l=!1)}return d=l,Rc(i,n),l=(n.flags&128)!==0,d||l?(d=n.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:d.render(),n.flags|=1,i!==null&&l?(n.child=Br(n,i.child,null,u),n.child=Br(n,null,r,u)):Oi(i,n,r,u),n.memoizedState=d.state,i=n.child):i=_s(i,n,u),i}function _v(i,n,r,l){return Dr(),n.flags|=256,Oi(i,n,r,l),n.child}var yd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bd(i){return{baseLanes:i,cachePool:a_()}}function Sd(i,n,r){return i=i!==null?i.childLanes&~r:0,n&&(i|=gn),i}function vv(i,n,r){var l=n.pendingProps,u=!1,d=(n.flags&128)!==0,_;if((_=d)||(_=i!==null&&i.memoizedState===null?!1:(Xt.current&2)!==0),_&&(u=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,i===null){if(nt){if(u?qs(n):Ws(),(i=kt)?(i=Ty(i,Rn),i=i!==null&&i.data!=="&"?i:null,i!==null&&(n.memoizedState={dehydrated:i,treeContext:js!==null?{id:Gn,overflow:Zn}:null,retryLane:536870912,hydrationErrors:null},r=Zg(i),r.return=n,n.child=r,Li=n,kt=null)):i=null,i===null)throw Us(n);return sf(i)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,u?(Ws(),u=n.mode,w=Mc({mode:"hidden",children:w},u),l=kr(l,u,r,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=bd(r),l.childLanes=Sd(i,_,r),n.memoizedState=yd,Ll(null,l)):(qs(n),wd(n,w))}var R=i.memoizedState;if(R!==null&&(w=R.dehydrated,w!==null)){if(d)n.flags&256?(qs(n),n.flags&=-257,n=Cd(i,n,r)):n.memoizedState!==null?(Ws(),n.child=i.child,n.flags|=128,n=null):(Ws(),w=l.fallback,u=n.mode,l=Mc({mode:"visible",children:l.children},u),w=kr(w,u,r,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,Br(n,i.child,null,r),l=n.child,l.memoizedState=bd(r),l.childLanes=Sd(i,_,r),n.memoizedState=yd,n=Ll(null,l));else if(qs(n),sf(w)){if(_=w.nextSibling&&w.nextSibling.dataset,_)var Y=_.dgst;_=Y,l=Error(a(419)),l.stack="",l.digest=_,Sl({value:l,source:null,stack:null}),n=Cd(i,n,r)}else if(ni||Ca(i,n,r,!1),_=(r&i.childLanes)!==0,ni||_){if(_=Ct,_!==null&&(l=Ai(_,r),l!==0&&l!==R.retryLane))throw R.retryLane=l,Tr(i,l),rn(_,i,l),_d;nf(w)||Uc(),n=Cd(i,n,r)}else nf(w)?(n.flags|=192,n.child=i.child,n=null):(i=R.treeContext,kt=Nn(w.nextSibling),Li=n,nt=!0,Hs=null,Rn=!1,i!==null&&e_(n,i),n=wd(n,l.children),n.flags|=4096);return n}return u?(Ws(),w=l.fallback,u=n.mode,R=i.child,Y=R.sibling,l=hs(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,Y!==null?w=hs(Y,w):(w=kr(w,u,r,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,Ll(null,l),l=n.child,w=i.child.memoizedState,w===null?w=bd(r):(u=w.cachePool,u!==null?(R=ti._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=a_(),w={baseLanes:w.baseLanes|r,cachePool:u}),l.memoizedState=w,l.childLanes=Sd(i,_,r),n.memoizedState=yd,Ll(i.child,l)):(qs(n),r=i.child,i=r.sibling,r=hs(r,{mode:"visible",children:l.children}),r.return=n,r.sibling=null,i!==null&&(_=n.deletions,_===null?(n.deletions=[i],n.flags|=16):_.push(i)),n.child=r,n.memoizedState=null,r)}function wd(i,n){return n=Mc({mode:"visible",children:n},i.mode),n.return=i,i.child=n}function Mc(i,n){return i=dn(22,i,null,n),i.lanes=0,i}function Cd(i,n,r){return Br(n,i.child,null,r),i=wd(n,n.pendingProps.children),i.flags|=2,n.memoizedState=null,i}function yv(i,n,r){i.lanes|=n;var l=i.alternate;l!==null&&(l.lanes|=n),Hh(i.return,n,r)}function xd(i,n,r,l,u,d){var _=i.memoizedState;_===null?i.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:u,treeForkCount:d}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=l,_.tail=r,_.tailMode=u,_.treeForkCount=d)}function bv(i,n,r){var l=n.pendingProps,u=l.revealOrder,d=l.tail;l=l.children;var _=Xt.current,w=(_&2)!==0;if(w?(_=_&1|2,n.flags|=128):_&=1,le(Xt,_),Oi(i,n,l,r),l=nt?bl:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=n.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&yv(i,r,n);else if(i.tag===19)yv(i,r,n);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break e;for(;i.sibling===null;){if(i.return===null||i.return===n)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(u){case"forwards":for(r=n.child,u=null;r!==null;)i=r.alternate,i!==null&&vc(i)===null&&(u=r),r=r.sibling;r=u,r===null?(u=n.child,n.child=null):(u=r.sibling,r.sibling=null),xd(n,!1,u,r,d,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,u=n.child,n.child=null;u!==null;){if(i=u.alternate,i!==null&&vc(i)===null){n.child=u;break}i=u.sibling,u.sibling=r,r=u,u=i}xd(n,!0,r,null,d,l);break;case"together":xd(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function _s(i,n,r){if(i!==null&&(n.dependencies=i.dependencies),Vs|=n.lanes,(r&n.childLanes)===0)if(i!==null){if(Ca(i,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(i!==null&&n.child!==i.child)throw Error(a(153));if(n.child!==null){for(i=n.child,r=hs(i,i.pendingProps),n.child=r,r.return=n;i.sibling!==null;)i=i.sibling,r=r.sibling=hs(i,i.pendingProps),r.return=n;r.sibling=null}return n.child}function Ed(i,n){return(i.lanes&n)!==0?!0:(i=i.dependencies,!!(i!==null&&uc(i)))}function AC(i,n,r){switch(n.tag){case 3:Ie(n,n.stateNode.containerInfo),Ps(n,ti,i.memoizedState.cache),Dr();break;case 27:case 5:J(n);break;case 4:Ie(n,n.stateNode.containerInfo);break;case 10:Ps(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Gh(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(qs(n),n.flags|=128,null):(r&n.child.childLanes)!==0?vv(i,n,r):(qs(n),i=_s(i,n,r),i!==null?i.sibling:null);qs(n);break;case 19:var u=(i.flags&128)!==0;if(l=(r&n.childLanes)!==0,l||(Ca(i,n,r,!1),l=(r&n.childLanes)!==0),u){if(l)return bv(i,n,r);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),le(Xt,Xt.current),l)break;return null;case 22:return n.lanes=0,dv(i,n,r,n.pendingProps);case 24:Ps(n,ti,i.memoizedState.cache)}return _s(i,n,r)}function Sv(i,n,r){if(i!==null)if(i.memoizedProps!==n.pendingProps)ni=!0;else{if(!Ed(i,r)&&(n.flags&128)===0)return ni=!1,AC(i,n,r);ni=(i.flags&131072)!==0}else ni=!1,nt&&(n.flags&1048576)!==0&&Jg(n,bl,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(i=Ar(n.elementType),n.type=i,typeof i=="function")Mh(i)?(l=zr(i,l),n.tag=1,n=gv(null,n,i,l,r)):(n.tag=0,n=vd(null,n,i,l,r));else{if(i!=null){var u=i.$$typeof;if(u===Z){n.tag=11,n=cv(null,n,i,l,r);break e}else if(u===ae){n.tag=14,n=uv(null,n,i,l,r);break e}}throw n=O(i)||i,Error(a(306,n,""))}}return n;case 0:return vd(i,n,n.type,n.pendingProps,r);case 1:return l=n.type,u=zr(l,n.pendingProps),gv(i,n,l,u,r);case 3:e:{if(Ie(n,n.stateNode.containerInfo),i===null)throw Error(a(387));l=n.pendingProps;var d=n.memoizedState;u=d.element,Wh(i,n),Dl(n,l,null,r);var _=n.memoizedState;if(l=_.cache,Ps(n,ti,l),l!==d.cache&&Uh(n,[ti],r,!0),kl(),l=_.element,d.isDehydrated)if(d={element:l,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=d,n.memoizedState=d,n.flags&256){n=_v(i,n,l,r);break e}else if(l!==u){u=Tn(Error(a(424)),n),Sl(u),n=_v(i,n,l,r);break e}else for(i=n.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,kt=Nn(i.firstChild),Li=n,nt=!0,Hs=null,Rn=!0,r=d_(n,null,l,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Dr(),l===u){n=_s(i,n,r);break e}Oi(i,n,l,r)}n=n.child}return n;case 26:return Rc(i,n),i===null?(r=Ay(n.type,null,n.pendingProps,null))?n.memoizedState=r:nt||(r=n.type,i=n.pendingProps,l=$c(Ce.current).createElement(r),l[Pt]=n,l[It]=i,zi(l,r,i),Kt(l),n.stateNode=l):n.memoizedState=Ay(n.type,i.memoizedProps,n.pendingProps,i.memoizedState),null;case 27:return J(n),i===null&&nt&&(l=n.stateNode=Ry(n.type,n.pendingProps,Ce.current),Li=n,Rn=!0,u=kt,Js(n.type)?(rf=u,kt=Nn(l.firstChild)):kt=u),Oi(i,n,n.pendingProps.children,r),Rc(i,n),i===null&&(n.flags|=4194304),n.child;case 5:return i===null&&nt&&((u=l=kt)&&(l=ox(l,n.type,n.pendingProps,Rn),l!==null?(n.stateNode=l,Li=n,kt=Nn(l.firstChild),Rn=!1,u=!0):u=!1),u||Us(n)),J(n),u=n.type,d=n.pendingProps,_=i!==null?i.memoizedProps:null,l=d.children,Jd(u,d)?l=null:_!==null&&Jd(u,_)&&(n.flags|=32),n.memoizedState!==null&&(u=Qh(i,n,CC,null,null,r),Vl._currentValue=u),Rc(i,n),Oi(i,n,l,r),n.child;case 6:return i===null&&nt&&((i=r=kt)&&(r=cx(r,n.pendingProps,Rn),r!==null?(n.stateNode=r,Li=n,kt=null,i=!0):i=!1),i||Us(n)),null;case 13:return vv(i,n,r);case 4:return Ie(n,n.stateNode.containerInfo),l=n.pendingProps,i===null?n.child=Br(n,null,l,r):Oi(i,n,l,r),n.child;case 11:return cv(i,n,n.type,n.pendingProps,r);case 7:return Oi(i,n,n.pendingProps,r),n.child;case 8:return Oi(i,n,n.pendingProps.children,r),n.child;case 12:return Oi(i,n,n.pendingProps.children,r),n.child;case 10:return l=n.pendingProps,Ps(n,n.type,l.value),Oi(i,n,l.children,r),n.child;case 9:return u=n.type._context,l=n.pendingProps.children,Mr(n),u=Bi(u),l=l(u),n.flags|=1,Oi(i,n,l,r),n.child;case 14:return uv(i,n,n.type,n.pendingProps,r);case 15:return hv(i,n,n.type,n.pendingProps,r);case 19:return bv(i,n,r);case 31:return NC(i,n,r);case 22:return dv(i,n,r,n.pendingProps);case 24:return Mr(n),l=Bi(ti),i===null?(u=Kh(),u===null&&(u=Ct,d=Ph(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=r),u=d),n.memoizedState={parent:l,cache:u},qh(n),Ps(n,ti,u)):((i.lanes&r)!==0&&(Wh(i,n),Dl(n,null,null,r),kl()),u=i.memoizedState,d=n.memoizedState,u.parent!==l?(u={parent:l,cache:l},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),Ps(n,ti,l)):(l=d.cache,Ps(n,ti,l),l!==u.cache&&Uh(n,[ti],r,!0))),Oi(i,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(a(156,n.tag))}function vs(i){i.flags|=4}function Td(i,n,r,l,u){if((n=(i.mode&32)!==0)&&(n=!1),n){if(i.flags|=16777216,(u&335544128)===u)if(i.stateNode.complete)i.flags|=8192;else if(Vv())i.flags|=8192;else throw Lr=pc,Fh}else i.flags&=-16777217}function wv(i,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!jy(n))if(Vv())i.flags|=8192;else throw Lr=pc,Fh}function Nc(i,n){n!==null&&(i.flags|=4),i.flags&16384&&(n=i.tag!==22?ei():536870912,i.lanes|=n,Oa|=n)}function Bl(i,n){if(!nt)switch(i.tailMode){case"hidden":n=i.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.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?n||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function Dt(i){var n=i.alternate!==null&&i.alternate.child===i.child,r=0,l=0;if(n)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,n}function LC(i,n,r){var l=n.pendingProps;switch(Bh(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(n),null;case 1:return Dt(n),null;case 3:return r=n.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),ps(ti),H(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(i===null||i.child===null)&&(wa(n)?vs(n):i===null||i.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,zh())),Dt(n),null;case 26:var u=n.type,d=n.memoizedState;return i===null?(vs(n),d!==null?(Dt(n),wv(n,d)):(Dt(n),Td(n,u,null,l,r))):d?d!==i.memoizedState?(vs(n),Dt(n),wv(n,d)):(Dt(n),n.flags&=-16777217):(i=i.memoizedProps,i!==l&&vs(n),Dt(n),Td(n,u,i,l,r)),null;case 27:if(Ee(n),r=Ce.current,u=n.type,i!==null&&n.stateNode!=null)i.memoizedProps!==l&&vs(n);else{if(!l){if(n.stateNode===null)throw Error(a(166));return Dt(n),null}i=fe.current,wa(n)?t_(n):(i=Ry(u,l,r),n.stateNode=i,vs(n))}return Dt(n),null;case 5:if(Ee(n),u=n.type,i!==null&&n.stateNode!=null)i.memoizedProps!==l&&vs(n);else{if(!l){if(n.stateNode===null)throw Error(a(166));return Dt(n),null}if(d=fe.current,wa(n))t_(n);else{var _=$c(Ce.current);switch(d){case 1:d=_.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=_.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=_.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof l.is=="string"?_.createElement("select",{is:l.is}):_.createElement("select"),l.multiple?d.multiple=!0:l.size&&(d.size=l.size);break;default:d=typeof l.is=="string"?_.createElement(u,{is:l.is}):_.createElement(u)}}d[Pt]=n,d[It]=l;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)d.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=d;e:switch(zi(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&&vs(n)}}return Dt(n),Td(n,n.type,i===null?null:i.memoizedProps,n.pendingProps,r),null;case 6:if(i&&n.stateNode!=null)i.memoizedProps!==l&&vs(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(a(166));if(i=Ce.current,wa(n)){if(i=n.stateNode,r=n.memoizedProps,l=null,u=Li,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}i[Pt]=n,i=!!(i.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||vy(i.nodeValue,r)),i||Us(n,!0)}else i=$c(i).createTextNode(l),i[Pt]=n,n.stateNode=i}return Dt(n),null;case 31:if(r=n.memoizedState,i===null||i.memoizedState!==null){if(l=wa(n),r!==null){if(i===null){if(!l)throw Error(a(318));if(i=n.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(557));i[Pt]=n}else Dr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Dt(n),i=!1}else r=zh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=r),i=!0;if(!i)return n.flags&256?(pn(n),n):(pn(n),null);if((n.flags&128)!==0)throw Error(a(558))}return Dt(n),null;case 13:if(l=n.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=wa(n),l!==null&&l.dehydrated!==null){if(i===null){if(!u)throw Error(a(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(a(317));u[Pt]=n}else Dr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Dt(n),u=!1}else u=zh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(pn(n),n):(pn(n),null)}return pn(n),(n.flags&128)!==0?(n.lanes=r,n):(r=l!==null,i=i!==null&&i.memoizedState!==null,r&&(l=n.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&&(n.child.flags|=8192),Nc(n,n.updateQueue),Dt(n),null);case 4:return H(),i===null&&Vd(n.stateNode.containerInfo),Dt(n),null;case 10:return ps(n.type),Dt(n),null;case 19:if(Q(Xt),l=n.memoizedState,l===null)return Dt(n),null;if(u=(n.flags&128)!==0,d=l.rendering,d===null)if(u)Bl(l,!1);else{if(qt!==0||i!==null&&(i.flags&128)!==0)for(i=n.child;i!==null;){if(d=vc(i),d!==null){for(n.flags|=128,Bl(l,!1),i=d.updateQueue,n.updateQueue=i,Nc(n,i),n.subtreeFlags=0,i=r,r=n.child;r!==null;)Gg(r,i),r=r.sibling;return le(Xt,Xt.current&1|2),nt&&ds(n,l.treeForkCount),n.child}i=i.sibling}l.tail!==null&<()>zc&&(n.flags|=128,u=!0,Bl(l,!1),n.lanes=4194304)}else{if(!u)if(i=vc(d),i!==null){if(n.flags|=128,u=!0,i=i.updateQueue,n.updateQueue=i,Nc(n,i),Bl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!d.alternate&&!nt)return Dt(n),null}else 2*lt()-l.renderingStartTime>zc&&r!==536870912&&(n.flags|=128,u=!0,Bl(l,!1),n.lanes=4194304);l.isBackwards?(d.sibling=n.child,n.child=d):(i=l.last,i!==null?i.sibling=d:n.child=d,l.last=d)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=lt(),i.sibling=null,r=Xt.current,le(Xt,u?r&1|2:r&1),nt&&ds(n,l.treeForkCount),i):(Dt(n),null);case 22:case 23:return pn(n),Xh(),l=n.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(r&536870912)!==0&&(n.flags&128)===0&&(Dt(n),n.subtreeFlags&6&&(n.flags|=8192)):Dt(n),r=n.updateQueue,r!==null&&Nc(n,r.retryQueue),r=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==r&&(n.flags|=2048),i!==null&&Q(Nr),null;case 24:return r=null,i!==null&&(r=i.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),ps(ti),Dt(n),null;case 25:return null;case 30:return null}throw Error(a(156,n.tag))}function BC(i,n){switch(Bh(n),n.tag){case 1:return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 3:return ps(ti),H(),i=n.flags,(i&65536)!==0&&(i&128)===0?(n.flags=i&-65537|128,n):null;case 26:case 27:case 5:return Ee(n),null;case 31:if(n.memoizedState!==null){if(pn(n),n.alternate===null)throw Error(a(340));Dr()}return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 13:if(pn(n),i=n.memoizedState,i!==null&&i.dehydrated!==null){if(n.alternate===null)throw Error(a(340));Dr()}return i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 19:return Q(Xt),null;case 4:return H(),null;case 10:return ps(n.type),null;case 22:case 23:return pn(n),Xh(),i!==null&&Q(Nr),i=n.flags,i&65536?(n.flags=i&-65537|128,n):null;case 24:return ps(ti),null;case 25:return null;default:return null}}function Cv(i,n){switch(Bh(n),n.tag){case 3:ps(ti),H();break;case 26:case 27:case 5:Ee(n);break;case 4:H();break;case 31:n.memoizedState!==null&&pn(n);break;case 13:pn(n);break;case 19:Q(Xt);break;case 10:ps(n.type);break;case 22:case 23:pn(n),Xh(),i!==null&&Q(Nr);break;case 24:ps(ti)}}function Ol(i,n){try{var r=n.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,_=r.inst;l=d(),_.destroy=l}r=r.next}while(r!==u)}}catch(w){pt(n,n.return,w)}}function $s(i,n,r){try{var l=n.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var d=u.next;l=d;do{if((l.tag&i)===i){var _=l.inst,w=_.destroy;if(w!==void 0){_.destroy=void 0,u=n;var R=r,Y=w;try{Y()}catch(re){pt(u,R,re)}}}l=l.next}while(l!==d)}}catch(re){pt(n,n.return,re)}}function xv(i){var n=i.updateQueue;if(n!==null){var r=i.stateNode;try{p_(n,r)}catch(l){pt(i,i.return,l)}}}function Ev(i,n,r){r.props=zr(i.type,i.memoizedProps),r.state=i.memoizedState;try{r.componentWillUnmount()}catch(l){pt(i,n,l)}}function zl(i,n){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){pt(i,n,u)}}function Qn(i,n){var r=i.ref,l=i.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(u){pt(i,n,u)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){pt(i,n,u)}else r.current=null}function Tv(i){var n=i.type,r=i.memoizedProps,l=i.stateNode;try{e:switch(n){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){pt(i,i.return,u)}}function kd(i,n,r){try{var l=i.stateNode;ix(l,i.type,r,n),l[It]=n}catch(u){pt(i,i.return,u)}}function kv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Js(i.type)||i.tag===4}function Dd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||kv(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&&Js(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 Rd(i,n,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(i,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(i),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=wi));else if(l!==4&&(l===27&&Js(i.type)&&(r=i.stateNode,n=null),i=i.child,i!==null))for(Rd(i,n,r),i=i.sibling;i!==null;)Rd(i,n,r),i=i.sibling}function Ac(i,n,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,n?r.insertBefore(i,n):r.appendChild(i);else if(l!==4&&(l===27&&Js(i.type)&&(r=i.stateNode),i=i.child,i!==null))for(Ac(i,n,r),i=i.sibling;i!==null;)Ac(i,n,r),i=i.sibling}function Dv(i){var n=i.stateNode,r=i.memoizedProps;try{for(var l=i.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);zi(n,l,r),n[Pt]=i,n[It]=r}catch(d){pt(i,i.return,d)}}var ys=!1,si=!1,Md=!1,Rv=typeof WeakSet=="function"?WeakSet:Set,Ci=null;function OC(i,n){if(i=i.containerInfo,Zd=Jc,i=Ig(i),Ch(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 _=0,w=-1,R=-1,Y=0,re=0,ue=i,G=null;t:for(;;){for(var ee;ue!==r||u!==0&&ue.nodeType!==3||(w=_+u),ue!==d||l!==0&&ue.nodeType!==3||(R=_+l),ue.nodeType===3&&(_+=ue.nodeValue.length),(ee=ue.firstChild)!==null;)G=ue,ue=ee;for(;;){if(ue===i)break t;if(G===r&&++Y===u&&(w=_),G===d&&++re===l&&(R=_),(ee=ue.nextSibling)!==null)break;ue=G,G=ue.parentNode}ue=ee}r=w===-1||R===-1?null:{start:w,end:R}}else r=null}r=r||{start:0,end:0}}else r=null;for(Qd={focusedElem:i,selectionRange:r},Jc=!1,Ci=n;Ci!==null;)if(n=Ci,i=n.child,(n.subtreeFlags&1028)!==0&&i!==null)i.return=n,Ci=i;else for(;Ci!==null;){switch(n=Ci,d=n.alternate,i=n.flags,n.tag){case 0:if((i&4)!==0&&(i=n.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=n,u=d.memoizedProps,d=d.memoizedState,l=r.stateNode;try{var Re=zr(r.type,u);i=l.getSnapshotBeforeUpdate(Re,d),l.__reactInternalSnapshotBeforeUpdate=i}catch(je){pt(r,r.return,je)}}break;case 3:if((i&1024)!==0){if(i=n.stateNode.containerInfo,r=i.nodeType,r===9)tf(i);else if(r===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":tf(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=n.sibling,i!==null){i.return=n.return,Ci=i;break}Ci=n.return}}function Mv(i,n,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:Ss(i,r),l&4&&Ol(5,r);break;case 1:if(Ss(i,r),l&4)if(i=r.stateNode,n===null)try{i.componentDidMount()}catch(_){pt(r,r.return,_)}else{var u=zr(r.type,n.memoizedProps);n=n.memoizedState;try{i.componentDidUpdate(u,n,i.__reactInternalSnapshotBeforeUpdate)}catch(_){pt(r,r.return,_)}}l&64&&xv(r),l&512&&zl(r,r.return);break;case 3:if(Ss(i,r),l&64&&(i=r.updateQueue,i!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{p_(i,n)}catch(_){pt(r,r.return,_)}}break;case 27:n===null&&l&4&&Dv(r);case 26:case 5:Ss(i,r),n===null&&l&4&&Tv(r),l&512&&zl(r,r.return);break;case 12:Ss(i,r);break;case 31:Ss(i,r),l&4&&Lv(i,r);break;case 13:Ss(i,r),l&4&&Bv(i,r),l&64&&(i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(r=qC.bind(null,r),ux(i,r))));break;case 22:if(l=r.memoizedState!==null||ys,!l){n=n!==null&&n.memoizedState!==null||si,u=ys;var d=si;ys=l,(si=n)&&!d?ws(i,r,(r.subtreeFlags&8772)!==0):Ss(i,r),ys=u,si=d}break;case 30:break;default:Ss(i,r)}}function Nv(i){var n=i.alternate;n!==null&&(i.alternate=null,Nv(n)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(n=i.stateNode,n!==null&&ls(n)),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 Nt=null,en=!1;function bs(i,n,r){for(r=r.child;r!==null;)Av(i,n,r),r=r.sibling}function Av(i,n,r){if(ct&&typeof ct.onCommitFiberUnmount=="function")try{ct.onCommitFiberUnmount(et,r)}catch{}switch(r.tag){case 26:si||Qn(r,n),bs(i,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:si||Qn(r,n);var l=Nt,u=en;Js(r.type)&&(Nt=r.stateNode,en=!1),bs(i,n,r),Wl(r.stateNode),Nt=l,en=u;break;case 5:si||Qn(r,n);case 6:if(l=Nt,u=en,Nt=null,bs(i,n,r),Nt=l,en=u,Nt!==null)if(en)try{(Nt.nodeType===9?Nt.body:Nt.nodeName==="HTML"?Nt.ownerDocument.body:Nt).removeChild(r.stateNode)}catch(d){pt(r,n,d)}else try{Nt.removeChild(r.stateNode)}catch(d){pt(r,n,d)}break;case 18:Nt!==null&&(en?(i=Nt,xy(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.stateNode),Fa(i)):xy(Nt,r.stateNode));break;case 4:l=Nt,u=en,Nt=r.stateNode.containerInfo,en=!0,bs(i,n,r),Nt=l,en=u;break;case 0:case 11:case 14:case 15:$s(2,r,n),si||$s(4,r,n),bs(i,n,r);break;case 1:si||(Qn(r,n),l=r.stateNode,typeof l.componentWillUnmount=="function"&&Ev(r,n,l)),bs(i,n,r);break;case 21:bs(i,n,r);break;case 22:si=(l=si)||r.memoizedState!==null,bs(i,n,r),si=l;break;default:bs(i,n,r)}}function Lv(i,n){if(n.memoizedState===null&&(i=n.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Fa(i)}catch(r){pt(n,n.return,r)}}}function Bv(i,n){if(n.memoizedState===null&&(i=n.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Fa(i)}catch(r){pt(n,n.return,r)}}function zC(i){switch(i.tag){case 31:case 13:case 19:var n=i.stateNode;return n===null&&(n=i.stateNode=new Rv),n;case 22:return i=i.stateNode,n=i._retryCache,n===null&&(n=i._retryCache=new Rv),n;default:throw Error(a(435,i.tag))}}function Lc(i,n){var r=zC(i);n.forEach(function(l){if(!r.has(l)){r.add(l);var u=WC.bind(null,i,l);l.then(u,u)}})}function tn(i,n){var r=n.deletions;if(r!==null)for(var l=0;l<r.length;l++){var u=r[l],d=i,_=n,w=_;e:for(;w!==null;){switch(w.tag){case 27:if(Js(w.type)){Nt=w.stateNode,en=!1;break e}break;case 5:Nt=w.stateNode,en=!1;break e;case 3:case 4:Nt=w.stateNode.containerInfo,en=!0;break e}w=w.return}if(Nt===null)throw Error(a(160));Av(d,_,u),Nt=null,en=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Ov(n,i),n=n.sibling}var Fn=null;function Ov(i,n){var r=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:tn(n,i),nn(i),l&4&&($s(3,i,i.return),Ol(3,i),$s(5,i,i.return));break;case 1:tn(n,i),nn(i),l&512&&(si||r===null||Qn(r,r.return)),l&64&&ys&&(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=Fn;if(tn(n,i),nn(i),l&512&&(si||r===null||Qn(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[Cn]||d[Pt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(l),u.head.insertBefore(d,u.querySelector("head > title"))),zi(d,l,r),d[Pt]=i,Kt(d),l=d;break e;case"link":var _=Oy("link","href",u).get(l+(r.href||""));if(_){for(var w=0;w<_.length;w++)if(d=_[w],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)){_.splice(w,1);break t}}d=u.createElement(l),zi(d,l,r),u.head.appendChild(d);break;case"meta":if(_=Oy("meta","content",u).get(l+(r.content||""))){for(w=0;w<_.length;w++)if(d=_[w],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)){_.splice(w,1);break t}}d=u.createElement(l),zi(d,l,r),u.head.appendChild(d);break;default:throw Error(a(468,l))}d[Pt]=i,Kt(d),l=d}i.stateNode=l}else zy(u,i.type,i.stateNode);else i.stateNode=By(u,l,i.memoizedProps);else d!==l?(d===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):d.count--,l===null?zy(u,i.type,i.stateNode):By(u,l,i.memoizedProps)):l===null&&i.stateNode!==null&&kd(i,i.memoizedProps,r.memoizedProps)}break;case 27:tn(n,i),nn(i),l&512&&(si||r===null||Qn(r,r.return)),r!==null&&l&4&&kd(i,i.memoizedProps,r.memoizedProps);break;case 5:if(tn(n,i),nn(i),l&512&&(si||r===null||Qn(r,r.return)),i.flags&32){u=i.stateNode;try{Bt(u,"")}catch(Re){pt(i,i.return,Re)}}l&4&&i.stateNode!=null&&(u=i.memoizedProps,kd(i,u,r!==null?r.memoizedProps:u)),l&1024&&(Md=!0);break;case 6:if(tn(n,i),nn(i),l&4){if(i.stateNode===null)throw Error(a(162));l=i.memoizedProps,r=i.stateNode;try{r.nodeValue=l}catch(Re){pt(i,i.return,Re)}}break;case 3:if(Xc=null,u=Fn,Fn=Yc(n.containerInfo),tn(n,i),Fn=u,nn(i),l&4&&r!==null&&r.memoizedState.isDehydrated)try{Fa(n.containerInfo)}catch(Re){pt(i,i.return,Re)}Md&&(Md=!1,zv(i));break;case 4:l=Fn,Fn=Yc(i.stateNode.containerInfo),tn(n,i),nn(i),Fn=l;break;case 12:tn(n,i),nn(i);break;case 31:tn(n,i),nn(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Lc(i,l)));break;case 13:tn(n,i),nn(i),i.child.flags&8192&&i.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Oc=lt()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Lc(i,l)));break;case 22:u=i.memoizedState!==null;var R=r!==null&&r.memoizedState!==null,Y=ys,re=si;if(ys=Y||u,si=re||R,tn(n,i),si=re,ys=Y,nn(i),l&8192)e:for(n=i.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(r===null||R||ys||si||jr(i)),r=null,n=i;;){if(n.tag===5||n.tag===26){if(r===null){R=r=n;try{if(d=R.stateNode,u)_=d.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{w=R.stateNode;var ue=R.memoizedProps.style,G=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;w.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(Re){pt(R,R.return,Re)}}}else if(n.tag===6){if(r===null){R=n;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(Re){pt(R,R.return,Re)}}}else if(n.tag===18){if(r===null){R=n;try{var ee=R.stateNode;u?Ey(ee,!0):Ey(R.stateNode,!1)}catch(Re){pt(R,R.return,Re)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===i)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===i)break e;for(;n.sibling===null;){if(n.return===null||n.return===i)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=i.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,Lc(i,r))));break;case 19:tn(n,i),nn(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Lc(i,l)));break;case 30:break;case 21:break;default:tn(n,i),nn(i)}}function nn(i){var n=i.flags;if(n&2){try{for(var r,l=i.return;l!==null;){if(kv(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var u=r.stateNode,d=Dd(i);Ac(i,d,u);break;case 5:var _=r.stateNode;r.flags&32&&(Bt(_,""),r.flags&=-33);var w=Dd(i);Ac(i,w,_);break;case 3:case 4:var R=r.stateNode.containerInfo,Y=Dd(i);Rd(i,Y,R);break;default:throw Error(a(161))}}catch(re){pt(i,i.return,re)}i.flags&=-3}n&4096&&(i.flags&=-4097)}function zv(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var n=i;zv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),i=i.sibling}}function Ss(i,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Mv(i,n.alternate,n),n=n.sibling}function jr(i){for(i=i.child;i!==null;){var n=i;switch(n.tag){case 0:case 11:case 14:case 15:$s(4,n,n.return),jr(n);break;case 1:Qn(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&Ev(n,n.return,r),jr(n);break;case 27:Wl(n.stateNode);case 26:case 5:Qn(n,n.return),jr(n);break;case 22:n.memoizedState===null&&jr(n);break;case 30:jr(n);break;default:jr(n)}i=i.sibling}}function ws(i,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,u=i,d=n,_=d.flags;switch(d.tag){case 0:case 11:case 15:ws(u,d,r),Ol(4,d);break;case 1:if(ws(u,d,r),l=d,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(Y){pt(l,l.return,Y)}if(l=d,u=l.updateQueue,u!==null){var w=l.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)f_(R[u],w)}catch(Y){pt(l,l.return,Y)}}r&&_&64&&xv(d),zl(d,d.return);break;case 27:Dv(d);case 26:case 5:ws(u,d,r),r&&l===null&&_&4&&Tv(d),zl(d,d.return);break;case 12:ws(u,d,r);break;case 31:ws(u,d,r),r&&_&4&&Lv(u,d);break;case 13:ws(u,d,r),r&&_&4&&Bv(u,d);break;case 22:d.memoizedState===null&&ws(u,d,r),zl(d,d.return);break;case 30:break;default:ws(u,d,r)}n=n.sibling}}function Nd(i,n){var r=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==r&&(i!=null&&i.refCount++,r!=null&&wl(r))}function Ad(i,n){i=null,n.alternate!==null&&(i=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==i&&(n.refCount++,i!=null&&wl(i))}function qn(i,n,r,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)jv(i,n,r,l),n=n.sibling}function jv(i,n,r,l){var u=n.flags;switch(n.tag){case 0:case 11:case 15:qn(i,n,r,l),u&2048&&Ol(9,n);break;case 1:qn(i,n,r,l);break;case 3:qn(i,n,r,l),u&2048&&(i=null,n.alternate!==null&&(i=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==i&&(n.refCount++,i!=null&&wl(i)));break;case 12:if(u&2048){qn(i,n,r,l),i=n.stateNode;try{var d=n.memoizedProps,_=d.id,w=d.onPostCommit;typeof w=="function"&&w(_,n.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(R){pt(n,n.return,R)}}else qn(i,n,r,l);break;case 31:qn(i,n,r,l);break;case 13:qn(i,n,r,l);break;case 23:break;case 22:d=n.stateNode,_=n.alternate,n.memoizedState!==null?d._visibility&2?qn(i,n,r,l):jl(i,n):d._visibility&2?qn(i,n,r,l):(d._visibility|=2,Aa(i,n,r,l,(n.subtreeFlags&10256)!==0||!1)),u&2048&&Nd(_,n);break;case 24:qn(i,n,r,l),u&2048&&Ad(n.alternate,n);break;default:qn(i,n,r,l)}}function Aa(i,n,r,l,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var d=i,_=n,w=r,R=l,Y=_.flags;switch(_.tag){case 0:case 11:case 15:Aa(d,_,w,R,u),Ol(8,_);break;case 23:break;case 22:var re=_.stateNode;_.memoizedState!==null?re._visibility&2?Aa(d,_,w,R,u):jl(d,_):(re._visibility|=2,Aa(d,_,w,R,u)),u&&Y&2048&&Nd(_.alternate,_);break;case 24:Aa(d,_,w,R,u),u&&Y&2048&&Ad(_.alternate,_);break;default:Aa(d,_,w,R,u)}n=n.sibling}}function jl(i,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=i,l=n,u=l.flags;switch(l.tag){case 22:jl(r,l),u&2048&&Nd(l.alternate,l);break;case 24:jl(r,l),u&2048&&Ad(l.alternate,l);break;default:jl(r,l)}n=n.sibling}}var Hl=8192;function La(i,n,r){if(i.subtreeFlags&Hl)for(i=i.child;i!==null;)Hv(i,n,r),i=i.sibling}function Hv(i,n,r){switch(i.tag){case 26:La(i,n,r),i.flags&Hl&&i.memoizedState!==null&&wx(r,Fn,i.memoizedState,i.memoizedProps);break;case 5:La(i,n,r);break;case 3:case 4:var l=Fn;Fn=Yc(i.stateNode.containerInfo),La(i,n,r),Fn=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=Hl,Hl=16777216,La(i,n,r),Hl=l):La(i,n,r));break;default:La(i,n,r)}}function Uv(i){var n=i.alternate;if(n!==null&&(i=n.child,i!==null)){n.child=null;do n=i.sibling,i.sibling=null,i=n;while(i!==null)}}function Ul(i){var n=i.deletions;if((i.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];Ci=l,Iv(l,i)}Uv(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Pv(i),i=i.sibling}function Pv(i){switch(i.tag){case 0:case 11:case 15:Ul(i),i.flags&2048&&$s(9,i,i.return);break;case 3:Ul(i);break;case 12:Ul(i);break;case 22:var n=i.stateNode;i.memoizedState!==null&&n._visibility&2&&(i.return===null||i.return.tag!==13)?(n._visibility&=-3,Bc(i)):Ul(i);break;default:Ul(i)}}function Bc(i){var n=i.deletions;if((i.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var l=n[r];Ci=l,Iv(l,i)}Uv(i)}for(i=i.child;i!==null;){switch(n=i,n.tag){case 0:case 11:case 15:$s(8,n,n.return),Bc(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,Bc(n));break;default:Bc(n)}i=i.sibling}}function Iv(i,n){for(;Ci!==null;){var r=Ci;switch(r.tag){case 0:case 11:case 15:$s(8,r,n);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:wl(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,Ci=l;else e:for(r=i;Ci!==null;){l=Ci;var u=l.sibling,d=l.return;if(Nv(l),l===r){Ci=null;break e}if(u!==null){u.return=d,Ci=u;break e}Ci=d}}}var jC={getCacheForType:function(i){var n=Bi(ti),r=n.data.get(i);return r===void 0&&(r=i(),n.data.set(i,r)),r},cacheSignal:function(){return Bi(ti).controller.signal}},HC=typeof WeakMap=="function"?WeakMap:Map,ot=0,Ct=null,Ze=null,tt=0,ft=0,mn=null,Ys=!1,Ba=!1,Ld=!1,Cs=0,qt=0,Vs=0,Hr=0,Bd=0,gn=0,Oa=0,Pl=null,sn=null,Od=!1,Oc=0,Kv=0,zc=1/0,jc=null,Xs=null,hi=0,Gs=null,za=null,xs=0,zd=0,jd=null,Fv=null,Il=0,Hd=null;function _n(){return(ot&2)!==0&&tt!==0?tt&-tt:M.T!==null?qd():yi()}function qv(){if(gn===0)if((tt&536870912)===0||nt){var i=wn;wn<<=1,(wn&3932160)===0&&(wn=262144),gn=i}else gn=536870912;return i=fn.current,i!==null&&(i.flags|=32),gn}function rn(i,n,r){(i===Ct&&(ft===2||ft===9)||i.cancelPendingCommit!==null)&&(ja(i,0),Zs(i,tt,gn,!1)),Ni(i,r),((ot&2)===0||i!==Ct)&&(i===Ct&&((ot&2)===0&&(Hr|=r),qt===4&&Zs(i,tt,gn,!1)),Jn(i))}function Wv(i,n,r){if((ot&6)!==0)throw Error(a(327));var l=!r&&(n&127)===0&&(n&i.expiredLanes)===0||ci(i,n),u=l?IC(i,n):Pd(i,n,!0),d=l;do{if(u===0){Ba&&!l&&Zs(i,n,0,!1);break}else{if(r=i.current.alternate,d&&!UC(r)){u=Pd(i,n,!1),d=!1;continue}if(u===2){if(d=n,i.errorRecoveryDisabledLanes&d)var _=0;else _=i.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var w=i;u=Pl;var R=w.current.memoizedState.isDehydrated;if(R&&(ja(w,_).flags|=256),_=Pd(w,_,!1),_!==2){if(Ld&&!R){w.errorRecoveryDisabledLanes|=d,Hr|=d,u=4;break e}d=sn,sn=u,d!==null&&(sn===null?sn=d:sn.push.apply(sn,d))}u=_}if(d=!1,u!==2)continue}}if(u===1){ja(i,0),Zs(i,n,0,!0);break}e:{switch(l=i,d=u,d){case 0:case 1:throw Error(a(345));case 4:if((n&4194048)!==n)break;case 6:Zs(l,n,gn,!Ys);break e;case 2:sn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((n&62914560)===n&&(u=Oc+300-lt(),10<u)){if(Zs(l,n,gn,!Ys),Ut(l,0,!0)!==0)break e;xs=n,l.timeoutHandle=wy($v.bind(null,l,r,sn,jc,Od,n,gn,Hr,Oa,Ys,d,"Throttled",-0,0),u);break e}$v(l,r,sn,jc,Od,n,gn,Hr,Oa,Ys,d,null,-0,0)}}break}while(!0);Jn(i)}function $v(i,n,r,l,u,d,_,w,R,Y,re,ue,G,ee){if(i.timeoutHandle=-1,ue=n.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wi},Hv(n,d,ue);var Re=(d&62914560)===d?Oc-lt():(d&4194048)===d?Kv-lt():0;if(Re=Cx(ue,Re),Re!==null){xs=d,i.cancelPendingCommit=Re(ey.bind(null,i,n,d,r,l,u,_,w,R,re,ue,null,G,ee)),Zs(i,d,_,!Y);return}}ey(i,n,d,r,l,u,_,w,R)}function UC(i){for(var n=i;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.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(!hn(d(),u))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===i)break;for(;n.sibling===null;){if(n.return===null||n.return===i)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Zs(i,n,r,l){n&=~Bd,n&=~Hr,i.suspendedLanes|=n,i.pingedLanes&=~n,l&&(i.warmLanes|=n),l=i.expirationTimes;for(var u=n;0<u;){var d=31-Ht(u),_=1<<d;l[d]=-1,u&=~_}r!==0&&qi(i,r,n)}function Hc(){return(ot&6)===0?(Kl(0),!1):!0}function Ud(){if(Ze!==null){if(ft===0)var i=Ze.return;else i=Ze,fs=Rr=null,td(i),ka=null,xl=0,i=Ze;for(;i!==null;)Cv(i.alternate,i),i=i.return;Ze=null}}function ja(i,n){var r=i.timeoutHandle;r!==-1&&(i.timeoutHandle=-1,rx(r)),r=i.cancelPendingCommit,r!==null&&(i.cancelPendingCommit=null,r()),xs=0,Ud(),Ct=i,Ze=r=hs(i.current,null),tt=n,ft=0,mn=null,Ys=!1,Ba=ci(i,n),Ld=!1,Oa=gn=Bd=Hr=Vs=qt=0,sn=Pl=null,Od=!1,(n&8)!==0&&(n|=n&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=n;0<l;){var u=31-Ht(l),d=1<<u;n|=i[u],l&=~d}return Cs=n,rc(),r}function Yv(i,n){We=null,M.H=Al,n===Ta||n===fc?(n=c_(),ft=3):n===Fh?(n=c_(),ft=4):ft=n===_d?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,mn=n,Ze===null&&(qt=1,kc(i,Tn(n,i.current)))}function Vv(){var i=fn.current;return i===null?!0:(tt&4194048)===tt?Mn===null:(tt&62914560)===tt||(tt&536870912)!==0?i===Mn:!1}function Xv(){var i=M.H;return M.H=Al,i===null?Al:i}function Gv(){var i=M.A;return M.A=jC,i}function Uc(){qt=4,Ys||(tt&4194048)!==tt&&fn.current!==null||(Ba=!0),(Vs&134217727)===0&&(Hr&134217727)===0||Ct===null||Zs(Ct,tt,gn,!1)}function Pd(i,n,r){var l=ot;ot|=2;var u=Xv(),d=Gv();(Ct!==i||tt!==n)&&(jc=null,ja(i,n)),n=!1;var _=qt;e:do try{if(ft!==0&&Ze!==null){var w=Ze,R=mn;switch(ft){case 8:Ud(),_=6;break e;case 3:case 2:case 9:case 6:fn.current===null&&(n=!0);var Y=ft;if(ft=0,mn=null,Ha(i,w,R,Y),r&&Ba){_=0;break e}break;default:Y=ft,ft=0,mn=null,Ha(i,w,R,Y)}}PC(),_=qt;break}catch(re){Yv(i,re)}while(!0);return n&&i.shellSuspendCounter++,fs=Rr=null,ot=l,M.H=u,M.A=d,Ze===null&&(Ct=null,tt=0,rc()),_}function PC(){for(;Ze!==null;)Zv(Ze)}function IC(i,n){var r=ot;ot|=2;var l=Xv(),u=Gv();Ct!==i||tt!==n?(jc=null,zc=lt()+500,ja(i,n)):Ba=ci(i,n);e:do try{if(ft!==0&&Ze!==null){n=Ze;var d=mn;t:switch(ft){case 1:ft=0,mn=null,Ha(i,n,d,1);break;case 2:case 9:if(l_(d)){ft=0,mn=null,Qv(n);break}n=function(){ft!==2&&ft!==9||Ct!==i||(ft=7),Jn(i)},d.then(n,n);break e;case 3:ft=7;break e;case 4:ft=5;break e;case 7:l_(d)?(ft=0,mn=null,Qv(n)):(ft=0,mn=null,Ha(i,n,d,7));break;case 5:var _=null;switch(Ze.tag){case 26:_=Ze.memoizedState;case 5:case 27:var w=Ze;if(_?jy(_):w.stateNode.complete){ft=0,mn=null;var R=w.sibling;if(R!==null)Ze=R;else{var Y=w.return;Y!==null?(Ze=Y,Pc(Y)):Ze=null}break t}}ft=0,mn=null,Ha(i,n,d,5);break;case 6:ft=0,mn=null,Ha(i,n,d,6);break;case 8:Ud(),qt=6;break e;default:throw Error(a(462))}}KC();break}catch(re){Yv(i,re)}while(!0);return fs=Rr=null,M.H=l,M.A=u,ot=r,Ze!==null?0:(Ct=null,tt=0,rc(),qt)}function KC(){for(;Ze!==null&&!Hi();)Zv(Ze)}function Zv(i){var n=Sv(i.alternate,i,Cs);i.memoizedProps=i.pendingProps,n===null?Pc(i):Ze=n}function Qv(i){var n=i,r=n.alternate;switch(n.tag){case 15:case 0:n=mv(r,n,n.pendingProps,n.type,void 0,tt);break;case 11:n=mv(r,n,n.pendingProps,n.type.render,n.ref,tt);break;case 5:td(n);default:Cv(r,n),n=Ze=Gg(n,Cs),n=Sv(r,n,Cs)}i.memoizedProps=i.pendingProps,n===null?Pc(i):Ze=n}function Ha(i,n,r,l){fs=Rr=null,td(n),ka=null,xl=0;var u=n.return;try{if(MC(i,u,n,r,tt)){qt=1,kc(i,Tn(r,i.current)),Ze=null;return}}catch(d){if(u!==null)throw Ze=u,d;qt=1,kc(i,Tn(r,i.current)),Ze=null;return}n.flags&32768?(nt||l===1?i=!0:Ba||(tt&536870912)!==0?i=!1:(Ys=i=!0,(l===2||l===9||l===3||l===6)&&(l=fn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Jv(n,i)):Pc(n)}function Pc(i){var n=i;do{if((n.flags&32768)!==0){Jv(n,Ys);return}i=n.return;var r=LC(n.alternate,n,Cs);if(r!==null){Ze=r;return}if(n=n.sibling,n!==null){Ze=n;return}Ze=n=i}while(n!==null);qt===0&&(qt=5)}function Jv(i,n){do{var r=BC(i.alternate,i);if(r!==null){r.flags&=32767,Ze=r;return}if(r=i.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(i=i.sibling,i!==null)){Ze=i;return}Ze=i=r}while(i!==null);qt=6,Ze=null}function ey(i,n,r,l,u,d,_,w,R){i.cancelPendingCommit=null;do Ic();while(hi!==0);if((ot&6)!==0)throw Error(a(327));if(n!==null){if(n===i.current)throw Error(a(177));if(d=n.lanes|n.childLanes,d|=Dh,Tt(i,r,d,_,w,R),i===Ct&&(Ze=Ct=null,tt=0),za=n,Gs=i,xs=r,zd=d,jd=u,Fv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,$C(jt,function(){return ry(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=M.T,M.T=null,u=X.p,X.p=2,_=ot,ot|=4;try{OC(i,n,r)}finally{ot=_,X.p=u,M.T=l}}hi=1,ty(),iy(),ny()}}function ty(){if(hi===1){hi=0;var i=Gs,n=za,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var l=X.p;X.p=2;var u=ot;ot|=4;try{Ov(n,i);var d=Qd,_=Ig(i.containerInfo),w=d.focusedElem,R=d.selectionRange;if(_!==w&&w&&w.ownerDocument&&Pg(w.ownerDocument.documentElement,w)){if(R!==null&&Ch(w)){var Y=R.start,re=R.end;if(re===void 0&&(re=Y),"selectionStart"in w)w.selectionStart=Y,w.selectionEnd=Math.min(re,w.value.length);else{var ue=w.ownerDocument||document,G=ue&&ue.defaultView||window;if(G.getSelection){var ee=G.getSelection(),Re=w.textContent.length,je=Math.min(R.start,Re),yt=R.end===void 0?je:Math.min(R.end,Re);!ee.extend&&je>yt&&(_=yt,yt=je,je=_);var P=Ug(w,je),A=Ug(w,yt);if(P&&A&&(ee.rangeCount!==1||ee.anchorNode!==P.node||ee.anchorOffset!==P.offset||ee.focusNode!==A.node||ee.focusOffset!==A.offset)){var W=ue.createRange();W.setStart(P.node,P.offset),ee.removeAllRanges(),je>yt?(ee.addRange(W),ee.extend(A.node,A.offset)):(W.setEnd(A.node,A.offset),ee.addRange(W))}}}}for(ue=[],ee=w;ee=ee.parentNode;)ee.nodeType===1&&ue.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ue.length;w++){var ce=ue[w];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Jc=!!Zd,Qd=Zd=null}finally{ot=u,X.p=l,M.T=r}}i.current=n,hi=2}}function iy(){if(hi===2){hi=0;var i=Gs,n=za,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var l=X.p;X.p=2;var u=ot;ot|=4;try{Mv(i,n.alternate,n)}finally{ot=u,X.p=l,M.T=r}}hi=3}}function ny(){if(hi===4||hi===3){hi=0,Yn();var i=Gs,n=za,r=xs,l=Fv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?hi=5:(hi=0,za=Gs=null,sy(i,i.pendingLanes));var u=i.pendingLanes;if(u===0&&(Xs=null),Pi(r),n=n.stateNode,ct&&typeof ct.onCommitFiberRoot=="function")try{ct.onCommitFiberRoot(et,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=M.T,u=X.p,X.p=2,M.T=null;try{for(var d=i.onRecoverableError,_=0;_<l.length;_++){var w=l[_];d(w.value,{componentStack:w.stack})}}finally{M.T=n,X.p=u}}(xs&3)!==0&&Ic(),Jn(i),u=i.pendingLanes,(r&261930)!==0&&(u&42)!==0?i===Hd?Il++:(Il=0,Hd=i):Il=0,Kl(0)}}function sy(i,n){(i.pooledCacheLanes&=n)===0&&(n=i.pooledCache,n!=null&&(i.pooledCache=null,wl(n)))}function Ic(){return ty(),iy(),ny(),ry()}function ry(){if(hi!==5)return!1;var i=Gs,n=zd;zd=0;var r=Pi(xs),l=M.T,u=X.p;try{X.p=32>r?32:r,M.T=null,r=jd,jd=null;var d=Gs,_=xs;if(hi=0,za=Gs=null,xs=0,(ot&6)!==0)throw Error(a(331));var w=ot;if(ot|=4,Pv(d.current),jv(d,d.current,_,r),ot=w,Kl(0,!1),ct&&typeof ct.onPostCommitFiberRoot=="function")try{ct.onPostCommitFiberRoot(et,d)}catch{}return!0}finally{X.p=u,M.T=l,sy(i,n)}}function ay(i,n,r){n=Tn(r,n),n=gd(i.stateNode,n,2),i=Fs(i,n,2),i!==null&&(Ni(i,2),Jn(i))}function pt(i,n,r){if(i.tag===3)ay(i,i,r);else for(;n!==null;){if(n.tag===3){ay(n,i,r);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Xs===null||!Xs.has(l))){i=Tn(r,i),r=lv(2),l=Fs(n,r,2),l!==null&&(ov(r,l,n,i),Ni(l,2),Jn(l));break}}n=n.return}}function Id(i,n,r){var l=i.pingCache;if(l===null){l=i.pingCache=new HC;var u=new Set;l.set(n,u)}else u=l.get(n),u===void 0&&(u=new Set,l.set(n,u));u.has(r)||(Ld=!0,u.add(r),i=FC.bind(null,i,n,r),n.then(i,i))}function FC(i,n,r){var l=i.pingCache;l!==null&&l.delete(n),i.pingedLanes|=i.suspendedLanes&r,i.warmLanes&=~r,Ct===i&&(tt&r)===r&&(qt===4||qt===3&&(tt&62914560)===tt&&300>lt()-Oc?(ot&2)===0&&ja(i,0):Bd|=r,Oa===tt&&(Oa=0)),Jn(i)}function ly(i,n){n===0&&(n=ei()),i=Tr(i,n),i!==null&&(Ni(i,n),Jn(i))}function qC(i){var n=i.memoizedState,r=0;n!==null&&(r=n.retryLane),ly(i,r)}function WC(i,n){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(n),ly(i,r)}function $C(i,n){return Ke(i,n)}var Kc=null,Ua=null,Kd=!1,Fc=!1,Fd=!1,Qs=0;function Jn(i){i!==Ua&&i.next===null&&(Ua===null?Kc=Ua=i:Ua=Ua.next=i),Fc=!0,Kd||(Kd=!0,VC())}function Kl(i,n){if(!Fd&&Fc){Fd=!0;do for(var r=!1,l=Kc;l!==null;){if(i!==0){var u=l.pendingLanes;if(u===0)var d=0;else{var _=l.suspendedLanes,w=l.pingedLanes;d=(1<<31-Ht(42|i)+1)-1,d&=u&~(_&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(r=!0,hy(l,d))}else d=tt,d=Ut(l,l===Ct?d:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(d&3)===0||ci(l,d)||(r=!0,hy(l,d));l=l.next}while(r);Fd=!1}}function YC(){oy()}function oy(){Fc=Kd=!1;var i=0;Qs!==0&&sx()&&(i=Qs);for(var n=lt(),r=null,l=Kc;l!==null;){var u=l.next,d=cy(l,n);d===0?(l.next=null,r===null?Kc=u:r.next=u,u===null&&(Ua=r)):(r=l,(i!==0||(d&3)!==0)&&(Fc=!0)),l=u}hi!==0&&hi!==5||Kl(i),Qs!==0&&(Qs=0)}function cy(i,n){for(var r=i.suspendedLanes,l=i.pingedLanes,u=i.expirationTimes,d=i.pendingLanes&-62914561;0<d;){var _=31-Ht(d),w=1<<_,R=u[_];R===-1?((w&r)===0||(w&l)!==0)&&(u[_]=Yt(w,n)):R<=n&&(i.expiredLanes|=w),d&=~w}if(n=Ct,r=tt,r=Ut(i,i===n?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,r===0||i===n&&(ft===2||ft===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&St(l),i.callbackNode=null,i.callbackPriority=0;if((r&3)===0||ci(i,r)){if(n=r&-r,n===i.callbackPriority)return n;switch(l!==null&&St(l),Pi(r)){case 2:case 8:r=_i;break;case 32:r=jt;break;case 268435456:r=vi;break;default:r=jt}return l=uy.bind(null,i),r=Ke(r,l),i.callbackPriority=n,i.callbackNode=r,n}return l!==null&&l!==null&&St(l),i.callbackPriority=2,i.callbackNode=null,2}function uy(i,n){if(hi!==0&&hi!==5)return i.callbackNode=null,i.callbackPriority=0,null;var r=i.callbackNode;if(Ic()&&i.callbackNode!==r)return null;var l=tt;return l=Ut(i,i===Ct?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(Wv(i,l,n),cy(i,lt()),i.callbackNode!=null&&i.callbackNode===r?uy.bind(null,i):null)}function hy(i,n){if(Ic())return null;Wv(i,n,!0)}function VC(){ax(function(){(ot&6)!==0?Ke(Zi,YC):oy()})}function qd(){if(Qs===0){var i=xa;i===0&&(i=on,on<<=1,(on&261888)===0&&(on=256)),Qs=i}return Qs}function dy(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:ua(""+i)}function fy(i,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,i.id&&r.setAttribute("form",i.id),n.parentNode.insertBefore(r,n),i=new FormData(i),r.parentNode.removeChild(r),i}function XC(i,n,r,l,u){if(n==="submit"&&r&&r.stateNode===u){var d=dy((u[It]||null).action),_=l.submitter;_&&(n=(n=_[It]||null)?dy(n.formAction):_.getAttribute("formAction"),n!==null&&(d=n,_=null));var w=new tc("action","action",null,l,u);i.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Qs!==0){var R=_?fy(u,_):new FormData(u);ud(r,{pending:!0,data:R,method:u.method,action:d},null,R)}}else typeof d=="function"&&(w.preventDefault(),R=_?fy(u,_):new FormData(u),ud(r,{pending:!0,data:R,method:u.method,action:d},d,R))},currentTarget:u}]})}}for(var Wd=0;Wd<kh.length;Wd++){var $d=kh[Wd],GC=$d.toLowerCase(),ZC=$d[0].toUpperCase()+$d.slice(1);Kn(GC,"on"+ZC)}Kn(qg,"onAnimationEnd"),Kn(Wg,"onAnimationIteration"),Kn($g,"onAnimationStart"),Kn("dblclick","onDoubleClick"),Kn("focusin","onFocus"),Kn("focusout","onBlur"),Kn(fC,"onTransitionRun"),Kn(pC,"onTransitionStart"),Kn(mC,"onTransitionCancel"),Kn(Yg,"onTransitionEnd"),xn("onMouseEnter",["mouseout","mouseover"]),xn("onMouseLeave",["mouseout","mouseover"]),xn("onPointerEnter",["pointerout","pointerover"]),xn("onPointerLeave",["pointerout","pointerover"]),cn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),cn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),cn("onBeforeInput",["compositionend","keypress","textInput","paste"]),cn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),cn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),cn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fl="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(" "),QC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fl));function py(i,n){n=(n&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(n)for(var _=l.length-1;0<=_;_--){var w=l[_],R=w.instance,Y=w.currentTarget;if(w=w.listener,R!==d&&u.isPropagationStopped())break e;d=w,u.currentTarget=Y;try{d(u)}catch(re){sc(re)}u.currentTarget=null,d=R}else for(_=0;_<l.length;_++){if(w=l[_],R=w.instance,Y=w.currentTarget,w=w.listener,R!==d&&u.isPropagationStopped())break e;d=w,u.currentTarget=Y;try{d(u)}catch(re){sc(re)}u.currentTarget=null,d=R}}}}function Qe(i,n){var r=n[br];r===void 0&&(r=n[br]=new Set);var l=i+"__bubble";r.has(l)||(my(n,i,2,!1),r.add(l))}function Yd(i,n,r){var l=0;n&&(l|=4),my(r,i,l,n)}var qc="_reactListening"+Math.random().toString(36).slice(2);function Vd(i){if(!i[qc]){i[qc]=!0,wr.forEach(function(r){r!=="selectionchange"&&(QC.has(r)||Yd(r,!1,i),Yd(r,!0,i))});var n=i.nodeType===9?i:i.ownerDocument;n===null||n[qc]||(n[qc]=!0,Yd("selectionchange",!1,n))}}function my(i,n,r,l){switch(qy(n)){case 2:var u=Tx;break;case 8:u=kx;break;default:u=uf}r=u.bind(null,n,r,i),u=void 0,!ph||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),l?u!==void 0?i.addEventListener(n,r,{capture:!0,passive:u}):i.addEventListener(n,r,!0):u!==void 0?i.addEventListener(n,r,{passive:u}):i.addEventListener(n,r,!1)}function Xd(i,n,r,l,u){var d=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var _=l.tag;if(_===3||_===4){var w=l.stateNode.containerInfo;if(w===u)break;if(_===4)for(_=l.return;_!==null;){var R=_.tag;if((R===3||R===4)&&_.stateNode.containerInfo===u)return;_=_.return}for(;w!==null;){if(_=Lt(w),_===null)return;if(R=_.tag,R===5||R===6||R===26||R===27){l=d=_;continue e}w=w.parentNode}}l=l.return}bg(function(){var Y=d,re=da(r),ue=[];e:{var G=Vg.get(i);if(G!==void 0){var ee=tc,Re=i;switch(i){case"keypress":if(Jo(r)===0)break e;case"keydown":case"keyup":ee=W1;break;case"focusin":Re="focus",ee=vh;break;case"focusout":Re="blur",ee=vh;break;case"beforeblur":case"afterblur":ee=vh;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":ee=Cg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=L1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=V1;break;case qg:case Wg:case $g:ee=z1;break;case Yg:ee=G1;break;case"scroll":case"scrollend":ee=N1;break;case"wheel":ee=Q1;break;case"copy":case"cut":case"paste":ee=H1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=Eg;break;case"toggle":case"beforetoggle":ee=eC}var je=(n&4)!==0,yt=!je&&(i==="scroll"||i==="scrollend"),P=je?G!==null?G+"Capture":null:G;je=[];for(var A=Y,W;A!==null;){var ce=A;if(W=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||W===null||P===null||(ce=hl(A,P),ce!=null&&je.push(ql(A,ce,W))),yt)break;A=A.return}0<je.length&&(G=new ee(G,Re,null,r,re),ue.push({event:G,listeners:je}))}}if((n&7)===0){e:{if(G=i==="mouseover"||i==="pointerover",ee=i==="mouseout"||i==="pointerout",G&&r!==ha&&(Re=r.relatedTarget||r.fromElement)&&(Lt(Re)||Re[Mt]))break e;if((ee||G)&&(G=re.window===re?re:(G=re.ownerDocument)?G.defaultView||G.parentWindow:window,ee?(Re=r.relatedTarget||r.toElement,ee=Y,Re=Re?Lt(Re):null,Re!==null&&(yt=c(Re),je=Re.tag,Re!==yt||je!==5&&je!==27&&je!==6)&&(Re=null)):(ee=null,Re=Y),ee!==Re)){if(je=Cg,ce="onMouseLeave",P="onMouseEnter",A="mouse",(i==="pointerout"||i==="pointerover")&&(je=Eg,ce="onPointerLeave",P="onPointerEnter",A="pointer"),yt=ee==null?G:Vn(ee),W=Re==null?G:Vn(Re),G=new je(ce,A+"leave",ee,r,re),G.target=yt,G.relatedTarget=W,ce=null,Lt(re)===Y&&(je=new je(P,A+"enter",Re,r,re),je.target=W,je.relatedTarget=yt,ce=je),yt=ce,ee&&Re)t:{for(je=JC,P=ee,A=Re,W=0,ce=P;ce;ce=je(ce))W++;ce=0;for(var Be=A;Be;Be=je(Be))ce++;for(;0<W-ce;)P=je(P),W--;for(;0<ce-W;)A=je(A),ce--;for(;W--;){if(P===A||A!==null&&P===A.alternate){je=P;break t}P=je(P),A=je(A)}je=null}else je=null;ee!==null&&gy(ue,G,ee,je,!1),Re!==null&&yt!==null&&gy(ue,yt,Re,je,!0)}}e:{if(G=Y?Vn(Y):window,ee=G.nodeName&&G.nodeName.toLowerCase(),ee==="select"||ee==="input"&&G.type==="file")var rt=Lg;else if(Ng(G))if(Bg)rt=uC;else{rt=oC;var Ne=lC}else ee=G.nodeName,!ee||ee.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?Y&&cs(Y.elementType)&&(rt=Lg):rt=cC;if(rt&&(rt=rt(i,Y))){Ag(ue,rt,r,re);break e}Ne&&Ne(i,G,Y),i==="focusout"&&Y&&G.type==="number"&&Y.memoizedProps.value!=null&&Ue(G,"number",G.value)}switch(Ne=Y?Vn(Y):window,i){case"focusin":(Ng(Ne)||Ne.contentEditable==="true")&&(ga=Ne,xh=Y,yl=null);break;case"focusout":yl=xh=ga=null;break;case"mousedown":Eh=!0;break;case"contextmenu":case"mouseup":case"dragend":Eh=!1,Kg(ue,r,re);break;case"selectionchange":if(dC)break;case"keydown":case"keyup":Kg(ue,r,re)}var $e;if(bh)e:{switch(i){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else ma?Rg(i,r)&&(it="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(it="onCompositionStart");it&&(Tg&&r.locale!=="ko"&&(ma||it!=="onCompositionStart"?it==="onCompositionEnd"&&ma&&($e=Sg()):(zs=re,mh="value"in zs?zs.value:zs.textContent,ma=!0)),Ne=Wc(Y,it),0<Ne.length&&(it=new xg(it,i,null,r,re),ue.push({event:it,listeners:Ne}),$e?it.data=$e:($e=Mg(r),$e!==null&&(it.data=$e)))),($e=iC?nC(i,r):sC(i,r))&&(it=Wc(Y,"onBeforeInput"),0<it.length&&(Ne=new xg("onBeforeInput","beforeinput",null,r,re),ue.push({event:Ne,listeners:it}),Ne.data=$e)),XC(ue,i,Y,r,re)}py(ue,n)})}function ql(i,n,r){return{instance:i,listener:n,currentTarget:r}}function Wc(i,n){for(var r=n+"Capture",l=[];i!==null;){var u=i,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=hl(i,r),u!=null&&l.unshift(ql(i,u,d)),u=hl(i,n),u!=null&&l.push(ql(i,u,d))),i.tag===3)return l;i=i.return}return[]}function JC(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function gy(i,n,r,l,u){for(var d=n._reactName,_=[];r!==null&&r!==l;){var w=r,R=w.alternate,Y=w.stateNode;if(w=w.tag,R!==null&&R===l)break;w!==5&&w!==26&&w!==27||Y===null||(R=Y,u?(Y=hl(r,d),Y!=null&&_.unshift(ql(r,Y,R))):u||(Y=hl(r,d),Y!=null&&_.push(ql(r,Y,R)))),r=r.return}_.length!==0&&i.push({event:n,listeners:_})}var ex=/\r\n?/g,tx=/\u0000|\uFFFD/g;function _y(i){return(typeof i=="string"?i:""+i).replace(ex,`
|
|
10
|
-
`).replace(tx,"")}function vy(i,n){return n=_y(n),_y(i)===n}function vt(i,n,r,l,u,d){switch(r){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Bt(i,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Bt(i,""+l);break;case"className":In(i,"class",l);break;case"tabIndex":In(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":In(i,r,l);break;case"style":Xn(i,l,d);break;case"data":if(n!=="object"){In(i,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||r!=="href")){i.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=ua(""+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"?(n!=="input"&&vt(i,n,"name",u.name,u,null),vt(i,n,"formEncType",u.formEncType,u,null),vt(i,n,"formMethod",u.formMethod,u,null),vt(i,n,"formTarget",u.formTarget,u,null)):(vt(i,n,"encType",u.encType,u,null),vt(i,n,"method",u.method,u,null),vt(i,n,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=ua(""+l),i.setAttribute(r,l);break;case"onClick":l!=null&&(i.onclick=wi);break;case"onScroll":l!=null&&Qe("scroll",i);break;case"onScrollEnd":l!=null&&Qe("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=ua(""+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":Qe("beforetoggle",i),Qe("toggle",i),$i(i,"popover",l);break;case"xlinkActuate":T(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":T(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":T(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":T(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":T(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":T(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":T(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":T(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":T(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":$i(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=un.get(r)||r,$i(i,r,l))}}function Gd(i,n,r,l,u,d){switch(r){case"style":Xn(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"?Bt(i,l):(typeof l=="number"||typeof l=="bigint")&&Bt(i,""+l);break;case"onScroll":l!=null&&Qe("scroll",i);break;case"onScrollEnd":l!=null&&Qe("scrollend",i);break;case"onClick":l!=null&&(i.onclick=wi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Os.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),n=r.slice(2,u?r.length-7:void 0),d=i[It]||null,d=d!=null?d[r]:null,typeof d=="function"&&i.removeEventListener(n,d,u),typeof l=="function")){typeof d!="function"&&d!==null&&(r in i?i[r]=null:i.hasAttribute(r)&&i.removeAttribute(r)),i.addEventListener(n,l,u);break e}r in i?i[r]=l:l===!0?i.setAttribute(r,""):$i(i,r,l)}}}function zi(i,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",i),Qe("load",i);var l=!1,u=!1,d;for(d in r)if(r.hasOwnProperty(d)){var _=r[d];if(_!=null)switch(d){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,n));default:vt(i,n,d,_,r,null)}}u&&vt(i,n,"srcSet",r.srcSet,r,null),l&&vt(i,n,"src",r.src,r,null);return;case"input":Qe("invalid",i);var w=d=_=u=null,R=null,Y=null;for(l in r)if(r.hasOwnProperty(l)){var re=r[l];if(re!=null)switch(l){case"name":u=re;break;case"type":_=re;break;case"checked":R=re;break;case"defaultChecked":Y=re;break;case"value":d=re;break;case"defaultValue":w=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(a(137,n));break;default:vt(i,n,l,re,r,null)}}de(i,d,w,R,Y,_,u,!1);return;case"select":Qe("invalid",i),l=_=d=null;for(u in r)if(r.hasOwnProperty(u)&&(w=r[u],w!=null))switch(u){case"value":d=w;break;case"defaultValue":_=w;break;case"multiple":l=w;default:vt(i,n,u,w,r,null)}n=d,r=_,i.multiple=!!l,n!=null?ze(i,!!l,n,!1):r!=null&&ze(i,!!l,r,!0);return;case"textarea":Qe("invalid",i),d=u=l=null;for(_ in r)if(r.hasOwnProperty(_)&&(w=r[_],w!=null))switch(_){case"value":l=w;break;case"defaultValue":u=w;break;case"children":d=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(a(91));break;default:vt(i,n,_,w,r,null)}ht(i,l,u,d);return;case"option":for(R in r)r.hasOwnProperty(R)&&(l=r[R],l!=null)&&(R==="selected"?i.selected=l&&typeof l!="function"&&typeof l!="symbol":vt(i,n,R,l,r,null));return;case"dialog":Qe("beforetoggle",i),Qe("toggle",i),Qe("cancel",i),Qe("close",i);break;case"iframe":case"object":Qe("load",i);break;case"video":case"audio":for(l=0;l<Fl.length;l++)Qe(Fl[l],i);break;case"image":Qe("error",i),Qe("load",i);break;case"details":Qe("toggle",i);break;case"embed":case"source":case"link":Qe("error",i),Qe("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(Y in r)if(r.hasOwnProperty(Y)&&(l=r[Y],l!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,n));default:vt(i,n,Y,l,r,null)}return;default:if(cs(n)){for(re in r)r.hasOwnProperty(re)&&(l=r[re],l!==void 0&&Gd(i,n,re,l,r,void 0));return}}for(w in r)r.hasOwnProperty(w)&&(l=r[w],l!=null&&vt(i,n,w,l,r,null))}function ix(i,n,r,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,d=null,_=null,w=null,R=null,Y=null,re=null;for(ee in r){var ue=r[ee];if(r.hasOwnProperty(ee)&&ue!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":R=ue;default:l.hasOwnProperty(ee)||vt(i,n,ee,null,l,ue)}}for(var G in l){var ee=l[G];if(ue=r[G],l.hasOwnProperty(G)&&(ee!=null||ue!=null))switch(G){case"type":d=ee;break;case"name":u=ee;break;case"checked":Y=ee;break;case"defaultChecked":re=ee;break;case"value":_=ee;break;case"defaultValue":w=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(a(137,n));break;default:ee!==ue&&vt(i,n,G,ee,l,ue)}}N(i,_,w,R,Y,re,d,u);return;case"select":ee=_=w=G=null;for(d in r)if(R=r[d],r.hasOwnProperty(d)&&R!=null)switch(d){case"value":break;case"multiple":ee=R;default:l.hasOwnProperty(d)||vt(i,n,d,null,l,R)}for(u in l)if(d=l[u],R=r[u],l.hasOwnProperty(u)&&(d!=null||R!=null))switch(u){case"value":G=d;break;case"defaultValue":w=d;break;case"multiple":_=d;default:d!==R&&vt(i,n,u,d,l,R)}n=w,r=_,l=ee,G!=null?ze(i,!!r,G,!1):!!l!=!!r&&(n!=null?ze(i,!!r,n,!0):ze(i,!!r,r?[]:"",!1));return;case"textarea":ee=G=null;for(w in r)if(u=r[w],r.hasOwnProperty(w)&&u!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:vt(i,n,w,null,l,u)}for(_ in l)if(u=l[_],d=r[_],l.hasOwnProperty(_)&&(u!=null||d!=null))switch(_){case"value":G=u;break;case"defaultValue":ee=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(a(91));break;default:u!==d&&vt(i,n,_,u,l,d)}Ge(i,G,ee);return;case"option":for(var Re in r)G=r[Re],r.hasOwnProperty(Re)&&G!=null&&!l.hasOwnProperty(Re)&&(Re==="selected"?i.selected=!1:vt(i,n,Re,null,l,G));for(R in l)G=l[R],ee=r[R],l.hasOwnProperty(R)&&G!==ee&&(G!=null||ee!=null)&&(R==="selected"?i.selected=G&&typeof G!="function"&&typeof G!="symbol":vt(i,n,R,G,l,ee));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 je in r)G=r[je],r.hasOwnProperty(je)&&G!=null&&!l.hasOwnProperty(je)&&vt(i,n,je,null,l,G);for(Y in l)if(G=l[Y],ee=r[Y],l.hasOwnProperty(Y)&&G!==ee&&(G!=null||ee!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(a(137,n));break;default:vt(i,n,Y,G,l,ee)}return;default:if(cs(n)){for(var yt in r)G=r[yt],r.hasOwnProperty(yt)&&G!==void 0&&!l.hasOwnProperty(yt)&&Gd(i,n,yt,void 0,l,G);for(re in l)G=l[re],ee=r[re],!l.hasOwnProperty(re)||G===ee||G===void 0&&ee===void 0||Gd(i,n,re,G,l,ee);return}}for(var P in r)G=r[P],r.hasOwnProperty(P)&&G!=null&&!l.hasOwnProperty(P)&&vt(i,n,P,null,l,G);for(ue in l)G=l[ue],ee=r[ue],!l.hasOwnProperty(ue)||G===ee||G==null&&ee==null||vt(i,n,ue,G,l,ee)}function yy(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function nx(){if(typeof performance.getEntriesByType=="function"){for(var i=0,n=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var u=r[l],d=u.transferSize,_=u.initiatorType,w=u.duration;if(d&&w&&yy(_)){for(_=0,w=u.responseEnd,l+=1;l<r.length;l++){var R=r[l],Y=R.startTime;if(Y>w)break;var re=R.transferSize,ue=R.initiatorType;re&&yy(ue)&&(R=R.responseEnd,_+=re*(R<w?1:(w-Y)/(R-Y)))}if(--l,n+=8*(d+_)/(u.duration/1e3),i++,10<i)break}}if(0<i)return n/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Zd=null,Qd=null;function $c(i){return i.nodeType===9?i:i.ownerDocument}function by(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 Sy(i,n){if(i===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&n==="foreignObject"?0:i}function Jd(i,n){return i==="textarea"||i==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var ef=null;function sx(){var i=window.event;return i&&i.type==="popstate"?i===ef?!1:(ef=i,!0):(ef=null,!1)}var wy=typeof setTimeout=="function"?setTimeout:void 0,rx=typeof clearTimeout=="function"?clearTimeout:void 0,Cy=typeof Promise=="function"?Promise:void 0,ax=typeof queueMicrotask=="function"?queueMicrotask:typeof Cy<"u"?function(i){return Cy.resolve(null).then(i).catch(lx)}:wy;function lx(i){setTimeout(function(){throw i})}function Js(i){return i==="head"}function xy(i,n){var r=n,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),Fa(n);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Wl(i.ownerDocument.documentElement);else if(r==="head"){r=i.ownerDocument.head,Wl(r);for(var d=r.firstChild;d;){var _=d.nextSibling,w=d.nodeName;d[Cn]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&d.rel.toLowerCase()==="stylesheet"||r.removeChild(d),d=_}}else r==="body"&&Wl(i.ownerDocument.body);r=u}while(r);Fa(n)}function Ey(i,n){var r=i;i=0;do{var l=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(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 tf(i){var n=i.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":tf(r),ls(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}i.removeChild(r)}}function ox(i,n,r,l){for(;i.nodeType===1;){var u=r;if(i.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[Cn])switch(n){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(n==="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=Nn(i.nextSibling),i===null)break}return null}function cx(i,n,r){if(n==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=Nn(i.nextSibling),i===null))return null;return i}function Ty(i,n){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!n||(i=Nn(i.nextSibling),i===null))return null;return i}function nf(i){return i.data==="$?"||i.data==="$~"}function sf(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function ux(i,n){var r=i.ownerDocument;if(i.data==="$~")i._reactRetry=n;else if(i.data!=="$?"||r.readyState!=="loading")n();else{var l=function(){n(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function Nn(i){for(;i!=null;i=i.nextSibling){var n=i.nodeType;if(n===1||n===3)break;if(n===8){if(n=i.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return i}var rf=null;function ky(i){i=i.nextSibling;for(var n=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"||r==="/&"){if(n===0)return Nn(i.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}i=i.nextSibling}return null}function Dy(i){i=i.previousSibling;for(var n=0;i;){if(i.nodeType===8){var r=i.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return i;n--}else r!=="/$"&&r!=="/&"||n++}i=i.previousSibling}return null}function Ry(i,n,r){switch(n=$c(r),i){case"html":if(i=n.documentElement,!i)throw Error(a(452));return i;case"head":if(i=n.head,!i)throw Error(a(453));return i;case"body":if(i=n.body,!i)throw Error(a(454));return i;default:throw Error(a(451))}}function Wl(i){for(var n=i.attributes;n.length;)i.removeAttributeNode(n[0]);ls(i)}var An=new Map,My=new Set;function Yc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Es=X.d;X.d={f:hx,r:dx,D:fx,C:px,L:mx,m:gx,X:vx,S:_x,M:yx};function hx(){var i=Es.f(),n=Hc();return i||n}function dx(i){var n=Wi(i);n!==null&&n.tag===5&&n.type==="form"?Y_(n):Es.r(i)}var Pa=typeof document>"u"?null:document;function Ny(i,n,r){var l=Pa;if(l&&typeof n=="string"&&n){var u=gt(n);u='link[rel="'+i+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),My.has(u)||(My.add(u),i={rel:i,crossOrigin:r,href:n},l.querySelector(u)===null&&(n=l.createElement("link"),zi(n,"link",i),Kt(n),l.head.appendChild(n)))}}function fx(i){Es.D(i),Ny("dns-prefetch",i,null)}function px(i,n){Es.C(i,n),Ny("preconnect",i,n)}function mx(i,n,r){Es.L(i,n,r);var l=Pa;if(l&&i&&n){var u='link[rel="preload"][as="'+gt(n)+'"]';n==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+gt(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+gt(r.imageSizes)+'"]')):u+='[href="'+gt(i)+'"]';var d=u;switch(n){case"style":d=Ia(i);break;case"script":d=Ka(i)}An.has(d)||(i=y({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:i,as:n},r),An.set(d,i),l.querySelector(u)!==null||n==="style"&&l.querySelector($l(d))||n==="script"&&l.querySelector(Yl(d))||(n=l.createElement("link"),zi(n,"link",i),Kt(n),l.head.appendChild(n)))}}function gx(i,n){Es.m(i,n);var r=Pa;if(r&&i){var l=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+gt(l)+'"][href="'+gt(i)+'"]',d=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Ka(i)}if(!An.has(d)&&(i=y({rel:"modulepreload",href:i},n),An.set(d,i),r.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Yl(d)))return}l=r.createElement("link"),zi(l,"link",i),Kt(l),r.head.appendChild(l)}}}function _x(i,n,r){Es.S(i,n,r);var l=Pa;if(l&&i){var u=Pn(l).hoistableStyles,d=Ia(i);n=n||"default";var _=u.get(d);if(!_){var w={loading:0,preload:null};if(_=l.querySelector($l(d)))w.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":n},r),(r=An.get(d))&&af(i,r);var R=_=l.createElement("link");Kt(R),zi(R,"link",i),R._p=new Promise(function(Y,re){R.onload=Y,R.onerror=re}),R.addEventListener("load",function(){w.loading|=1}),R.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Vc(_,n,l)}_={type:"stylesheet",instance:_,count:1,state:w},u.set(d,_)}}}function vx(i,n){Es.X(i,n);var r=Pa;if(r&&i){var l=Pn(r).hoistableScripts,u=Ka(i),d=l.get(u);d||(d=r.querySelector(Yl(u)),d||(i=y({src:i,async:!0},n),(n=An.get(u))&&lf(i,n),d=r.createElement("script"),Kt(d),zi(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function yx(i,n){Es.M(i,n);var r=Pa;if(r&&i){var l=Pn(r).hoistableScripts,u=Ka(i),d=l.get(u);d||(d=r.querySelector(Yl(u)),d||(i=y({src:i,async:!0,type:"module"},n),(n=An.get(u))&&lf(i,n),d=r.createElement("script"),Kt(d),zi(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function Ay(i,n,r,l){var u=(u=Ce.current)?Yc(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"?(n=Ia(r.href),r=Pn(u).hoistableStyles,l=r.get(n),l||(l={type:"style",instance:null,count:0,state:null},r.set(n,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=Ia(r.href);var d=Pn(u).hoistableStyles,_=d.get(i);if(_||(u=u.ownerDocument||u,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(i,_),(d=u.querySelector($l(i)))&&!d._p&&(_.instance=d,_.state.loading=5),An.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},An.set(i,r),d||bx(u,i,r,_.state))),n&&l===null)throw Error(a(528,""));return _}if(n&&l!==null)throw Error(a(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Ka(r),r=Pn(u).hoistableScripts,l=r.get(n),l||(l={type:"script",instance:null,count:0,state:null},r.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,i))}}function Ia(i){return'href="'+gt(i)+'"'}function $l(i){return'link[rel="stylesheet"]['+i+"]"}function Ly(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function bx(i,n,r,l){i.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=i.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),zi(n,"link",r),Kt(n),i.head.appendChild(n))}function Ka(i){return'[src="'+gt(i)+'"]'}function Yl(i){return"script[async]"+i}function By(i,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var l=i.querySelector('style[data-href~="'+gt(r.href)+'"]');if(l)return n.instance=l,Kt(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"),Kt(l),zi(l,"style",u),Vc(l,r.precedence,i),n.instance=l;case"stylesheet":u=Ia(r.href);var d=i.querySelector($l(u));if(d)return n.state.loading|=4,n.instance=d,Kt(d),d;l=Ly(r),(u=An.get(u))&&af(l,u),d=(i.ownerDocument||i).createElement("link"),Kt(d);var _=d;return _._p=new Promise(function(w,R){_.onload=w,_.onerror=R}),zi(d,"link",l),n.state.loading|=4,Vc(d,r.precedence,i),n.instance=d;case"script":return d=Ka(r.src),(u=i.querySelector(Yl(d)))?(n.instance=u,Kt(u),u):(l=r,(u=An.get(d))&&(l=y({},r),lf(l,u)),i=i.ownerDocument||i,u=i.createElement("script"),Kt(u),zi(u,"link",l),i.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(a(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,Vc(l,r.precedence,i));return n.instance}function Vc(i,n,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,d=u,_=0;_<l.length;_++){var w=l[_];if(w.dataset.precedence===n)d=w;else if(d!==u)break}d?d.parentNode.insertBefore(i,d.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(i,n.firstChild))}function af(i,n){i.crossOrigin==null&&(i.crossOrigin=n.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=n.referrerPolicy),i.title==null&&(i.title=n.title)}function lf(i,n){i.crossOrigin==null&&(i.crossOrigin=n.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=n.referrerPolicy),i.integrity==null&&(i.integrity=n.integrity)}var Xc=null;function Oy(i,n,r){if(Xc===null){var l=new Map,u=Xc=new Map;u.set(r,l)}else u=Xc,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[Cn]||d[Pt]||i==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var _=d.getAttribute(n)||"";_=i+_;var w=l.get(_);w?w.push(d):l.set(_,[d])}}return l}function zy(i,n,r){i=i.ownerDocument||i,i.head.insertBefore(r,n==="title"?i.querySelector("head > title"):null)}function Sx(i,n,r){if(r===1||n.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(i=n.disabled,typeof n.precedence=="string"&&i==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function jy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function wx(i,n,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=Ia(l.href),d=n.querySelector($l(u));if(d){n=d._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(i.count++,i=Gc.bind(i),n.then(i,i)),r.state.loading|=4,r.instance=d,Kt(d);return}d=n.ownerDocument||n,l=Ly(l),(u=An.get(u))&&af(l,u),d=d.createElement("link"),Kt(d);var _=d;_._p=new Promise(function(w,R){_.onload=w,_.onerror=R}),zi(d,"link",l),r.instance=d}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(i.count++,r=Gc.bind(i),n.addEventListener("load",r),n.addEventListener("error",r))}}var of=0;function Cx(i,n){return i.stylesheets&&i.count===0&&Qc(i,i.stylesheets),0<i.count||0<i.imgCount?function(r){var l=setTimeout(function(){if(i.stylesheets&&Qc(i,i.stylesheets),i.unsuspend){var d=i.unsuspend;i.unsuspend=null,d()}},6e4+n);0<i.imgBytes&&of===0&&(of=62500*nx());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Qc(i,i.stylesheets),i.unsuspend)){var d=i.unsuspend;i.unsuspend=null,d()}},(i.imgBytes>of?50:800)+n);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Gc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Zc=null;function Qc(i,n){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Zc=new Map,n.forEach(xx,i),Zc=null,Gc.call(i))}function xx(i,n){if(!(n.state.loading&4)){var r=Zc.get(i);if(r)var l=r.get(null);else{r=new Map,Zc.set(i,r);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var _=u[d];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(r.set(_.dataset.precedence,_),l=_)}l&&r.set(null,l)}u=n.instance,_=u.getAttribute("data-precedence"),d=r.get(_)||l,d===l&&r.set(null,u),r.set(_,u),this.count++,l=Gc.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)),n.state.loading|=4}}var Vl={$$typeof:U,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function Ex(i,n,r,l,u,d,_,w,R){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=ui(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ui(0),this.hiddenUpdates=ui(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Hy(i,n,r,l,u,d,_,w,R,Y,re,ue){return i=new Ex(i,n,r,_,R,Y,re,ue,w),n=1,d===!0&&(n|=24),d=dn(3,null,null,n),i.current=d,d.stateNode=i,n=Ph(),n.refCount++,i.pooledCache=n,n.refCount++,d.memoizedState={element:l,isDehydrated:r,cache:n},qh(d),i}function Uy(i){return i?(i=ya,i):ya}function Py(i,n,r,l,u,d){u=Uy(u),l.context===null?l.context=u:l.pendingContext=u,l=Ks(n),l.payload={element:r},d=d===void 0?null:d,d!==null&&(l.callback=d),r=Fs(i,l,n),r!==null&&(rn(r,i,n),Tl(r,i,n))}function Iy(i,n){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<n?r:n}}function cf(i,n){Iy(i,n),(i=i.alternate)&&Iy(i,n)}function Ky(i){if(i.tag===13||i.tag===31){var n=Tr(i,67108864);n!==null&&rn(n,i,67108864),cf(i,67108864)}}function Fy(i){if(i.tag===13||i.tag===31){var n=_n();n=ut(n);var r=Tr(i,n);r!==null&&rn(r,i,n),cf(i,n)}}var Jc=!0;function Tx(i,n,r,l){var u=M.T;M.T=null;var d=X.p;try{X.p=2,uf(i,n,r,l)}finally{X.p=d,M.T=u}}function kx(i,n,r,l){var u=M.T;M.T=null;var d=X.p;try{X.p=8,uf(i,n,r,l)}finally{X.p=d,M.T=u}}function uf(i,n,r,l){if(Jc){var u=hf(l);if(u===null)Xd(i,n,l,eu,r),Wy(i,l);else if(Rx(u,i,n,r,l))l.stopPropagation();else if(Wy(i,l),n&4&&-1<Dx.indexOf(i)){for(;u!==null;){var d=Wi(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var _=Et(d.pendingLanes);if(_!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;_;){var R=1<<31-Ht(_);w.entanglements[1]|=R,_&=~R}Jn(d),(ot&6)===0&&(zc=lt()+500,Kl(0))}}break;case 31:case 13:w=Tr(d,2),w!==null&&rn(w,d,2),Hc(),cf(d,2)}if(d=hf(l),d===null&&Xd(i,n,l,eu,r),d===u)break;u=d}u!==null&&l.stopPropagation()}else Xd(i,n,l,null,r)}}function hf(i){return i=da(i),df(i)}var eu=null;function df(i){if(eu=null,i=Lt(i),i!==null){var n=c(i);if(n===null)i=null;else{var r=n.tag;if(r===13){if(i=h(n),i!==null)return i;i=null}else if(r===31){if(i=f(n),i!==null)return i;i=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;i=null}else n!==i&&(i=null)}}return eu=i,null}function qy(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(li()){case Zi:return 2;case _i:return 8;case jt:case Ui:return 32;case vi:return 268435456;default:return 32}default:return 32}}var ff=!1,er=null,tr=null,ir=null,Xl=new Map,Gl=new Map,nr=[],Dx="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 Wy(i,n){switch(i){case"focusin":case"focusout":er=null;break;case"dragenter":case"dragleave":tr=null;break;case"mouseover":case"mouseout":ir=null;break;case"pointerover":case"pointerout":Xl.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gl.delete(n.pointerId)}}function Zl(i,n,r,l,u,d){return i===null||i.nativeEvent!==d?(i={blockedOn:n,domEventName:r,eventSystemFlags:l,nativeEvent:d,targetContainers:[u]},n!==null&&(n=Wi(n),n!==null&&Ky(n)),i):(i.eventSystemFlags|=l,n=i.targetContainers,u!==null&&n.indexOf(u)===-1&&n.push(u),i)}function Rx(i,n,r,l,u){switch(n){case"focusin":return er=Zl(er,i,n,r,l,u),!0;case"dragenter":return tr=Zl(tr,i,n,r,l,u),!0;case"mouseover":return ir=Zl(ir,i,n,r,l,u),!0;case"pointerover":var d=u.pointerId;return Xl.set(d,Zl(Xl.get(d)||null,i,n,r,l,u)),!0;case"gotpointercapture":return d=u.pointerId,Gl.set(d,Zl(Gl.get(d)||null,i,n,r,l,u)),!0}return!1}function $y(i){var n=Lt(i.target);if(n!==null){var r=c(n);if(r!==null){if(n=r.tag,n===13){if(n=h(r),n!==null){i.blockedOn=n,dt(i.priority,function(){Fy(r)});return}}else if(n===31){if(n=f(r),n!==null){i.blockedOn=n,dt(i.priority,function(){Fy(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){i.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}i.blockedOn=null}function tu(i){if(i.blockedOn!==null)return!1;for(var n=i.targetContainers;0<n.length;){var r=hf(i.nativeEvent);if(r===null){r=i.nativeEvent;var l=new r.constructor(r.type,r);ha=l,r.target.dispatchEvent(l),ha=null}else return n=Wi(r),n!==null&&Ky(n),i.blockedOn=r,!1;n.shift()}return!0}function Yy(i,n,r){tu(i)&&r.delete(n)}function Mx(){ff=!1,er!==null&&tu(er)&&(er=null),tr!==null&&tu(tr)&&(tr=null),ir!==null&&tu(ir)&&(ir=null),Xl.forEach(Yy),Gl.forEach(Yy)}function iu(i,n){i.blockedOn===n&&(i.blockedOn=null,ff||(ff=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Mx)))}var nu=null;function Vy(i){nu!==i&&(nu=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){nu===i&&(nu=null);for(var n=0;n<i.length;n+=3){var r=i[n],l=i[n+1],u=i[n+2];if(typeof l!="function"){if(df(l||r)===null)continue;break}var d=Wi(r);d!==null&&(i.splice(n,3),n-=3,ud(d,{pending:!0,data:u,method:r.method,action:l},l,u))}}))}function Fa(i){function n(R){return iu(R,i)}er!==null&&iu(er,i),tr!==null&&iu(tr,i),ir!==null&&iu(ir,i),Xl.forEach(n),Gl.forEach(n);for(var r=0;r<nr.length;r++){var l=nr[r];l.blockedOn===i&&(l.blockedOn=null)}for(;0<nr.length&&(r=nr[0],r.blockedOn===null);)$y(r),r.blockedOn===null&&nr.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],_=u[It]||null;if(typeof d=="function")_||Vy(r);else if(_){var w=null;if(d&&d.hasAttribute("formAction")){if(u=d,_=d[It]||null)w=_.formAction;else if(df(u)!==null)continue}else w=_.action;typeof w=="function"?r[l+1]=w:(r.splice(l,3),l-=3),Vy(r)}}}function Xy(){function i(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(_){return u=_})},focusReset:"manual",scroll:"manual"})}function n(){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",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function pf(i){this._internalRoot=i}su.prototype.render=pf.prototype.render=function(i){var n=this._internalRoot;if(n===null)throw Error(a(409));var r=n.current,l=_n();Py(r,l,i,n,null,null)},su.prototype.unmount=pf.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var n=i.containerInfo;Py(i.current,2,null,i,null,null),Hc(),n[Mt]=null}};function su(i){this._internalRoot=i}su.prototype.unstable_scheduleHydration=function(i){if(i){var n=yi();i={blockedOn:null,target:i,priority:n};for(var r=0;r<nr.length&&n!==0&&n<nr[r].priority;r++);nr.splice(r,0,i),r===0&&$y(i)}};var Gy=t.version;if(Gy!=="19.2.6")throw Error(a(527,Gy,"19.2.6"));X.findDOMNode=function(i){var n=i._reactInternals;if(n===void 0)throw typeof i.render=="function"?Error(a(188)):(i=Object.keys(i).join(","),Error(a(268,i)));return i=p(n),i=i!==null?b(i):null,i=i===null?null:i.stateNode,i};var Nx={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ru=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ru.isDisabled&&ru.supportsFiber)try{et=ru.inject(Nx),ct=ru}catch{}}return Jl.createRoot=function(i,n){if(!o(i))throw Error(a(299));var r=!1,l="",u=nv,d=sv,_=rv;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(d=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=Hy(i,1,!1,null,null,r,l,null,u,d,_,Xy),i[Mt]=n.current,Vd(i),new pf(n)},Jl.hydrateRoot=function(i,n,r){if(!o(i))throw Error(a(299));var l=!1,u="",d=nv,_=sv,w=rv,R=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&&(_=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError),r.formState!==void 0&&(R=r.formState)),n=Hy(i,1,!0,n,r??null,l,u,R,d,_,w,Xy),n.context=Uy(null),r=n.current,l=_n(),l=ut(l),u=Ks(l),u.callback=null,Fs(r,u,l),r=l,n.current.lanes=r,Ni(n,r),Jn(n),i[Mt]=n.current,Vd(i),new su(n)},Jl.version="19.2.6",Jl}var ab;function Ix(){if(ab)return _f.exports;ab=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(),_f.exports=Px(),_f.exports}var Kx=Ix();class Ns extends Error{constructor(t,s){super(s),this.status=t,this.name="ApiError"}status}function Vu(e=fetch){return{getSession:(t={})=>Me(e,`/api/auth/session${bo(t)}`),setupPassword:t=>Me(e,"/api/auth/password",Je("POST",t)),login:t=>Me(e,"/api/auth/login",Je("POST",t)),reauth:t=>Me(e,"/api/auth/reauth",Je("POST",t)),logout:()=>Me(e,"/api/auth/logout",{method:"POST",credentials:"same-origin"}),sendClientDiagnostics:t=>Me(e,"/api/client-diagnostics",Je("POST",t)),setupTotp:()=>Me(e,"/api/auth/totp/setup",{method:"POST",credentials:"same-origin"}),activateTotp:t=>Me(e,"/api/auth/totp/activate",Je("POST",t)),disableTotp:()=>Me(e,"/api/auth/totp",{method:"DELETE",credentials:"same-origin"}),listDevices:()=>Me(e,"/api/auth/devices"),revokeDevice:async t=>{await Ya(e,`/api/auth/devices/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listNetworks:()=>Me(e,"/api/auth/networks"),addNetwork:t=>Me(e,"/api/auth/networks",Je("POST",t)),removeNetwork:async t=>{await Ya(e,`/api/auth/networks/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listAgents:()=>Me(e,"/api/agents"),addAgent:t=>Me(e,"/api/agents",Je("POST",t)),reorderAgents:t=>Me(e,"/api/agents/order",Je("PUT",{serverIds:t})),renameAgent:(t,s)=>Me(e,`/api/agents/${encodeURIComponent(t)}`,Je("PATCH",{name:s})),getMainInfo:()=>Me(e,"/api/main"),renameMain:t=>Me(e,"/api/main",Je("PATCH",{name:t})),removeAgent:async t=>{await Ya(e,`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},uninstallAgent:t=>Me(e,`/api/agents/${encodeURIComponent(t)}/uninstall`,{method:"POST",credentials:"same-origin"}),pingAgent:t=>Me(e,`/api/agents/${encodeURIComponent(t)}/ping`),getMainStats:()=>Me(e,"/api/stats"),getAgentStats:t=>Me(e,`/api/agents/${encodeURIComponent(t)}/stats`),getVersion:()=>Me(e,"/api/version"),checkUpdate:()=>Me(e,"/api/update/check",{method:"POST",credentials:"same-origin"}),runUpdate:()=>Me(e,"/api/update",{method:"POST",credentials:"same-origin"}),getAgentVersion:t=>Me(e,`/api/agents/${encodeURIComponent(t)}/version`),checkAgentUpdate:t=>Me(e,`/api/agents/${encodeURIComponent(t)}/update/check`,{method:"POST",credentials:"same-origin"}),runAgentUpdate:t=>Me(e,`/api/agents/${encodeURIComponent(t)}/update`,{method:"POST",credentials:"same-origin"}),listTerminals:()=>Me(e,"/api/terminals"),getTerminalLayout:()=>Me(e,"/api/terminal-layout"),saveTerminalLayout:t=>Me(e,"/api/terminal-layout",Je("PUT",t)),createFileRoot:t=>Me(e,"/api/files/root",Je("POST",t)),listFiles:t=>Me(e,"/api/files/list",Je("POST",t)),readFile:t=>Me(e,"/api/files/read",Je("POST",t)),writeFile:t=>Me(e,"/api/files/write",Je("POST",t)),createFileEntry:t=>Me(e,"/api/files/create",Je("POST",t)),moveFileEntry:t=>Me(e,"/api/files/move",Je("POST",t)),previewDeleteFileEntry:t=>Me(e,"/api/files/delete-preview",Je("POST",t)),deleteFileEntry:t=>Me(e,"/api/files/delete",Je("POST",t)),openFileInTerminal:t=>Me(e,"/api/files/open",Je("POST",t)),previewFile:t=>l0(e,"/api/files/preview",Je("POST",t)),createTerminal:(t={})=>Me(e,"/api/terminals",Je("POST",t)),closeTerminal:async t=>{await Ya(e,`/api/terminals/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},renameTerminal:(t,s)=>Me(e,`/api/terminals/${encodeURIComponent(t)}`,Je("PATCH",{title:s})),getTerminalHistory:(t,s={})=>Me(e,`/api/terminals/${encodeURIComponent(t)}/history${bo(s)}`),getTerminalTranscriptHistory:(t,s={})=>Me(e,`/api/terminals/${encodeURIComponent(t)}/transcript-history${bo(s)}`),getTerminalTranscriptSource:t=>Me(e,`/api/terminals/${encodeURIComponent(t)}/transcript-source`),listNotificationAssets:()=>Me(e,"/api/notification-assets"),uploadNotificationAsset:t=>{const s=new FormData;return s.append("asset",t),Me(e,"/api/notification-assets",{method:"POST",credentials:"same-origin",body:s})},updateNotificationAssetSelection:t=>Me(e,"/api/notification-assets/selection",Je("PUT",t)),deleteNotificationAsset:async t=>{await Ya(e,`/api/notification-assets/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})}}}function Do(e,t=fetch){const s=a=>e?`/api/agents/${encodeURIComponent(e)}/${a}`:`/api/${a}`;return{isAgent:e!==null,listTerminals:()=>Me(t,s("terminals")),createTerminal:(a={})=>Me(t,s("terminals"),Je("POST",a)),closeTerminal:async a=>{await Ya(t,s(`terminals/${encodeURIComponent(a)}`),{method:"DELETE",credentials:"same-origin"})},renameTerminal:(a,o)=>Me(t,s(`terminals/${encodeURIComponent(a)}`),Je("PATCH",{title:o})),getTerminalHistory:(a,o={})=>Me(t,`${s(`terminals/${encodeURIComponent(a)}/history`)}${bo(o)}`),getTerminalTranscriptHistory:(a,o={})=>Me(t,`${s(`terminals/${encodeURIComponent(a)}/transcript-history`)}${bo(o)}`),getTerminalTranscriptSource:a=>Me(t,s(`terminals/${encodeURIComponent(a)}/transcript-source`)),getTerminalLayout:()=>Me(t,s("terminal-layout")),saveTerminalLayout:a=>Me(t,s("terminal-layout"),Je("PUT",a)),createFileRoot:a=>Me(t,s("files/root"),Je("POST",a)),listFiles:a=>Me(t,s("files/list"),Je("POST",a)),readFile:a=>Me(t,s("files/read"),Je("POST",a)),writeFile:a=>Me(t,s("files/write"),Je("POST",a)),createFileEntry:a=>Me(t,s("files/create"),Je("POST",a)),moveFileEntry:a=>Me(t,s("files/move"),Je("POST",a)),previewDeleteFileEntry:a=>Me(t,s("files/delete-preview"),Je("POST",a)),deleteFileEntry:a=>Me(t,s("files/delete"),Je("POST",a)),openFileInTerminal:a=>Me(t,s("files/open"),Je("POST",a)),previewFile:a=>l0(t,s("files/preview"),Je("POST",a)),createWebSocketUrl:(a,o=window.location.href)=>Fx(s(`terminals/${encodeURIComponent(a)}/ws`),o)}}function Fx(e,t){const s=new URL(t);return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.pathname=e,s.search="",s.hash="",s.toString()}function Je(e,t){return{method:e,headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)}}function bo(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.maxLines!==void 0&&t.set("maxLines",String(e.maxLines)),e.includeTools!==void 0&&t.set("includeTools",e.includeTools?"true":"false"),e.invalidationSource!==void 0&&t.set("invalidationSource",e.invalidationSource);const s=t.toString();return s?`?${s}`:""}async function Me(e,t,s){const a=await e(t,s??{credentials:"same-origin"});await Dm(a);try{return await a.json()}catch{throw new Ns(a.status,"invalid_json_response")}}async function Ya(e,t,s){const a=await e(t,s);await Dm(a)}async function l0(e,t,s){const a=await e(t,s);return await Dm(a),a.blob()}async function Dm(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const s=await e.json(),a=typeof s.error=="string"?s.error:s.message;typeof a=="string"&&a.trim()&&(t=a)}catch{}throw new Ns(e.status,t)}const Rm="nterminal.theme.id",o0="nterminal.theme.accent",Jf="nterminal:theme",Mu=[{id:"midnight",label:"Midnight",description:"Current dark terminal look with aqua focus.",mode:"dark",tokens:{bg:"#0a0d10",bg2:"#0d1216",bgSidebar:"#08090b",line:"#1a2128",line2:"#2a3340",fg:"#e2e8ee",fg2:"#8896a3",fg3:"#54616d",fg4:"#3f4a54",accent:"#5eead4",accentSoft:"rgba(94, 234, 212, 0.10)",accentGlow:"rgba(94, 234, 212, 0.55)",onAccent:"#062423",ok:"#34d399",danger:"#f87171",onDanger:"#190607",dangerSoft:"rgba(248, 113, 113, 0.08)",dangerLine:"rgba(248, 113, 113, 0.30)",warning:"#fbbf24",warningSoft:"rgba(247, 217, 119, 0.075)",warningGlow:"rgba(245, 158, 11, 0.55)",scrim:"rgba(0, 0, 0, 0.55)",scrimSoft:"rgba(0, 0, 0, 0.28)",shadow:"rgba(0, 0, 0, 0.35)",shadowStrong:"rgba(0, 0, 0, 0.50)",floatingBg:"rgba(10, 13, 16, 0.86)",floatingBgStrong:"rgba(10, 13, 16, 0.96)",floatingBgHover:"rgba(15, 23, 27, 0.94)",subtleFill:"rgba(255, 255, 255, 0.018)",hoverFill:"rgba(255, 255, 255, 0.015)",scrollbarThumb:"rgba(148, 163, 184, 0.50)",scrollbarThumbHover:"rgba(148, 163, 184, 0.70)",transcriptUser:"#f7d977",transcriptAssistant:"#5eead4",transcriptTool:"#9aa7b4",transcriptCommand:"#8fd6ff",transcriptCode:"#c4f1ff",transcriptSearch:"#f7d977",transcriptOnSearch:"#121417",qrBg:"#ffffff"},xterm:{background:"#0a0d10",foreground:"#e2e8ee",cursor:"#5eead4",selectionBackground:"#1f3f45"}},{id:"daylight",label:"Daylight",description:"Light workspace with dark terminal contrast.",mode:"light",tokens:{bg:"#f7f9fc",bg2:"#ffffff",bgSidebar:"#eef2f7",line:"#dbe3ec",line2:"#c3cedb",fg:"#17212b",fg2:"#526170",fg3:"#7b8794",fg4:"#a1acb8",accent:"#0f8f83",accentSoft:"rgba(15, 143, 131, 0.11)",accentGlow:"rgba(15, 143, 131, 0.24)",onAccent:"#021918",ok:"#16835c",danger:"#c03545",onDanger:"#fff7f8",dangerSoft:"rgba(192, 53, 69, 0.10)",dangerLine:"rgba(192, 53, 69, 0.30)",warning:"#b7791f",warningSoft:"rgba(183, 121, 31, 0.12)",warningGlow:"rgba(183, 121, 31, 0.26)",scrim:"rgba(15, 23, 42, 0.34)",scrimSoft:"rgba(15, 23, 42, 0.20)",shadow:"rgba(15, 23, 42, 0.18)",shadowStrong:"rgba(15, 23, 42, 0.28)",floatingBg:"rgba(255, 255, 255, 0.92)",floatingBgStrong:"rgba(255, 255, 255, 0.98)",floatingBgHover:"rgba(239, 246, 249, 0.96)",subtleFill:"rgba(15, 23, 42, 0.025)",hoverFill:"rgba(15, 23, 42, 0.035)",scrollbarThumb:"rgba(82, 97, 112, 0.38)",scrollbarThumbHover:"rgba(82, 97, 112, 0.58)",transcriptUser:"#8b3f75",transcriptAssistant:"#0f8f83",transcriptTool:"#66717d",transcriptCommand:"#0b6fa4",transcriptCode:"#075985",transcriptSearch:"#f0c14b",transcriptOnSearch:"#1f1a10",qrBg:"#ffffff"},xterm:{background:"#ffffff",foreground:"#17212b",cursor:"#0f8f83",selectionBackground:"#cdeee9",...lb({foreground:"#17212b",foregroundMuted:"#526170",line:"#dbe3ec",red:"#b4232f",green:"#16794f",yellow:"#9a6700",blue:"#0b6fa4",magenta:"#8f3f85",cyan:"#0f766e"})}},{id:"signal-red",label:"Signal",description:"Dark control-room surface with red alerts.",mode:"dark",tokens:{bg:"#100d0f",bg2:"#171113",bgSidebar:"#0b080a",line:"#2a1b20",line2:"#452b32",fg:"#f1e7e9",fg2:"#a58d93",fg3:"#765f66",fg4:"#55434a",accent:"#ff2a3d",accentSoft:"rgba(255, 42, 61, 0.12)",accentGlow:"rgba(255, 42, 61, 0.52)",onAccent:"#210407",ok:"#34d399",danger:"#ff4d5f",onDanger:"#210407",dangerSoft:"rgba(255, 77, 95, 0.10)",dangerLine:"rgba(255, 77, 95, 0.32)",warning:"#fbbf24",warningSoft:"rgba(251, 191, 36, 0.10)",warningGlow:"rgba(245, 158, 11, 0.50)",scrim:"rgba(0, 0, 0, 0.58)",scrimSoft:"rgba(0, 0, 0, 0.30)",shadow:"rgba(0, 0, 0, 0.36)",shadowStrong:"rgba(0, 0, 0, 0.52)",floatingBg:"rgba(16, 13, 15, 0.88)",floatingBgStrong:"rgba(16, 13, 15, 0.96)",floatingBgHover:"rgba(25, 16, 19, 0.96)",subtleFill:"rgba(255, 255, 255, 0.018)",hoverFill:"rgba(255, 255, 255, 0.018)",scrollbarThumb:"rgba(165, 141, 147, 0.45)",scrollbarThumbHover:"rgba(165, 141, 147, 0.65)",transcriptUser:"#f8d36f",transcriptAssistant:"#ff2a3d",transcriptTool:"#ad9ca2",transcriptCommand:"#ff9ca6",transcriptCode:"#ffd1d6",transcriptSearch:"#f8d36f",transcriptOnSearch:"#1b0e10",qrBg:"#ffffff"},xterm:{background:"#100d0f",foreground:"#f1e7e9",cursor:"#ff2a3d",selectionBackground:"#4a1b22"}},{id:"graphite",label:"Graphite",description:"Neutral dark theme with blue command focus.",mode:"dark",tokens:{bg:"#101214",bg2:"#171a1d",bgSidebar:"#0c0e10",line:"#262b30",line2:"#39414a",fg:"#eceff3",fg2:"#9aa4af",fg3:"#6c7680",fg4:"#4d5660",accent:"#7dd3fc",accentSoft:"rgba(125, 211, 252, 0.11)",accentGlow:"rgba(125, 211, 252, 0.38)",onAccent:"#071c26",ok:"#4ade80",danger:"#fb7185",onDanger:"#26070d",dangerSoft:"rgba(251, 113, 133, 0.09)",dangerLine:"rgba(251, 113, 133, 0.30)",warning:"#facc15",warningSoft:"rgba(250, 204, 21, 0.09)",warningGlow:"rgba(250, 204, 21, 0.42)",scrim:"rgba(0, 0, 0, 0.55)",scrimSoft:"rgba(0, 0, 0, 0.28)",shadow:"rgba(0, 0, 0, 0.34)",shadowStrong:"rgba(0, 0, 0, 0.50)",floatingBg:"rgba(16, 18, 20, 0.88)",floatingBgStrong:"rgba(16, 18, 20, 0.96)",floatingBgHover:"rgba(22, 28, 33, 0.96)",subtleFill:"rgba(255, 255, 255, 0.018)",hoverFill:"rgba(255, 255, 255, 0.018)",scrollbarThumb:"rgba(154, 164, 175, 0.45)",scrollbarThumbHover:"rgba(154, 164, 175, 0.65)",transcriptUser:"#f2d675",transcriptAssistant:"#7dd3fc",transcriptTool:"#aab4bf",transcriptCommand:"#8fd6ff",transcriptCode:"#c4f1ff",transcriptSearch:"#f2d675",transcriptOnSearch:"#141513",qrBg:"#ffffff"},xterm:{background:"#101214",foreground:"#eceff3",cursor:"#7dd3fc",selectionBackground:"#263d4b"}},{id:"paper",label:"Paper",description:"Warm light surface with restrained amber accent.",mode:"light",tokens:{bg:"#fbfaf7",bg2:"#ffffff",bgSidebar:"#f2f0ea",line:"#e2ddd4",line2:"#cbc3b6",fg:"#25211d",fg2:"#62584e",fg3:"#8d8275",fg4:"#afa69b",accent:"#a35d00",accentSoft:"rgba(163, 93, 0, 0.11)",accentGlow:"rgba(163, 93, 0, 0.24)",onAccent:"#fffaf2",ok:"#26744d",danger:"#b23a48",onDanger:"#fff8f8",dangerSoft:"rgba(178, 58, 72, 0.10)",dangerLine:"rgba(178, 58, 72, 0.30)",warning:"#a35d00",warningSoft:"rgba(163, 93, 0, 0.12)",warningGlow:"rgba(163, 93, 0, 0.26)",scrim:"rgba(37, 33, 29, 0.32)",scrimSoft:"rgba(37, 33, 29, 0.18)",shadow:"rgba(37, 33, 29, 0.18)",shadowStrong:"rgba(37, 33, 29, 0.28)",floatingBg:"rgba(255, 253, 249, 0.92)",floatingBgStrong:"rgba(255, 253, 249, 0.98)",floatingBgHover:"rgba(250, 247, 240, 0.96)",subtleFill:"rgba(37, 33, 29, 0.025)",hoverFill:"rgba(37, 33, 29, 0.035)",scrollbarThumb:"rgba(98, 88, 78, 0.35)",scrollbarThumbHover:"rgba(98, 88, 78, 0.55)",transcriptUser:"#7b3f8c",transcriptAssistant:"#a35d00",transcriptTool:"#776d63",transcriptCommand:"#176a94",transcriptCode:"#6f4b00",transcriptSearch:"#e9c46a",transcriptOnSearch:"#241b0a",qrBg:"#ffffff"},xterm:{background:"#fffdf9",foreground:"#25211d",cursor:"#a35d00",selectionBackground:"#f2dfc5",...lb({foreground:"#25211d",foregroundMuted:"#62584e",line:"#e2ddd4",red:"#a8323d",green:"#26744d",yellow:"#875600",blue:"#176a94",magenta:"#8b4b80",cyan:"#276f68"})}}],el="midnight";function Xu(e){return Mu.some(t=>t.id===e)?e:el}function Mm(e){return Mu.find(t=>t.id===e)??Mu[0]}function mr(){if(typeof window>"u")return el;try{const e=window.localStorage.getItem(Rm);return e?Xu(e):Vx(window.localStorage.getItem(o0))}catch{return el}}function qx(e){const t=Xu(e);if(typeof window<"u"){try{window.localStorage.setItem(Rm,t)}catch{}Nm(t),window.dispatchEvent(new CustomEvent(Jf,{detail:t}))}return t}function Nm(e=mr()){if(typeof document>"u")return;const t=Mm(Xu(e)),s=document.documentElement;s.dataset.ntTheme=t.id,s.style.setProperty("color-scheme",t.mode),Ye(s,"--nt-bg",t.tokens.bg),Ye(s,"--nt-bg-2",t.tokens.bg2),Ye(s,"--nt-bg-sidebar",t.tokens.bgSidebar),Ye(s,"--nt-line",t.tokens.line),Ye(s,"--nt-line-2",t.tokens.line2),Ye(s,"--nt-fg",t.tokens.fg),Ye(s,"--nt-fg-2",t.tokens.fg2),Ye(s,"--nt-fg-3",t.tokens.fg3),Ye(s,"--nt-fg-4",t.tokens.fg4),Ye(s,"--nt-accent",t.tokens.accent),Ye(s,"--nt-accent-soft",t.tokens.accentSoft),Ye(s,"--nt-accent-glow",t.tokens.accentGlow),Ye(s,"--nt-on-accent",t.tokens.onAccent),Ye(s,"--nt-ok",t.tokens.ok),Ye(s,"--nt-danger",t.tokens.danger),Ye(s,"--nt-on-danger",t.tokens.onDanger),Ye(s,"--nt-danger-soft",t.tokens.dangerSoft),Ye(s,"--nt-danger-line",t.tokens.dangerLine),Ye(s,"--nt-warning",t.tokens.warning),Ye(s,"--nt-warn",t.tokens.warning),Ye(s,"--nt-warning-soft",t.tokens.warningSoft),Ye(s,"--nt-warning-glow",t.tokens.warningGlow),Ye(s,"--nt-scrim",t.tokens.scrim),Ye(s,"--nt-scrim-soft",t.tokens.scrimSoft),Ye(s,"--nt-shadow",t.tokens.shadow),Ye(s,"--nt-shadow-strong",t.tokens.shadowStrong),Ye(s,"--nt-floating-bg",t.tokens.floatingBg),Ye(s,"--nt-floating-bg-strong",t.tokens.floatingBgStrong),Ye(s,"--nt-floating-bg-hover",t.tokens.floatingBgHover),Ye(s,"--nt-subtle-fill",t.tokens.subtleFill),Ye(s,"--nt-hover-fill",t.tokens.hoverFill),Ye(s,"--nt-scrollbar-thumb",t.tokens.scrollbarThumb),Ye(s,"--nt-scrollbar-thumb-hover",t.tokens.scrollbarThumbHover),Ye(s,"--nt-transcript-user",t.tokens.transcriptUser),Ye(s,"--nt-transcript-assistant",t.tokens.transcriptAssistant),Ye(s,"--nt-transcript-tool",t.tokens.transcriptTool),Ye(s,"--nt-transcript-command",t.tokens.transcriptCommand),Ye(s,"--nt-transcript-code",t.tokens.transcriptCode),Ye(s,"--nt-transcript-search",t.tokens.transcriptSearch),Ye(s,"--nt-transcript-on-search",t.tokens.transcriptOnSearch),Ye(s,"--nt-qr-bg",t.tokens.qrBg)}function Wx(e=mr()){return Mm(Xu(e)).xterm}function Am(e){if(typeof window>"u")return()=>{};const t=s=>{(s.key===Rm||s.key===o0)&&(Nm(mr()),e())};return window.addEventListener(Jf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Jf,e),window.removeEventListener("storage",t)}}function Ye(e,t,s){e.style.setProperty(t,s)}function lb(e){const t=$x(237);return t[215]=e.foreground,t[221]=e.line,{black:e.foreground,red:e.red,green:e.green,yellow:e.yellow,blue:e.blue,magenta:e.magenta,cyan:e.cyan,white:e.foregroundMuted,brightBlack:e.foregroundMuted,brightRed:e.red,brightGreen:e.green,brightYellow:e.yellow,brightBlue:e.blue,brightMagenta:e.magenta,brightCyan:e.cyan,brightWhite:e.foreground,extendedAnsi:t}}function $x(e){const t=[];for(let s=16;s<=e;s+=1)t.push(Yx(s));return t}function Yx(e){if(e>=16&&e<=231){const t=e-16,s=[0,95,135,175,215,255],a=s[Math.floor(t/36)%6],o=s[Math.floor(t/6)%6],c=s[t%6];return ob(a,o,c)}if(e>=232&&e<=255){const t=8+(e-232)*10;return ob(t,t,t)}return"#000000"}function ob(e,t,s){return`#${Sf(e)}${Sf(t)}${Sf(s)}`}function Sf(e){return e.toString(16).padStart(2,"0")}function Vx(e){return e==="signal-red"?"signal-red":el}function c0(){const e=v.useSyncExternalStore(Am,mr,()=>el);return Mm(e).mode==="light"?"-light":""}function u0({size:e=22}){const t=c0();return m.jsx("img",{className:"nterminal-mark",src:`/brand/nterminal-mark${t}.svg`,width:e,height:e,alt:"","aria-hidden":"true"})}function h0({height:e=18}){const t=c0(),s=Math.round(243/34*e);return m.jsx("img",{className:"nterminal-wordmark",src:`/brand/nterminal-wordmark${t}.svg`,width:s,height:e,alt:"NTerminal"})}var ho=a0();const Gu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function sl(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Lm(e){return"nodeType"in e}function ln(e){var t,s;return e?sl(e)?e:Lm(e)&&(t=(s=e.ownerDocument)==null?void 0:s.defaultView)!=null?t:window:window}function Bm(e){const{Document:t}=ln(e);return e instanceof t}function Io(e){return sl(e)?!1:e instanceof ln(e).HTMLElement}function d0(e){return e instanceof ln(e).SVGElement}function rl(e){return e?sl(e)?e.document:Lm(e)?Bm(e)?e:Io(e)||d0(e)?e.ownerDocument:document:document:document}const gr=Gu?v.useLayoutEffect:v.useEffect;function Om(e){const t=v.useRef(e);return gr(()=>{t.current=e}),v.useCallback(function(){for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];return t.current==null?void 0:t.current(...a)},[])}function Xx(){const e=v.useRef(null),t=v.useCallback((a,o)=>{e.current=setInterval(a,o)},[]),s=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,s]}function Ro(e,t){t===void 0&&(t=[e]);const s=v.useRef(e);return gr(()=>{s.current!==e&&(s.current=e)},t),s}function Ko(e,t){const s=v.useRef();return v.useMemo(()=>{const a=e(s.current);return s.current=a,a},[...t])}function Nu(e){const t=Om(e),s=v.useRef(null),a=v.useCallback(o=>{o!==s.current&&t?.(o,s.current),s.current=o},[]);return[s,a]}function ep(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let wf={};function Zu(e,t){return v.useMemo(()=>{if(t)return t;const s=wf[e]==null?0:wf[e]+1;return wf[e]=s,e+"-"+s},[e,t])}function f0(e){return function(t){for(var s=arguments.length,a=new Array(s>1?s-1:0),o=1;o<s;o++)a[o-1]=arguments[o];return a.reduce((c,h)=>{const f=Object.entries(h);for(const[g,p]of f){const b=c[g];b!=null&&(c[g]=b+e*p)}return c},{...t})}}const Qa=f0(1),Au=f0(-1);function Gx(e){return"clientX"in e&&"clientY"in e}function p0(e){if(!e)return!1;const{KeyboardEvent:t}=ln(e.target);return t&&e instanceof t}function Zx(e){if(!e)return!1;const{TouchEvent:t}=ln(e.target);return t&&e instanceof t}function tp(e){if(Zx(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:s}=e.touches[0];return{x:t,y:s}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:s}=e.changedTouches[0];return{x:t,y:s}}}return Gx(e)?{x:e.clientX,y:e.clientY}:null}const ip=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:s}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:s}=e;return"scaleX("+t+") scaleY("+s+")"}},Transform:{toString(e){if(e)return[ip.Translate.toString(e),ip.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:s,easing:a}=e;return t+" "+s+"ms "+a}}}),cb="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qx(e){return e.matches(cb)?e:e.querySelector(cb)}const Jx={display:"none"};function e2(e){let{id:t,value:s}=e;return mi.createElement("div",{id:t,style:Jx},s)}function t2(e){let{id:t,announcement:s,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 mi.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":!0},s)}function i2(){const[e,t]=v.useState("");return{announce:v.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const m0=v.createContext(null);function n2(e){const t=v.useContext(m0);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function s2(){const[e]=v.useState(()=>new Set),t=v.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[v.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 r2={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
|
-
`},a2={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was moved over droppable area "+s.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:s}=e;return s?"Draggable item "+t.id+" was dropped over droppable area "+s.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function l2(e){let{announcements:t=a2,container:s,hiddenTextDescribedById:a,screenReaderInstructions:o=r2}=e;const{announce:c,announcement:h}=i2(),f=Zu("DndLiveRegion"),[g,p]=v.useState(!1);if(v.useEffect(()=>{p(!0)},[]),n2(v.useMemo(()=>({onDragStart(y){let{active:S}=y;c(t.onDragStart({active:S}))},onDragMove(y){let{active:S,over:C}=y;t.onDragMove&&c(t.onDragMove({active:S,over:C}))},onDragOver(y){let{active:S,over:C}=y;c(t.onDragOver({active:S,over:C}))},onDragEnd(y){let{active:S,over:C}=y;c(t.onDragEnd({active:S,over:C}))},onDragCancel(y){let{active:S,over:C}=y;c(t.onDragCancel({active:S,over:C}))}}),[c,t])),!g)return null;const b=mi.createElement(mi.Fragment,null,mi.createElement(e2,{id:a,value:o.draggable}),mi.createElement(t2,{id:f,announcement:h}));return s?ho.createPortal(b,s):b}var pi;(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"})(pi||(pi={}));function Lu(){}function ub(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function o2(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return v.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const $n=Object.freeze({x:0,y:0});function c2(e,t){let{data:{value:s}}=e,{data:{value:a}}=t;return a-s}function u2(e,t){if(!e||e.length===0)return null;const[s]=e;return s[t]}function h2(e,t){const s=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-s;if(a<o&&s<c){const g=t.width*t.height,p=e.width*e.height,b=h*f,y=b/(g+p-b);return Number(y.toFixed(4))}return 0}const d2=e=>{let{collisionRect:t,droppableRects:s,droppableContainers:a}=e;const o=[];for(const c of a){const{id:h}=c,f=s.get(h);if(f){const g=h2(f,t);g>0&&o.push({id:h,data:{droppableContainer:c,value:g}})}}return o.sort(c2)};function f2(e,t,s){return{...e,scaleX:t&&s?t.width/s.width:1,scaleY:t&&s?t.height/s.height:1}}function g0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:$n}function p2(e){return function(s){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}),{...s})}}const m2=p2(1);function g2(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 _2(e,t,s){const a=g2(t);if(!a)return e;const{scaleX:o,scaleY:c,x:h,y:f}=a,g=e.left-h-(1-o)*parseFloat(s),p=e.top-f-(1-c)*parseFloat(s.slice(s.indexOf(" ")+1)),b=o?e.width/o:e.width,y=c?e.height/c:e.height;return{width:b,height:y,top:p,right:g+b,bottom:p+y,left:g}}const v2={ignoreTransform:!1};function Fo(e,t){t===void 0&&(t=v2);let s=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:p,transformOrigin:b}=ln(e).getComputedStyle(e);p&&(s=_2(s,p,b))}const{top:a,left:o,width:c,height:h,bottom:f,right:g}=s;return{top:a,left:o,width:c,height:h,bottom:f,right:g}}function hb(e){return Fo(e,{ignoreTransform:!0})}function y2(e){const t=e.innerWidth,s=e.innerHeight;return{top:0,left:0,right:t,bottom:s,width:t,height:s}}function b2(e,t){return t===void 0&&(t=ln(e).getComputedStyle(e)),t.position==="fixed"}function S2(e,t){t===void 0&&(t=ln(e).getComputedStyle(e));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const c=t[o];return typeof c=="string"?s.test(c):!1})}function zm(e,t){const s=[];function a(o){if(t!=null&&s.length>=t||!o)return s;if(Bm(o)&&o.scrollingElement!=null&&!s.includes(o.scrollingElement))return s.push(o.scrollingElement),s;if(!Io(o)||d0(o)||s.includes(o))return s;const c=ln(e).getComputedStyle(o);return o!==e&&S2(o,c)&&s.push(o),b2(o,c)?s:a(o.parentNode)}return e?a(e):s}function _0(e){const[t]=zm(e,1);return t??null}function Cf(e){return!Gu||!e?null:sl(e)?e:Lm(e)?Bm(e)||e===rl(e).scrollingElement?window:Io(e)?e:null:null}function v0(e){return sl(e)?e.scrollX:e.scrollLeft}function y0(e){return sl(e)?e.scrollY:e.scrollTop}function np(e){return{x:v0(e),y:y0(e)}}var Ti;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ti||(Ti={}));function b0(e){return!Gu||!e?!1:e===document.scrollingElement}function S0(e){const t={x:0,y:0},s=b0(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-s.width,y:e.scrollHeight-s.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 w2={x:.2,y:.2};function C2(e,t,s,a,o){let{top:c,left:h,right:f,bottom:g}=s;a===void 0&&(a=10),o===void 0&&(o=w2);const{isTop:p,isBottom:b,isLeft:y,isRight:S}=S0(e),C={x:0,y:0},x={x:0,y:0},E={height:t.height*o.y,width:t.width*o.x};return!p&&c<=t.top+E.height?(C.y=Ti.Backward,x.y=a*Math.abs((t.top+E.height-c)/E.height)):!b&&g>=t.bottom-E.height&&(C.y=Ti.Forward,x.y=a*Math.abs((t.bottom-E.height-g)/E.height)),!S&&f>=t.right-E.width?(C.x=Ti.Forward,x.x=a*Math.abs((t.right-E.width-f)/E.width)):!y&&h<=t.left+E.width&&(C.x=Ti.Backward,x.x=a*Math.abs((t.left+E.width-h)/E.width)),{direction:C,speed:x}}function x2(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:s,right:a,bottom:o}=e.getBoundingClientRect();return{top:t,left:s,right:a,bottom:o,width:e.clientWidth,height:e.clientHeight}}function w0(e){return e.reduce((t,s)=>Qa(t,np(s)),$n)}function E2(e){return e.reduce((t,s)=>t+v0(s),0)}function T2(e){return e.reduce((t,s)=>t+y0(s),0)}function k2(e,t){if(t===void 0&&(t=Fo),!e)return;const{top:s,left:a,bottom:o,right:c}=t(e);_0(e)&&(o<=0||c<=0||s>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const D2=[["x",["left","right"],E2],["y",["top","bottom"],T2]];class jm{constructor(t,s){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=zm(s),o=w0(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,h,f]of D2)for(const g of h)Object.defineProperty(this,g,{get:()=>{const p=f(a),b=o[c]-p;return this.rect[g]+b},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class So{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...s)})},this.target=t}add(t,s,a){var o;(o=this.target)==null||o.addEventListener(t,s,a),this.listeners.push([t,s,a])}}function R2(e){const{EventTarget:t}=ln(e);return e instanceof t?e:rl(e)}function xf(e,t){const s=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(s**2+a**2)>t:"x"in t&&"y"in t?s>t.x&&a>t.y:"x"in t?s>t.x:"y"in t?a>t.y:!1}var On;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(On||(On={}));function db(e){e.preventDefault()}function M2(e){e.stopPropagation()}var xt;(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"})(xt||(xt={}));const C0={start:[xt.Space,xt.Enter],cancel:[xt.Esc],end:[xt.Space,xt.Enter,xt.Tab]},N2=(e,t)=>{let{currentCoordinates:s}=t;switch(e.code){case xt.Right:return{...s,x:s.x+25};case xt.Left:return{...s,x:s.x-25};case xt.Down:return{...s,y:s.y+25};case xt.Up:return{...s,y:s.y-25}}};class x0{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:s}}=t;this.props=t,this.listeners=new So(rl(s)),this.windowListeners=new So(ln(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(On.Resize,this.handleCancel),this.windowListeners.add(On.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(On.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:s}=this.props,a=t.node.current;a&&k2(a),s($n)}handleKeyDown(t){if(p0(t)){const{active:s,context:a,options:o}=this.props,{keyboardCodes:c=C0,coordinateGetter:h=N2,scrollBehavior:f="smooth"}=o,{code:g}=t;if(c.end.includes(g)){this.handleEnd(t);return}if(c.cancel.includes(g)){this.handleCancel(t);return}const{collisionRect:p}=a.current,b=p?{x:p.left,y:p.top}:$n;this.referenceCoordinates||(this.referenceCoordinates=b);const y=h(t,{active:s,context:a.current,currentCoordinates:b});if(y){const S=Au(y,b),C={x:0,y:0},{scrollableAncestors:x}=a.current;for(const E of x){const L=t.code,{isTop:D,isRight:j,isLeft:U,isBottom:Z,maxScroll:ie,minScroll:ne}=S0(E),ae=x2(E),oe={x:Math.min(L===xt.Right?ae.right-ae.width/2:ae.right,Math.max(L===xt.Right?ae.left:ae.left+ae.width/2,y.x)),y:Math.min(L===xt.Down?ae.bottom-ae.height/2:ae.bottom,Math.max(L===xt.Down?ae.top:ae.top+ae.height/2,y.y))},pe=L===xt.Right&&!j||L===xt.Left&&!U,I=L===xt.Down&&!Z||L===xt.Up&&!D;if(pe&&oe.x!==y.x){const q=E.scrollLeft+S.x,K=L===xt.Right&&q<=ie.x||L===xt.Left&&q>=ne.x;if(K&&!S.y){E.scrollTo({left:q,behavior:f});return}K?C.x=E.scrollLeft-q:C.x=L===xt.Right?E.scrollLeft-ie.x:E.scrollLeft-ne.x,C.x&&E.scrollBy({left:-C.x,behavior:f});break}else if(I&&oe.y!==y.y){const q=E.scrollTop+S.y,K=L===xt.Down&&q<=ie.y||L===xt.Up&&q>=ne.y;if(K&&!S.x){E.scrollTo({top:q,behavior:f});return}K?C.y=E.scrollTop-q:C.y=L===xt.Down?E.scrollTop-ie.y:E.scrollTop-ne.y,C.y&&E.scrollBy({top:-C.y,behavior:f});break}}this.handleMove(t,Qa(Au(y,this.referenceCoordinates),C))}}}handleMove(t,s){const{onMove:a}=this.props;t.preventDefault(),a(s)}handleEnd(t){const{onEnd:s}=this.props;t.preventDefault(),this.detach(),s()}handleCancel(t){const{onCancel:s}=this.props;t.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}x0.activators=[{eventName:"onKeyDown",handler:(e,t,s)=>{let{keyboardCodes:a=C0,onActivation:o}=t,{active:c}=s;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 fb(e){return!!(e&&"distance"in e)}function pb(e){return!!(e&&"delay"in e)}class Hm{constructor(t,s,a){var o;a===void 0&&(a=R2(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=s;const{event:c}=t,{target:h}=c;this.props=t,this.events=s,this.document=rl(h),this.documentListeners=new So(this.document),this.listeners=new So(a),this.windowListeners=new So(ln(h)),this.initialCoordinates=(o=tp(c))!=null?o:$n,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:s,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(On.Resize,this.handleCancel),this.windowListeners.add(On.DragStart,db),this.windowListeners.add(On.VisibilityChange,this.handleCancel),this.windowListeners.add(On.ContextMenu,db),this.documentListeners.add(On.Keydown,this.handleKeydown),s){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(pb(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(fb(s)){this.handlePending(s);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,s){const{active:a,onPending:o}=this.props;o(a,t,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:t}=this,{onStart:s}=this.props;t&&(this.activated=!0,this.documentListeners.add(On.Click,M2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(On.SelectionChange,this.removeTextSelection),s(t))}handleMove(t){var s;const{activated:a,initialCoordinates:o,props:c}=this,{onMove:h,options:{activationConstraint:f}}=c;if(!o)return;const g=(s=tp(t))!=null?s:$n,p=Au(o,g);if(!a&&f){if(fb(f)){if(f.tolerance!=null&&xf(p,f.tolerance))return this.handleCancel();if(xf(p,f.distance))return this.handleStart()}if(pb(f)&&xf(p,f.tolerance))return this.handleCancel();this.handlePending(f,p);return}t.cancelable&&t.preventDefault(),h(g)}handleEnd(){const{onAbort:t,onEnd:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleCancel(){const{onAbort:t,onCancel:s}=this.props;this.detach(),this.activated||t(this.props.active),s()}handleKeydown(t){t.code===xt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const A2={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class E0 extends Hm{constructor(t){const{event:s}=t,a=rl(s.target);super(t,A2,a)}}E0.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:a}=t;return!s.isPrimary||s.button!==0?!1:(a?.({event:s}),!0)}}];const L2={move:{name:"mousemove"},end:{name:"mouseup"}};var sp;(function(e){e[e.RightClick=2]="RightClick"})(sp||(sp={}));class T0 extends Hm{constructor(t){super(t,L2,rl(t.event.target))}}T0.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:a}=t;return s.button===sp.RightClick?!1:(a?.({event:s}),!0)}}];const Ef={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class k0 extends Hm{constructor(t){super(t,Ef)}static setup(){return window.addEventListener(Ef.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ef.move.name,t)};function t(){}}}k0.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:s}=e,{onActivation:a}=t;const{touches:o}=s;return o.length>1?!1:(a?.({event:s}),!0)}}];var wo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(wo||(wo={}));var Bu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Bu||(Bu={}));function B2(e){let{acceleration:t,activator:s=wo.Pointer,canScroll:a,draggingRect:o,enabled:c,interval:h=5,order:f=Bu.TreeOrder,pointerCoordinates:g,scrollableAncestors:p,scrollableAncestorRects:b,delta:y,threshold:S}=e;const C=z2({delta:y,disabled:!c}),[x,E]=Xx(),L=v.useRef({x:0,y:0}),D=v.useRef({x:0,y:0}),j=v.useMemo(()=>{switch(s){case wo.Pointer:return g?{top:g.y,bottom:g.y,left:g.x,right:g.x}:null;case wo.DraggableRect:return o}},[s,o,g]),U=v.useRef(null),Z=v.useCallback(()=>{const ne=U.current;if(!ne)return;const ae=L.current.x*D.current.x,oe=L.current.y*D.current.y;ne.scrollBy(ae,oe)},[]),ie=v.useMemo(()=>f===Bu.TreeOrder?[...p].reverse():p,[f,p]);v.useEffect(()=>{if(!c||!p.length||!j){E();return}for(const ne of ie){if(a?.(ne)===!1)continue;const ae=p.indexOf(ne),oe=b[ae];if(!oe)continue;const{direction:pe,speed:I}=C2(ne,oe,j,t,S);for(const q of["x","y"])C[q][pe[q]]||(I[q]=0,pe[q]=0);if(I.x>0||I.y>0){E(),U.current=ne,x(Z,h),L.current=I,D.current=pe;return}}L.current={x:0,y:0},D.current={x:0,y:0},E()},[t,Z,a,E,c,h,JSON.stringify(j),JSON.stringify(C),x,p,ie,b,JSON.stringify(S)])}const O2={x:{[Ti.Backward]:!1,[Ti.Forward]:!1},y:{[Ti.Backward]:!1,[Ti.Forward]:!1}};function z2(e){let{delta:t,disabled:s}=e;const a=ep(t);return Ko(o=>{if(s||!a||!o)return O2;const c={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[Ti.Backward]:o.x[Ti.Backward]||c.x===-1,[Ti.Forward]:o.x[Ti.Forward]||c.x===1},y:{[Ti.Backward]:o.y[Ti.Backward]||c.y===-1,[Ti.Forward]:o.y[Ti.Forward]||c.y===1}}},[s,t,a])}function j2(e,t){const s=t!=null?e.get(t):void 0,a=s?s.node.current:null;return Ko(o=>{var c;return t==null?null:(c=a??o)!=null?c:null},[a,t])}function H2(e,t){return v.useMemo(()=>e.reduce((s,a)=>{const{sensor:o}=a,c=o.activators.map(h=>({eventName:h.eventName,handler:t(h.handler,a)}));return[...s,...c]},[]),[e,t])}var Mo;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Mo||(Mo={}));var rp;(function(e){e.Optimized="optimized"})(rp||(rp={}));const mb=new Map;function U2(e,t){let{dragging:s,dependencies:a,config:o}=t;const[c,h]=v.useState(null),{frequency:f,measure:g,strategy:p}=o,b=v.useRef(e),y=L(),S=Ro(y),C=v.useCallback(function(D){D===void 0&&(D=[]),!S.current&&h(j=>j===null?D:j.concat(D.filter(U=>!j.includes(U))))},[S]),x=v.useRef(null),E=Ko(D=>{if(y&&!s)return mb;if(!D||D===mb||b.current!==e||c!=null){const j=new Map;for(let U of e){if(!U)continue;if(c&&c.length>0&&!c.includes(U.id)&&U.rect.current){j.set(U.id,U.rect.current);continue}const Z=U.node.current,ie=Z?new jm(g(Z),Z):null;U.rect.current=ie,ie&&j.set(U.id,ie)}return j}return D},[e,c,s,y,g]);return v.useEffect(()=>{b.current=e},[e]),v.useEffect(()=>{y||C()},[s,y]),v.useEffect(()=>{c&&c.length>0&&h(null)},[JSON.stringify(c)]),v.useEffect(()=>{y||typeof f!="number"||x.current!==null||(x.current=setTimeout(()=>{C(),x.current=null},f))},[f,y,C,...a]),{droppableRects:E,measureDroppableContainers:C,measuringScheduled:c!=null};function L(){switch(p){case Mo.Always:return!1;case Mo.BeforeDragging:return s;default:return!s}}}function D0(e,t){return Ko(s=>e?s||(typeof t=="function"?t(e):e):null,[t,e])}function P2(e,t){return D0(e,t)}function I2(e){let{callback:t,disabled:s}=e;const a=Om(t),o=v.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(a)},[a,s]);return v.useEffect(()=>()=>o?.disconnect(),[o]),o}function Qu(e){let{callback:t,disabled:s}=e;const a=Om(t),o=v.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(a)},[s]);return v.useEffect(()=>()=>o?.disconnect(),[o]),o}function K2(e){return new jm(Fo(e),e)}function gb(e,t,s){t===void 0&&(t=K2);const[a,o]=v.useState(null);function c(){o(g=>{if(!e)return null;if(e.isConnected===!1){var p;return(p=g??s)!=null?p:null}const b=t(e);return JSON.stringify(g)===JSON.stringify(b)?g:b})}const h=I2({callback(g){if(e)for(const p of g){const{type:b,target:y}=p;if(b==="childList"&&y instanceof HTMLElement&&y.contains(e)){c();break}}}}),f=Qu({callback:c});return gr(()=>{c(),e?(f?.observe(e),h?.observe(document.body,{childList:!0,subtree:!0})):(f?.disconnect(),h?.disconnect())},[e]),a}function F2(e){const t=D0(e);return g0(e,t)}const _b=[];function q2(e){const t=v.useRef(e),s=Ko(a=>e?a&&a!==_b&&e&&t.current&&e.parentNode===t.current.parentNode?a:zm(e):_b,[e]);return v.useEffect(()=>{t.current=e},[e]),s}function W2(e){const[t,s]=v.useState(null),a=v.useRef(e),o=v.useCallback(c=>{const h=Cf(c.target);h&&s(f=>f?(f.set(h,np(h)),new Map(f)):null)},[]);return v.useEffect(()=>{const c=a.current;if(e!==c){h(c);const f=e.map(g=>{const p=Cf(g);return p?(p.addEventListener("scroll",o,{passive:!0}),[p,np(p)]):null}).filter(g=>g!=null);s(f.length?new Map(f):null),a.current=e}return()=>{h(e),h(c)};function h(f){f.forEach(g=>{const p=Cf(g);p?.removeEventListener("scroll",o)})}},[o,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,h)=>Qa(c,h),$n):w0(e):$n,[e,t])}function vb(e,t){t===void 0&&(t=[]);const s=v.useRef(null);return v.useEffect(()=>{s.current=null},t),v.useEffect(()=>{const a=e!==$n;a&&!s.current&&(s.current=e),!a&&s.current&&(s.current=null)},[e]),s.current?Au(e,s.current):$n}function $2(e){v.useEffect(()=>{if(!Gu)return;const t=e.map(s=>{let{sensor:a}=s;return a.setup==null?void 0:a.setup()});return()=>{for(const s of t)s?.()}},e.map(t=>{let{sensor:s}=t;return s}))}function Y2(e,t){return v.useMemo(()=>e.reduce((s,a)=>{let{eventName:o,handler:c}=a;return s[o]=h=>{c(h,t)},s},{}),[e,t])}function R0(e){return v.useMemo(()=>e?y2(e):null,[e])}const yb=[];function V2(e,t){t===void 0&&(t=Fo);const[s]=e,a=R0(s?ln(s):null),[o,c]=v.useState(yb);function h(){c(()=>e.length?e.map(g=>b0(g)?a:new jm(t(g),g)):yb)}const f=Qu({callback:h});return gr(()=>{f?.disconnect(),h(),e.forEach(g=>f?.observe(g))},[e]),o}function X2(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Io(t)?t:e}function G2(e){let{measure:t}=e;const[s,a]=v.useState(null),o=v.useCallback(p=>{for(const{target:b}of p)if(Io(b)){a(y=>{const S=t(b);return y?{...y,width:S.width,height:S.height}:S});break}},[t]),c=Qu({callback:o}),h=v.useCallback(p=>{const b=X2(p);c?.disconnect(),b&&c?.observe(b),a(b?t(b):null)},[t,c]),[f,g]=Nu(h);return v.useMemo(()=>({nodeRef:f,rect:s,setRef:g}),[s,f,g])}const Z2=[{sensor:E0,options:{}},{sensor:x0,options:{}}],Q2={current:{}},yu={draggable:{measure:hb},droppable:{measure:hb,strategy:Mo.WhileDragging,frequency:rp.Optimized},dragOverlay:{measure:Fo}};class Co extends Map{get(t){var s;return t!=null&&(s=super.get(t))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:s}=t;return!s})}getNodeFor(t){var s,a;return(s=(a=this.get(t))==null?void 0:a.node.current)!=null?s:void 0}}const J2={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Co,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Lu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:yu,measureDroppableContainers:Lu,windowRect:null,measuringScheduled:!1},eE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Lu,draggableNodes:new Map,over:null,measureDroppableContainers:Lu},Ju=v.createContext(eE),tE=v.createContext(J2);function iE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Co}}}function nE(e,t){switch(t.type){case pi.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case pi.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 pi.DragEnd:case pi.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case pi.RegisterDroppable:{const{element:s}=t,{id:a}=s,o=new Co(e.droppable.containers);return o.set(a,s),{...e,droppable:{...e.droppable,containers:o}}}case pi.SetDroppableDisabled:{const{id:s,key:a,disabled:o}=t,c=e.droppable.containers.get(s);if(!c||a!==c.key)return e;const h=new Co(e.droppable.containers);return h.set(s,{...c,disabled:o}),{...e,droppable:{...e.droppable,containers:h}}}case pi.UnregisterDroppable:{const{id:s,key:a}=t,o=e.droppable.containers.get(s);if(!o||a!==o.key)return e;const c=new Co(e.droppable.containers);return c.delete(s),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function sE(e){let{disabled:t}=e;const{active:s,activatorEvent:a,draggableNodes:o}=v.useContext(Ju),c=ep(a),h=ep(s?.id);return v.useEffect(()=>{if(!t&&!a&&c&&h!=null){if(!p0(c)||document.activeElement===c.target)return;const f=o.get(h);if(!f)return;const{activatorNode:g,node:p}=f;if(!g.current&&!p.current)return;requestAnimationFrame(()=>{for(const b of[g.current,p.current]){if(!b)continue;const y=Qx(b);if(y){y.focus();break}}})}},[a,t,o,h,c]),null}function rE(e,t){let{transform:s,...a}=t;return e!=null&&e.length?e.reduce((o,c)=>c({transform:o,...a}),s):s}function aE(e){return v.useMemo(()=>({draggable:{...yu.draggable,...e?.draggable},droppable:{...yu.droppable,...e?.droppable},dragOverlay:{...yu.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function lE(e){let{activeNode:t,measure:s,initialRect:a,config:o=!0}=e;const c=v.useRef(!1),{x:h,y:f}=typeof o=="boolean"?{x:o,y:o}:o;gr(()=>{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=s(p),y=g0(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 S=_0(p);S&&S.scrollBy({top:y.y,left:y.x})}},[t,h,f,a,s])}const M0=v.createContext({...$n,scaleX:1,scaleY:1});var ur;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ur||(ur={}));const oE=v.memo(function(t){var s,a,o,c;let{id:h,accessibility:f,autoScroll:g=!0,children:p,sensors:b=Z2,collisionDetection:y=d2,measuring:S,modifiers:C,...x}=t;const E=v.useReducer(nE,void 0,iE),[L,D]=E,[j,U]=s2(),[Z,ie]=v.useState(ur.Uninitialized),ne=Z===ur.Initialized,{draggable:{active:ae,nodes:oe,translate:pe},droppable:{containers:I}}=L,q=ae!=null?oe.get(ae):null,K=v.useRef({initial:null,translated:null}),z=v.useMemo(()=>{var wt;return ae!=null?{id:ae,data:(wt=q?.data)!=null?wt:Q2,rect:K}:null},[ae,q]),O=v.useRef(null),[se,M]=v.useState(null),[X,V]=v.useState(null),ye=Ro(x,Object.values(x)),xe=Zu("DndDescribedBy",h),k=v.useMemo(()=>I.getEnabled(),[I]),Q=aE(S),{droppableRects:le,measureDroppableContainers:fe,measuringScheduled:we}=U2(k,{dragging:ne,dependencies:[pe.x,pe.y],config:Q.droppable}),Ce=j2(oe,ae),ke=v.useMemo(()=>X?tp(X):null,[X]),Ie=wn(),H=P2(Ce,Q.draggable.measure);lE({activeNode:ae!=null?oe.get(ae):null,config:Ie.layoutShiftCompensation,initialRect:H,measure:Q.draggable.measure});const J=gb(Ce,Q.draggable.measure,H),Ee=gb(Ce?Ce.parentElement:null),ve=v.useRef({activatorEvent:null,active:null,activeNode:Ce,collisionRect:null,collisions:null,droppableRects:le,draggableNodes:oe,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ge=I.getNodeFor((s=ve.current.over)==null?void 0:s.id),F=G2({measure:Q.dragOverlay.measure}),me=(a=F.nodeRef.current)!=null?a:Ce,Se=ne?(o=F.rect)!=null?o:J:null,Le=!!(F.nodeRef.current&&F.rect),qe=F2(Le?null:J),st=R0(me?ln(me):null),Ke=q2(ne?ge??Ce:null),St=V2(Ke),Hi=rE(C,{transform:{x:pe.x-qe.x,y:pe.y-qe.y,scaleX:1,scaleY:1},activatorEvent:X,active:z,activeNodeRect:J,containerNodeRect:Ee,draggingNodeRect:Se,over:ve.current.over,overlayNodeRect:F.rect,scrollableAncestors:Ke,scrollableAncestorRects:St,windowRect:st}),Yn=ke?Qa(ke,pe):null,lt=W2(Ke),li=vb(lt),Zi=vb(lt,[J]),_i=Qa(Hi,li),jt=Se?m2(Se,Hi):null,Ui=z&&jt?y({active:z,collisionRect:jt,droppableRects:le,droppableContainers:k,pointerCoordinates:Yn}):null,vi=u2(Ui,"id"),[$,He]=v.useState(null),et=Le?Hi:Qa(Hi,Zi),ct=f2(et,(c=$?.rect)!=null?c:null,J),Jt=v.useRef(null),Ht=v.useCallback((wt,Et)=>{let{sensor:Ut,options:ci}=Et;if(O.current==null)return;const Yt=oe.get(O.current);if(!Yt)return;const ei=wt.nativeEvent,ui=new Ut({active:O.current,activeNode:Yt,event:ei,options:ci,context:ve,onAbort(Tt){if(!oe.get(Tt))return;const{onDragAbort:Vt}=ye.current,Ai={id:Tt};Vt?.(Ai),j({type:"onDragAbort",event:Ai})},onPending(Tt,qi,Vt,Ai){if(!oe.get(Tt))return;const{onDragPending:Pi}=ye.current,yi={id:Tt,constraint:qi,initialCoordinates:Vt,offset:Ai};Pi?.(yi),j({type:"onDragPending",event:yi})},onStart(Tt){const qi=O.current;if(qi==null)return;const Vt=oe.get(qi);if(!Vt)return;const{onDragStart:Ai}=ye.current,ut={activatorEvent:ei,active:{id:qi,data:Vt.data,rect:K}};ho.unstable_batchedUpdates(()=>{Ai?.(ut),ie(ur.Initializing),D({type:pi.DragStart,initialCoordinates:Tt,active:qi}),j({type:"onDragStart",event:ut}),M(Jt.current),V(ei)})},onMove(Tt){D({type:pi.DragMove,coordinates:Tt})},onEnd:Ni(pi.DragEnd),onCancel:Ni(pi.DragCancel)});Jt.current=ui;function Ni(Tt){return async function(){const{active:Vt,collisions:Ai,over:ut,scrollAdjustedTranslate:Pi}=ve.current;let yi=null;if(Vt&&Pi){const{cancelDrop:dt}=ye.current;yi={activatorEvent:ei,active:Vt,collisions:Ai,delta:Pi,over:ut},Tt===pi.DragEnd&&typeof dt=="function"&&await Promise.resolve(dt(yi))&&(Tt=pi.DragCancel)}O.current=null,ho.unstable_batchedUpdates(()=>{D({type:Tt}),ie(ur.Uninitialized),He(null),M(null),V(null),Jt.current=null;const dt=Tt===pi.DragEnd?"onDragEnd":"onDragCancel";if(yi){const bi=ye.current[dt];bi?.(yi),j({type:dt,event:yi})}})}}},[oe]),oi=v.useCallback((wt,Et)=>(Ut,ci)=>{const Yt=Ut.nativeEvent,ei=oe.get(ci);if(O.current!==null||!ei||Yt.dndKit||Yt.defaultPrevented)return;const ui={active:ei};wt(Ut,Et.options,ui)===!0&&(Yt.dndKit={capturedBy:Et.sensor},O.current=ci,Ht(Ut,Et))},[oe,Ht]),Fi=H2(b,oi);$2(b),gr(()=>{J&&Z===ur.Initializing&&ie(ur.Initialized)},[J,Z]),v.useEffect(()=>{const{onDragMove:wt}=ye.current,{active:Et,activatorEvent:Ut,collisions:ci,over:Yt}=ve.current;if(!Et||!Ut)return;const ei={active:Et,activatorEvent:Ut,collisions:ci,delta:{x:_i.x,y:_i.y},over:Yt};ho.unstable_batchedUpdates(()=>{wt?.(ei),j({type:"onDragMove",event:ei})})},[_i.x,_i.y]),v.useEffect(()=>{const{active:wt,activatorEvent:Et,collisions:Ut,droppableContainers:ci,scrollAdjustedTranslate:Yt}=ve.current;if(!wt||O.current==null||!Et||!Yt)return;const{onDragOver:ei}=ye.current,ui=ci.get(vi),Ni=ui&&ui.rect.current?{id:ui.id,rect:ui.rect.current,data:ui.data,disabled:ui.disabled}:null,Tt={active:wt,activatorEvent:Et,collisions:Ut,delta:{x:Yt.x,y:Yt.y},over:Ni};ho.unstable_batchedUpdates(()=>{He(Ni),ei?.(Tt),j({type:"onDragOver",event:Tt})})},[vi]),gr(()=>{ve.current={activatorEvent:X,active:z,activeNode:Ce,collisionRect:jt,collisions:Ui,droppableRects:le,draggableNodes:oe,draggingNode:me,draggingNodeRect:Se,droppableContainers:I,over:$,scrollableAncestors:Ke,scrollAdjustedTranslate:_i},K.current={initial:Se,translated:jt}},[z,Ce,Ui,jt,oe,me,Se,le,I,$,Ke,_i]),B2({...Ie,delta:pe,draggingRect:jt,pointerCoordinates:Yn,scrollableAncestors:Ke,scrollableAncestorRects:St});const as=v.useMemo(()=>({active:z,activeNode:Ce,activeNodeRect:J,activatorEvent:X,collisions:Ui,containerNodeRect:Ee,dragOverlay:F,draggableNodes:oe,droppableContainers:I,droppableRects:le,over:$,measureDroppableContainers:fe,scrollableAncestors:Ke,scrollableAncestorRects:St,measuringConfiguration:Q,measuringScheduled:we,windowRect:st}),[z,Ce,J,X,Ui,Ee,F,oe,I,le,$,fe,Ke,St,Q,we,st]),on=v.useMemo(()=>({activatorEvent:X,activators:Fi,active:z,activeNodeRect:J,ariaDescribedById:{draggable:xe},dispatch:D,draggableNodes:oe,over:$,measureDroppableContainers:fe}),[X,Fi,z,J,D,xe,oe,$,fe]);return mi.createElement(m0.Provider,{value:U},mi.createElement(Ju.Provider,{value:on},mi.createElement(tE.Provider,{value:as},mi.createElement(M0.Provider,{value:ct},p)),mi.createElement(sE,{disabled:f?.restoreFocus===!1})),mi.createElement(l2,{...f,hiddenTextDescribedById:xe}));function wn(){const wt=se?.autoScrollEnabled===!1,Et=typeof g=="object"?g.enabled===!1:g===!1,Ut=ne&&!wt&&!Et;return typeof g=="object"?{...g,enabled:Ut}:{enabled:Ut}}}),cE=v.createContext(null),bb="button",uE="Draggable";function N0(e){let{id:t,data:s,disabled:a=!1,attributes:o}=e;const c=Zu(uE),{activators:h,activatorEvent:f,active:g,activeNodeRect:p,ariaDescribedById:b,draggableNodes:y,over:S}=v.useContext(Ju),{role:C=bb,roleDescription:x="draggable",tabIndex:E=0}=o??{},L=g?.id===t,D=v.useContext(L?M0:cE),[j,U]=Nu(),[Z,ie]=Nu(),ne=Y2(h,t),ae=Ro(s);gr(()=>(y.set(t,{id:t,key:c,node:j,activatorNode:Z,data:ae}),()=>{const pe=y.get(t);pe&&pe.key===c&&y.delete(t)}),[y,t]);const oe=v.useMemo(()=>({role:C,tabIndex:E,"aria-disabled":a,"aria-pressed":L&&C===bb?!0:void 0,"aria-roledescription":x,"aria-describedby":b.draggable}),[a,C,E,L,x,b.draggable]);return{active:g,activatorEvent:f,activeNodeRect:p,attributes:oe,isDragging:L,listeners:a?void 0:ne,node:j,over:S,setNodeRef:U,setActivatorNodeRef:ie,transform:D}}const hE="Droppable",dE={timeout:25};function A0(e){let{data:t,disabled:s=!1,id:a,resizeObserverConfig:o}=e;const c=Zu(hE),{active:h,dispatch:f,over:g,measureDroppableContainers:p}=v.useContext(Ju),b=v.useRef({disabled:s}),y=v.useRef(!1),S=v.useRef(null),C=v.useRef(null),{disabled:x,updateMeasurementsFor:E,timeout:L}={...dE,...o},D=Ro(E??a),j=v.useCallback(()=>{if(!y.current){y.current=!0;return}C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{p(Array.isArray(D.current)?D.current:[D.current]),C.current=null},L)},[L]),U=Qu({callback:j,disabled:x||!h}),Z=v.useCallback((oe,pe)=>{U&&(pe&&(U.unobserve(pe),y.current=!1),oe&&U.observe(oe))},[U]),[ie,ne]=Nu(Z),ae=Ro(t);return v.useEffect(()=>{!U||!ie.current||(U.disconnect(),y.current=!1,U.observe(ie.current))},[ie,U]),v.useEffect(()=>(f({type:pi.RegisterDroppable,element:{id:a,key:c,disabled:s,node:ie,rect:S,data:ae}}),()=>f({type:pi.UnregisterDroppable,key:c,id:a})),[a]),v.useEffect(()=>{s!==b.current.disabled&&(f({type:pi.SetDroppableDisabled,id:a,key:c,disabled:s}),b.current.disabled=s)},[a,c,s,f]),{active:h,rect:S,isOver:g?.id===a,node:ie,over:g,setNodeRef:ne}}const fE=128,pE=512,mE=64,gE=4096;function L0(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>fE)return null;const s=t.workspaces.map(_E);return s.some(a=>a===null)?null:{activeWorkspaceId:t.activeWorkspaceId,workspaces:s}}function _E(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>pE)return null;const s=t.tabs.map(vE);return s.some(a=>a===null)?null:{id:t.id,title:t.title,activeTabId:t.activeTabId,tabs:s}}function vE(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 s=yE(t.root);return s?{id:t.id,title:t.title,activeTerminalId:t.activeTerminalId,root:s}:null}function yE(e){if(!e||typeof e!="object")return null;let t=0;return ap(e,1,()=>(t+=1,t<=gE))}function ap(e,t,s){if(!e||typeof e!="object"||t>mE||!s())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=ap(a.first,t+1,s),c=ap(a.second,t+1,s);return!o||!c?null:{type:"split",direction:a.direction,ratio:bE(a.ratio),first:o,second:c}}function bE(e){return typeof e=="number"&&Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}const B0=[{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"}],Yr="__main__";function SE(e){return e===void 0?"unknown":e==="error"?"offline":"ok"}function wE(e){const t=e.trim();return t?t.charAt(0).toUpperCase():"?"}const Sb="Local",CE=3e4,xE=2,EE=6,O0="nterminal.serverList.viewMode.v1";function TE(){try{return window.localStorage.getItem(O0)==="list"?"list":"stats"}catch{return"stats"}}function kE(e){try{window.localStorage.setItem(O0,e)}catch{}}function Fr(e,t){const s=[Yr,...t.map(h=>h.id)],a=new Set(s),o=new Set,c=[];for(const h of e??[])!a.has(h)||o.has(h)||(o.add(h),c.push(h));for(const h of s)o.has(h)||c.push(h);return c}function DE(e,t){const s=new Map(e.map(a=>[a.id,a]));return Fr(t,e).flatMap(a=>{if(a===Yr)return[{kind:"main",id:Yr}];const o=s.get(a);return o?[{kind:"agent",id:a,agent:o}]:[]})}function wb(e,t){return e.length===t.length&&e.every((s,a)=>s===t[a])}function z0(e){return e===void 0?"":e==="error"?"offline":[`CPU ${jn(e.cpuPercent)} ${Um(e)}`,`MEM ${jn(e.memoryPercent)} ${As(e.memoryUsedBytes,e.memoryTotalBytes)}`,`DISK ${jn(e.diskPercent)} ${As(e.diskUsedBytes,e.diskTotalBytes)}`,`SWAP ${jn(e.swapPercent)} ${As(e.swapUsedBytes,e.swapTotalBytes)}`].join(" · ")}function RE(e){if(!(e===void 0||e==="error"))return[`CPU ${jn(e.cpuPercent)} (${Um(e)})`,`RAM ${jn(e.memoryPercent)} (${As(e.memoryUsedBytes,e.memoryTotalBytes)})`,`Disk ${jn(e.diskPercent)} (${As(e.diskUsedBytes,e.diskTotalBytes)})`,`Swap ${jn(e.swapPercent)} (${As(e.swapUsedBytes,e.swapTotalBytes)})`].join(" · ")}function ME(e,t){const s=z0(t);return`${e}${s?` — ${s}`:""}. Double-click to rename.`}function jn(e){return typeof e=="number"&&Number.isFinite(e)?`${Math.round(e)}%`:"–"}function Um(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`:`${lp(e.cpuPercent/100*t)}/${t} cores`}function As(e,t){return!Cb(e)||!Cb(t)?"–/–":NE(e,t)}function NE(e,t){const s=t>=1073741824?"GB":t>=1048576?"MB":"KB",a=s==="GB"?1024**3:s==="MB"?1024**2:1024;return`${lp(e/a)}/${lp(t/a)} ${s}`}function lp(e){return e>=10||Number.isInteger(e)?e.toFixed(0):e.toFixed(1)}function Cb(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function au(e){return typeof e!="number"||!Number.isFinite(e)?"normal":e>95?"danger":e>90?"warning":"normal"}function AE(e){return[{label:"CPU",percent:jn(e.cpuPercent),detail:Um(e),tone:au(e.cpuPercent)},{label:"MEM",percent:jn(e.memoryPercent),detail:As(e.memoryUsedBytes,e.memoryTotalBytes),tone:au(e.memoryPercent)},{label:"DISK",percent:jn(e.diskPercent),detail:As(e.diskUsedBytes,e.diskTotalBytes),tone:au(e.diskPercent)},{label:"SWAP",percent:jn(e.swapPercent),detail:As(e.swapUsedBytes,e.swapTotalBytes),tone:au(e.swapPercent)}]}function LE({entry:e}){return e==="error"?m.jsx("span",{className:"server-list-stats server-list-stats--offline",children:"offline"}):e===void 0?m.jsx("span",{className:"server-list-stats server-list-stats-grid","aria-hidden":"true",children:["CPU","MEM","DISK","SWAP"].map(t=>m.jsxs("span",{className:"server-list-stat-cell",children:[m.jsx("span",{className:"server-list-stat-label",children:t}),m.jsx("span",{className:"server-list-stat-value",children:"–"}),m.jsx("span",{className:"server-list-stat-detail",children:"–"})]},t))}):m.jsx("span",{className:"server-list-stats server-list-stats-grid",title:RE(e),children:AE(e).map(t=>m.jsxs("span",{className:"server-list-stat-cell",children:[m.jsx("span",{className:"server-list-stat-label",children:t.label}),m.jsx("span",{className:"server-list-stat-value","data-tone":t.tone,children:t.percent}),m.jsx("span",{className:"server-list-stat-detail",children:t.detail})]},t.label))})}function Tf({api:e,activeAgentId:t,onSelectServer:s,onSessionInvalid:a,refreshToken:o=0,compact:c=!1}){const[h,f]=v.useState([]),[g,p]=v.useState([Yr]),[b,y]=v.useState(null),[S,C]=v.useState(null),[x,E]=v.useState(""),L=v.useRef(null),[D,j]=v.useState(()=>TE()),[U,Z]=v.useState(null),[ie,ne]=v.useState(null),[ae,oe]=v.useState({}),pe=v.useRef({}),I=v.useRef(0),q=v.useRef([]),K=v.useRef([Yr]),z=v.useRef(null);v.useEffect(()=>{q.current=h},[h]),v.useEffect(()=>{const H=Fr(g,h);K.current=H,wb(H,g)||p(H)},[h,g]),v.useEffect(()=>{let H=!1;return e.listAgents().then(J=>{H||(f(J.agents),p(Fr(J.serverOrder,J.agents)))}).catch(()=>{}),e.getMainInfo().then(J=>{H||y(J.name)}).catch(()=>{}),()=>{H=!0}},[e,o]),v.useEffect(()=>{S&&(L.current?.focus(),L.current?.select())},[S]),v.useEffect(()=>{let H=!1;function J(){const ve=[{key:"__main__",load:()=>e.getMainStats()},...h.map(F=>({key:F.id,load:()=>e.getAgentStats(F.id)}))],ge=new Set(ve.map(F=>F.key));for(const F of Object.keys(pe.current))ge.has(F)||delete pe.current[F];oe(F=>{const me={};for(const Se of ge)Se in F&&(me[Se]=F[Se]);return me});for(const F of ve)F.load().then(me=>{H||(pe.current[F.key]=0,oe(Se=>ge.has(F.key)?{...Se,[F.key]:me}:Se))}).catch(me=>{if(H)return;if(me instanceof Ns&&me.status===401&&F.key==="__main__"){a?.({source:"main-stats-401",status:401,activeAgentId:null});return}const Se=(pe.current[F.key]??0)+1;pe.current[F.key]=Se,Se>=xE&&oe(Le=>ge.has(F.key)?{...Le,[F.key]:"error"}:Le)})}J();const Ee=window.setInterval(J,CE);return()=>{H=!0,window.clearInterval(Ee)}},[e,h,a]);function O(H){H==="main"?(E(b??""),C({kind:"main"})):(E(H.name),C({kind:"agent",id:H.id}))}async function se(){if(!S)return;const H=x.trim(),J=S;if(C(null),J.kind==="main"){const Ee=H||"";try{const ve=await e.renameMain(Ee);y(ve.name)}catch{}}else{if(!H)return;const Ee=h.find(ve=>ve.id===J.id)?.name;f(ve=>ve.map(ge=>ge.id===J.id?{...ge,name:H}:ge));try{await e.renameAgent(J.id,H)}catch{Ee!==void 0&&f(ve=>ve.map(ge=>ge.id===J.id?{...ge,name:Ee}:ge))}}}function M(){C(null)}function X(H){j(H),kE(H)}function V(H,J,Ee){if(H===J)return;const ve=Fr(K.current,q.current),ge=ve.findIndex(Ke=>Ke===H),F=ve.findIndex(Ke=>Ke===J);if(ge<0||F<0)return;const me=[...ve],[Se]=me.splice(ge,1);if(!Se)return;const Le=me.findIndex(Ke=>Ke===J);if(Le<0)return;const qe=Ee==="before"?Le:Le+1;if(me.splice(qe,0,Se),wb(me,ve))return;const st=I.current+1;I.current=st,K.current=me,p(me),e.reorderAgents(me).then(Ke=>{if(I.current===st){q.current=Ke.agents;const St=Fr(Ke.serverOrder,Ke.agents);K.current=St,f(Ke.agents),p(St)}}).catch(async()=>{if(I.current===st)try{const Ke=await e.listAgents();if(I.current===st){q.current=Ke.agents;const St=Fr(Ke.serverOrder,Ke.agents);K.current=St,f(Ke.agents),p(St)}}catch{I.current===st&&(K.current=ve,p(ve))}})}function ye(H,J){const Ee=Fr(K.current,q.current),ve=Ee.findIndex(F=>F===H),ge=Ee[ve+J];ve<0||!ge||V(H,ge,J<0?"before":"after")}function xe(H,J){J.pointerType==="mouse"&&J.button!==0||(J.stopPropagation(),z.current={sourceId:H,pointerId:J.pointerId,startX:J.clientX,startY:J.clientY,active:!1,targetId:null,placement:"after"},J.currentTarget.setPointerCapture?.(J.pointerId))}function k(H){const J=z.current;if(!J||J.pointerId!==H.pointerId)return;const Ee=Math.hypot(H.clientX-J.startX,H.clientY-J.startY);if(!J.active){if(Ee<EE)return;J.active=!0,Z(J.sourceId)}const ge=document.elementFromPoint(H.clientX,H.clientY)?.closest("[data-server-id]"),F=ge?.dataset.serverId??null;if(!ge||!F||F===J.sourceId){J.targetId=null,ne(null);return}const me=ge.getBoundingClientRect(),Se=H.clientY<me.top+me.height/2?"before":"after";J.targetId=F,J.placement=Se,ne({serverId:F,placement:Se})}function Q(H){const J=z.current;!J||J.pointerId!==H.pointerId||(H.stopPropagation(),H.currentTarget.releasePointerCapture?.(H.pointerId),z.current=null,Z(null),ne(null),J.active&&J.targetId&&V(J.sourceId,J.targetId,J.placement))}function le(H){const J=z.current;J&&J.pointerId===H.pointerId&&H.currentTarget.releasePointerCapture?.(H.pointerId),z.current=null,Z(null),ne(null)}const fe=b?.trim()||Sb,we=S?.kind==="main",Ce=D==="stats",ke=DE(h,g),Ie=ke.length>1;return c?m.jsx("div",{className:"server-list server-list--compact",children:ke.map(H=>{const J=H.kind==="main",Ee=J?fe:H.agent.name,ve=J?Yr:H.id,ge=ae[ve],F=z0(ge);return m.jsxs("button",{type:"button",className:`server-list-chip${(J?t===null:t===H.id)?" server-list-chip--active":""}`,onClick:()=>s(J?null:H.id),"aria-label":Ee,title:`${Ee}${F?` — ${F}`:""}`,children:[m.jsx("span",{className:"server-list-chip-initial",children:wE(Ee)}),m.jsx("span",{className:"server-list-chip-pip","data-status":SE(ge)})]},H.id)})}):m.jsxs("div",{className:`server-list server-list--${D}`,children:[m.jsxs("div",{className:"server-list-toolbar","aria-label":"Server list display",children:[m.jsx("button",{type:"button",className:"server-list-view-button","aria-pressed":D==="list",onClick:()=>X("list"),title:"Show server names only",children:"List"}),m.jsx("button",{type:"button",className:"server-list-view-button","aria-pressed":D==="stats",onClick:()=>X("stats"),title:"Show resource usage",children:"Stats"})]}),ke.map(H=>{const J=H.kind==="main",Ee=J?fe:H.agent.name,ve=J?Yr:H.id,ge=J?t===null:t===H.id,F=J?we:S?.kind==="agent"&&S.id===H.id;return m.jsx("div",{className:["server-list-row",U===H.id?"server-list-row--dragging":"",ie?.serverId===H.id&&U!==H.id?"server-list-row--drop-target":"",ie?.serverId===H.id&&U!==H.id?`server-list-row--drop-${ie.placement}`:""].filter(Boolean).join(" "),"data-server-id":H.id,children:F?m.jsxs(m.Fragment,{children:[Ie?m.jsx("span",{className:"server-list-drag-spacer","aria-hidden":"true"}):null,m.jsx("form",{className:"server-list-editor",onSubmit:me=>{me.preventDefault(),se()},children:m.jsx("input",{ref:L,"aria-label":J?"Rename main server":`Rename ${Ee}`,value:x,onChange:me=>E(me.target.value),onBlur:()=>{se()},onKeyDown:me=>{me.key==="Escape"&&(me.preventDefault(),M())},placeholder:J?Sb:void 0})})]}):m.jsxs(m.Fragment,{children:[Ie?m.jsx("button",{type:"button",className:"server-list-drag-handle","data-server-drag-handle":H.id,title:"Drag to reorder","aria-label":`Reorder ${Ee}`,"aria-grabbed":U===H.id,onPointerDown:me=>xe(H.id,me),onPointerMove:k,onPointerUp:Q,onPointerCancel:le,onKeyDown:me=>{(me.key==="ArrowUp"||me.key==="ArrowDown")&&(me.preventDefault(),me.stopPropagation(),ye(H.id,me.key==="ArrowUp"?-1:1))},onClick:me=>me.stopPropagation(),children:"::"}):null,m.jsxs("button",{type:"button",className:`server-list-item${ge?" server-list-item--active":""}`,onClick:()=>s(J?null:H.id),onDoubleClick:me=>{me.preventDefault(),O(J?"main":{id:H.id,name:Ee})},title:ME(Ee,ae[ve]),children:[m.jsxs("span",{className:"server-list-item-header",children:[m.jsx("span",{className:"server-list-dot"}),m.jsx("span",{className:"server-list-name",title:J?void 0:H.agent.url,children:Ee})]}),Ce?m.jsx(LE,{entry:ae[ve]}):null]})]})},H.id)})]})}function BE({api:e}){const[t,s]=v.useState([]),[a,o]=v.useState([]),[c,h]=v.useState(!1),[f,g]=v.useState(null),[p,b]=v.useState(""),[y,S]=v.useState("");async function C(){try{const[D,j,U]=await Promise.all([e.listDevices(),e.listNetworks(),e.getSession()]);s(D.devices),o(j.networks),h(U.totpEnabled),g(null)}catch(D){g(D instanceof Error?D.message:"Failed to load")}}v.useEffect(()=>{C()},[]);async function x(D){await e.revokeDevice(D),await C()}async function E(D){await e.removeNetwork(D),await C()}async function L(D){D.preventDefault(),g(null);try{await e.addNetwork({value:p.trim(),label:y.trim()}),b(""),S(""),await C()}catch(j){g(j instanceof Error?j.message:"Failed to add network")}}return m.jsxs(m.Fragment,{children:[f?m.jsx("p",{className:"form-error",children:f}):null,m.jsxs("section",{className:"security-section",children:[m.jsx("h3",{children:"Trusted devices"}),m.jsx("p",{className:"muted",children:"Devices that can re-authenticate with a 2FA code only (no password) for 30 days."}),t.length===0?m.jsx("p",{className:"muted",children:"No trusted devices."}):m.jsx("ul",{className:"security-list",children:t.map(D=>m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsxs("span",{className:"security-item-label",children:[D.label,D.current?m.jsx("span",{className:"security-badge",children:"this device"}):null]}),m.jsxs("span",{className:"security-item-meta",children:["last seen ",new Date(D.lastSeenAt).toLocaleString()]})]}),m.jsx("button",{type:"button",className:"security-remove",onClick:()=>{x(D.id)},children:"revoke"})]},D.id))})]}),m.jsxs("section",{className:"security-section",children:[m.jsx("h3",{children:"Trusted networks"}),m.jsx("p",{className:"muted",children:"Sessions from these IPs/ranges skip the 2FA re-auth prompt."}),a.length===0?m.jsx("p",{className:"muted",children:"No trusted networks."}):m.jsx("ul",{className:"security-list",children:a.map(D=>m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsx("span",{className:"security-item-label",children:D.value}),D.label!==D.value?m.jsx("span",{className:"security-item-meta",children:D.label}):null]}),m.jsx("button",{type:"button",className:"security-remove",onClick:()=>{E(D.id)},children:"remove"})]},D.id))}),m.jsxs("form",{className:"security-add-form",onSubmit:L,children:[m.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}),m.jsx("input",{type:"text",placeholder:"Label (optional)",value:y,onChange:D=>S(D.currentTarget.value)}),m.jsx("button",{type:"submit",disabled:!p.trim(),children:"Add"})]})]}),c?m.jsxs("section",{className:"security-section",children:[m.jsx("h3",{children:"Two-factor authentication"}),m.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."}),m.jsx("button",{type:"button",className:"security-remove",onClick:async()=>{await e.disableTotp(),await C()},children:"Disable 2FA"})]}):null]})}const Pm="nterminal.clientDiagnostics.v1",j0=150,OE=24,zE=160;let xb=!1,eo=null;function jE(){xb||typeof window>"u"||(xb=!0,bn("page.load",{navigation:GE(),visibility:document.visibilityState,online:navigator.onLine,viewport:U0(),standalone:XE()}),document.addEventListener("visibilitychange",()=>{bn("page.visibility",{visibility:document.visibilityState,online:navigator.onLine})}),window.addEventListener("pageshow",e=>{bn("page.show",{persisted:e.persisted,visibility:document.visibilityState,online:navigator.onLine})}),window.addEventListener("pagehide",e=>{bn("page.hide",{persisted:e.persisted,visibility:document.visibilityState,online:navigator.onLine})}),window.addEventListener("online",()=>bn("network.online")),window.addEventListener("offline",()=>bn("network.offline")),window.addEventListener("focus",()=>bn("window.focus")),window.addEventListener("blur",()=>bn("window.blur")),window.addEventListener("error",e=>{bn("runtime.error",{message:e.message,source:ZE(e.filename),line:e.lineno||null})}),window.addEventListener("unhandledrejection",e=>{bn("runtime.unhandledrejection",{reason:QE(e.reason)})}))}function bn(e,t={}){const s={at:new Date().toISOString(),event:th(e,80),data:H0({...t,visibility:t.visibility??YE(),online:t.online??VE(),viewport:t.viewport??U0()})},a=Vr();return a.push(s),IE(a.slice(-j0)),s}function Vr(){try{const e=window.localStorage.getItem(Pm);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(KE).filter(s=>s!==null).slice(-j0):[]}catch{return[]}}function HE(){try{window.localStorage.removeItem(Pm)}catch{}}function UE(){const e=Vr();return JSON.stringify({generatedAt:new Date().toISOString(),eventCount:e.length,events:e},null,2)}async function PE(){const e=UE();return navigator.clipboard?.writeText?(await navigator.clipboard.writeText(e),!0):JE(e)}async function eh(e,t=fetch){if(eo)return eo;const s=Vr(),a={reason:th(e,80),events:s},o=JSON.stringify(a);eo=(async()=>{const c=await t("/api/client-diagnostics",{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",keepalive:o.length<48e3,body:o});if(!c.ok)throw new Error(`diagnostics_send_failed_${c.status}`);return c.json()})();try{return await eo}finally{eo=null}}function IE(e){try{window.localStorage.setItem(Pm,JSON.stringify(e))}catch{}}function KE(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.at!="string"||typeof t.event!="string"?null:{at:t.at.slice(0,40),event:th(t.event,80),...t.data&&typeof t.data=="object"?{data:H0(t.data)}:{}}}function H0(e){const t={};for(const[s,a]of Object.entries(e).slice(0,OE)){const o=th(s,64);if(!o||FE(o))continue;const c=qE(a);c!==void 0&&(t[o]=c)}return t}function FE(e){return/(?:password|secret|token|cookie|authorization|sessionid|session_id|nterminal_session|nterminal_device)/i.test(e)}function qE(e){if(typeof e=="string")return WE(e,zE);if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="boolean"||e===null)return e}function th(e,t){return e.replace(/[^a-zA-Z0-9_.:-]/g,"_").slice(0,t)}function WE(e,t){return $E(e).replace(/[\r\n\t]+/g," ").replace(/[^\x20-\x7E]/g,"_").slice(0,t)}function $E(e){return e.replace(/https?:\/\/[^\s"'<>]+/gi,"[url]").replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi,"Bearer [redacted]").replace(/\b[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,"[redacted]").replace(/\b((?:auth|authorization|cookie|password|secret|session|sessionid|session_id|token)[a-z0-9_.:-]*\s*[:=]\s*)[^\s&,;]+/gi,"$1[redacted]").replace(/\b(nterminal_session|nterminal_device)\s*=\s*[^\s;,]+/gi,"$1=[redacted]").replace(/\b[A-Za-z0-9+/_=-]{48,}\b/g,"[redacted]")}function YE(){return typeof document>"u"?void 0:document.visibilityState}function VE(){return typeof navigator>"u"?void 0:navigator.onLine}function U0(){if(typeof window>"u")return;const e=window.innerWidth||0;return e<640?"mobile":e<1024?"tablet":"desktop"}function XE(){return typeof window>"u"?!1:window.matchMedia?.("(display-mode: standalone)").matches===!0||navigator.standalone===!0}function GE(){return performance.getEntriesByType?.("navigation")?.[0]?.type??"unknown"}function ZE(e){if(!e)return null;try{const t=new URL(e);return t.pathname.split("/").pop()||t.pathname}catch{return e.split("/").pop()??e}}function QE(e){return e instanceof Error?e.message||e.name:typeof e=="string"?e:typeof e}function JE(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();let s=!1;try{s=document.execCommand("copy")}finally{document.body.removeChild(t)}return s}const P0="nterminal.notifications.completionEnabled",Im="nterminal.notifications.completionToastEnabled",Km="nterminal.notifications.completionToastDurationSeconds",Fm="nterminal.notifications.completionToastPersistent",op="nterminal:completion-toast-display",xo=6.5,cp=2,up=60;function ih(){return typeof window<"u"&&"Notification"in window}function I0(){try{return window.localStorage.getItem(P0)==="true"}catch{return!1}}function Eb(e){try{window.localStorage.setItem(P0,e?"true":"false")}catch{}}function Jr(){return{enabled:nT(),durationSeconds:iT(),persistUntilDismissed:sT()}}function eT(e){if(typeof window<"u"){try{window.localStorage.setItem(Im,e?"true":"false")}catch{}Wm()}return Jr()}function Tb(e){const t=F0(e);if(typeof window<"u"){try{window.localStorage.setItem(Km,String(t))}catch{}Wm()}return Jr()}function tT(e){if(typeof window<"u"){try{window.localStorage.setItem(Fm,e?"true":"false")}catch{}Wm()}return Jr()}function K0(e){if(typeof window>"u")return()=>{};const t=s=>{(s.key===Im||s.key===Km||s.key===Fm)&&e()};return window.addEventListener(op,e),window.addEventListener("storage",t),()=>{window.removeEventListener(op,e),window.removeEventListener("storage",t)}}function qm(){return ih()?window.Notification.permission:"unsupported"}function iT(){if(typeof window>"u")return xo;try{const e=window.localStorage.getItem(Km);return e===null?xo:F0(Number(e))}catch{return xo}}function nT(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(Im)!=="false"}catch{return!0}}function sT(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Fm)==="true"}catch{return!1}}function F0(e){if(!Number.isFinite(e))return xo;const t=Math.round(e*2)/2;return Math.max(cp,Math.min(up,t))}function Wm(){typeof window<"u"&&window.dispatchEvent(new CustomEvent(op))}async function rT(){if(!ih())return"unsupported";try{return await window.Notification.requestPermission()}catch{return qm()}}function aT(e){if(!ih()||qm()!=="granted"||!I0()||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 lT=1500,$m="nterminal.terminal.fontSize",Ym="nterminal.terminal.fontFamily",hp="nterminal:terminal-font-size",dp="nterminal:terminal-font-family",fp=11,pp=20,Gr=14,Ou=[{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:[]}],tl="meslo";mp(tl);async function kf(e=Gr,t=tl){if(typeof document>"u"||!document.fonts)return;const s=$0(t).webFontFamilies;if(s.length===0)return;const a=Promise.all(s.map(o=>document.fonts.load(`${e}px ${o}`))).then(()=>{}).catch(()=>{});await Promise.race([a,new Promise(o=>{globalThis.setTimeout(o,lT)})])}function q0(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return Gr;const s=Math.round(t);return Math.max(fp,Math.min(pp,s))}function W0(e){return Ou.some(t=>t.id===e)?e:tl}function mp(e){return $0(e).cssFamily}function $0(e){return Ou.find(t=>t.id===e)??Ou[0]}function gp(){if(typeof window>"u")return Gr;try{const e=window.localStorage.getItem($m);return e?q0(e):Gr}catch{return Gr}}function _p(){if(typeof window>"u")return tl;try{return W0(window.localStorage.getItem(Ym))}catch{return tl}}function lu(e){const t=q0(e);if(typeof window>"u")return t;try{window.localStorage.setItem($m,String(t))}catch{}return window.dispatchEvent(new CustomEvent(hp,{detail:t})),t}function oT(e){const t=W0(e);if(typeof window>"u")return t;try{window.localStorage.setItem(Ym,t)}catch{}return window.dispatchEvent(new CustomEvent(dp,{detail:t})),t}function Y0(e){if(typeof window>"u")return()=>{};const t=s=>{s.key===$m&&e()};return window.addEventListener(hp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(hp,e),window.removeEventListener("storage",t)}}function V0(e){if(typeof window>"u")return()=>{};const t=s=>{s.key===Ym&&e()};return window.addEventListener(dp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(dp,e),window.removeEventListener("storage",t)}}const Vm="nterminal.terminal.showScrollProgress",vp="nterminal:terminal-scroll-progress";function yp(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(Vm)!=="false"}catch{return!0}}function cT(e){if(typeof window<"u"){try{window.localStorage.setItem(Vm,e?"true":"false")}catch{}window.dispatchEvent(new CustomEvent(vp,{detail:e}))}return e}function X0(e){if(typeof window>"u")return()=>{};const t=s=>{s.key===Vm&&e()};return window.addEventListener(vp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(vp,e),window.removeEventListener("storage",t)}}const Xm="nterminal.shortcuts.workspace.v1",bp="nterminal:workspace-shortcuts",No=[{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"},{id:"history.toggle",label:"Toggle view history",group:"Panes",requiresPrimaryModifier:!0}],nh={"server.previous":Ei("ArrowUp",{ctrlKey:!0}),"server.next":Ei("ArrowDown",{ctrlKey:!0}),"tab.previous":Ei("ArrowLeft",{ctrlKey:!0}),"tab.next":Ei("ArrowRight",{ctrlKey:!0}),"tab.index":Ei("Digit",{ctrlKey:!0,altKey:!0}),"pane.index":Ei("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.right":Ei("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Ei("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"history.toggle":Ei("KeyH",{altKey:!0})},uT={"server.previous":Ei("BracketLeft",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"server.next":Ei("BracketRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"tab.previous":Ei("BracketLeft",{ctrlKey:!0,altKey:!0}),"tab.next":Ei("BracketRight",{ctrlKey:!0,altKey:!0}),"tab.index":Ei("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"pane.index":Ei("Digit",{ctrlKey:!0,altKey:!0}),"split.right":Ei("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Ei("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"history.toggle":Ei("KeyH",{altKey:!0})};function ea(){const e=Q0(nh);if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Xm);if(!t)return e;const s=JSON.parse(t);for(const a of No){const o=s[a.id];if(vT(o)){const c=J0(o,a);_T(c,uT[a.id])||(e[a.id]=c)}}}catch{return e}return e}function kb(){return JSON.stringify(ea())}function hT(e,t){const s=ea(),a=No.find(o=>o.id===e);return a&&(s[e]=J0(t,a),Qm(s)),s}function dT(e){const t=ea();return t[e]={...nh[e]},Qm(t),t}function fT(){const e=Q0(nh);return Qm(e),e}function Gm(e){if(typeof window>"u")return()=>{};const t=s=>{s.key===Xm&&e()};return window.addEventListener(bp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(bp,e),window.removeEventListener("storage",t)}}function pT(e,t){const s=iw(e);return!s||bT(s)||t.indexed&&tw(e)===null||t.requiresPrimaryModifier&&!ew(e)?null:{ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,code:t.indexed?"Digit":s}}function G0(e){const t=ea();for(const s of No){const a=t[s.id];if(!(!a||!yT(e,a))){if(s.indexed){if(a.code!=="Digit")continue;const o=tw(e);if(o!==null)return{id:s.id,index:o};continue}if(iw(e)===a.code)return{id:s.id,index:null}}}return null}function Zm(e){return Z0(ea()[e])}function Z0(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(ST(e.code)),t.join("+")}const mT=()=>Zm("split.right"),gT=()=>Zm("split.down");function Ei(e,t){return{ctrlKey:t.ctrlKey??!1,altKey:t.altKey??!1,shiftKey:t.shiftKey??!1,metaKey:t.metaKey??!1,code:e}}function Q0(e){return Object.fromEntries(Object.entries(e).map(([t,s])=>[t,{...s}]))}function _T(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey&&e.code===t.code}function Qm(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Xm,JSON.stringify(e))}catch{}window.dispatchEvent(new CustomEvent(bp))}}function J0(e,t){return t.requiresPrimaryModifier&&!ew(e)?{...nh[t.id]}:{ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,shiftKey:!!e.shiftKey,metaKey:!!e.metaKey,code:t.indexed?"Digit":e.code}}function ew(e){return e.ctrlKey||e.altKey||e.metaKey}function vT(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 yT(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey}function tw(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 iw(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 bT(e){return e==="ControlLeft"||e==="ControlRight"||e==="AltLeft"||e==="AltRight"||e==="ShiftLeft"||e==="ShiftRight"||e==="MetaLeft"||e==="MetaRight"}function ST(e){if(e==="Digit")return"1-9";const t=/^Digit([0-9])$/.exec(e);if(t?.[1])return t[1];const s=/^Key([A-Z])$/.exec(e);if(s?.[1])return s[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 wT="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 CT(e="nterminal",t=new Date){return{reason:"permission",message:wT,command:`sudo npm i -g ${e}@latest --prefer-online && nterminal restart-after-update`,detectedAt:t.toISOString()}}function xT(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 nw=3600*1e3,ET="local",Sp=new Set,fr=new Map;let _r={checking:!1,hasUpdates:!1,lastCheckedAt:null},Jm=null,Eo=null,zu=0,cr=null;function TT(e){return Sp.add(e),()=>{Sp.delete(e)}}function Db(){return _r}function kT(e){const t=AT();Jm=e,eg(),wp(e,t);const s=()=>{if(document.visibilityState!=="visible"||!vr(e,t))return;const a=_r.lastCheckedAt;(a===null||Date.now()-a>=nw)&&wp(e,t)};return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s),vr(e,t)&&NT()}}function DT(e,t){fr.set(e,sw(t)),il({..._r,hasUpdates:tg(),lastCheckedAt:Date.now()})}function Df(e){e===void 0?fr.clear():fr.set(e,!1),il({..._r,hasUpdates:tg()})}async function wp(e,t){if(!vr(e,t))return;if(cr&&cr.api===e&&cr.runId===t)return cr.promise;il({..._r,checking:!0});const s=RT(e,t).finally(()=>{cr?.promise===s&&(cr=null),vr(e,t)&&(il({..._r,checking:!1,lastCheckedAt:Date.now()}),MT(e,t))});return cr={api:e,runId:t,promise:s},s}async function RT(e,t){try{const s=await e.listAgents();if(!vr(e,t))return;const a=[{key:ET,check:()=>e.checkUpdate()},...s.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,sw(h))}catch{o.set(c.key,fr.get(c.key)??!1)}})),!vr(e,t))return;fr.clear();for(const[c,h]of o)fr.set(c,h);il({..._r,hasUpdates:tg()})}catch{}}function MT(e,t){vr(e,t)&&(eg(),Eo=window.setTimeout(()=>{Eo=null,vr(e,t)&&wp(e,t)},nw))}function NT(){zu+=1,eg(),Jm=null,cr=null,fr.clear(),il({checking:!1,hasUpdates:!1,lastCheckedAt:null})}function eg(){Eo!==null&&(window.clearTimeout(Eo),Eo=null)}function AT(){return zu+=1,zu}function vr(e,t){return Jm===e&&zu===t}function sw(e){return e.updateAvailable===!0}function tg(){return Array.from(fr.values()).some(Boolean)}function il(e){_r=e;for(const t of Array.from(Sp))t()}const LT=e=>new Promise(t=>setTimeout(t,e));function BT({api:e,onAgentRemoved:t}){const[s,a]=v.useState([{key:"local",id:null,name:"Local (main)"}]),[o,c]=v.useState({}),[h,f]=v.useState(!1),[g,p]=v.useState(null),[b,y]=v.useState(!1);function S(I,q){c(K=>({...K,[I]:{...K[I],...q}}))}const C=I=>I.id===null?e.getVersion():e.getAgentVersion(I.id),x=I=>I.id===null?e.checkUpdate():e.checkAgentUpdate(I.id),E=I=>I.id===null?e.runUpdate():e.runAgentUpdate(I.id);v.useEffect(()=>{let I=!1;return e.listAgents().then(q=>{if(I)return;const K=[{key:"local",id:null,name:"Local (main)"},...q.agents.map(z=>({key:z.id,id:z.id,name:z.name}))];a(K);for(const z of K)C(z).then(O=>S(z.key,{version:O,manualUpdate:O.manualUpdate??null})).catch(O=>S(z.key,{error:O instanceof Error?O.message:"unreachable"}))}).catch(()=>{}),()=>{I=!0}},[]);async function L(I){S(I.key,{busy:!0,status:"checking…",error:void 0});try{const q=await x(I);DT(I.key,q),S(I.key,{latestVersion:q.latestVersion,updateAvailable:q.updateAvailable,status:ae(q),...q.updateAvailable===!1?{manualUpdate:null}:{},busy:!1})}catch(q){S(I.key,{busy:!1,error:q instanceof Error?q.message:"check failed"})}}async function D(){f(!0),await Promise.all(s.map(I=>L(I))),f(!1)}async function j(I,q){const K=Date.now()+18e4;for(;Date.now()<K;){await LT(3e3);try{const z=await C(I);if(q&&z.runningVersion!==q.runningVersion)return z}catch{}}return null}async function U(I){let q=o[I.key]?.version;if(!q)try{q=await C(I),S(I.key,{version:q,manualUpdate:q.manualUpdate??null})}catch(O){return S(I.key,{busy:!1,error:O instanceof Error?O.message:"version check failed"}),"failed"}S(I.key,{busy:!0,status:"updating…",error:void 0});let K;try{K=await E(I)}catch(O){return S(I.key,{busy:!1,error:O instanceof Error?O.message:"update failed"}),"failed"}if(!K.ok){const O=K.manualUpdate??(xT(K.message)?CT():null);return O?(S(I.key,{busy:!1,status:"manual update required",error:void 0,manualUpdate:O}),"manual"):(S(I.key,{busy:!1,status:void 0,error:K.message}),"failed")}if(!K.changed)return S(I.key,{busy:!1,status:"already up to date",updateAvailable:!1,manualUpdate:null}),Df(I.key),"unchanged";S(I.key,{status:"restarting…"});const z=await j(I,q);return z?(S(I.key,{busy:!1,version:z,updateAvailable:!1,status:"updated",manualUpdate:z.manualUpdate??null}),Df(I.key),I.id===null&&(y(!0),p("Main server updated. Reload the page to use the new client.")),"updated"):(S(I.key,{busy:!1,status:void 0,error:"timed out — check the server log"}),"failed")}async function Z(I){if(!(I.id===null||!window.confirm([`Delete secondary server "${I.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
|
-
`)))){S(I.key,{busy:!0,status:"deleting…",error:void 0}),p(null);try{const K=await e.uninstallAgent(I.id);a(z=>z.filter(O=>O.key!==I.key)),c(z=>{const O={...z};return delete O[I.key],O}),Df(I.key),t?.(I.id),p(K.message)}catch(K){S(I.key,{busy:!1,status:void 0,error:K instanceof Error?K.message:"delete failed"})}}}async function ie(){f(!0),p(null);const I=s.filter(M=>M.id!==null),q=s.find(M=>M.id===null),K=await Promise.all(I.map(M=>U(M))),z=K.filter(M=>M==="failed").length;let O=K.filter(M=>M==="manual").length,se=null;if(q&&(se=await U(q),se==="manual"&&(O+=1),se==="updated")){z>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}z>0&&O>0?p("Some servers failed and some need manual update. Check each marked row."):z>0?p("Some secondary servers failed to update. Check their rows and retry."):O>0&&p("Some servers need manual update. Copy and run the command shown on each marked server."),f(!1)}function ne(I){return I?I.error?I.error:I.status?I.status:I.manualUpdate?"manual update required":I.version?`v${I.version.version}`:"…":"…"}function ae(I){return I.error?I.error:typeof I.updateAvailable=="boolean"?I.updateAvailable?`latest v${I.latestVersion??"available"}`:"up to date":"unknown"}function oe(I){const q=I?.version;return q?`npm package v${q.runningVersion}`:""}async function pe(I,q){try{await OT(q),S(I,{copiedCommand:!0}),window.setTimeout(()=>S(I,{copiedCommand:!1}),1800)}catch(K){S(I,{error:K instanceof Error?K.message:"copy failed"})}}return m.jsxs("section",{className:"security-section",children:[m.jsx("h3",{children:"Servers"}),m.jsxs("div",{className:"update-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{D()},disabled:h,children:"Check for updates"}),m.jsx("button",{type:"button",onClick:()=>{ie()},disabled:h,children:"Update all"})]}),g?m.jsx("p",{className:"settings-status",children:g}):null,b?m.jsxs("div",{className:"server-reload-required",role:"status",children:[m.jsx("span",{children:"Main server update is ready."}),m.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:"Reload page"})]}):null,m.jsx("ul",{className:"security-list",children:s.map(I=>{const q=o[I.key],K=oe(q),z=q?.manualUpdate??null,O=q?.version!==void 0&&q?.updateAvailable!==!1&&!q?.busy&&!h,se=I.id!==null&&!q?.busy&&!h;return m.jsxs("li",{children:[m.jsxs("div",{className:"server-row-main",children:[m.jsxs("div",{children:[m.jsx("span",{className:"security-item-label",children:I.name}),m.jsxs("span",{className:"security-item-meta",children:[K?`${K} — `:"",ne(q)]})]}),z?m.jsxs("div",{className:"server-manual-update",children:[m.jsx("span",{children:z.message}),m.jsxs("div",{className:"server-manual-command",children:[m.jsx("code",{children:z.command}),m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{pe(I.key,z.command)},children:q?.copiedCommand?"Copied":"Copy"})]})]}):null]}),m.jsxs("div",{className:"server-row-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{U(I)},disabled:!O,children:q?.busy?"…":"Update"}),I.id!==null?m.jsx("button",{type:"button",className:"server-delete-button",onClick:()=>{Z(I)},disabled:!se,children:"Delete"}):null]})]},I.key)})})]})}async function OT(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 ou=[{id:"appearance",label:"Appearance"},{id:"shortcuts",label:"Shortcuts"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"},{id:"diagnostics",label:"Diagnostics"},{id:"servers",label:"Servers"}];function zT({onClose:e,api:t,updateAvailable:s=!1,onNotificationAssetsChanged:a,onAgentRemoved:o}){const c=v.useMemo(()=>t??Vu(),[t]),[h,f]=v.useState(()=>gp()),[g,p]=v.useState(()=>_p()),[b,y]=v.useState(()=>yp()),[S,C]=v.useState(()=>mr()),[x,E]=v.useState(()=>ea()),[L,D]=v.useState(null),[j,U]=v.useState(null),[Z,ie]=v.useState("appearance"),[ne,ae]=v.useState(()=>I0()),[oe,pe]=v.useState(()=>Jr()),[I,q]=v.useState(()=>qm()),[K,z]=v.useState([]),[O,se]=v.useState([]),[M,X]=v.useState([]),[V,ye]=v.useState(5*1024*1024),[xe,k]=v.useState(!1),[Q,le]=v.useState(null),[fe,we]=v.useState(()=>Vr()),[Ce,ke]=v.useState(!1),[Ie,H]=v.useState(null),J=v.useRef(null),Ee=v.useRef(null),ve=v.useRef({appearance:null,shortcuts:null,notifications:null,security:null,diagnostics:null,servers:null}),ge=v.useMemo(()=>new Set(O),[O]),F=!PT(O,M);v.useEffect(()=>Y0(()=>f(gp())),[]),v.useEffect(()=>V0(()=>p(_p())),[]),v.useEffect(()=>X0(()=>y(yp())),[]),v.useEffect(()=>Am(()=>C(mr())),[]),v.useEffect(()=>Gm(()=>E(ea())),[]),v.useEffect(()=>K0(()=>pe(Jr())),[]),v.useEffect(()=>{const $=()=>we(Vr());$();const He=window.setInterval($,1500);return()=>window.clearInterval(He)},[]),v.useEffect(()=>{if(!L)return;const $=No.find(et=>et.id===L);if(!$)return;const He=et=>{if(et.preventDefault(),et.stopPropagation(),et.key==="Escape"){D(null),U(null);return}const ct=pT(et,$);if(!ct){U(UT($));return}E(hT(L,ct)),D(null),U(null)};return window.addEventListener("keydown",He,!0),()=>window.removeEventListener("keydown",He,!0)},[L]),v.useEffect(()=>{let $=!1;return c.listNotificationAssets().then(He=>{$||St(He)}).catch(He=>{$||le(qa(He))}),()=>{$=!0}},[c]);function me($){f(lu(Number($)))}function Se($){pe(Tb(Number($)))}function Le($){ie($);const He=Ee.current,et=ve.current[$];if(!He||!et)return;const ct=Math.max(0,Rb(et,He)-12);typeof He.scrollTo=="function"?He.scrollTo({top:ct,behavior:"smooth"}):He.scrollTop=ct}function qe(){const $=Ee.current;if(!$)return;if($.scrollTop+$.clientHeight>=$.scrollHeight-2){ie(ou[ou.length-1].id);return}let He="appearance";const et=$.scrollTop+Math.min(180,Math.max(48,$.clientHeight*.28));for(const ct of ou){const Jt=ve.current[ct.id];Jt&&Rb(Jt,$)<=et&&(He=ct.id)}ie(He)}function st($){E(dT($)),D(null),U(null)}function Ke(){E(fT()),D(null),U(null)}function St($){const He=$.assets.filter(et=>et.enabled).map(et=>et.id);z($.assets),se(He),X(He),ye($.maxFileBytes),le(null)}async function Hi(){if(ne){Eb(!1),ae(!1);return}let $=I;$==="default"&&($=await rT(),q($)),$==="granted"&&(Eb(!0),ae(!0))}async function Yn($){const He=$?.[0];if(He){if(He.size>V){le(`File must be ${Rf(V)} or smaller.`),li();return}if(He.type!=="video/mp4"&&He.type!=="video/webm"){le("Upload an MP4 or WebM video."),li();return}k(!0),le(null);try{await c.uploadNotificationAsset(He),St(await c.listNotificationAssets()),a?.()}catch(et){le(qa(et))}finally{k(!1),li()}}}async function lt($){k(!0),le(null);try{await c.deleteNotificationAsset($),St(await c.listNotificationAssets()),a?.()}catch(He){le(qa(He))}finally{k(!1)}}function li(){J.current&&(J.current.value="")}function Zi($,He){const et=new Set(O);if(He?et.add($):et.delete($),et.size===0){le("Keep at least one toast video selected.");return}le(null),se(Array.from(et))}async function _i(){if(O.length===0){le("Keep at least one toast video selected.");return}k(!0),le(null);try{const $=await c.updateNotificationAssetSelection({enabledAssetIds:O});St($),a?.()}catch($){le(qa($))}finally{k(!1)}}async function jt(){H(null),ke(!0);try{const $=await PE();H($?"Diagnostics copied.":"Copy failed in this browser."),we(Vr())}catch($){H(qa($))}finally{ke(!1)}}async function Ui(){H(null),ke(!0);try{const $=await eh("manual-settings");H(`Sent ${$.accepted} diagnostic events.`),we(Vr())}catch($){H(qa($))}finally{ke(!1)}}function vi(){HE(),we([]),H("Diagnostics cleared.")}return m.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-label":"Settings",onClick:e,children:m.jsxs("div",{className:"security-panel settings-panel",onClick:$=>$.stopPropagation(),children:[m.jsxs("header",{className:"security-panel-header",children:[m.jsx("h2",{children:"Settings"}),m.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:e,children:"×"})]}),m.jsxs("div",{className:"settings-layout",children:[m.jsx("nav",{className:"settings-nav","aria-label":"Settings categories",children:ou.map($=>m.jsxs("button",{type:"button","data-active":Z===$.id?"true":"false","aria-current":Z===$.id?"true":void 0,onClick:()=>Le($.id),children:[$.label,$.id==="servers"&&s?m.jsx("span",{className:"update-pulse-dot settings-update-dot","aria-hidden":"true"}):null]},$.id))}),m.jsxs("div",{ref:Ee,className:"settings-content",onScroll:qe,children:[m.jsxs("section",{id:"settings-appearance",ref:$=>{ve.current.appearance=$},className:"security-section settings-section",children:[m.jsx("h3",{children:"Appearance"}),m.jsx("div",{className:"settings-section-heading",children:m.jsxs("div",{children:[m.jsx("span",{className:"settings-control-title",children:"Theme"}),m.jsx("p",{className:"muted settings-control-description",children:"Choose the workspace and terminal color preset."})]})}),m.jsx("div",{className:"settings-theme-picker",role:"radiogroup","aria-label":"Interface theme",children:Mu.map($=>m.jsxs("button",{type:"button",className:"settings-theme-card",role:"radio","aria-checked":S===$.id,"data-active":S===$.id?"true":"false",onClick:()=>C(qx($.id)),style:{"--settings-theme-bg":$.tokens.bg,"--settings-theme-bg-2":$.tokens.bg2,"--settings-theme-sidebar":$.tokens.bgSidebar,"--settings-theme-line":$.tokens.line,"--settings-theme-fg":$.tokens.fg,"--settings-theme-fg-2":$.tokens.fg2,"--settings-theme-accent":$.tokens.accent,"--settings-theme-xterm-bg":$.xterm.background,"--settings-theme-xterm-fg":$.xterm.foreground,"--settings-theme-xterm-selection":$.xterm.selectionBackground},children:[m.jsxs("span",{className:"settings-theme-preview","aria-hidden":"true",children:[m.jsxs("span",{className:"settings-theme-preview-sidebar",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]}),m.jsxs("span",{className:"settings-theme-preview-main",children:[m.jsxs("span",{className:"settings-theme-preview-tabs",children:[m.jsx("span",{}),m.jsx("span",{})]}),m.jsxs("span",{className:"settings-theme-preview-terminal",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]})]})]}),m.jsxs("span",{className:"settings-theme-card-copy",children:[m.jsx("strong",{children:$.label}),m.jsx("small",{children:$.description})]})]},$.id))}),m.jsxs("label",{className:"settings-control",children:[m.jsx("span",{children:"Font size"}),m.jsxs("span",{className:"settings-control-value",children:[h,"px"]}),m.jsx("input",{type:"range",min:fp,max:pp,step:1,value:h,"aria-label":"Terminal font size",onChange:$=>me($.currentTarget.value)})]}),m.jsxs("div",{className:"settings-stepper-row",children:[m.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(lu(h-1)),children:"-"}),m.jsx("input",{type:"number",min:fp,max:pp,step:1,value:h,"aria-label":"Terminal font size value",onChange:$=>me($.currentTarget.value)}),m.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(lu(h+1)),children:"+"}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:()=>f(lu(Gr)),children:"Reset"})]}),m.jsxs("label",{className:"settings-control",children:[m.jsx("span",{children:"Font family"}),m.jsx("select",{value:g,"aria-label":"Terminal font family",onChange:$=>p(oT($.currentTarget.value)),children:Ou.map($=>m.jsx("option",{value:$.id,children:$.label},$.id))})]}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:b,onChange:$=>y(cT($.currentTarget.checked))}),"Show scroll progress"]})]}),m.jsxs("section",{id:"settings-shortcuts",ref:$=>{ve.current.shortcuts=$},className:"security-section settings-section",children:[m.jsxs("div",{className:"settings-section-heading",children:[m.jsx("h3",{children:"Shortcuts"}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:Ke,children:"Reset all"})]}),m.jsx("p",{className:"muted",children:"Defaults avoid Chrome's browser-tab shortcuts. Click a shortcut, then press the new key combo."}),j?m.jsx("p",{className:"settings-error",children:j}):null,m.jsx("ul",{className:"settings-shortcut-list","aria-label":"Workspace shortcuts",children:No.map($=>{const He=L===$.id;return m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsx("span",{className:"settings-shortcut-label",children:$.label}),m.jsx("span",{className:"settings-shortcut-group",children:$.group})]}),m.jsxs("div",{className:"settings-shortcut-actions",children:[m.jsx("button",{type:"button",className:"settings-shortcut-recorder","data-recording":He?"true":"false",onClick:()=>{D($.id),U(null)},children:He?"Press keys…":Z0(x[$.id])}),m.jsx("button",{type:"button",className:"secondary-button settings-shortcut-reset",onClick:()=>st($.id),children:"Reset"})]})]},$.id)})})]}),m.jsxs("section",{id:"settings-notifications",ref:$=>{ve.current.notifications=$},className:"security-section settings-section",children:[m.jsx("h3",{children:"Notifications"}),ih()?m.jsxs(m.Fragment,{children:[m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:ne&&I==="granted",onChange:()=>{Hi()},disabled:I==="denied"}),"System notification when page is hidden"]}),I==="denied"?m.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."}):m.jsx("p",{className:"muted",children:"Uses browser notifications only when this page isn't visible. Animated toast is controlled separately below."})]}):m.jsx("p",{className:"muted",children:"This browser doesn't expose the Notification API; animated toast and in-app badges can still work."}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:oe.enabled,onChange:$=>pe(eT($.currentTarget.checked))}),"Show animated completion toast"]}),m.jsxs("label",{className:"settings-control",children:[m.jsx("span",{children:"Toast duration"}),m.jsx("span",{className:"settings-control-value",children:oe.persistUntilDismissed?"Until closed":`${oe.durationSeconds}s`}),m.jsx("input",{type:"range",min:cp,max:up,step:.5,value:oe.durationSeconds,disabled:!oe.enabled||oe.persistUntilDismissed,"aria-label":"Completion toast duration",onChange:$=>Se($.currentTarget.value)})]}),m.jsxs("div",{className:"settings-stepper-row settings-duration-row",children:[m.jsx("input",{type:"number",min:cp,max:up,step:.5,value:oe.durationSeconds,disabled:!oe.enabled||oe.persistUntilDismissed,"aria-label":"Completion toast duration value",onChange:$=>Se($.currentTarget.value)}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",disabled:!oe.enabled||oe.persistUntilDismissed,onClick:()=>pe(Tb(xo)),children:"Reset"})]}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:oe.persistUntilDismissed,disabled:!oe.enabled,onChange:$=>pe(tT($.currentTarget.checked))}),"Keep toast until dismissed"]}),m.jsxs("div",{className:"settings-assets-header",children:[m.jsx("span",{children:"Toast videos"}),m.jsxs("span",{children:[Rf(V)," max"]})]}),m.jsx("input",{ref:J,type:"file",accept:"video/mp4,video/webm",className:"settings-asset-input","aria-label":"Upload toast video",onChange:$=>{Yn($.currentTarget.files)}}),m.jsx("button",{type:"button",className:"secondary-button settings-upload-button",disabled:xe,onClick:()=>J.current?.click(),children:"Upload video"}),Q?m.jsx("p",{className:"settings-error",children:Q}):null,K.length>0?m.jsx("ul",{className:"settings-asset-list","aria-label":"Toast videos",children:K.map($=>m.jsxs("li",{"data-enabled":ge.has($.id)?"true":"false",children:[m.jsxs("label",{className:"settings-asset-choice",children:[m.jsx("input",{type:"checkbox",checked:ge.has($.id),disabled:xe,"aria-label":`Use ${$.filename}`,onChange:He=>Zi($.id,He.currentTarget.checked)}),m.jsx("video",{src:$.url,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),m.jsxs("span",{className:"settings-asset-copy",children:[m.jsx("span",{children:$.filename}),m.jsx("small",{children:$.source==="built-in"?"Built-in":Rf($.size)})]})]}),$.source==="uploaded"?m.jsx("button",{type:"button",className:"secondary-button settings-asset-delete",disabled:xe,"aria-label":`Delete ${$.filename}`,onClick:()=>{lt($.id)},children:"x"}):null]},$.id))}):m.jsx("p",{className:"muted",children:"Built-in videos will be used."}),m.jsx("button",{type:"button",className:"secondary-button settings-save-assets-button",disabled:xe||K.length===0||!F,onClick:()=>{_i()},children:"Save selected videos"})]}),m.jsx("div",{id:"settings-security",ref:$=>{ve.current.security=$},className:"settings-section-group",children:m.jsx(BE,{api:c})}),m.jsxs("section",{id:"settings-diagnostics",ref:$=>{ve.current.diagnostics=$},className:"security-section settings-section",children:[m.jsxs("div",{className:"settings-section-heading",children:[m.jsxs("div",{children:[m.jsx("h3",{children:"Diagnostics"}),m.jsx("p",{className:"muted settings-control-description",children:"Recent browser lifecycle and auth transition events for troubleshooting."})]}),m.jsx("span",{className:"settings-diagnostics-count",children:fe.length})]}),m.jsxs("div",{className:"settings-diagnostics-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",disabled:Ce||fe.length===0,onClick:()=>{jt()},children:"Copy"}),m.jsx("button",{type:"button",className:"secondary-button",disabled:Ce||fe.length===0,onClick:()=>{Ui()},children:"Send"}),m.jsx("button",{type:"button",className:"secondary-button",disabled:Ce||fe.length===0,onClick:vi,children:"Clear"})]}),Ie?m.jsx("p",{className:"settings-status",children:Ie}):null,fe.length>0?m.jsx("ol",{className:"settings-diagnostics-list","aria-label":"Recent diagnostics",children:fe.slice(-8).reverse().map(($,He)=>m.jsxs("li",{children:[m.jsx("span",{children:jT($.at)}),m.jsx("strong",{children:$.event}),$.data?m.jsx("code",{children:HT($.data)}):null]},`${$.at}:${$.event}:${He}`))}):m.jsx("p",{className:"muted",children:"No diagnostics recorded yet."})]}),m.jsx("div",{id:"settings-servers",ref:$=>{ve.current.servers=$},className:"settings-section-group",children:m.jsx(BT,{api:c,...o?{onAgentRemoved:o}:{}})})]})]})]})})}function Rb(e,t){const s=e.getBoundingClientRect(),a=t.getBoundingClientRect();return s.top-a.top+t.scrollTop}function Rf(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 qa(e){return e instanceof Error?e.message:"Request failed."}function jT(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function HT(e){return Object.entries(e).slice(0,5).map(([t,s])=>`${t}=${String(s)}`).join(" ")}function UT(e){return e.indexed?"Press a shortcut ending in a number from 1 to 9.":e.requiresPrimaryModifier?"Use Ctrl, Alt, or Meta with another key.":"Press a complete shortcut."}function PT(e,t){if(e.length!==t.length)return!1;const s=new Set(t);return e.every(a=>s.has(a))}class Ur extends Error{constructor(t,s){super(s),this.status=t,this.name="UploadClientError"}status}function IT(e){const t=e.createXhr?.()??new XMLHttpRequest,s=new FormData,a=e.files.map((o,c)=>({fieldName:`file${c}`,relativePath:o.relativePath,size:o.file.size}));s.append("manifest",JSON.stringify({terminalId:e.terminalId,entries:a}));for(const[o,c]of e.files.entries())s.append(`file${o}`,c.file);return new Promise((o,c)=>{let h=!1;const f=()=>{e.signal?.removeEventListener("abort",b)},g=y=>{h||(h=!0,f(),o(y))},p=y=>{h||(h=!0,f(),c(y))},b=()=>{t.abort(),p(new Ur(0,"Upload aborted."))};if(e.signal?.aborted){p(new Ur(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{g(JSON.parse(t.responseText))}catch{p(new Ur(t.status,"Invalid upload response."))}return}p(new Ur(t.status,KT(t.responseText,t.statusText||`HTTP ${t.status}`)))},t.onerror=()=>p(new Ur(0,"Upload failed.")),t.onabort=()=>p(new Ur(0,"Upload aborted.")),t.ontimeout=()=>p(new Ur(0,"Upload timed out.")),t.send(s)})}function KT(e,t){try{const s=JSON.parse(e),a=typeof s.error=="string"?s.error:s.message;if(typeof a=="string"&&a.trim())return a}catch{}return t}const FT="modulepreload",qT=function(e){return"/"+e},Mb={},ig=function(t,s,a){let o=Promise.resolve();if(s&&s.length>0){let g=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=g(s.map(p=>{if(p=qT(p),p in Mb)return;Mb[p]=!0;const b=p.endsWith(".css"),y=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const S=document.createElement("link");if(S.rel=b?"stylesheet":FT,b||(S.as="script"),S.crossOrigin="",S.href=p,f&&S.setAttribute("nonce",f),document.head.appendChild(S),b)return new Promise((C,x)=>{S.addEventListener("load",C),S.addEventListener("error",()=>x(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)})},WT=v.lazy(()=>ig(()=>import("./MarkdownPreview-DvW1iSJP.js"),__vite__mapDeps([0,1])));function $T({api:e,activeTerminalId:t,activeTerminalCwd:s,onOpenFile:a}){const[o,c]=v.useState(null),[h,f]=v.useState(""),[g,p]=v.useState({}),[b,y]=v.useState(()=>new Set),[S,C]=v.useState(null),[x,E]=v.useState({type:"empty"}),[L,D]=v.useState("idle"),[j,U]=v.useState(null),Z=v.useRef(null),ie=v.useRef(null),ne=v.useRef(!1),ae=v.useRef(0),oe=v.useRef(null);oe.current===null&&t&&(oe.current=t);const pe=oe.current,I=t?Nf(t,s):null,q=o?[o.rootPath,h].filter(Boolean).join("/"):"",K=S?.path??null;v.useEffect(()=>(ne.current=!0,()=>{ne.current=!1,ae.current+=1,Ie()}),[]),v.useEffect(()=>{oe.current=t,ie.current=null;const F=t?Nf(t,s):null;z(t,F)},[e]),v.useEffect(()=>{if(!pe||t!==pe)return;const F=Nf(pe,s);F!==ie.current&&z(pe,F)},[pe,t,s]);async function z(F,me=I){const Se=H();if(ie.current=me,Ie(),c(null),f(""),p({}),y(new Set),C(null),E({type:"empty"}),U(null),!F){D("idle");return}D("loading");try{const Le=await e.createFileRoot({terminalId:F});if(!J(Se))return;c({rootToken:Le.rootToken,rootPath:Le.rootPath});const qe=await e.listFiles({rootToken:Le.rootToken,path:""});if(!J(Se))return;M(qe),D("idle")}catch(Le){if(await Ee(Le,Se))return;J(Se)&&(U(rr(Le)),D("idle"))}}async function O(F=h,me=o){if(!me)return;const Se=H();D("loading"),U(null);try{const Le=await e.listFiles({rootToken:me.rootToken,path:F});if(!J(Se))return;M(Le),D("idle")}catch(Le){if(await Ee(Le,Se))return;J(Se)&&(U(rr(Le)),D("idle"))}}async function se(){oe.current=t,await z(t,I)}function M(F){p(me=>({...me,[F.path]:VT(F.entries)}))}async function X(F){if(!(!Mf(F)||!o)){if(C(F),U(null),F.kind==="directory"){f(F.path),ke(),await ye(F);return}if(f(Pr(F.path)),F.editable){await k(F);return}F.previewKind!=="none"&&await le(F,F.previewKind)}}async function V(F){if(!(!Mf(F)||!o)){if(C(F),U(null),F.kind==="directory"){f(F.path),ke(),await ye(F);return}if(f(Pr(F.path)),F.editable){await Q(F);return}F.previewKind!=="none"&&await le(F,F.previewKind)}}async function ye(F){if(b.has(F.path)){y(me=>{const Se=new Set(me);return Se.delete(F.path),Se});return}y(me=>new Set(me).add(F.path)),await O(F.path)}function xe(F,me){F.key==="Enter"&&(F.preventDefault(),V(me))}async function k(F){if(!o)return;const me=H();D("loading"),Ie();try{const Se=await e.readFile({rootToken:o.rootToken,path:F.path});if(!J(me))return;E({type:"text-preview",file:F,read:Se}),D("idle")}catch(Se){if(await Ee(Se,me))return;J(me)&&(U(rr(Se)),D("idle"))}}async function Q(F){if(!o)return;const me=H();D("loading");try{await a({rootToken:o.rootToken,path:F.path}),J(me)&&D("idle")}catch(Se){if(await Ee(Se,me))return;J(me)&&(U(rr(Se)),D("idle"))}}async function le(F,me){if(!o)return;const Se=H();D("loading"),Ie();try{const Le=await e.previewFile({rootToken:o.rootToken,path:F.path});if(!J(Se))return;const qe=URL.createObjectURL(Le);if(!J(Se)){URL.revokeObjectURL(qe);return}Z.current=qe,E({type:"preview",file:F,previewKind:me,url:qe}),D("idle")}catch(Le){if(await Ee(Le,Se))return;J(Se)&&(U(rr(Le)),D("idle"))}}async function fe(F){if(!o)return;const me=F==="file"?"New file":"New folder",Se=window.prompt(me,""),Le=S?S.kind==="directory"?S.path:Pr(S.path):h,qe=Nb(Se,Le);if(qe){U(null);try{const st=await e.createFileEntry({rootToken:o.rootToken,path:qe,kind:F});C(st.entry),await O(Le)}catch(st){if(await Ee(st))return;U(rr(st))}}}async function we(){if(!o||!S)return;const F=window.prompt("Move selected entry",S.path),me=Nb(F,"");if(!me||me===S.path)return;const Se=Pr(S.path),Le=Pr(me);U(null);try{const qe=await e.moveFileEntry({rootToken:o.rootToken,sourcePath:S.path,destinationPath:me});C(qe.entry),f(qe.entry.kind==="directory"?qe.entry.path:Pr(qe.entry.path)),ke(),await O(Se),Le!==Se&&await O(Le)}catch(qe){if(await Ee(qe))return;U(rr(qe))}}async function Ce(){if(!o||!S)return;const F=S.path,me=Pr(F);U(null);try{const Se=await e.previewDeleteFileEntry({rootToken:o.rootToken,path:S.path}),Le=Se.descendantCount>0?` and ${Se.descendantCount} nested item${Se.descendantCount===1?"":"s"}`:"";if(!window.confirm(`Delete ${Se.path}${Le}?`))return;await e.deleteFileEntry({rootToken:o.rootToken,path:S.path,previewToken:Se.previewToken}),C(null),f(me),y(qe=>{const st=new Set(qe);for(const Ke of qe)(Ke===F||Ke.startsWith(`${F}/`))&&st.delete(Ke);return st}),ke(),await O(me)}catch(Se){if(await Ee(Se))return;U(rr(Se))}}function ke(){ae.current+=1,Ie(),E({type:"empty"})}function Ie(){Z.current&&(URL.revokeObjectURL(Z.current),Z.current=null)}function H(){return ae.current+=1,ae.current}function J(F){return ne.current&&F===ae.current}async function Ee(F,me){return XT(F)?(me!==void 0&&!J(me)||await z(t,I),!0):!1}function ve(F,me){const Se=Mf(F),Le=F.kind==="directory"&&b.has(F.path),qe=g[F.path]??[],st={"--file-tree-depth":me};return m.jsxs(mi.Fragment,{children:[m.jsxs("button",{type:"button",className:"file-entry-button","data-kind":F.kind,"data-expanded":Le,"data-active":K===F.path,disabled:!Se,style:st,"aria-expanded":F.kind==="directory"?Le:void 0,"aria-label":`${F.kind==="directory"?"Open folder":"Open file"} ${F.name}`,title:F.kind==="directory"?"Expand or collapse folder":"Click to preview. Double-click or press Enter to open.",onClick:()=>{X(F)},onDoubleClick:()=>{V(F)},onKeyDown:Ke=>xe(Ke,F),children:[m.jsx("span",{className:"file-entry-disclosure","aria-hidden":"true",children:F.kind==="directory"?Le?"▾":"▸":""}),m.jsx("span",{className:"file-entry-name",children:F.name}),m.jsx("small",{children:YT(F)})]}),Le?m.jsx("div",{className:"file-tree-children",role:"group",children:qe.map(Ke=>ve(Ke,me+1))}):null]},F.path)}const ge=g[""]??[];return m.jsxs("section",{className:"file-explorer","aria-label":"Files","aria-busy":L==="loading",children:[m.jsxs("header",{className:"file-explorer-header",children:[m.jsx("div",{className:"file-explorer-path",title:q,children:q||"No active pane"}),m.jsxs("div",{className:"file-explorer-toolbar","aria-label":"File actions",children:[m.jsx("button",{type:"button","aria-label":"Refresh files",title:"Refresh",disabled:!t,onClick:()=>{se()},children:"↻"}),m.jsx("button",{type:"button","aria-label":"New file",title:"New file",disabled:!o,onClick:()=>{fe("file")},children:"+"}),m.jsx("button",{type:"button","aria-label":"New folder",title:"New folder",disabled:!o,onClick:()=>{fe("directory")},children:"▣"})]})]}),j?m.jsx("div",{className:"file-explorer-alert",role:"alert",children:j}):null,m.jsxs("div",{className:"file-explorer-layout",children:[m.jsx("div",{className:"file-tree","aria-label":q?`Files in ${q}`:"Files",children:ge.map(F=>ve(F,0))}),m.jsxs("section",{className:"file-detail","aria-label":"File detail",children:[m.jsxs("div",{className:"file-detail-header",children:[m.jsx("strong",{children:S?.name??"detail"}),m.jsxs("div",{className:"file-detail-actions",children:[m.jsx("button",{type:"button","aria-label":"Move selected entry",disabled:!S,onClick:()=>{we()},children:"Move"}),m.jsx("button",{type:"button","aria-label":"Delete selected entry",disabled:!S,onClick:()=>{Ce()},children:"Delete"})]})]}),L==="loading"?m.jsx("div",{className:"file-detail-empty",children:"loading"}):null,x.type==="empty"&&L!=="loading"?m.jsx("div",{className:"file-detail-empty",children:"No file selected"}):null,x.type==="preview"?m.jsxs("div",{className:"file-preview-frame",children:[x.previewKind==="image"?m.jsx("img",{src:x.url,alt:x.file.name}):null,x.previewKind==="pdf"?m.jsx("iframe",{src:x.url,title:x.file.name}):null]}):null,x.type==="text-preview"&&x.read.language==="markdown"?m.jsx("div",{className:"file-markdown-preview","aria-label":`Preview for ${x.file.name}`,children:m.jsx(v.Suspense,{fallback:m.jsx("div",{className:"file-markdown-preview-loading",children:"loading preview"}),children:m.jsx(WT,{content:x.read.content})})}):null,x.type==="text-preview"&&x.read.language==="text"?m.jsx("pre",{className:"file-text-preview","aria-label":`Preview for ${x.file.name}`,children:x.read.content}):null]})]})]})}function Mf(e){return e.kind==="directory"||e.editable||e.previewKind!=="none"}function YT(e){return e.kind==="directory"?"dir":e.editable?"edit":e.previewKind!=="none"?e.previewKind:"unsupported"}function Nf(e,t){return`${e}\0${t??""}`}function VT(e){return[...e].sort((t,s)=>t.kind==="directory"&&s.kind!=="directory"?-1:t.kind!=="directory"&&s.kind==="directory"?1:t.name.localeCompare(s.name))}function Pr(e){const t=e.split("/").filter(Boolean);return t.pop(),t.join("/")}function Nb(e,t){if(e===null)return null;const s=e.trim().replace(/^\/+/,"").replace(/\/{2,}/g,"/").replace(/\/$/,"");return s?!t||s.includes("/")?s:`${t}/${s}`:null}function rr(e){return e instanceof Error?e.message:"Request failed"}function XT(e){return e instanceof Ns&&e.status===409&&e.message==="terminal_cwd_changed"}const GT=v.lazy(()=>ig(()=>import("./MarkdownPreview-DvW1iSJP.js"),__vite__mapDeps([0,1])));function Ab({api:e,editor:t,canClose:s,onClose:a}){const[o,c]=v.useState(t.read),[h,f]=v.useState(t.read.content),[g,p]=v.useState("idle"),[b,y]=v.useState(null),[S,C]=v.useState(!1),[x,E]=v.useState("edit"),L=v.useRef(t),D=v.useRef(t.read),j=v.useRef(t.read.content),U=v.useRef(!1),Z=v.useRef(!1),ie=v.useRef(0),ne=h!==o.content&&g!=="saving"&&!S;v.useEffect(()=>(Z.current=!0,()=>{Z.current=!1,ie.current+=1}),[]),v.useEffect(()=>{ie.current+=1,U.current=!1,L.current=t,D.current=t.read,j.current=t.read.content,c(t.read),f(t.read.content),p("idle"),y(null),C(!1),E("edit")},[t.id,t.read]),v.useEffect(()=>{L.current=t},[t]),v.useEffect(()=>{D.current=o},[o]),v.useEffect(()=>{j.current=h},[h]),v.useEffect(()=>{if(h===o.content||S)return;const q=window.setInterval(()=>{!U.current&&j.current!==D.current.content&&ae()},1e3);return()=>window.clearInterval(q)},[h===o.content,S,t.id]);async function ae(){if(U.current)return;const q=j.current,K=D.current;if(q===K.content)return;const z=L.current,O=ie.current;U.current=!0,p("saving"),y(null),C(!1);try{const se=await e.writeFile({rootToken:z.rootToken,path:z.path,content:q,expectedVersion:K.version});if(!Z.current||O!==ie.current)return;const M={...K,content:q,version:se.version};D.current=M,c(M),p(j.current===q?"saved":"idle")}catch(se){if(!Z.current||O!==ie.current)return;if(se instanceof Ns&&se.status===409){C(!0),p("idle");return}y(ZT(se)),p("idle")}finally{O===ie.current&&(U.current=!1)}}const oe=g==="saving"?"saving":g==="saved"?"saved":o.language,pe=o.language==="markdown",I=pe&&x==="preview";return m.jsxs("section",{className:"editor-pane","aria-label":`Editor pane ${t.title}`,children:[m.jsxs("header",{className:"editor-pane-header",children:[m.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),m.jsx("strong",{children:t.title}),m.jsx("span",{className:"terminal-pane-spacer"}),m.jsx("span",{className:"terminal-pane-state",children:oe}),m.jsx("button",{type:"button","aria-label":`Save ${t.title}`,disabled:!ne,onClick:()=>{ae()},children:"Save"}),pe?m.jsx("button",{type:"button","aria-label":`${I?"Edit":"Preview"} ${t.title}`,onClick:()=>E(q=>q==="preview"?"edit":"preview"),children:I?"Edit":"Preview"}):null,s?m.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close editor ${t.title}`,onClick:a,children:"x"}):null]}),b?m.jsx("div",{className:"editor-pane-alert",role:"alert",children:b}):null,S?m.jsx("div",{className:"editor-pane-alert",role:"alert",children:"File changed on disk."}):null,I?m.jsx("div",{className:"editor-markdown-preview","aria-label":`Markdown preview for ${t.title}`,children:m.jsx(v.Suspense,{fallback:m.jsx("div",{className:"editor-markdown-preview-loading",children:"loading preview"}),children:m.jsx(GT,{content:h})})}):m.jsx("textarea",{className:"editor-pane-textarea","aria-label":`Editor for ${t.title}`,spellCheck:!1,value:h,onChange:q=>{const K=q.target.value;j.current=K,f(K),p("idle"),y(null),C(!1)}})]})}function ZT(e){return e instanceof Error?e.message:"Request failed"}var QT=2,JT=1,ek=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,s=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(s.getPropertyValue("height")),o=Math.max(0,parseInt(s.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,g=h.right+h.left,p=a-f,b=o-g-t;return{cols:Math.max(QT,Math.floor(b/e.css.cell.width)),rows:Math.max(JT,Math.floor(p/e.css.cell.height))}}};var rw=Object.defineProperty,tk=Object.getOwnPropertyDescriptor,ik=(e,t)=>{for(var s in t)rw(e,s,{get:t[s],enumerable:!0})},$t=(e,t,s,a)=>{for(var o=a>1?void 0:a?tk(t,s):t,c=e.length-1,h;c>=0;c--)(h=e[c])&&(o=(a?h(t,s,o):h(o))||o);return a&&o&&rw(t,s,o),o},De=(e,t)=>(s,a)=>t(s,a,e),Lb="Terminal input",Cp={get:()=>Lb,set:e=>Lb=e},Bb="Too much output to announce, navigate to rows manually to read",xp={get:()=>Bb,set:e=>Bb=e};function nk(e){return e.replace(/\r?\n/g,"\r")}function sk(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function rk(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function ak(e,t,s,a){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");aw(o,t,s,a)}}function aw(e,t,s,a){e=nk(e),e=sk(e,s.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(e,!0),t.value=""}function lw(e,t,s){let a=s.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 Ob(e,t,s,a,o){lw(e,t,s),o&&a.rightClickSelect(e),t.value=a.selectionText,t.select()}function hr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function sh(e,t=0,s=e.length){let a="";for(let o=t;o<s;++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 lk=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)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<s;++c){let h=e.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=s)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}},ok=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let a=0,o,c,h,f,g=0,p=0;if(this.interim[0]){let S=!1,C=this.interim[0];C&=(C&224)===192?31:(C&240)===224?15:7;let x=0,E;for(;(E=this.interim[++x]&63)&&x<4;)C<<=6,C|=E;let L=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=L-x;for(;p<D;){if(p>=s)return 0;if(E=e[p++],(E&192)!==128){p--,S=!0;break}else this.interim[x++]=E,C<<=6,C|=E&63}S||(L===2?C<128?p--:t[a++]=C:L===3?C<2048||C>=55296&&C<=57343||C===65279||(t[a++]=C):C<65536||C>1114111||(t[a++]=C)),this.interim.fill(0)}let b=s-4,y=p;for(;y<s;){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>=s)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(g=(o&31)<<6|c&63,g<128){y--;continue}t[a++]=g}else if((o&240)===224){if(y>=s)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=s)return this.interim[0]=o,this.interim[1]=c,a;if(h=e[y++],(h&192)!==128){y--;continue}if(g=(o&15)<<12|(c&63)<<6|h&63,g<2048||g>=55296&&g<=57343||g===65279)continue;t[a++]=g}else if((o&248)===240){if(y>=s)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=s)return this.interim[0]=o,this.interim[1]=c,a;if(h=e[y++],(h&192)!==128){y--;continue}if(y>=s)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=h,a;if(f=e[y++],(f&192)!==128){y--;continue}if(g=(o&7)<<18|(c&63)<<12|(h&63)<<6|f&63,g<65536||g>1114111)continue;t[a++]=g}}return a}},ow="",dr=" ",qo=class cw{constructor(){this.fg=0,this.bg=0,this.extended=new ju}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 cw;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}},ju=class uw{constructor(t=0,s=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=s}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 uw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Hn=class hw extends qo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ju,this.combinedData=""}static fromCharData(t){let s=new hw;return s.setFromCharData(t),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?hr(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 s=!1;if(t[1].length>2)s=!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:s=!0}else s=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;s&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},zb="di$target",Ep="di$dependencies",Af=new Map;function ck(e){return e[Ep]||[]}function Mi(e){if(Af.has(e))return Af.get(e);let t=function(s,a,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");uk(t,s,o)};return t._id=e,Af.set(e,t),t}function uk(e,t,s){t[zb]===t?t[Ep].push({id:e,index:s}):(t[Ep]=[{id:e,index:s}],t[zb]=t)}var Xi=Mi("BufferService"),dw=Mi("CoreMouseService"),sa=Mi("CoreService"),hk=Mi("CharsetService"),ng=Mi("InstantiationService"),fw=Mi("LogService"),Gi=Mi("OptionsService"),pw=Mi("OscLinkService"),dk=Mi("UnicodeService"),Wo=Mi("DecorationService"),Tp=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let a=[],o=this._optionsService.rawOptions.linkHandler,c=new Hn,h=s.getTrimmedLength(),f=-1,g=-1,p=!1;for(let b=0;b<h;b++)if(!(g===-1&&!s.hasContent(b))){if(s.loadCell(b,c),c.hasExtendedAttrs()&&c.extended.urlId)if(g===-1){g=b,f=c.extended.urlId;continue}else p=c.extended.urlId!==f;else g!==-1&&(p=!0);if(p||g!==-1&&b===h-1){let y=this._oscLinkService.getLinkData(f)?.uri;if(y){let S={start:{x:g+1,y:e},end:{x:b+(!p&&b===h-1?1:0),y:e}},C=!1;if(!o?.allowNonHttpProtocols)try{let x=new URL(y);["http:","https:"].includes(x.protocol)||(C=!0)}catch{C=!0}C||a.push({text:y,range:S,activate:(x,E)=>o?o.activate(x,E,S):fk(x,E),hover:(x,E)=>o?.hover?.(x,E,S),leave:(x,E)=>o?.leave?.(x,E,S)})}p=!1,c.hasExtendedAttrs()&&c.extended.urlId?(g=b,f=c.extended.urlId):(g=-1,f=-1)}}t(a)}};Tp=$t([De(0,Xi),De(1,Gi),De(2,pw)],Tp);function fk(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
16
|
-
|
|
17
|
-
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var rh=Mi("CharSizeService"),Ls=Mi("CoreBrowserService"),sg=Mi("MouseService"),Bs=Mi("RenderService"),pk=Mi("SelectionService"),mw=Mi("CharacterJoinerService"),al=Mi("ThemeService"),gw=Mi("LinkProviderService"),mk=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?jb.isErrorNoTelemetry(e)?new jb(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)}},gk=new mk;function bu(e){_k(e)||gk.onUnexpectedError(e)}var kp="Canceled";function _k(e){return e instanceof vk?!0:e instanceof Error&&e.name===kp&&e.message===kp}var vk=class extends Error{constructor(){super(kp),this.name=this.message}};function yk(e){return new Error(`Illegal argument: ${e}`)}var jb=class Dp extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Dp)return t;let s=new Dp;return s.message=t.message,s.stack=t.stack,s}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Rp=class _w extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,_w.prototype)}};function vn(e,t=0){return e[e.length-(1+t)]}var bk;(e=>{function t(c){return c<0}e.isLessThan=t;function s(c){return c<=0}e.isLessThanOrEqual=s;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})(bk||={});function Sk(e,t){let s=this,a=!1,o;return function(){return a||(a=!0,t||(o=e.apply(s,arguments))),o}}var vw;(e=>{function t(Z){return Z&&typeof Z=="object"&&typeof Z[Symbol.iterator]=="function"}e.is=t;let s=Object.freeze([]);function a(){return s}e.empty=a;function*o(Z){yield Z}e.single=o;function c(Z){return t(Z)?Z:o(Z)}e.wrap=c;function h(Z){return Z||s}e.from=h;function*f(Z){for(let ie=Z.length-1;ie>=0;ie--)yield Z[ie]}e.reverse=f;function g(Z){return!Z||Z[Symbol.iterator]().next().done===!0}e.isEmpty=g;function p(Z){return Z[Symbol.iterator]().next().value}e.first=p;function b(Z,ie){let ne=0;for(let ae of Z)if(ie(ae,ne++))return!0;return!1}e.some=b;function y(Z,ie){for(let ne of Z)if(ie(ne))return ne}e.find=y;function*S(Z,ie){for(let ne of Z)ie(ne)&&(yield ne)}e.filter=S;function*C(Z,ie){let ne=0;for(let ae of Z)yield ie(ae,ne++)}e.map=C;function*x(Z,ie){let ne=0;for(let ae of Z)yield*ie(ae,ne++)}e.flatMap=x;function*E(...Z){for(let ie of Z)yield*ie}e.concat=E;function L(Z,ie,ne){let ae=ne;for(let oe of Z)ae=ie(ae,oe);return ae}e.reduce=L;function*D(Z,ie,ne=Z.length){for(ie<0&&(ie+=Z.length),ne<0?ne+=Z.length:ne>Z.length&&(ne=Z.length);ie<ne;ie++)yield Z[ie]}e.slice=D;function j(Z,ie=Number.POSITIVE_INFINITY){let ne=[];if(ie===0)return[ne,Z];let ae=Z[Symbol.iterator]();for(let oe=0;oe<ie;oe++){let pe=ae.next();if(pe.done)return[ne,e.empty()];ne.push(pe.value)}return[ne,{[Symbol.iterator](){return ae}}]}e.consume=j;async function U(Z){let ie=[];for await(let ne of Z)ie.push(ne);return Promise.resolve(ie)}e.asyncToArray=U})(vw||={});function ta(e){if(vw.is(e)){let t=[];for(let s of e)if(s)try{s.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 wk(...e){return At(()=>ta(e))}function At(e){return{dispose:Sk(()=>{e()})}}var yw=class bw{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{ta(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?bw.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)}};yw.DISABLE_DISPOSED_WARNING=!1;var pr=yw,Xe=class{constructor(){this._store=new pr,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)}};Xe.None=Object.freeze({dispose(){}});var nl=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}},Ms=typeof window=="object"?window:globalThis,Mp=class Np{constructor(t){this.element=t,this.next=Np.Undefined,this.prev=Np.Undefined}};Mp.Undefined=new Mp(void 0);var Ot=Mp,Hb=class{constructor(){this._first=Ot.Undefined,this._last=Ot.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ot.Undefined}clear(){let e=this._first;for(;e!==Ot.Undefined;){let t=e.next;e.prev=Ot.Undefined,e.next=Ot.Undefined,e=t}this._first=Ot.Undefined,this._last=Ot.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new Ot(e);if(this._first===Ot.Undefined)this._first=s,this._last=s;else if(t){let o=this._last;this._last=s,s.prev=o,o.next=s}else{let o=this._first;this._first=s,s.next=o,o.prev=s}this._size+=1;let a=!1;return()=>{a||(a=!0,this._remove(s))}}shift(){if(this._first!==Ot.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ot.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ot.Undefined&&e.next!==Ot.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ot.Undefined&&e.next===Ot.Undefined?(this._first=Ot.Undefined,this._last=Ot.Undefined):e.next===Ot.Undefined?(this._last=this._last.prev,this._last.next=Ot.Undefined):e.prev===Ot.Undefined&&(this._first=this._first.next,this._first.prev=Ot.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ot.Undefined;)yield e.element,e=e.next}},Ck=globalThis.performance&&typeof globalThis.performance.now=="function",xk=class Sw{static create(t){return new Sw(t)}constructor(t){this._now=Ck&&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}},ji;(e=>{e.None=()=>Xe.None;function t(K,z){return y(K,()=>{},0,void 0,!0,void 0,z)}e.defer=t;function s(K){return(z,O=null,se)=>{let M=!1,X;return X=K(V=>{if(!M)return X?X.dispose():M=!0,z.call(O,V)},null,se),M&&X.dispose(),X}}e.once=s;function a(K,z,O){return p((se,M=null,X)=>K(V=>se.call(M,z(V)),null,X),O)}e.map=a;function o(K,z,O){return p((se,M=null,X)=>K(V=>{z(V),se.call(M,V)},null,X),O)}e.forEach=o;function c(K,z,O){return p((se,M=null,X)=>K(V=>z(V)&&se.call(M,V),null,X),O)}e.filter=c;function h(K){return K}e.signal=h;function f(...K){return(z,O=null,se)=>{let M=wk(...K.map(X=>X(V=>z.call(O,V))));return b(M,se)}}e.any=f;function g(K,z,O,se){let M=O;return a(K,X=>(M=z(M,X),M),se)}e.reduce=g;function p(K,z){let O,se={onWillAddFirstListener(){O=K(M.fire,M)},onDidRemoveLastListener(){O?.dispose()}},M=new be(se);return z?.add(M),M.event}function b(K,z){return z instanceof Array?z.push(K):z&&z.add(K),K}function y(K,z,O=100,se=!1,M=!1,X,V){let ye,xe,k,Q=0,le,fe={leakWarningThreshold:X,onWillAddFirstListener(){ye=K(Ce=>{Q++,xe=z(xe,Ce),se&&!k&&(we.fire(xe),xe=void 0),le=()=>{let ke=xe;xe=void 0,k=void 0,(!se||Q>1)&&we.fire(ke),Q=0},typeof O=="number"?(clearTimeout(k),k=setTimeout(le,O)):k===void 0&&(k=0,queueMicrotask(le))})},onWillRemoveListener(){M&&Q>0&&le?.()},onDidRemoveLastListener(){le=void 0,ye.dispose()}},we=new be(fe);return V?.add(we),we.event}e.debounce=y;function S(K,z=0,O){return e.debounce(K,(se,M)=>se?(se.push(M),se):[M],z,void 0,!0,void 0,O)}e.accumulate=S;function C(K,z=(se,M)=>se===M,O){let se=!0,M;return c(K,X=>{let V=se||!z(X,M);return se=!1,M=X,V},O)}e.latch=C;function x(K,z,O){return[e.filter(K,z,O),e.filter(K,se=>!z(se),O)]}e.split=x;function E(K,z=!1,O=[],se){let M=O.slice(),X=K(xe=>{M?M.push(xe):ye.fire(xe)});se&&se.add(X);let V=()=>{M?.forEach(xe=>ye.fire(xe)),M=null},ye=new be({onWillAddFirstListener(){X||(X=K(xe=>ye.fire(xe)),se&&se.add(X))},onDidAddFirstListener(){M&&(z?setTimeout(V):V())},onDidRemoveLastListener(){X&&X.dispose(),X=null}});return se&&se.add(ye),ye.event}e.buffer=E;function L(K,z){return(O,se,M)=>{let X=z(new j);return K(function(V){let ye=X.evaluate(V);ye!==D&&O.call(se,ye)},void 0,M)}}e.chain=L;let D=Symbol("HaltChainable");class j{constructor(){this.steps=[]}map(z){return this.steps.push(z),this}forEach(z){return this.steps.push(O=>(z(O),O)),this}filter(z){return this.steps.push(O=>z(O)?O:D),this}reduce(z,O){let se=O;return this.steps.push(M=>(se=z(se,M),se)),this}latch(z=(O,se)=>O===se){let O=!0,se;return this.steps.push(M=>{let X=O||!z(M,se);return O=!1,se=M,X?M:D}),this}evaluate(z){for(let O of this.steps)if(z=O(z),z===D)break;return z}}function U(K,z,O=se=>se){let se=(...ye)=>V.fire(O(...ye)),M=()=>K.on(z,se),X=()=>K.removeListener(z,se),V=new be({onWillAddFirstListener:M,onDidRemoveLastListener:X});return V.event}e.fromNodeEventEmitter=U;function Z(K,z,O=se=>se){let se=(...ye)=>V.fire(O(...ye)),M=()=>K.addEventListener(z,se),X=()=>K.removeEventListener(z,se),V=new be({onWillAddFirstListener:M,onDidRemoveLastListener:X});return V.event}e.fromDOMEventEmitter=Z;function ie(K){return new Promise(z=>s(K)(z))}e.toPromise=ie;function ne(K){let z=new be;return K.then(O=>{z.fire(O)},()=>{z.fire(void 0)}).finally(()=>{z.dispose()}),z.event}e.fromPromise=ne;function ae(K,z){return K(O=>z.fire(O))}e.forward=ae;function oe(K,z,O){return z(O),K(se=>z(se))}e.runAndSubscribe=oe;class pe{constructor(z,O){this._observable=z,this._counter=0,this._hasChanged=!1;let se={onWillAddFirstListener:()=>{z.addObserver(this)},onDidRemoveLastListener:()=>{z.removeObserver(this)}};this.emitter=new be(se),O&&O.add(this.emitter)}beginUpdate(z){this._counter++}handlePossibleChange(z){}handleChange(z,O){this._hasChanged=!0}endUpdate(z){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function I(K,z){return new pe(K,z).emitter.event}e.fromObservable=I;function q(K){return(z,O,se)=>{let M=0,X=!1,V={beginUpdate(){M++},endUpdate(){M--,M===0&&(K.reportChanges(),X&&(X=!1,z.call(O)))},handlePossibleChange(){},handleChange(){X=!0}};K.addObserver(V),K.reportChanges();let ye={dispose(){K.removeObserver(V)}};return se instanceof pr?se.add(ye):Array.isArray(se)&&se.push(ye),ye}}e.fromObservableLight=q})(ji||={});var Ap=class Lp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Lp._idPool++}`,Lp.all.add(this)}start(t){this._stopWatch=new xk,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}}};Ap.all=new Set,Ap._idPool=0;var Ek=Ap,Tk=-1,ww=class Cw{constructor(t,s,a=(Cw._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=s,this.name=a,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,s){let a=this.threshold;if(a<=0||s<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 ${s} listeners already. MOST frequent listener (${h}):`;console.warn(f),console.warn(c);let g=new Rk(f,c);this._errorHandler(g)}return()=>{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,s=0;for(let[a,o]of this._stacks)(!t||s<o)&&(t=[a,o],s=o);return t}};ww._idPool=1;var kk=ww,Dk=class xw{constructor(t){this.value=t}static create(){let t=new Error;return new xw(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
|
-
`).slice(2).join(`
|
|
23
|
-
`))}},Rk=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Mk=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Nk=0,Lf=class{constructor(e){this.value=e,this.id=Nk++}},Ak=2,Lk,be=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new kk(e?.onListenerError??bu,this._options?.leakWarningThreshold??Tk):void 0,this._perfMon=this._options?._profName?new Ek(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,s)=>{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],g=new Mk(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||bu)(g),Xe.None}if(this._disposed)return Xe.None;t&&(e=e.bind(t));let a=new Lf(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=Dk.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Lf?(this._deliveryQueue??=new Bk,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=At(()=>{o?.(),this._removeListener(a)});return s instanceof pr?s.add(c):Array.isArray(s)&&s.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,s=t.indexOf(e);if(s===-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[s]=void 0;let a=this._deliveryQueue.current===this;if(this._size*Ak<=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 s=this._options?.onListenerError||bu;if(!s){e.value(t);return}try{e.value(t)}catch(a){s(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 Lf)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}},Bk=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Bp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new be,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new be,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,s){if(this.getZoomLevel(s)===t)return;let a=this.getWindowId(s);this.mapWindowIdToZoomLevel.set(a,t),this._onDidChangeZoomLevel.fire(a)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,s){this.mapWindowIdToZoomFactor.set(this.getWindowId(s),t)}setFullscreen(t,s){if(this.isFullscreen(s)===t)return;let a=this.getWindowId(s);this.mapWindowIdToFullScreen.set(a,t),this._onDidChangeFullscreen.fire(a)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Bp.INSTANCE=new Bp;var rg=Bp;function Ok(e,t,s){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",s)}rg.INSTANCE.onDidChangeZoomLevel;function zk(e){return rg.INSTANCE.getZoomFactor(e)}rg.INSTANCE.onDidChangeFullscreen;var ll=typeof navigator=="object"?navigator.userAgent:"",Op=ll.indexOf("Firefox")>=0,jk=ll.indexOf("AppleWebKit")>=0,ag=ll.indexOf("Chrome")>=0,Hk=!ag&&ll.indexOf("Safari")>=0;ll.indexOf("Electron/")>=0;ll.indexOf("Android")>=0;var Bf=!1;if(typeof Ms.matchMedia=="function"){let e=Ms.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ms.matchMedia("(display-mode: fullscreen)");Bf=e.matches,Ok(Ms,e,({matches:s})=>{Bf&&t.matches||(Bf=s)})}var Va="en",zp=!1,jp=!1,Su=!1,Ew=!1,cu,wu=Va,Ub=Va,Uk,Ds,Zr=globalThis,Sn;typeof Zr.vscode<"u"&&typeof Zr.vscode.process<"u"?Sn=Zr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Sn=process);var Pk=typeof Sn?.versions?.electron=="string",Ik=Pk&&Sn?.type==="renderer";if(typeof Sn=="object"){zp=Sn.platform==="win32",jp=Sn.platform==="darwin",Su=Sn.platform==="linux",Su&&Sn.env.SNAP&&Sn.env.SNAP_REVISION,Sn.env.CI||Sn.env.BUILD_ARTIFACTSTAGINGDIRECTORY,cu=Va,wu=Va;let e=Sn.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);cu=t.userLocale,Ub=t.osLocale,wu=t.resolvedLanguage||Va,Uk=t.languagePack?.translationsConfigFile}catch{}Ew=!0}else typeof navigator=="object"&&!Ik?(Ds=navigator.userAgent,zp=Ds.indexOf("Windows")>=0,jp=Ds.indexOf("Macintosh")>=0,(Ds.indexOf("Macintosh")>=0||Ds.indexOf("iPad")>=0||Ds.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Su=Ds.indexOf("Linux")>=0,Ds?.indexOf("Mobi")>=0,wu=globalThis._VSCODE_NLS_LANGUAGE||Va,cu=navigator.language.toLowerCase(),Ub=cu):console.error("Unable to resolve platform.");var Tw=zp,ss=jp,Kk=Su,Pb=Ew,rs=Ds,ar=wu,Fk;(e=>{function t(){return ar}e.value=t;function s(){return ar.length===2?ar==="en":ar.length>=3?ar[0]==="e"&&ar[1]==="n"&&ar[2]==="-":!1}e.isDefaultVariant=s;function a(){return ar==="en"}e.isDefault=a})(Fk||={});var qk=typeof Zr.postMessage=="function"&&!Zr.importScripts;(()=>{if(qk){let e=[];Zr.addEventListener("message",s=>{if(s.data&&s.data.vscodeScheduleAsyncWork)for(let a=0,o=e.length;a<o;a++){let c=e[a];if(c.id===s.data.vscodeScheduleAsyncWork){e.splice(a,1),c.callback();return}}});let t=0;return s=>{let a=++t;e.push({id:a,callback:s}),Zr.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})();var Wk=!!(rs&&rs.indexOf("Chrome")>=0);rs&&rs.indexOf("Firefox")>=0;!Wk&&rs&&rs.indexOf("Safari")>=0;rs&&rs.indexOf("Edg/")>=0;rs&&rs.indexOf("Android")>=0;var Wa=typeof navigator=="object"?navigator:{};Pb||document.queryCommandSupported&&document.queryCommandSupported("copy")||Wa&&Wa.clipboard&&Wa.clipboard.writeText,Pb||Wa&&Wa.clipboard&&Wa.clipboard.readText;var lg=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}},Of=new lg,Ib=new lg,Kb=new lg,$k=new Array(230),kw;(e=>{function t(f){return Of.keyCodeToStr(f)}e.toString=t;function s(f){return Of.strToKeyCode(f)}e.fromString=s;function a(f){return Ib.keyCodeToStr(f)}e.toUserSettingsUS=a;function o(f){return Kb.keyCodeToStr(f)}e.toUserSettingsGeneral=o;function c(f){return Ib.strToKeyCode(f)||Kb.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 Of.keyCodeToStr(f)}e.toElectronAccelerator=h})(kw||={});var Yk=class Dw{constructor(t,s,a,o,c){this.ctrlKey=t,this.shiftKey=s,this.altKey=a,this.metaKey=o,this.keyCode=c}equals(t){return t instanceof Dw&&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",s=this.shiftKey?"1":"0",a=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${s}${a}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Vk([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Vk=class{constructor(e){if(e.length===0)throw yk("chords");this.chords=e}getHashCode(){let e="";for(let t=0,s=this.chords.length;t<s;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 Xk(e){if(e.charCode){let s=String.fromCharCode(e.charCode).toUpperCase();return kw.fromString(s)}let t=e.keyCode;if(t===3)return 7;if(Op)switch(t){case 59:return 85;case 60:if(Kk)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ss)return 57;break}else if(jk&&(ss&&t===93||!ss&&t===92))return 57;return $k[t]||0}var Gk=ss?256:2048,Zk=512,Qk=1024,Jk=ss?2048:256,Fb=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=Xk(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|=Gk),this.altKey&&(t|=Zk),this.shiftKey&&(t|=Qk),this.metaKey&&(t|=Jk),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Yk(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},qb=new WeakMap;function eD(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,s=e.parent.location;if(t.origin!=="null"&&s.origin!=="null"&&t.origin!==s.origin)return null}catch{return null}return e.parent}var tD=class{static getSameOriginWindowChain(e){let t=qb.get(e);if(!t){t=[],qb.set(e,t);let s=e,a;do a=eD(s),a?t.push({window:new WeakRef(s),iframeElement:s.frameElement||null}):t.push({window:new WeakRef(s),iframeElement:null}),s=a;while(s)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let s=0,a=0,o=this.getSameOriginWindowChain(e);for(let c of o){let h=c.window.deref();if(s+=h?.scrollY??0,a+=h?.scrollX??0,h===t||!c.iframeElement)break;let f=c.iframeElement.getBoundingClientRect();s+=f.top,a+=f.left}return{top:s,left:a}}},uu=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 s=tD.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Wb=class{constructor(e,t=0,s=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let a=!1;if(ag){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?Op&&!ss?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")Hk&&Tw?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?Op&&!ss?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 s=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(s)}}}),iD;(e=>{function t(s){return s===e.None||s===e.Cancelled||s instanceof nD?!0:!s||typeof s!="object"?!1:typeof s.isCancellationRequested=="boolean"&&typeof s.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ji.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Rw})})(iD||={});var nD=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 be),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},og=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 Rp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Rp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},sD=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,s=globalThis){if(this.isDisposed)throw new Rp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=s.setInterval(()=>{e()},t);this.disposable=At(()=>{s.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},rD;(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 s(a){return new Promise(async(o,c)=>{try{await a(o,c)}catch(h){c(h)}})}e.withAsyncBody=s})(rD||={});var $b=class Bn{static fromArray(t){return new Bn(s=>{s.emitMany(t)})}static fromPromise(t){return new Bn(async s=>{s.emitMany(await t)})}static fromPromises(t){return new Bn(async s=>{await Promise.all(t.map(async a=>s.emitOne(await a)))})}static merge(t){return new Bn(async s=>{await Promise.all(t.map(async a=>{for await(let o of a)s.emitOne(o)}))})}constructor(t,s){this._state=0,this._results=[],this._error=null,this._onReturn=s,this._onStateChanged=new be,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 ji.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,s){return new Bn(async a=>{for await(let o of t)a.emitOne(s(o))})}map(t){return Bn.map(this,t)}static filter(t,s){return new Bn(async a=>{for await(let o of t)s(o)&&a.emitOne(o)})}filter(t){return Bn.filter(this,t)}static coalesce(t){return Bn.filter(t,s=>!!s)}coalesce(){return Bn.coalesce(this)}static async toPromise(t){let s=[];for await(let a of t)s.push(a);return s}toPromise(){return Bn.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())}};$b.EMPTY=$b.fromArray([]);var{getWindow:ns,getWindowId:aD,onDidRegisterWindow:lD}=(function(){let e=new Map,t={window:Ms,disposables:new pr};e.set(Ms.vscodeWindowId,t);let s=new be,a=new be,o=new be;function c(h,f){return(typeof h=="number"?e.get(h):void 0)??(f?t:void 0)}return{onDidRegisterWindow:s.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:a.event,registerWindow(h){if(e.has(h.vscodeWindowId))return Xe.None;let f=new pr,g={window:h,disposables:f.add(new pr)};return e.set(h.vscodeWindowId,g),f.add(At(()=>{e.delete(h.vscodeWindowId),a.fire(h)})),f.add(Pe(h,xi.BEFORE_UNLOAD,()=>{o.fire(h)})),s.fire(g),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 g=h;return g?.view?g.view.window:Ms},getDocument(h){return ns(h).document}}})(),oD=class{constructor(e,t,s,a){this._node=e,this._type=t,this._handler=s,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 Pe(e,t,s,a){return new oD(e,t,s,a)}var Yb=function(e,t,s,a){return Pe(e,t,s,a)},cg,cD=class extends sD{constructor(e){super(),this.defaultTarget=e&&ns(e)}cancelAndSet(e,t,s){return super.cancelAndSet(e,t,s??this.defaultTarget)}},Vb=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){bu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,s=new Map,a=new Map,o=c=>{s.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(Vb.sort),h.shift().execute();a.set(c,!1)};cg=(c,h,f=0)=>{let g=aD(c),p=new Vb(h,f),b=e.get(g);return b||(b=[],e.set(g,b)),b.push(p),s.get(g)||(s.set(g,!0),c.requestAnimationFrame(()=>o(g))),p}})();function uD(e){let t=e.getBoundingClientRect(),s=ns(e);return{left:t.left+s.scrollX,top:t.top+s.scrollY,width:t.width,height:t.height}}var xi={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"},hD=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=an(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=an(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=an(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=an(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=an(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=an(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=an(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=an(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=an(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=an(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=an(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=an(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=an(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=an(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 an(e){return typeof e=="number"?`${e}px`:e}function To(e){return new hD(e)}var Mw=class{constructor(){this._hooks=new pr,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 s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,a,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=a,this._onStopCallback=o;let c=e;try{e.setPointerCapture(t),this._hooks.add(At(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=ns(e)}this._hooks.add(Pe(c,xi.POINTER_MOVE,h=>{if(h.buttons!==s){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(Pe(c,xi.POINTER_UP,h=>this.stopMonitoring(!0)))}};function dD(e,t,s){let a=null,o=null;if(typeof s.value=="function"?(a="value",o=s.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof s.get=="function"&&(a="get",o=s.get),!o)throw new Error("not supported");let c=`$memoize$${t}`;s[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 is;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(is||={});var fo=class Ki extends Xe{constructor(){super(),this.dispatched=!1,this.targets=new Hb,this.ignoreTargets=new Hb,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ji.runAndSubscribe(lD,({window:t,disposables:s})=>{s.add(Pe(t.document,"touchstart",a=>this.onTouchStart(a),{passive:!1})),s.add(Pe(t.document,"touchend",a=>this.onTouchEnd(t,a))),s.add(Pe(t.document,"touchmove",a=>this.onTouchMove(a),{passive:!1}))},{window:Ms,disposables:this._store}))}static addTarget(t){if(!Ki.isTouchDevice())return Xe.None;Ki.INSTANCE||(Ki.INSTANCE=new Ki);let s=Ki.INSTANCE.targets.push(t);return At(s)}static ignoreTarget(t){if(!Ki.isTouchDevice())return Xe.None;Ki.INSTANCE||(Ki.INSTANCE=new Ki);let s=Ki.INSTANCE.ignoreTargets.push(t);return At(s)}static isTouchDevice(){return"ontouchstart"in Ms||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let s=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:s,initialPageX:c.pageX,initialPageY:c.pageY,rollingTimestamps:[s],rollingPageX:[c.pageX],rollingPageY:[c.pageY]};let h=this.newGestureEvent(is.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,s){let a=Date.now(),o=Object.keys(this.activeTouches).length;for(let c=0,h=s.changedTouches.length;c<h;c++){let f=s.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let g=this.activeTouches[f.identifier],p=Date.now()-g.initialTimeStamp;if(p<Ki.HOLD_DELAY&&Math.abs(g.initialPageX-vn(g.rollingPageX))<30&&Math.abs(g.initialPageY-vn(g.rollingPageY))<30){let b=this.newGestureEvent(is.Tap,g.initialTarget);b.pageX=vn(g.rollingPageX),b.pageY=vn(g.rollingPageY),this.dispatchEvent(b)}else if(p>=Ki.HOLD_DELAY&&Math.abs(g.initialPageX-vn(g.rollingPageX))<30&&Math.abs(g.initialPageY-vn(g.rollingPageY))<30){let b=this.newGestureEvent(is.Contextmenu,g.initialTarget);b.pageX=vn(g.rollingPageX),b.pageY=vn(g.rollingPageY),this.dispatchEvent(b)}else if(o===1){let b=vn(g.rollingPageX),y=vn(g.rollingPageY),S=vn(g.rollingTimestamps)-g.rollingTimestamps[0],C=b-g.rollingPageX[0],x=y-g.rollingPageY[0],E=[...this.targets].filter(L=>g.initialTarget instanceof Node&&L.contains(g.initialTarget));this.inertia(t,E,a,Math.abs(C)/S,C>0?1:-1,b,Math.abs(x)/S,x>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(is.End,g.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(s.preventDefault(),s.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,s){let a=document.createEvent("CustomEvent");return a.initEvent(t,!1,!0),a.initialTarget=s,a.tapCount=0,a}dispatchEvent(t){if(t.type===is.Tap){let s=new Date().getTime(),a=0;s-this._lastSetTapCountTime>Ki.CLEAR_TAP_COUNT_TIME?a=1:a=2,this._lastSetTapCountTime=s,t.tapCount=a}else(t.type===is.Change||t.type===is.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let a of this.ignoreTargets)if(a.contains(t.initialTarget))return;let s=[];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;s.push([o,a])}s.sort((a,o)=>a[0]-o[0]);for(let[a,o]of s)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,s,a,o,c,h,f,g,p){this.handle=cg(t,()=>{let b=Date.now(),y=b-a,S=0,C=0,x=!0;o+=Ki.SCROLL_FRICTION*y,f+=Ki.SCROLL_FRICTION*y,o>0&&(x=!1,S=c*o*y),f>0&&(x=!1,C=g*f*y);let E=this.newGestureEvent(is.Change);E.translationX=S,E.translationY=C,s.forEach(L=>L.dispatchEvent(E)),x||this.inertia(t,s,b,o,c,h+S,f,g,p+C)})}onTouchMove(t){let s=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(is.Change,h.initialTarget);f.translationX=c.pageX-vn(h.rollingPageX),f.translationY=c.pageY-vn(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(s)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};fo.SCROLL_FRICTION=-.005,fo.HOLD_DELAY=700,fo.CLEAR_TAP_COUNT_TIME=400,$t([dD],fo,"isTouchDevice",1);var fD=fo,ug=class extends Xe{onclick(e,t){this._register(Pe(e,xi.CLICK,s=>t(new uu(ns(e),s))))}onmousedown(e,t){this._register(Pe(e,xi.MOUSE_DOWN,s=>t(new uu(ns(e),s))))}onmouseover(e,t){this._register(Pe(e,xi.MOUSE_OVER,s=>t(new uu(ns(e),s))))}onmouseleave(e,t){this._register(Pe(e,xi.MOUSE_LEAVE,s=>t(new uu(ns(e),s))))}onkeydown(e,t){this._register(Pe(e,xi.KEY_DOWN,s=>t(new Fb(s))))}onkeyup(e,t){this._register(Pe(e,xi.KEY_UP,s=>t(new Fb(s))))}oninput(e,t){this._register(Pe(e,xi.INPUT,t))}onblur(e,t){this._register(Pe(e,xi.BLUR,t))}onfocus(e,t){this._register(Pe(e,xi.FOCUS,t))}onchange(e,t){this._register(Pe(e,xi.CHANGE,t))}ignoreGesture(e){return fD.ignoreTarget(e)}},Xb=11,pD=class extends ug{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=Xb+"px",this.domNode.style.height=Xb+"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 Mw),this._register(Yb(this.bgDomNode,xi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Yb(this.domNode,xi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new cD),this._pointerdownScheduleRepeatTimer=this._register(new og)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,ns(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},mD=class Hp{constructor(t,s,a,o,c,h,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(s=s|0,a=a|0,o=o|0,c=c|0,h=h|0,f=f|0),this.rawScrollLeft=o,this.rawScrollTop=f,s<0&&(s=0),o+s>a&&(o=a-s),o<0&&(o=0),c<0&&(c=0),f+c>h&&(f=h-c),f<0&&(f=0),this.width=s,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,s){return new Hp(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,s?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,s?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Hp(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,s){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,g=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:s,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:g}}},gD=class extends Xe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new mD(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 s=this._state.withScrollDimensions(e,t);this._setState(s,!!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 s=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===s.scrollLeft&&this._smoothScrolling.to.scrollTop===s.scrollTop)return;let a;t?a=new Zb(this._smoothScrolling.from,s,this._smoothScrolling.startTime,this._smoothScrolling.duration):a=this._smoothScrolling.combine(this._state,s,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=a}else{let s=this._state.withScrollPosition(e);this._smoothScrolling=Zb.start(this._state,s,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 s=this._state;s.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(s,t)))}},Gb=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function zf(e,t){let s=t-e;return function(a){return e+s*yD(a)}}function _D(e,t,s){return function(a){return a<s?e(a/s):t((a-s)/(1-s))}}var Zb=class Up{constructor(t,s,a,o){this.from=t,this.to=s,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,s,a){if(Math.abs(t-s)>2.5*a){let o,c;return t<s?(o=t+.75*a,c=s-.75*a):(o=t-.75*a,c=s+.75*a),_D(zf(t,o),zf(c,s),.33)}return zf(t,s)}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 s=(t-this.startTime)/this.duration;if(s<1){let a=this.scrollLeft(s),o=this.scrollTop(s);return new Gb(a,o,!1)}return new Gb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,s,a){return Up.start(t,s,a)}static start(t,s,a){a=a+10;let o=Date.now()-10;return new Up(t,s,o,a)}};function vD(e){return Math.pow(e,3)}function yD(e){return 1-vD(1-e)}var bD=class extends Xe{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new og)}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":"")))}},SD=140,Nw=class extends ug{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 bD(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Mw),this._shouldRender=!0,this.domNode=To(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(Pe(this.domNode.domNode,xi.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new pD(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,a){this.slider=To(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof a=="number"&&this.slider.setHeight(a),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Pe(this.slider.domNode,xi.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,s=t+this._scrollbarState.getSliderPosition(),a=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);s<=o&&o<=a?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let o=uD(this.domNode.domNode);t=e.pageX-o.left,s=e.pageY-o.top}let a=this._pointerDownRelativePosition(t,s);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),s=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-s);if(Tw&&h>SD){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()}},Aw=class Pp{constructor(t,s,a,o,c,h){this._scrollbarSize=Math.round(s),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 Pp(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let s=Math.round(t);return this._visibleSize!==s?(this._visibleSize=s,this._refreshComputedValues(),!0):!1}setScrollSize(t){let s=Math.round(t);return this._scrollSize!==s?(this._scrollSize=s,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let s=Math.round(t);return this._scrollPosition!==s?(this._scrollPosition=s,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,s,a,o,c){let h=Math.max(0,a-t),f=Math.max(0,h-2*s),g=o>0&&o>a;if(!g)return{computedAvailableSize:Math.round(h),computedIsNeeded:g,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:g,computedSliderSize:Math.round(p),computedSliderRatio:b,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=Pp._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 s=t-this._arrowSize-this._computedSliderSize/2;return Math.round(s/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let s=t-this._arrowSize,a=this._scrollPosition;return s<this._computedSliderPosition?a-=this._visibleSize:a+=this._visibleSize,a}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let s=this._computedSliderPosition+t;return Math.round(s/this._computedSliderRatio)}},wD=class extends Nw{constructor(e,t,s){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Aw(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}},CD=class extends Nw{constructor(e,t,s){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new Aw(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}},xD=500,Qb=50,ED=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},Ip=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,s=0,a=1,o=this._rear;do{let c=o===this._front?t:Math.pow(2,-a);if(t-=c,s+=this._memory[o].score*c,o===this._front)break;o=(this._capacity+o-1)%this._capacity,a++}while(!0);return s<=.5}acceptStandardWheelEvent(t){if(ag){let s=ns(t.browserEvent),a=zk(s);this.accept(Date.now(),t.deltaX*a,t.deltaY*a)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,s,a){let o=null,c=new ED(t,s,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,s){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),s){let o=Math.abs(t.deltaX),c=Math.abs(t.deltaY),h=Math.abs(s.deltaX),f=Math.abs(s.deltaY),g=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%g===0&&y%p===0&&(a-=.5)}return Math.min(Math.max(a,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ip.INSTANCE=new Ip;var TD=Ip,kD=class extends ug{constructor(e,t,s){super(),this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new be),this.onWillScroll=this._onWillScroll.event,this._options=RD(t),this._scrollable=s,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 CD(this._scrollable,this._options,a)),this._horizontalScrollbar=this._register(new wD(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=To(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=To(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=To(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 og),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ta(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,ss&&(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 Wb(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ta(this._mouseWheelToDispose),e)){let t=s=>{this._onMouseWheel(new Wb(s))};this._mouseWheelToDispose.push(Pe(this._listenOnDomNode,xi.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=TD.INSTANCE;t.acceptStandardWheelEvent(e);let s=!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=!ss&&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(),g={};if(o){let p=Qb*o,b=f.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(g,b)}if(c){let p=Qb*c,b=f.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(g,b)}g=this._scrollable.validateScrollPosition(g),(f.scrollLeft!==g.scrollLeft||f.scrollTop!==g.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(g):this._scrollable.setScrollPositionNow(g),s=!0)}let a=s;!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,s=e.scrollLeft>0,a=s?" left":"",o=t?" top":"",c=s||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(),xD)}},DD=class extends kD{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function RD(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,ss&&(t.className+=" mac"),t}var Kp=class extends Xe{constructor(e,t,s,a,o,c,h,f){super(),this._bufferService=s,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let g=this._register(new gD({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>cg(a.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{g.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new DD(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},g)),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(ji.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(At(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=a.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(At(()=>this._styleElement.remove())),this._register(ji.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),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};Kp=$t([De(2,Xi),De(3,Ls),De(4,dw),De(5,al),De(6,Gi),De(7,Bs)],Kp);var Fp=class extends Xe{constructor(e,t,s,a,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,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(At(()=>{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 s=e.options.x??0;return s&&s>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 s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Fp=$t([De(1,Xi),De(2,Ls),De(3,Wo),De(4,Bs)],Fp);var MD=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,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},es={full:0,left:0,center:0,right:0},lr={full:0,left:0,center:0,right:0},to={full:0,left:0,center:0,right:0},Hu=class extends Xe{constructor(e,t,s,a,o,c,h,f){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=a,this._renderService=o,this._optionsService=c,this._themeService=h,this._coreBrowserService=f,this._colorZoneStore=new MD,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(At(()=>this._canvas?.remove()));let g=this._canvas.getContext("2d");if(g)this._ctx=g;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);lr.full=this._canvas.width,lr.left=e,lr.center=t,lr.right=e,this._refreshDrawHeightConstants(),to.full=1,to.left=1,to.center=1+lr.left,to.right=1+lr.left+lr.center}_refreshDrawHeightConstants(){es.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);es.left=t,es.center=t,es.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*es.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*es.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*es.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*es.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(to[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-es[e.position||"full"]/2),lr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+es[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}))}};Hu=$t([De(2,Xi),De(3,Wo),De(4,Bs),De(5,Gi),De(6,al),De(7,Ls)],Hu);var he;(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=""))(he||={});var Cu;(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=""))(Cu||={});var Lw;(e=>e.ST=`${he.ESC}\\`)(Lw||={});var qp=class{constructor(e,t,s,a,o,c){this._textarea=e,this._compositionView=t,this._bufferService=s,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 s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!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,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${he.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),s=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=s+"px",this._compositionView.style.lineHeight=s+"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)}}};qp=$t([De(2,Xi),De(3,Gi),De(4,sa),De(5,Bs)],qp);var ki=0,Di=0,Ri=0,Wt=0,Jb={css:"#00000000",rgba:0},ai;(e=>{function t(o,c,h,f){return f!==void 0?`#${Ir(o)}${Ir(c)}${Ir(h)}${Ir(f)}`:`#${Ir(o)}${Ir(c)}${Ir(h)}`}e.toCss=t;function s(o,c,h,f=255){return(o<<24|c<<16|h<<8|f)>>>0}e.toRgba=s;function a(o,c,h,f){return{css:e.toCss(o,c,h,f),rgba:e.toRgba(o,c,h,f)}}e.toColor=a})(ai||={});var Rt;(e=>{function t(g,p){if(Wt=(p.rgba&255)/255,Wt===1)return{css:p.css,rgba:p.rgba};let b=p.rgba>>24&255,y=p.rgba>>16&255,S=p.rgba>>8&255,C=g.rgba>>24&255,x=g.rgba>>16&255,E=g.rgba>>8&255;ki=C+Math.round((b-C)*Wt),Di=x+Math.round((y-x)*Wt),Ri=E+Math.round((S-E)*Wt);let L=ai.toCss(ki,Di,Ri),D=ai.toRgba(ki,Di,Ri);return{css:L,rgba:D}}e.blend=t;function s(g){return(g.rgba&255)===255}e.isOpaque=s;function a(g,p,b){let y=xu.ensureContrastRatio(g.rgba,p.rgba,b);if(y)return ai.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=a;function o(g){let p=(g.rgba|255)>>>0;return[ki,Di,Ri]=xu.toChannels(p),{css:ai.toCss(ki,Di,Ri),rgba:p}}e.opaque=o;function c(g,p){return Wt=Math.round(p*255),[ki,Di,Ri]=xu.toChannels(g.rgba),{css:ai.toCss(ki,Di,Ri,Wt),rgba:ai.toRgba(ki,Di,Ri,Wt)}}e.opacity=c;function h(g,p){return Wt=g.rgba&255,c(g,Wt*p/255)}e.multiplyOpacity=h;function f(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}e.toColorRGB=f})(Rt||={});var zt;(e=>{let t,s;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",s=t.createLinearGradient(0,0,1,1))}catch{}function a(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return ki=parseInt(o.slice(1,2).repeat(2),16),Di=parseInt(o.slice(2,3).repeat(2),16),Ri=parseInt(o.slice(3,4).repeat(2),16),ai.toColor(ki,Di,Ri);case 5:return ki=parseInt(o.slice(1,2).repeat(2),16),Di=parseInt(o.slice(2,3).repeat(2),16),Ri=parseInt(o.slice(3,4).repeat(2),16),Wt=parseInt(o.slice(4,5).repeat(2),16),ai.toColor(ki,Di,Ri,Wt);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 ki=parseInt(c[1]),Di=parseInt(c[2]),Ri=parseInt(c[3]),Wt=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),ai.toColor(ki,Di,Ri,Wt);if(!t||!s)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=s,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ki,Di,Ri,Wt]=t.getImageData(0,0,1,1).data,Wt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ai.toRgba(ki,Di,Ri,Wt),css:o}}e.toColor=a})(zt||={});var Vi;(e=>{function t(a){return s(a>>16&255,a>>8&255,a&255)}e.relativeLuminance=t;function s(a,o,c){let h=a/255,f=o/255,g=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=g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4);return p*.2126+b*.7152+y*.0722}e.relativeLuminance2=s})(Vi||={});var xu;(e=>{function t(h,f){if(Wt=(f&255)/255,Wt===1)return f;let g=f>>24&255,p=f>>16&255,b=f>>8&255,y=h>>24&255,S=h>>16&255,C=h>>8&255;return ki=y+Math.round((g-y)*Wt),Di=S+Math.round((p-S)*Wt),Ri=C+Math.round((b-C)*Wt),ai.toRgba(ki,Di,Ri)}e.blend=t;function s(h,f,g){let p=Vi.relativeLuminance(h>>8),b=Vi.relativeLuminance(f>>8);if(Ts(p,b)<g){if(b<p){let C=a(h,f,g),x=Ts(p,Vi.relativeLuminance(C>>8));if(x<g){let E=o(h,f,g),L=Ts(p,Vi.relativeLuminance(E>>8));return x>L?C:E}return C}let y=o(h,f,g),S=Ts(p,Vi.relativeLuminance(y>>8));if(S<g){let C=a(h,f,g),x=Ts(p,Vi.relativeLuminance(C>>8));return S>x?y:C}return y}}e.ensureContrastRatio=s;function a(h,f,g){let p=h>>24&255,b=h>>16&255,y=h>>8&255,S=f>>24&255,C=f>>16&255,x=f>>8&255,E=Ts(Vi.relativeLuminance2(S,C,x),Vi.relativeLuminance2(p,b,y));for(;E<g&&(S>0||C>0||x>0);)S-=Math.max(0,Math.ceil(S*.1)),C-=Math.max(0,Math.ceil(C*.1)),x-=Math.max(0,Math.ceil(x*.1)),E=Ts(Vi.relativeLuminance2(S,C,x),Vi.relativeLuminance2(p,b,y));return(S<<24|C<<16|x<<8|255)>>>0}e.reduceLuminance=a;function o(h,f,g){let p=h>>24&255,b=h>>16&255,y=h>>8&255,S=f>>24&255,C=f>>16&255,x=f>>8&255,E=Ts(Vi.relativeLuminance2(S,C,x),Vi.relativeLuminance2(p,b,y));for(;E<g&&(S<255||C<255||x<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),E=Ts(Vi.relativeLuminance2(S,C,x),Vi.relativeLuminance2(p,b,y));return(S<<24|C<<16|x<<8|255)>>>0}e.increaseLuminance=o;function c(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=c})(xu||={});function Ir(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ts(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var ND=class extends qo{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}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()]}},Uu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Hn}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 s=[],a=t.translateToString(!0),o=0,c=0,h=0,f=t.getFg(0),g=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!==g){if(p-o>1){let b=this._getJoinedRanges(a,h,c,t,o);for(let y=0;y<b.length;y++)s.push(b[y])}o=p,h=c,f=this._workCell.fg,g=this._workCell.bg}c+=this._workCell.getChars().length||dr.length}if(this._bufferService.cols-o>1){let p=this._getJoinedRanges(a,h,c,t,o);for(let b=0;b<p.length;b++)s.push(p[b])}return s}_getJoinedRanges(e,t,s,a,o){let c=e.substring(t,s),h=[];try{h=this._characterJoiners[0].handler(c)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let g=this._characterJoiners[f].handler(c);for(let p=0;p<g.length;p++)Uu._mergeRanges(h,g[p])}catch(g){console.error(g)}return this._stringRangesToCellRanges(h,a,o),h}_stringRangesToCellRanges(e,t,s){let a=0,o=!1,c=0,h=e[a];if(h){for(let f=s;f<this._bufferService.cols;f++){let g=t.getWidth(f),p=t.getString(f).length||dr.length;if(g!==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 s=!1;for(let a=0;a<e.length;a++){let o=e[a];if(s){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]),s=!0);continue}}return s?e[e.length-1][1]=t[1]:e.push(t),e}};Uu=$t([De(0,Xi)],Uu);function AD(e){return 57508<=e&&e<=57558}function LD(e){return 9472<=e&&e<=9631}function BD(e){return AD(e)||LD(e)}function OD(){return{css:{canvas:hu(),cell:hu()},device:{canvas:hu(),cell:hu(),char:{width:0,height:0,left:0,top:0}}}}function hu(){return{width:0,height:0}}var Wp=class{constructor(e,t,s,a,o,c,h){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=a,this._coreService=o,this._decorationService=c,this._themeService=h,this._workCell=new Hn,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,a,o,c,h,f,g,p,b){let y=[],S=this._characterJoinerService.getJoinedCharacters(t),C=this._themeService.colors,x=e.getNoBgTrimmedLength();s&&x<c+1&&(x=c+1);let E,L=0,D="",j=0,U=0,Z=0,ie=0,ne=!1,ae=0,oe=!1,pe=0,I=0,q=[],K=p!==-1&&b!==-1;for(let z=0;z<x;z++){e.loadCell(z,this._workCell);let O=this._workCell.getWidth();if(O===0)continue;let se=!1,M=z>=I,X=z,V=this._workCell;if(S.length>0&&z===S[0][0]&&M){let ge=S.shift(),F=this._isCellInSelection(ge[0],t);for(j=ge[0]+1;j<ge[1];j++)M&&=F===this._isCellInSelection(j,t);M&&=!s||c<ge[0]||c>=ge[1],M?(se=!0,V=new ND(this._workCell,e.translateToString(!0,ge[0],ge[1]),ge[1]-ge[0]),X=ge[1]-1,O=V.getWidth()):I=ge[1]}let ye=this._isCellInSelection(z,t),xe=s&&z===c,k=K&&z>=p&&z<=b,Q=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,ge=>{Q=!0});let le=V.getChars()||dr;if(le===" "&&(V.isUnderline()||V.isOverline())&&(le=" "),pe=O*f-g.get(le,V.isBold(),V.isItalic()),!E)E=this._document.createElement("span");else if(L&&(ye&&oe||!ye&&!oe&&V.bg===U)&&(ye&&oe&&C.selectionForeground||V.fg===Z)&&V.extended.ext===ie&&k===ne&&pe===ae&&!xe&&!se&&!Q&&M){V.isInvisible()?D+=dr:D+=le,L++;continue}else L&&(E.textContent=D),E=this._document.createElement("span"),L=0,D="";if(U=V.bg,Z=V.fg,ie=V.extended.ext,ne=k,ae=pe,oe=ye,se&&c>=z&&c<=X&&(c=z),!this._coreService.isCursorHidden&&xe&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&q.push("xterm-cursor-blink"),q.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline");break}}if(V.isBold()&&q.push("xterm-bold"),V.isItalic()&&q.push("xterm-italic"),V.isDim()&&q.push("xterm-dim"),V.isInvisible()?D=dr:D=V.getChars()||dr,V.isUnderline()&&(q.push(`xterm-underline-${V.extended.underlineStyle}`),D===" "&&(D=" "),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${qo.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let ge=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&ge<8&&(ge+=8),E.style.textDecorationColor=C.ansi[ge].css}V.isOverline()&&(q.push("xterm-overline"),D===" "&&(D=" ")),V.isStrikethrough()&&q.push("xterm-strikethrough"),k&&(E.style.textDecoration="underline");let fe=V.getFgColor(),we=V.getFgColorMode(),Ce=V.getBgColor(),ke=V.getBgColorMode(),Ie=!!V.isInverse();if(Ie){let ge=fe;fe=Ce,Ce=ge;let F=we;we=ke,ke=F}let H,J,Ee=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,ge=>{ge.options.layer!=="top"&&Ee||(ge.backgroundColorRGB&&(ke=50331648,Ce=ge.backgroundColorRGB.rgba>>8&16777215,H=ge.backgroundColorRGB),ge.foregroundColorRGB&&(we=50331648,fe=ge.foregroundColorRGB.rgba>>8&16777215,J=ge.foregroundColorRGB),Ee=ge.options.layer==="top")}),!Ee&&ye&&(H=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,Ce=H.rgba>>8&16777215,ke=50331648,Ee=!0,C.selectionForeground&&(we=50331648,fe=C.selectionForeground.rgba>>8&16777215,J=C.selectionForeground)),Ee&&q.push("xterm-decoration-top");let ve;switch(ke){case 16777216:case 33554432:ve=C.ansi[Ce],q.push(`xterm-bg-${Ce}`);break;case 50331648:ve=ai.toColor(Ce>>16,Ce>>8&255,Ce&255),this._addStyle(E,`background-color:#${eS((Ce>>>0).toString(16),"0",6)}`);break;default:Ie?(ve=C.foreground,q.push("xterm-bg-257")):ve=C.background}switch(H||V.isDim()&&(H=Rt.multiplyOpacity(ve,.5)),we){case 16777216:case 33554432:V.isBold()&&fe<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(fe+=8),this._applyMinimumContrast(E,ve,C.ansi[fe],V,H,void 0)||q.push(`xterm-fg-${fe}`);break;case 50331648:let ge=ai.toColor(fe>>16&255,fe>>8&255,fe&255);this._applyMinimumContrast(E,ve,ge,V,H,J)||this._addStyle(E,`color:#${eS(fe.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,ve,C.foreground,V,H,J)||Ie&&q.push("xterm-fg-257")}q.length&&(E.className=q.join(" "),q.length=0),!xe&&!se&&!Q&&M?L++:E.textContent=D,pe!==this.defaultSpacing&&(E.style.letterSpacing=`${pe}px`),y.push(E),z=X}return E&&L&&(E.textContent=D),y}_applyMinimumContrast(e,t,s,a,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||BD(a.getCode()))return!1;let h=this._getContrastCache(a),f;if(!o&&!c&&(f=h.getColor(t.rgba,s.rgba)),f===void 0){let g=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);f=Rt.ensureContrastRatio(o||t,c||s,g),h.setColor((o||t).rgba,(c||s).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 s=this._selectionStart,a=this._selectionEnd;return!s||!a?!1:this._columnSelectMode?s[0]<=a[0]?e>=s[0]&&t>=s[1]&&e<a[0]&&t<=a[1]:e<s[0]&&t>=s[1]&&e>=a[0]&&t<=a[1]:t>s[1]&&t<a[1]||s[1]===a[1]&&t===s[1]&&e>=s[0]&&e<a[0]||s[1]<a[1]&&t===a[1]&&e<a[0]||s[1]<a[1]&&t===s[1]&&e>=s[0]}};Wp=$t([De(1,mw),De(2,Gi),De(3,Ls),De(4,sa),De(5,Wo),De(6,al)],Wp);function eS(e,t,s){for(;e.length<s;)e=t+e;return e}var zD=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 s=e.createElement("span");s.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=[s,a,o,c],this._container.appendChild(s),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,s,a){e===this._font&&t===this._fontSize&&s===this._weight&&a===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(e,t,s){let a=0;if(!t&&!s&&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"),s&&(o+="I");let c=this._holey.get(o);if(c===void 0){let h=0;t&&(h|=1),s&&(h|=2),c=this._measure(e,h),c>0&&this._holey.set(o,c)}return c}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},jD=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,s,a=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let o=e.buffers.active.ydisp,c=t[1]-o,h=s[1]-o,f=Math.max(c,0),g=Math.min(h,e.rows-1);if(f>=e.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=g,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function HD(){return new jD}var jf="xterm-dom-renderer-owner-",Ln="xterm-rows",du="xterm-fg-",tS="xterm-bg-",io="xterm-focus",fu="xterm-selection",UD=1,$p=class extends Xe{constructor(e,t,s,a,o,c,h,f,g,p,b,y,S,C){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=a,this._viewportElement=o,this._helperContainer=c,this._linkifier2=h,this._charSizeService=g,this._optionsService=p,this._bufferService=b,this._coreService=y,this._coreBrowserService=S,this._themeService=C,this._terminalClass=UD++,this._rowElements=[],this._selectionRenderModel=HD(),this.onRequestRedraw=this._register(new be).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ln),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(fu),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=OD(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(Wp,document),this._element.classList.add(jf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(At(()=>{this._element.classList.remove(jf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new zD(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 s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Ln} 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} .${Ln} { 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} .${Ln} .xterm-dim { color: ${Rt.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 s=`blink_underline_${this._terminalClass}`,a=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 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} .${Ln}.${io} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Ln}.${io} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Ln}.${io} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${Ln} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Ln} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Ln} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Ln} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Ln} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${fu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${fu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${fu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,h]of e.ansi.entries())t+=`${this._terminalSelector} .${du}${c} { color: ${h.css}; }${this._terminalSelector} .${du}${c}.xterm-dim { color: ${Rt.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${tS}${c} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${du}257 { color: ${Rt.opaque(e.background).css}; }${this._terminalSelector} .${du}257.xterm-dim { color: ${Rt.multiplyOpacity(Rt.opaque(e.background),.5).css}; }${this._terminalSelector} .${tS}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 s=this._rowElements.length;s<=t;s++){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(io),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(io),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!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(s){let g=e[0]>t[0];f.appendChild(this._createSelectionElement(c,g?t[0]:e[0],g?e[0]:t[0],h-c+1))}else{let g=a===c?e[0]:0,p=c===o?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,g,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,s,a=1){let o=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(s-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 s=this._bufferService.buffer,a=s.ybase+s.y,o=Math.min(s.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 g=e;g<=t;g++){let p=g+s.ydisp,b=this._rowElements[g],y=s.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`.${jf}${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,s,a,o,c){s<0&&(e=0),a<0&&(t=0);let h=this._bufferService.rows-1;s=Math.max(Math.min(s,h),0),a=Math.max(Math.min(a,h),0),o=Math.min(o,this._bufferService.cols);let f=this._bufferService.buffer,g=f.ybase+f.y,p=Math.min(f.x,o-1),b=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let C=s;C<=a;++C){let x=C+f.ydisp,E=this._rowElements[C],L=f.lines.get(x);if(!E||!L)break;E.replaceChildren(...this._rowFactory.createRow(L,x,x===g,y,S,p,b,this.dimensions.css.cell.width,this._widthCache,c?C===s?e:0:-1,c?(C===a?t:o)-1:-1))}}};$p=$t([De(7,ng),De(8,rh),De(9,Gi),De(10,Xi),De(11,sa),De(12,Ls),De(13,al)],$p);var Yp=class extends Xe{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new be),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new ID(this._optionsService))}catch{this._measureStrategy=this._register(new PD(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())}};Yp=$t([De(2,Gi)],Yp);var Bw=class extends Xe{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)}},PD=class extends Bw{constructor(e,t,s){super(),this._document=e,this._parentElement=t,this._optionsService=s,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}},ID=class extends Bw{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}},KD=class extends Xe{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new FD(this._window)),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new be),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(ji.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Pe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Pe(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}},FD=class extends Xe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new nl),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(At(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Pe(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)}},qD=class extends Xe{constructor(){super(),this.linkProviders=[],this._register(At(()=>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 hg(e,t,s){let a=s.getBoundingClientRect(),o=e.getComputedStyle(s),c=parseInt(o.getPropertyValue("padding-left")),h=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-a.left-c,t.clientY-a.top-h]}function WD(e,t,s,a,o,c,h,f,g){if(!c)return;let p=hg(e,t,s);if(p)return p[0]=Math.ceil((p[0]+(g?h/2:0))/h),p[1]=Math.ceil(p[1]/f),p[0]=Math.min(Math.max(p[0],1),a+(g?1:0)),p[1]=Math.min(Math.max(p[1],1),o),p}var Vp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,a,o){return WD(window,e,t,s,a,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let s=hg(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};Vp=$t([De(0,Bs),De(1,rh)],Vp);var $D=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,s){this._rowCount=s,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=[]}},Ow={};ik(Ow,{getSafariVersion:()=>VD,isChromeOS:()=>Uw,isFirefox:()=>zw,isIpad:()=>XD,isIphone:()=>GD,isLegacyEdge:()=>YD,isLinux:()=>dg,isMac:()=>Pu,isNode:()=>ah,isSafari:()=>jw,isWindows:()=>Hw});var ah=typeof process<"u"&&"title"in process,$o=ah?"node":navigator.userAgent,Yo=ah?"node":navigator.platform,zw=$o.includes("Firefox"),YD=$o.includes("Edge"),jw=/^((?!chrome|android).)*safari/i.test($o);function VD(){if(!jw)return 0;let e=$o.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Pu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Yo),XD=Yo==="iPad",GD=Yo==="iPhone",Hw=["Windows","Win16","Win32","WinCE"].includes(Yo),dg=Yo.indexOf("Linux")>=0,Uw=/\bCrOS\b/.test($o),Pw=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,s=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),s=Math.max(t,s),o=e.timeRemaining(),s*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()}},ZD=class extends Pw{_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())}}},QD=class extends Pw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Iu=!ah&&"requestIdleCallback"in window?QD:ZD,JD=class{constructor(){this._queue=new Iu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Xp=class extends Xe{constructor(e,t,s,a,o,c,h,f,g){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=a,this._coreService=o,this._coreBrowserService=f,this._renderer=this._register(new nl),this._pausedResizeTask=new JD,this._observerDisposable=this._register(new nl),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 be),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new be),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new be),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new $D((p,b)=>this._renderRows(p,b),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new eR(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(At(()=>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(g.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 s=new e.IntersectionObserver(a=>this._handleIntersectionChange(a[a.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=At(()=>s.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,s=!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)),s||(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,s){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,this._renderer.value?.handleSelectionChanged(e,t,s)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Xp=$t([De(2,Gi),De(3,rh),De(4,sa),De(5,Wo),De(6,Xi),De(7,Ls),De(8,al)],Xp);var eR=class{constructor(e,t,s){this._coreBrowserService=e,this._coreService=t,this._onTimeout=s,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 tR(e,t,s,a){let o=s.buffer.x,c=s.buffer.y;if(!s.buffer.hasScrollback)return sR(o,c,e,t,s,a)+lh(c,t,s,a)+rR(o,c,e,t,s,a);let h;if(c===t)return h=o>e?"D":"C",Lo(Math.abs(o-e),Ao(h,a));h=c>t?"D":"C";let f=Math.abs(c-t),g=nR(c>t?e:o,s)+(f-1)*s.cols+1+iR(c>t?o:e);return Lo(g,Ao(h,a))}function iR(e,t){return e-1}function nR(e,t){return t.cols-e}function sR(e,t,s,a,o,c){return lh(t,a,o,c).length===0?"":Lo(Kw(e,t,e,t-ia(t,o),!1,o).length,Ao("D",c))}function lh(e,t,s,a){let o=e-ia(e,s),c=t-ia(t,s),h=Math.abs(o-c)-aR(e,t,s);return Lo(h,Ao(Iw(e,t),a))}function rR(e,t,s,a,o,c){let h;lh(t,a,o,c).length>0?h=a-ia(a,o):h=t;let f=a,g=lR(e,t,s,a,o,c);return Lo(Kw(e,h,s,f,g==="C",o).length,Ao(g,c))}function aR(e,t,s){let a=0,o=e-ia(e,s),c=t-ia(t,s);for(let h=0;h<Math.abs(o-c);h++){let f=Iw(e,t)==="A"?-1:1;s.buffer.lines.get(o+f*h)?.isWrapped&&a++}return a}function ia(e,t){let s=0,a=t.buffer.lines.get(e),o=a?.isWrapped;for(;o&&e>=0&&e<t.rows;)s++,a=t.buffer.lines.get(--e),o=a?.isWrapped;return s}function lR(e,t,s,a,o,c){let h;return lh(s,a,o,c).length>0?h=a-ia(a,o):h=t,e<s&&h<=a||e>=s&&h<a?"C":"D"}function Iw(e,t){return e>t?"A":"B"}function Kw(e,t,s,a,o,c){let h=e,f=t,g="";for(;(h!==s||f!==a)&&f>=0&&f<c.buffer.lines.length;)h+=o?1:-1,o&&h>c.cols-1?(g+=c.buffer.translateBufferLineToString(f,!1,e,h),h=0,e=0,f++):!o&&h<0&&(g+=c.buffer.translateBufferLineToString(f,!1,0,e+1),h=c.cols-1,e=h,f--);return g+c.buffer.translateBufferLineToString(f,!1,e,h)}function Ao(e,t){let s=t?"O":"[";return he.ESC+s+e}function Lo(e,t){e=Math.floor(e);let s="";for(let a=0;a<e;a++)s+=t;return s}var oR=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 iS(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 Hf=50,cR=15,uR=50,hR=500,dR=" ",fR=new RegExp(dR,"g"),Gp=class extends Xe{constructor(e,t,s,a,o,c,h,f,g){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=a,this._coreService=o,this._mouseService=c,this._optionsService=h,this._renderService=f,this._coreBrowserService=g,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Hn,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new be),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new be),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new be),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 oR(this._bufferService),this._activeSelectionMode=0,this._register(At(()=>{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 s=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=s.translateBufferLineToString(h,!0,o,c);a.push(f)}}else{let o=e[1]===t[1]?t[0]:void 0;a.push(s.translateBufferLineToString(e[1],!0,e[0],o));for(let c=e[1]+1;c<=t[1]-1;c++){let h=s.lines.get(c),f=s.translateBufferLineToString(c,!0);h?.isWrapped?a[a.length-1]+=f:a.push(f)}if(e[1]!==t[1]){let c=s.lines.get(t[1]),h=s.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?a[a.length-1]+=h:a.push(h)}}return a.map(o=>o.replace(fR," ")).join(Hw?`\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())),dg&&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),s=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!s||!a||!t?!1:this._areCoordsInSelection(t,s,a)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!s||!a?!1:this._areCoordsInSelection([e,t],s,a)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=iS(s,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=hg(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-Hf),Hf),t/=Hf,t/Math.abs(t)+Math.round(t*(cR-1)))}shouldForceSelection(e){return Pu?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(),uR)}_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&&!(Pu&&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 s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let a=s.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<hR&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let a=tR(s[0]-1,s[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,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);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,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let a=0;t>=a;a++){let o=e.loadCell(a,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:o>1&&t!==a&&(s+=o-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!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]),g=f,p=e[0]-f,b=0,y=0,S=0,C=0;if(h.charAt(f)===" "){for(;f>0&&h.charAt(f-1)===" ";)f--;for(;g<h.length&&h.charAt(g+1)===" ";)g++}else{let L=e[0],D=e[0];c.getWidth(L)===0&&(b++,L--),c.getWidth(D)===2&&(y++,D++);let j=c.getString(D).length;for(j>1&&(C+=j-1,g+=j-1);L>0&&f>0&&!this._isCharWordSeparator(c.loadCell(L-1,this._workCell));){c.loadCell(L-1,this._workCell);let U=this._workCell.getChars().length;this._workCell.getWidth()===0?(b++,L--):U>1&&(S+=U-1,f-=U-1),f--,L--}for(;D<c.length&&g+1<h.length&&!this._isCharWordSeparator(c.loadCell(D+1,this._workCell));){c.loadCell(D+1,this._workCell);let U=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,D++):U>1&&(C+=U-1,g+=U-1),g++,D++}}g++;let x=f+p-b+S,E=Math.min(this._bufferService.cols,g-f+b+y-S-C);if(!(!t&&h.slice(f,g).trim()==="")){if(s&&x===0&&c.getCodePoint(0)!==32){let L=o.lines.get(e[1]-1);if(L&&c.isWrapped&&L.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let j=this._bufferService.cols-D.start;x-=j,E+=j}}}if(a&&x+E===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let L=o.lines.get(e[1]+1);if(L?.isWrapped&&L.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(E+=D.length)}}return{start:x,length:E}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={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=iS(s,this._bufferService.cols)}};Gp=$t([De(3,Xi),De(4,sa),De(5,sg),De(6,Gi),De(7,Bs),De(8,Ls)],Gp);var nS=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},sS=class{constructor(){this._color=new nS,this._css=new nS}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},di=Object.freeze((()=>{let e=[zt.toColor("#2e3436"),zt.toColor("#cc0000"),zt.toColor("#4e9a06"),zt.toColor("#c4a000"),zt.toColor("#3465a4"),zt.toColor("#75507b"),zt.toColor("#06989a"),zt.toColor("#d3d7cf"),zt.toColor("#555753"),zt.toColor("#ef2929"),zt.toColor("#8ae234"),zt.toColor("#fce94f"),zt.toColor("#729fcf"),zt.toColor("#ad7fa8"),zt.toColor("#34e2e2"),zt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let s=0;s<216;s++){let a=t[s/36%6|0],o=t[s/6%6|0],c=t[s%6];e.push({css:ai.toCss(a,o,c),rgba:ai.toRgba(a,o,c)})}for(let s=0;s<24;s++){let a=8+s*10;e.push({css:ai.toCss(a,a,a),rgba:ai.toRgba(a,a,a)})}return e})()),qr=zt.toColor("#ffffff"),po=zt.toColor("#000000"),rS=zt.toColor("#ffffff"),aS=po,no={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},pR=qr,Zp=class extends Xe{constructor(e){super(),this._optionsService=e,this._contrastCache=new sS,this._halfContrastCache=new sS,this._onChangeColors=this._register(new be),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:qr,background:po,cursor:rS,cursorAccent:aS,selectionForeground:void 0,selectionBackgroundTransparent:no,selectionBackgroundOpaque:Rt.blend(po,no),selectionInactiveBackgroundTransparent:no,selectionInactiveBackgroundOpaque:Rt.blend(po,no),scrollbarSliderBackground:Rt.opacity(qr,.2),scrollbarSliderHoverBackground:Rt.opacity(qr,.4),scrollbarSliderActiveBackground:Rt.opacity(qr,.5),overviewRulerBorder:qr,ansi:di.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=bt(e.foreground,qr),t.background=bt(e.background,po),t.cursor=Rt.blend(t.background,bt(e.cursor,rS)),t.cursorAccent=Rt.blend(t.background,bt(e.cursorAccent,aS)),t.selectionBackgroundTransparent=bt(e.selectionBackground,no),t.selectionBackgroundOpaque=Rt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=bt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Rt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?bt(e.selectionForeground,Jb):void 0,t.selectionForeground===Jb&&(t.selectionForeground=void 0),Rt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Rt.opacity(t.selectionBackgroundTransparent,.3)),Rt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Rt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=bt(e.scrollbarSliderBackground,Rt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=bt(e.scrollbarSliderHoverBackground,Rt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=bt(e.scrollbarSliderActiveBackground,Rt.opacity(t.foreground,.5)),t.overviewRulerBorder=bt(e.overviewRulerBorder,pR),t.ansi=di.slice(),t.ansi[0]=bt(e.black,di[0]),t.ansi[1]=bt(e.red,di[1]),t.ansi[2]=bt(e.green,di[2]),t.ansi[3]=bt(e.yellow,di[3]),t.ansi[4]=bt(e.blue,di[4]),t.ansi[5]=bt(e.magenta,di[5]),t.ansi[6]=bt(e.cyan,di[6]),t.ansi[7]=bt(e.white,di[7]),t.ansi[8]=bt(e.brightBlack,di[8]),t.ansi[9]=bt(e.brightRed,di[9]),t.ansi[10]=bt(e.brightGreen,di[10]),t.ansi[11]=bt(e.brightYellow,di[11]),t.ansi[12]=bt(e.brightBlue,di[12]),t.ansi[13]=bt(e.brightMagenta,di[13]),t.ansi[14]=bt(e.brightCyan,di[14]),t.ansi[15]=bt(e.brightWhite,di[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let a=0;a<s;a++)t.ansi[a+16]=bt(e.extendedAnsi[a],di[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()}}};Zp=$t([De(0,Gi)],Zp);function bt(e,t){if(e!==void 0)try{return zt.toColor(e)}catch{}return t}var mR=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},gR=class{constructor(){this._services=new mR,this._services.set(ng,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let s=ck(e).sort((c,h)=>c.index-h.index),a=[];for(let c of s){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=s.length>0?s[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)}},_R={trace:0,debug:1,info:2,warn:3,error:4,off:5},vR="xterm.js: ",Qp=class extends Xe{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=_R[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,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":vR)+t,...s)}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)}};Qp=$t([De(0,Gi)],Qp);var lS=class extends Xe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new be),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new be),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new be),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 s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];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,...s){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+s.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<s.length;a++)this._array[this._getCyclicIndex(e+a)]=s[a];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let a=this._length+s.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let o=t-1;o>=0;o--)this.set(e+o+s,this.get(e+o));let a=e+t+s-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+s,this.get(e+a))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ve=3,ri=Object.freeze(new qo),pu=0,Uf=2,mo=class Fw{constructor(t,s,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ve);let o=s||Hn.fromCharData([0,ow,1,0]);for(let c=0;c<t;++c)this.setCell(c,o);this.length=t}get(t){let s=this._data[t*Ve+0],a=s&2097151;return[this._data[t*Ve+1],s&2097152?this._combined[t]:a?hr(a):"",s>>22,s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):a]}set(t,s){this._data[t*Ve+1]=s[0],s[1].length>1?(this._combined[t]=s[1],this._data[t*Ve+0]=t|2097152|s[2]<<22):this._data[t*Ve+0]=s[1].charCodeAt(0)|s[2]<<22}getWidth(t){return this._data[t*Ve+0]>>22}hasWidth(t){return this._data[t*Ve+0]&12582912}getFg(t){return this._data[t*Ve+1]}getBg(t){return this._data[t*Ve+2]}hasContent(t){return this._data[t*Ve+0]&4194303}getCodePoint(t){let s=this._data[t*Ve+0];return s&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s&2097151}isCombined(t){return this._data[t*Ve+0]&2097152}getString(t){let s=this._data[t*Ve+0];return s&2097152?this._combined[t]:s&2097151?hr(s&2097151):""}isProtected(t){return this._data[t*Ve+2]&536870912}loadCell(t,s){return pu=t*Ve,s.content=this._data[pu+0],s.fg=this._data[pu+1],s.bg=this._data[pu+2],s.content&2097152&&(s.combinedData=this._combined[t]),s.bg&268435456&&(s.extended=this._extendedAttrs[t]),s}setCell(t,s){s.content&2097152&&(this._combined[t]=s.combinedData),s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Ve+0]=s.content,this._data[t*Ve+1]=s.fg,this._data[t*Ve+2]=s.bg}setCellFromCodepoint(t,s,a,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Ve+0]=s|a<<22,this._data[t*Ve+1]=o.fg,this._data[t*Ve+2]=o.bg}addCodepointToCell(t,s,a){let o=this._data[t*Ve+0];o&2097152?this._combined[t]+=hr(s):o&2097151?(this._combined[t]=hr(o&2097151)+hr(s),o&=-2097152,o|=2097152):o=s|1<<22,a&&(o&=-12582913,o|=a<<22),this._data[t*Ve+0]=o}insertCells(t,s,a){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),s<this.length-t){let o=new Hn;for(let c=this.length-t-s-1;c>=0;--c)this.setCell(t+s+c,this.loadCell(t+c,o));for(let c=0;c<s;++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,s,a){if(t%=this.length,s<this.length-t){let o=new Hn;for(let c=0;c<this.length-t-s;++c)this.setCell(t+c,this.loadCell(t+s+c,o));for(let c=this.length-s;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,s,a,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,a),s<this.length&&this.getWidth(s-1)===2&&!this.isProtected(s)&&this.setCellFromCodepoint(s,0,1,a);t<s&&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),s<this.length&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s,0,1,a);t<s&&t<this.length;)this.setCell(t++,a)}resize(t,s){if(t===this.length)return this._data.length*4*Uf<this._data.buffer.byteLength;let a=t*Ve;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,s)}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*Uf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Uf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,s=!1){if(s){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 s in t._combined)this._combined[s]=t._combined[s];this._extendedAttrs={};for(let s in t._extendedAttrs)this._extendedAttrs[s]=t._extendedAttrs[s];this.isWrapped=t.isWrapped}clone(){let t=new Fw(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let s in this._combined)t._combined[s]=this._combined[s];for(let s in this._extendedAttrs)t._extendedAttrs[s]=this._extendedAttrs[s];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ve+0]&4194303)return t+(this._data[t*Ve+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ve+0]&4194303||this._data[t*Ve+2]&50331648)return t+(this._data[t*Ve+0]>>22);return 0}copyCellsFrom(t,s,a,o,c){let h=t._data;if(c)for(let g=o-1;g>=0;g--){for(let p=0;p<Ve;p++)this._data[(a+g)*Ve+p]=h[(s+g)*Ve+p];h[(s+g)*Ve+2]&268435456&&(this._extendedAttrs[a+g]=t._extendedAttrs[s+g])}else for(let g=0;g<o;g++){for(let p=0;p<Ve;p++)this._data[(a+g)*Ve+p]=h[(s+g)*Ve+p];h[(s+g)*Ve+2]&268435456&&(this._extendedAttrs[a+g]=t._extendedAttrs[s+g])}let f=Object.keys(t._combined);for(let g=0;g<f.length;g++){let p=parseInt(f[g],10);p>=s&&(this._combined[p-s+a]=t._combined[p])}}translateToString(t,s,a,o){s=s??0,a=a??this.length,t&&(a=Math.min(a,this.getTrimmedLength())),o&&(o.length=0);let c="";for(;s<a;){let h=this._data[s*Ve+0],f=h&2097151,g=h&2097152?this._combined[s]:f?hr(f):dr;if(c+=g,o)for(let p=0;p<g.length;++p)o.push(s);s+=h>>22||1}return o&&o.push(s),c}};function yR(e,t,s,a,o,c){let h=[];for(let f=0;f<e.length-1;f++){let g=f,p=e.get(++g);if(!p.isWrapped)continue;let b=[e.get(f)];for(;g<e.length&&p.isWrapped;)b.push(p),p=e.get(++g);if(!c&&a>=f&&a<g){f+=b.length-1;continue}let y=0,S=Bo(b,y,t),C=1,x=0;for(;C<b.length;){let L=Bo(b,C,t),D=L-x,j=s-S,U=Math.min(D,j);b[y].copyCellsFrom(b[C],x,S,U,!1),S+=U,S===s&&(y++,S=0),x+=U,x===L&&(C++,x=0),S===0&&y!==0&&b[y-1].getWidth(s-1)===2&&(b[y].copyCellsFrom(b[y-1],s-1,S++,1,!1),b[y-1].setCell(s-1,o))}b[y].replaceCells(S,s,o);let E=0;for(let L=b.length-1;L>0&&(L>y||b[L].getTrimmedLength()===0);L--)E++;E>0&&(h.push(f+b.length-E),h.push(E)),f+=b.length-1}return h}function bR(e,t){let s=[],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 s.push(h);return{layout:s,countRemoved:c}}function SR(e,t){let s=[];for(let a=0;a<t.length;a++)s.push(e.get(t[a]));for(let a=0;a<s.length;a++)e.set(a,s[a]);e.length=t.length}function wR(e,t,s){let a=[],o=e.map((g,p)=>Bo(e,p,t)).reduce((g,p)=>g+p),c=0,h=0,f=0;for(;f<o;){if(o-f<s){a.push(o-f);break}c+=s;let g=Bo(e,h,t);c>g&&(c-=g,h++);let p=e[h].getWidth(c-1)===2;p&&c--;let b=p?s-1:s;a.push(b),f+=b}return a}function Bo(e,t,s){if(t===e.length-1)return e[t].getTrimmedLength();let a=!e[t].hasContent(s-1)&&e[t].getWidth(s-1)===1,o=e[t+1].getWidth(0)===2;return a&&o?s-1:s}var qw=class Ww{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Ww._nextId++,this._onDispose=this.register(new be),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ta(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};qw._nextId=1;var CR=qw,gi={},Wr=gi.B;gi[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:"≥","{":"π","|":"≠","}":"£","~":"·"};gi.A={"#":"£"};gi.B=void 0;gi[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};gi.C=gi[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gi.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};gi.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};gi.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};gi.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};gi.E=gi[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};gi.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};gi.H=gi[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gi["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var oS=4294967295,cS=class{constructor(e,t,s){this._hasScrollback=e,this._optionsService=t,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ri.clone(),this.savedCharset=Wr,this.markers=[],this._nullCell=Hn.fromCharData([0,ow,1,0]),this._whitespaceCell=Hn.fromCharData([0,dr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Iu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new lS(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 ju),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 ju),this._whitespaceCell}getBlankLine(e,t){return new mo(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>oS?oS:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ri);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 lS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let s=this.getNullCell(ri),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,s);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 mo(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+c+1?(this.ybase--,c++,this.ydisp>0&&this.ydisp--):this.lines.push(new mo(e,s)));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,s);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 s=this._optionsService.rawOptions.reflowCursorLine,a=yR(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ri),s);if(a.length>0){let o=bR(this.lines,a);SR(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,s){let a=this.getNullCell(ri),o=s;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new mo(e,a))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,t){let s=this._optionsService.rawOptions.reflowCursorLine,a=this.getNullCell(ri),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 g=[f];for(;f.isWrapped&&h>0;)f=this.lines.get(--h),g.unshift(f);if(!s){let U=this.ybase+this.y;if(U>=h&&U<h+g.length)continue}let p=g[g.length-1].getTrimmedLength(),b=wR(g,this._cols,e),y=b.length-g.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+y):S=Math.max(0,this.lines.length-this.lines.maxLength+y);let C=[];for(let U=0;U<y;U++){let Z=this.getBlankLine(ri,!0);C.push(Z)}C.length>0&&(o.push({start:h+g.length+c,newLines:C}),c+=C.length),g.push(...C);let x=b.length-1,E=b[x];E===0&&(x--,E=b[x]);let L=g.length-y-1,D=p;for(;L>=0;){let U=Math.min(D,E);if(g[x]===void 0)break;if(g[x].copyCellsFrom(g[L],D-U,E-U,U,!0),E-=U,E===0&&(x--,E=b[x]),D-=U,D===0){L--;let Z=Math.max(L,0);D=Bo(g,Z,this._cols)}}for(let U=0;U<g.length;U++)b[U]<e&&g[U].setCell(b[U],a);let j=y-S;for(;j-- >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 E=0;E<this.lines.length;E++)f.push(this.lines.get(E));let g=this.lines.length,p=g-1,b=0,y=o[b];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let S=0;for(let E=Math.min(this.lines.maxLength-1,g+c-1);E>=0;E--)if(y&&y.start>p+S){for(let L=y.newLines.length-1;L>=0;L--)this.lines.set(E--,y.newLines[L]);E++,h.push({index:p+1,amount:y.newLines.length}),S+=y.newLines.length,y=o[++b]}else this.lines.set(E,f[p--]);let C=0;for(let E=h.length-1;E>=0;E--)h[E].index+=C,this.lines.onInsertEmitter.fire(h[E]),C+=h[E].amount;let x=Math.max(0,g+c-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,s=0,a){let o=this.lines.get(e);return o?o.translateToString(t,s,a):""}getWrappedRangeForLine(e){let t=e,s=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:t,last:s}}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 CR(e);return this.markers.push(t),t.register(this.lines.onTrim(s=>{t.line-=s,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(s=>{t.line>=s.index&&(t.line+=s.amount)})),t.register(this.lines.onDelete(s=>{t.line>=s.index&&t.line<s.index+s.amount&&t.dispose(),t.line>s.index&&(t.line-=s.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},xR=class extends Xe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new be),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 cS(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new cS(!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)}},$w=2,Yw=1,Jp=class extends Xe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,$w),this.rows=Math.max(e.rawOptions.rows||0,Yw),this.buffers=this._register(new xR(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let s=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:s,rowsChanged:a})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let s=this.buffer,a;a=this._cachedBlankLine,(!a||a.length!==this.cols||a.getFg(0)!==e.fg||a.getBg(0)!==e.bg)&&(a=s.getBlankLine(e,t),this._cachedBlankLine=a),a.isWrapped=t;let o=s.ybase+s.scrollTop,c=s.ybase+s.scrollBottom;if(s.scrollTop===0){let h=s.lines.isFull;c===s.lines.length-1?h?s.lines.recycle().copyFrom(a):s.lines.push(a.clone()):s.lines.splice(c+1,0,a.clone()),h?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let h=c-o+1;s.lines.shiftElements(o+1,h-1,-1),s.lines.set(c,a.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,t){let s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let a=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),a!==s.ydisp&&(t||this._onScroll.fire(s.ydisp))}};Jp=$t([De(0,Gi)],Jp);var $a={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:Pu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},ER=["normal","bold","100","200","300","400","500","600","700","800","900"],TR=class extends Xe{constructor(e){super(),this._onOptionChange=this._register(new be),this.onOptionChange=this._onOptionChange.event;let t={...$a};for(let s in e)if(s in t)try{let a=e[s];t[s]=this._sanitizeAndValidateOption(s,a)}catch(a){console.error(a)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(At(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in $a))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,a)=>{if(!(s in $a))throw new Error(`No option with key "${s}"`);a=this._sanitizeAndValidateOption(s,a),this.rawOptions[s]!==a&&(this.rawOptions[s]=a,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let a={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,a)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=$a[e]),!kR(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=$a[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=ER.includes(t)?t:$a[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 kR(e){return e==="block"||e==="underline"||e==="bar"}function go(e,t=5){if(typeof e!="object")return e;let s=Array.isArray(e)?[]:{};for(let a in e)s[a]=t<=1?e[a]:e[a]&&go(e[a],t-1);return s}var uS=Object.freeze({insertMode:!1}),hS=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),em=class extends Xe{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new be),this.onData=this._onData.event,this._onUserInput=this._register(new be),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new be),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=go(uS),this.decPrivateModes=go(hS)}reset(){this.modes=go(uS),this.decPrivateModes=go(hS)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.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))}};em=$t([De(0,Xi),De(1,fw),De(2,Gi)],em);var dS={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 Pf(e,t){let s=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(s|=64,s|=e.action):(s|=e.button&3,e.button&4&&(s|=64),e.button&8&&(s|=128),e.action===32?s|=32:e.action===0&&!t&&(s|=3)),s}var If=String.fromCharCode,fS={DEFAULT:e=>{let t=[Pf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${If(t[0])}${If(t[1])}${If(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Pf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Pf(e,!0)};${e.x};${e.y}${t}`}},tm=class extends Xe{constructor(e,t,s){super(),this._bufferService=e,this._coreService=t,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new be),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(dS))this.addProtocol(a,dS[a]);for(let a of Object.keys(fS))this.addEncoding(a,fS[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,s){if(e.deltaY===0||e.shiftKey||t===void 0||s===void 0)return 0;let a=t/s,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,s){if(s){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)}};tm=$t([De(0,Xi),De(1,sa),De(2,Gi)],tm);var Kf=[[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]],DR=[[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]],fi;function RR(e,t){let s=0,a=t.length-1,o;if(e<t[0][0]||e>t[a][1])return!1;for(;a>=s;)if(o=s+a>>1,e>t[o][1])s=o+1;else if(e<t[o][0])a=o-1;else return!0;return!1}var MR=class{constructor(){if(this.version="6",!fi){fi=new Uint8Array(65536),fi.fill(1),fi[0]=0,fi.fill(0,1,32),fi.fill(0,127,160),fi.fill(2,4352,4448),fi[9001]=2,fi[9002]=2,fi.fill(2,11904,42192),fi[12351]=1,fi.fill(2,44032,55204),fi.fill(2,63744,64256),fi.fill(2,65040,65050),fi.fill(2,65072,65136),fi.fill(2,65280,65377),fi.fill(2,65504,65511);for(let e=0;e<Kf.length;++e)fi.fill(0,Kf[e][0],Kf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?fi[e]:RR(e,DR)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),a=s===0&&t!==0;if(a){let o=Xr.extractWidth(t);o===0?a=!1:o>s&&(s=o)}return Xr.createPropertyValue(0,s,a)}},Xr=class Eu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new be,this.onChange=this._onChange.event;let t=new MR;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,s,a=!1){return(t&16777215)<<3|(s&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 s=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 s+this.wcwidth(h);let p=t.charCodeAt(c);56320<=p&&p<=57343?h=(h-55296)*1024+p-56320+65536:s+=this.wcwidth(p)}let f=this.charProperties(h,a),g=Eu.extractWidth(f);Eu.extractShouldJoin(f)&&(g-=Eu.extractWidth(a)),s+=g,a=f}return s}charProperties(t,s){return this._activeProvider.charProperties(t,s)}},NR=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 pS(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&t&&(s.isWrapped=t[3]!==0&&t[3]!==32)}var so=2147483647,AR=256,Vw=class im{constructor(t=32,s=32){if(this.maxLength=t,this.maxSubParamsLength=s,s>AR)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(s),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let s=new im;if(!t.length)return s;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)s.addSubParam(o[c]);else s.addParam(o)}return s}clone(){let t=new im(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 s=0;s<this.length;++s){t.push(this.params[s]);let a=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&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>so?so: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>so?so:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let s=this._subParamsIdx[t]>>8,a=this._subParamsIdx[t]&255;return a-s>0?this._subParams.subarray(s,a):null}getSubParamsAll(){let t={};for(let s=0;s<this.length;++s){let a=this._subParamsIdx[s]>>8,o=this._subParamsIdx[s]&255;o-a>0&&(t[s]=this._subParams.slice(a,o))}return t}addDigit(t){let s;if(this._rejectDigits||!(s=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let a=this._digitIsSub?this._subParams:this.params,o=a[s-1];a[s-1]=~o?Math.min(o*10+t,so):t}},ro=[],LR=class{constructor(){this._state=0,this._active=ro,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 s=this._handlers[e];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.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=ro}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=ro,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ro,!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,s){if(!this._active.length)this._handlerFb(this._id,"PUT",sh(e,t,s));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){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&&s-t>0&&this._put(e,t,s)}}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 s=!1,a=this._active.length-1,o=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;a>=0&&(s=this._active[a].end(e),s!==!0);a--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,s;a--}for(;a>=0;a--)if(s=this._active[a].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,s}this._active=ro,this._id=-1,this._state=0}}},yn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=sh(e,t,s),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(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},ao=[],BR=class{constructor(){this._handlers=Object.create(null),this._active=ao,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ao}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let a=s.indexOf(t);a!==-1&&s.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=ao,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ao,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",sh(e,t,s));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,a=this._active.length-1,o=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,s=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&s===!1){for(;a>=0&&(s=this._active[a].unhook(e),s!==!0);a--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,s;a--}for(;a>=0;a--)if(s=this._active[a].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,s}this._active=ao,this._ident=0}},_o=new Vw;_o.addParam(0);var mS=class{constructor(e){this._handler=e,this._data="",this._params=_o,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():_o,this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=sh(e,t,s),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(s=>(this._params=_o,this._data="",this._hitLimit=!1,s));return this._params=_o,this._data="",this._hitLimit=!1,t}},OR=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,a){this.table[t<<8|e]=s<<4|a}addMany(e,t,s,a){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=s<<4|a}},zn=160,zR=(function(){let e=new OR(4095),t=Array.apply(null,Array(256)).map((f,g)=>g),s=(f,g)=>t.slice(f,g),a=s(32,127),o=s(0,24);o.push(25),o.push.apply(o,s(28,32));let c=s(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(s(128,144),h,3,0),e.addMany(s(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(s(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(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(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(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(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(zn,0,2,0),e.add(zn,8,5,8),e.add(zn,6,0,6),e.add(zn,11,0,11),e.add(zn,13,13,13),e})(),jR=class extends Xe{constructor(e=zR){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 Vw,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,a)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},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(At(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new LR),this._dcsParser=this._register(new BR),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>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");s<<=8,s|=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 s<<=8,s|=a,s}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 s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let a=this._escHandlers[s];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 s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let a=this._csiHandlers[s];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,s,a,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=a,this._parseStack.chunkPos=o}parse(e,t,s){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(s===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,g=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&g>-1){for(;g>=0&&(h=f[g](this._params),h!==!0);g--)if(h instanceof Promise)return this._parseStack.handlerPos=g,h}this._parseStack.handlers=[];break;case 4:if(s===!1&&g>-1){for(;g>=0&&(h=f[g](),h!==!0);g--)if(h instanceof Promise)return this._parseStack.handlerPos=g,h}this._parseStack.handlers=[];break;case 6:if(a=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(a!==24&&a!==26,s),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,s),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:zn)],o>>4){case 2:for(let S=f+1;;++S){if(S>=t||(a=e[S])<32||a>126&&a<zn){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(a=e[S])<32||a>126&&a<zn){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(a=e[S])<32||a>126&&a<zn){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(a=e[S])<32||a>126&&a<zn){this._printHandler(e,f,S),f=S-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 g=this._csiHandlers[this._collect<<8|a],p=g?g.length-1:-1;for(;p>=0&&(h=g[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(3,g,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 S=f+1;;++S)if(S>=t||(a=e[S])===24||a===26||a===27||a>127&&a<zn){this._dcsParser.put(e,f,S),f=S-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 S=f+1;;S++)if(S>=t||(a=e[S])<32||a>127&&a<zn){this._oscParser.put(e,f,S),f=S-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}}},HR=/^([\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})$/,UR=/^[\da-f]+$/;function gS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let s=HR.exec(t);if(s){let a=s[1]?15:s[4]?255:s[7]?4095:65535;return[Math.round(parseInt(s[1]||s[4]||s[7]||s[10],16)/a*255),Math.round(parseInt(s[2]||s[5]||s[8]||s[11],16)/a*255),Math.round(parseInt(s[3]||s[6]||s[9]||s[12],16)/a*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),UR.exec(t)&&[3,6,9,12].includes(t.length))){let s=t.length/3,a=[0,0,0];for(let o=0;o<3;++o){let c=parseInt(t.slice(s*o,s*o+s),16);a[o]=s===1?c<<4:s===2?c:s===3?c>>4:c>>8}return a}}function Ff(e,t){let s=e.toString(16),a=s.length<2?"0"+s:s;switch(t){case 4:return s[0];case 8:return a;case 12:return(a+a).slice(0,3);default:return a+a}}function PR(e,t=16){let[s,a,o]=e;return`rgb:${Ff(s,t)}/${Ff(a,t)}/${Ff(o,t)}`}var IR={"(":0,")":1,"*":2,"+":3,"-":1,".":2},or=131072,_S=10;function vS(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 yS=5e3,bS=0,KR=class extends Xe{constructor(e,t,s,a,o,c,h,f,g=new jR){super(),this._bufferService=e,this._charsetService=t,this._coreService=s,this._logService=a,this._optionsService=o,this._oscLinkService=c,this._coreMouseService=h,this._unicodeService=f,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new lk,this._utf8Decoder=new ok,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ri.clone(),this._eraseAttrDataInternal=ri.clone(),this._onRequestBell=this._register(new be),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new be),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new be),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new be),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new be),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new be),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new be),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new be),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new be),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 nm(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(he.BEL,()=>this.bell()),this._parser.setExecuteHandler(he.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(he.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(he.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(he.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(he.BS,()=>this.backspace()),this._parser.setExecuteHandler(he.HT,()=>this.tab()),this._parser.setExecuteHandler(he.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(he.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Cu.IND,()=>this.index()),this._parser.setExecuteHandler(Cu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Cu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new yn(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new yn(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new yn(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new yn(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new yn(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new yn(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new yn(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new yn(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new yn(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new yn(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new yn(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new yn(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 gi)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 mS((p,b)=>this.requestStatusString(p,b)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,s,a){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=s,this._parseStack.position=a}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,s)=>setTimeout(()=>s("#SLOW_TIMEOUT"),yS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${yS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let s,a=this._activeBuffer.x,o=this._activeBuffer.y,c=0,h=this._parseStack.paused;if(h){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(s),s;a=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>or&&(c=this._parseStack.position+or)}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<or&&(this._parseBuffer=new Uint32Array(Math.min(e.length,or))),h||this._dirtyRowTracker.clearRange(),e.length>or)for(let p=c;p<e.length;p+=or){let b=p+or<e.length?p+or: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(s=this._parser.parse(this._parseBuffer,y))return this._preserveStack(a,o,y,p),this._logSlowResolvingAsync(s),s}else if(!h){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,p))return this._preserveStack(a,o,p,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==a||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),g=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);g<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(g,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,s){let a,o,c=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,g=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&&s-t>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.setCellFromCodepoint(this._activeBuffer.x-1,0,1,b);let S=this._parser.precedingJoinState;for(let C=t;C<s;++C){if(a=e[C],a<127&&c){let D=c[String.fromCharCode(a)];D&&(a=D.charCodeAt(0))}let x=this._unicodeService.charProperties(a,S);o=Xr.extractWidth(x);let E=Xr.extractShouldJoin(x),L=E?Xr.extractWidth(S):0;if(S=x,h&&this._onA11yChar.fire(hr(a)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-L>f){if(g){let D=y,j=this._activeBuffer.x-L;for(this._activeBuffer.x=L,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),L>0&&y instanceof mo&&y.copyCellsFrom(D,j,0,L,!1);j<f;)D.setCellFromCodepoint(j++,0,1,b)}else if(this._activeBuffer.x=f-1,o===2)continue}if(E&&this._activeBuffer.x){let D=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-D,a,o);for(let j=o-L;--j>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,b);continue}if(p&&(y.insertCells(this._activeBuffer.x,o-L,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=S,this._activeBuffer.x<f&&s-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,s=>vS(s.params[0],this._optionsService.rawOptions.windowOptions)?t(s):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new mS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new yn(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,s,a=!1,o=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);c.replaceCells(t,s,this._activeBuffer.getNullCell(this._eraseAttrData()),o),a&&(c.isWrapped=!1)}_resetBufferLine(e,t=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let s;switch(e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);s<this._bufferService.rows;s++)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,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 s=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(s,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 s=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(s,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(ri));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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=this._activeBuffer.scrollTop;s<=this._activeBuffer.scrollBottom;++s){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+s);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 s=e.params[0]||1,a=Xr.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*s),f=0;for(let p=0;p<c.length;){let b=c.codePointAt(p)||0;h[f++]=b,p+=b>65535?2:1}let g=f;for(let p=1;p<s;++p)h.copyWithin(g,0,f),g+=f;return this.print(h,0,g),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(he.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(he.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(he.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(he.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(he.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,Wr),this._charsetService.setgCharset(1,Wr),this._charsetService.setgCharset(2,Wr),this._charsetService.setgCharset(3,Wr);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 s;(E=>(E[E.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",E[E.SET=1]="SET",E[E.RESET=2]="RESET",E[E.PERMANENTLY_SET=3]="PERMANENTLY_SET",E[E.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(s||={});let a=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:c}=this._coreMouseService,h=this._coreService,{buffers:f,cols:g}=this._bufferService,{active:p,alt:b}=f,y=this._optionsService.rawOptions,S=(E,L)=>(h.triggerDataEvent(`${he.ESC}[${t?"":"?"}${E};${L}$y`),!0),C=E=>E?1:2,x=e.params[0];return t?x===2?S(x,4):x===4?S(x,C(h.modes.insertMode)):x===12?S(x,3):x===20?S(x,C(y.convertEol)):S(x,0):x===1?S(x,C(a.applicationCursorKeys)):x===3?S(x,y.windowOptions.setWinLines?g===80?2:g===132?1:0:0):x===6?S(x,C(a.origin)):x===7?S(x,C(a.wraparound)):x===8?S(x,3):x===9?S(x,C(o==="X10")):x===12?S(x,C(y.cursorBlink)):x===25?S(x,C(!h.isCursorHidden)):x===45?S(x,C(a.reverseWraparound)):x===66?S(x,C(a.applicationKeypad)):x===67?S(x,4):x===1e3?S(x,C(o==="VT200")):x===1002?S(x,C(o==="DRAG")):x===1003?S(x,C(o==="ANY")):x===1004?S(x,C(a.sendFocus)):x===1005?S(x,4):x===1006?S(x,C(c==="SGR")):x===1015?S(x,4):x===1016?S(x,C(c==="SGR_PIXELS")):x===1048?S(x,1):x===47||x===1047||x===1049?S(x,C(p===b)):x===2004?S(x,C(a.bracketedPasteMode)):x===2026?S(x,C(a.synchronizedOutput)):S(x,0)}_updateAttrColor(e,t,s,a,o){return t===2?(e|=50331648,e&=-16777216,e|=qo.fromColorRGB([s,a,o])):t===5&&(e&=-50331904,e|=33554432|s&255),e}_extractColor(e,t,s){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:s.fg=this._updateAttrColor(s.fg,a[1],a[3],a[4],a[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,a[1],a[3],a[4],a[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.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=ri.fg,e.bg=ri.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,s,a=this._curAttrData;for(let o=0;o<t;o++)s=e.params[o],s>=30&&s<=37?(a.fg&=-50331904,a.fg|=16777216|s-30):s>=40&&s<=47?(a.bg&=-50331904,a.bg|=16777216|s-40):s>=90&&s<=97?(a.fg&=-50331904,a.fg|=16777216|s-90|8):s>=100&&s<=107?(a.bg&=-50331904,a.bg|=16777216|s-100|8):s===0?this._processSGR0(a):s===1?a.fg|=134217728:s===3?a.bg|=67108864:s===4?(a.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,a)):s===5?a.fg|=536870912:s===7?a.fg|=67108864:s===8?a.fg|=1073741824:s===9?a.fg|=2147483648:s===2?a.bg|=134217728:s===21?this._processUnderline(2,a):s===22?(a.fg&=-134217729,a.bg&=-134217729):s===23?a.bg&=-67108865:s===24?(a.fg&=-268435457,this._processUnderline(0,a)):s===25?a.fg&=-536870913:s===27?a.fg&=-67108865:s===28?a.fg&=-1073741825:s===29?a.fg&=2147483647:s===39?(a.fg&=-67108864,a.fg|=ri.fg&16777215):s===49?(a.bg&=-67108864,a.bg|=ri.bg&16777215):s===38||s===48||s===58?o+=this._extractColor(e,o,a):s===53?a.bg|=1073741824:s===55?a.bg&=-1073741825:s===59?(a.extended=a.extended.clone(),a.extended.underlineColor=-1,a.updateExtended()):s===100?(a.fg&=-67108864,a.fg|=ri.fg&16777215,a.bg&=-67108864,a.bg|=ri.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${he.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${he.ESC}[${t};${s}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${he.ESC}[?${t};${s}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=ri.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 s=t%2===1;this._coreService.decPrivateModes.cursorBlink=s}return!0}setScrollRegion(e){let t=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||s===0)&&(s=this._bufferService.rows),s>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!vS(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(`${he.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>_S&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>_S&&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=[],s=e.split(";");for(;s.length>1;){let a=s.shift(),o=s.shift();if(/^\d+$/.exec(a)){let c=parseInt(a);if(SS(c))if(o==="?")t.push({type:0,index:c});else{let h=gS(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 s=e.slice(0,t).trim(),a=e.slice(t+1);return a?this._createHyperlink(s,a):s.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),a,o=s.findIndex(c=>c.startsWith("id="));return o!==-1&&(a=s[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 s=e.split(";");for(let a=0;a<s.length&&!(t>=this._specialColors.length);++a,++t)if(s[a]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=gS(s[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=[],s=e.split(";");for(let a=0;a<s.length;++a)if(/^\d+$/.exec(s[a])){let o=parseInt(s[a]);SS(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,Wr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(IR[e[0]],gi[e[1]]||Wr),!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=ri.clone(),this._eraseAttrDataInternal=ri.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 Hn;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 s=this._activeBuffer.ybase+this._activeBuffer.y+t,a=this._activeBuffer.lines.get(s);a&&(a.fill(e),a.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let s=h=>(this._coreService.triggerDataEvent(`${he.ESC}${h}${he.ESC}\\`),!0),a=this._bufferService.buffer,o=this._optionsService.rawOptions;return s(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)}},nm=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&&(bS=e,e=t,t=bS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};nm=$t([De(0,Xi)],nm);function SS(e){return 0<=e&&e<256}var FR=5e7,wS=12,qR=50,WR=class extends Xe{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 be),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 s;for(;s=this._writeBuffer.shift();){this._action(s);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>FR)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 s=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()-s>=wS?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(s,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()-s>=wS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>qR&&(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()}},sm=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),g={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(g,f)),this._dataByLinkId.set(g.id,g),g.id}let s=e,a=this._getEntryIdKey(s),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(s),data:s,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 s=this._dataByLinkId.get(e);if(s&&s.lines.every(a=>a.line!==t)){let a=this._bufferService.buffer.addMarker(t);s.lines.push(a),a.onDispose(()=>this._removeMarkerFromLink(s,a))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};sm=$t([De(0,Xi)],sm);var CS=!1,$R=class extends Xe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new nl),this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onData=this._register(new be),this.onData=this._onData.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new be),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new be),this._instantiationService=new gR,this.optionsService=this._register(new TR(e)),this._instantiationService.setService(Gi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Jp)),this._instantiationService.setService(Xi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Qp)),this._instantiationService.setService(fw,this._logService),this.coreService=this._register(this._instantiationService.createInstance(em)),this._instantiationService.setService(sa,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(tm)),this._instantiationService.setService(dw,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Xr)),this._instantiationService.setService(dk,this.unicodeService),this._charsetService=this._instantiationService.createInstance(NR),this._instantiationService.setService(hk,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(sm),this._instantiationService.setService(pw,this._oscLinkService),this._inputHandler=this._register(new KR(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ji.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ji.forward(this._bufferService.onResize,this._onResize)),this._register(ji.forward(this.coreService.onData,this._onData)),this._register(ji.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 WR((t,s)=>this._inputHandler.parse(t,s))),this._register(ji.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new be),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&&!CS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),CS=!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,$w),t=Math.max(t,Yw),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(pS.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(pS(this._bufferService),!1))),this._windowsWrappingHeuristics.value=At(()=>{for(let t of e)t.dispose()})}}},YR={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 VR(e,t,s,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=he.ESC+"OA":o.key=he.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=he.ESC+"OD":o.key=he.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=he.ESC+"OC":o.key=he.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=he.ESC+"OB":o.key=he.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":he.DEL,e.altKey&&(o.key=he.ESC+o.key);break;case 9:if(e.shiftKey){o.key=he.ESC+"[Z";break}o.key=he.HT,o.cancel=!0;break;case 13:o.key=e.altKey?he.ESC+he.CR:he.CR,o.cancel=!0;break;case 27:o.key=he.ESC,e.altKey&&(o.key=he.ESC+he.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;c?o.key=he.ESC+"[1;"+(c+1)+"D":t?o.key=he.ESC+"OD":o.key=he.ESC+"[D";break;case 39:if(e.metaKey)break;c?o.key=he.ESC+"[1;"+(c+1)+"C":t?o.key=he.ESC+"OC":o.key=he.ESC+"[C";break;case 38:if(e.metaKey)break;c?o.key=he.ESC+"[1;"+(c+1)+"A":t?o.key=he.ESC+"OA":o.key=he.ESC+"[A";break;case 40:if(e.metaKey)break;c?o.key=he.ESC+"[1;"+(c+1)+"B":t?o.key=he.ESC+"OB":o.key=he.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=he.ESC+"[2~");break;case 46:c?o.key=he.ESC+"[3;"+(c+1)+"~":o.key=he.ESC+"[3~";break;case 36:c?o.key=he.ESC+"[1;"+(c+1)+"H":t?o.key=he.ESC+"OH":o.key=he.ESC+"[H";break;case 35:c?o.key=he.ESC+"[1;"+(c+1)+"F":t?o.key=he.ESC+"OF":o.key=he.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=he.ESC+"[5;"+(c+1)+"~":o.key=he.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=he.ESC+"[6;"+(c+1)+"~":o.key=he.ESC+"[6~";break;case 112:c?o.key=he.ESC+"[1;"+(c+1)+"P":o.key=he.ESC+"OP";break;case 113:c?o.key=he.ESC+"[1;"+(c+1)+"Q":o.key=he.ESC+"OQ";break;case 114:c?o.key=he.ESC+"[1;"+(c+1)+"R":o.key=he.ESC+"OR";break;case 115:c?o.key=he.ESC+"[1;"+(c+1)+"S":o.key=he.ESC+"OS";break;case 116:c?o.key=he.ESC+"[15;"+(c+1)+"~":o.key=he.ESC+"[15~";break;case 117:c?o.key=he.ESC+"[17;"+(c+1)+"~":o.key=he.ESC+"[17~";break;case 118:c?o.key=he.ESC+"[18;"+(c+1)+"~":o.key=he.ESC+"[18~";break;case 119:c?o.key=he.ESC+"[19;"+(c+1)+"~":o.key=he.ESC+"[19~";break;case 120:c?o.key=he.ESC+"[20;"+(c+1)+"~":o.key=he.ESC+"[20~";break;case 121:c?o.key=he.ESC+"[21;"+(c+1)+"~":o.key=he.ESC+"[21~";break;case 122:c?o.key=he.ESC+"[23;"+(c+1)+"~":o.key=he.ESC+"[23~";break;case 123:c?o.key=he.ESC+"[24;"+(c+1)+"~":o.key=he.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=he.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=he.DEL:e.keyCode===219?o.key=he.ESC:e.keyCode===220?o.key=he.FS:e.keyCode===221&&(o.key=he.GS);else if((!s||a)&&e.altKey&&!e.metaKey){let h=YR[e.keyCode]?.[e.shiftKey?1:0];if(h)o.key=he.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,g=String.fromCharCode(f);e.shiftKey&&(g=g.toUpperCase()),o.key=he.ESC+g}else if(e.keyCode===32)o.key=he.ESC+(e.ctrlKey?he.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),o.key=he.ESC+f,o.cancel=!0}}else s&&!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=he.US),e.key==="@"&&(o.key=he.NUL));break}return o}var Zt=0,XR=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Iu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Iu,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,s=0,a=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<a.length;o++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(a[o]=e[t],t++):a[o]=this._array[s++];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||(Zt=this._search(t),Zt===-1)||this._getKey(this._array[Zt])!==t)return!1;do if(this._array[Zt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Zt),!0;while(++Zt<this._array.length&&this._getKey(this._array[Zt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,c)=>o-c),t=0,s=new Array(this._array.length-e.length),a=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:s[a++]=this._array[o];this._array=s,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&&(Zt=this._search(e),!(Zt<0||Zt>=this._array.length)&&this._getKey(this._array[Zt])===e))do yield this._array[Zt];while(++Zt<this._array.length&&this._getKey(this._array[Zt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Zt=this._search(e),!(Zt<0||Zt>=this._array.length)&&this._getKey(this._array[Zt])===e))do t(this._array[Zt]);while(++Zt<this._array.length&&this._getKey(this._array[Zt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let a=t+s>>1,o=this._getKey(this._array[a]);if(o>e)s=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}},qf=0,xS=0,GR=class extends Xe{constructor(){super(),this._decorations=new XR(e=>e?.marker.line),this._onDecorationRegistered=this._register(new be),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new be),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(At(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new ZR(e);if(t){let s=t.marker.onDispose(()=>t.dispose()),a=t.onDispose(()=>{a.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.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,s){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&&(!s||(c.options.layer??"bottom")===s)&&(yield c)}forEachDecorationAtCell(e,t,s,a){this._decorations.forEachByKey(t,o=>{qf=o.options.x??0,xS=qf+(o.options.width??1),e>=qf&&e<xS&&(!s||(o.options.layer??"bottom")===s)&&a(o)})}},ZR=class extends pr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new be),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new be),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=zt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=zt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},QR=1e3,JR=class{constructor(e,t=QR){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,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)}},ES=20,Ku=class extends Xe{constructor(e,t,s,a){super(),this._terminal=e,this._coreBrowserService=s,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 JR(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(Pe(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(At(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<ES+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
29
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===ES+1&&(this._liveRegion.textContent+=xp.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 s=this._terminal.buffer,a=s.lines.length.toString();for(let o=e;o<=t;o++){let c=s.lines.get(s.ydisp+o),h=[],f=c?.translateToString(!0,void 0,void 0,h)||"",g=(s.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",g),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 s=e.target,a=this._rowElements[t===0?1:this._rowElements.length-2],o=s.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=s,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(h=this._rowElements.shift(),f=s,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{let g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}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},s={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===s.node&&t.offset>s.offset)&&([t,s]=[s,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(s.node.compareDocumentPosition(a)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:a,offset:a.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let o=({node:f,offset:g})=>{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 S=g<y.length?y[g]:y.slice(-1)[0]+1;return S>=this._terminal.cols&&(++b,S=0),{row:b,column:S}},c=o(t),h=o(s);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,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let a=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${a/t})`}};Ku=$t([De(1,ng),De(2,Ls),De(3,Bs)],Ku);var rm=class extends Xe{constructor(e,t,s,a,o){super(),this._element=e,this._mouseService=t,this._renderService=s,this._bufferService=a,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new be),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new be),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(At(()=>{ta(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(Pe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Pe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Pe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Pe(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 s=e.composedPath();for(let a=0;a<s.length;a++){let o=s[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 s=!1;for(let[a,o]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(a)&&(s=this._checkLinkProviderResult(a,e,s)):o.provideLinks(e.y,c=>{if(this._isMouseOut)return;let h=c?.map(f=>({link:f}));this._activeProviderReplies?.set(a,h),s=this._checkLinkProviderResult(a,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let s=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,g=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let p=f;p<=g;p++){if(s.has(p)){o.splice(c--,1);break}s.add(p)}}}}_checkLinkProviderResult(e,t,s){if(!this._activeProviderReplies)return s;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&&(s=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let c=0;c<this._activeProviderReplies.size;c++){let h=this._activeProviderReplies.get(c)?.find(f=>this._linkAtPosition(f.link,t));if(h){s=!0,this._handleNewLink(h);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&eM(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,ta(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:s=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;let a=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+s.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,s){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(s,t.text)}_fireUnderlineEvent(e,t){let s=e.range,a=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-a-1,s.end.x,s.end.y-a-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,s){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(s,t.text)}_linkAtPosition(e,t){let s=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 s<=o&&o<=a}_positionFromMouseEvent(e,t,s){let a=s.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,s,a,o){return{x1:e,y1:t,x2:s,y2:a,cols:this._bufferService.cols,fg:o}}};rm=$t([De(1,sg),De(2,Bs),De(3,Xi),De(4,gw)],rm);function eM(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 tM=class extends $R{constructor(e={}){super(e),this._linkifier=this._register(new nl),this.browser=Ow,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new nl),this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new be),this.onKey=this._onKey.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new be),this.onBell=this._onBell.event,this._onFocus=this._register(new be),this._onBlur=this._register(new be),this._onA11yCharEmitter=this._register(new be),this._onA11yTabEmitter=this._register(new be),this._onWillOpen=this._register(new be),this._setup(),this._decorationService=this._instantiationService.createInstance(GR),this._instantiationService.setService(Wo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(qD),this._instantiationService.setService(gw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Tp)),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(ji.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ji.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ji.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ji.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(At(()=>{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 s,a="";switch(t.index){case 256:s="foreground",a="10";break;case 257:s="background",a="11";break;case 258:s="cursor",a="12";break;default:s="ansi",a="4;"+t.index}switch(t.type){case 0:let o=Rt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${he.ESC}]${a};${PR(o)}${Lw.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=ai.toColor(...t.color));else{let c=s;this._themeService.modifyColors(h=>h[c]=ai.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(Ku,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(he.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(he.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 s=Math.min(this.buffer.x,this.cols-1),a=this._renderService.dimensions.css.cell.height,o=t.getWidth(s),c=this._renderService.dimensions.css.cell.width*o,h=this.buffer.y*this._renderService.dimensions.css.cell.height,f=s*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(Pe(this.element,"copy",t=>{this.hasSelection()&&rk(t,this._selectionService)}));let e=t=>ak(t,this.textarea,this.coreService,this.optionsService);this._register(Pe(this.textarea,"paste",e)),this._register(Pe(this.element,"paste",e)),zw?this._register(Pe(this.element,"mousedown",t=>{t.button===2&&Ob(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Pe(this.element,"contextmenu",t=>{Ob(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),dg&&this._register(Pe(this.element,"auxclick",t=>{t.button===1&&lw(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Pe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Pe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Pe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Pe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Pe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Pe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Pe(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(Pe(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 s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Cp.get()),Uw||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",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(KD,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ls,this._coreBrowserService),this._register(Pe(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Pe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Yp,this._document,this._helperContainer),this._instantiationService.setService(rh,this._charSizeService),this._themeService=this._instantiationService.createInstance(Zp),this._instantiationService.setService(al,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Uu),this._instantiationService.setService(mw,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Xp,this.rows,this.screenElement)),this._instantiationService.setService(Bs,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(qp,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Vp),this._instantiationService.setService(sg,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(rm,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(Kp,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(Gp,this.element,this.screenElement,a)),this._instantiationService.setService(pk,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(ji.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Fp,this.screenElement)),this._register(Pe(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(Ku,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Hu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Hu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance($p,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(c){let h=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!h)return!1;let f,g;switch(c.overrideType||c.type){case"mousemove":g=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":g=0,f=c.button<3?c.button:3;break;case"mousedown":g=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;g=p<0?0:1,f=4;break;default:return!1}return g===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:g,ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey})}let a={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:c=>(s(c),c.buttons||(this._document.removeEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.removeEventListener("mousemove",a.mousedrag)),this.cancel(c)),wheel:c=>(s(c),this.cancel(c,!0)),mousedrag:c=>{c.buttons&&s(c)},mousemove:c=>{c.buttons||s(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(Pe(t,"mousedown",c=>{if(c.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(c)))return s(c),a.mouseup&&this._document.addEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.addEventListener("mousemove",a.mousedrag),this.cancel(c)})),this._register(Pe(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=he.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){aw(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,s){this._selectionService.setSelection(e,t,s)}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 s=VR(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let a=this.rows-1;return this.scrollLines(s.type===2?-a:a),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.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((s.key===he.ETX||s.key===he.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=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"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(iM(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(ri));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(he.ESC+"[I"):this.coreService.triggerDataEvent(he.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${he.ESC}[4;${s};${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(`${he.ESC}[6;${o};${a}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function iM(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var nM=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;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)}},sM=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 Hn)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},TS=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 sM(t)}getNullCell(){return new Hn}},rM=class extends Xe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new be),this.onBufferChange=this._onBufferChange.event,this._normal=new TS(this._core.buffers.normal,"normal"),this._alternate=new TS(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)}},aM=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,s=>t(s.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(s,a)=>t(s,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)}},lM=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}},oM=["cols","rows"],ts=0,cM=class extends Xe{constructor(e){super(),this._core=this._register(new tM(e)),this._addonManager=this._register(new nM),this._publicOptions={...this._core.options};let t=a=>this._core.options[a],s=(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:s.bind(this,a)};Object.defineProperty(this._publicOptions,a,o)}}_checkReadonlyOptions(e){if(oM.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 aM(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new lM(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 rM(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,s){this._verifyIntegers(e,t,s),this._core.select(e,t,s)}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 Cp.get()},set promptLabel(e){Cp.set(e)},get tooMuchOutput(){return xp.get()},set tooMuchOutput(e){xp.set(e)}}}_verifyIntegers(...e){for(ts of e)if(ts===1/0||isNaN(ts)||ts%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(ts of e)if(ts&&(ts===1/0||isNaN(ts)||ts%1!==0||ts<0))throw new Error("This API only accepts positive integers")}};class uM{pending=null;accept(t){let s="";for(const a of t)s+=this.acceptChar(a);return s}acceptChar(t){return t===""?this.acceptBackspace():Qw.has(t)?this.acceptConsonant(t):Jw.has(t)?this.acceptVowel(t):pM(t)&&this.canReplacePendingWith(t)?(this.pending=DS(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(e1.has(t))return this.pending.final=t,"";const o=this.flushPending();return this.pending={initial:t},o}const s=fM.get(`${this.pending.final}${t}`);if(s)return this.pending.final=s,"";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=dM.get(`${this.pending.vowel}${t}`);return c?(this.pending.vowel=c,""):this.flushPending()+t}const s=kS.get(this.pending.final);if(s){this.pending.final=s[0];const c=this.flushPending();return this.pending={initial:s[1],vowel:t},c}const a=this.pending.final,o=RS({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=kS.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 s=DS(t);return s.initial===this.pending.initial&&(!this.pending.vowel||s.vowel===this.pending.vowel)&&(!this.pending.final||s.final===this.pending.final)}flushPending(){if(!this.pending)return"";const t=RS(this.pending);return this.pending=null,t}}const Fu=44032,qu=21,Xa=28,hM=19*qu*Xa,Xw=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],Gw=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],Zw=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],Qw=fg(Xw),Jw=fg(Gw),e1=fg(Zw),dM=new Map([["ㅗㅏ","ㅘ"],["ㅗㅐ","ㅙ"],["ㅗㅣ","ㅚ"],["ㅜㅓ","ㅝ"],["ㅜㅔ","ㅞ"],["ㅜㅣ","ㅟ"],["ㅡㅣ","ㅢ"]]),t1=[["ㄱㅅ","ㄳ"],["ㄴㅈ","ㄵ"],["ㄴㅎ","ㄶ"],["ㄹㄱ","ㄺ"],["ㄹㅁ","ㄻ"],["ㄹㅂ","ㄼ"],["ㄹㅅ","ㄽ"],["ㄹㅌ","ㄾ"],["ㄹㅍ","ㄿ"],["ㄹㅎ","ㅀ"],["ㅂㅅ","ㅄ"]],fM=new Map(t1),kS=new Map(t1.map(([e,t])=>[t,[e[0],e[1]]]));function fg(e){return new Map(e.map((t,s)=>[t,s]))}function pM(e){const t=e.codePointAt(0);return t!==void 0&&t>=Fu&&t<Fu+hM}function DS(e){const t=e.codePointAt(0)-Fu,s=Math.floor(t/(qu*Xa)),a=Math.floor(t%(qu*Xa)/Xa),o=t%Xa,c={initial:Xw[s],vowel:Gw[a]};return o===0?c:{...c,final:Zw[o]}}function RS(e){if(!e.vowel)return e.initial;const t=Qw.get(e.initial),s=Jw.get(e.vowel),a=e.final?e1.get(e.final):0;return t===void 0||s===void 0||a===void 0?`${e.initial}${e.vowel}${e.final??""}`:String.fromCodePoint(Fu+(t*qu+s)*Xa+a)}const mM=[{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 gM({ctrlActive:e,onCtrl:t,onStandaloneKey:s,onPreserveFocus:a,onHide:o}){function c(h){h.stopPropagation(),a()}return m.jsxs("div",{className:"mobile-terminal-key-bar",role:"toolbar","aria-label":"Mobile terminal keys",onMouseDown:c,onPointerDown:c,children:[m.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"}),mM.map(h=>m.jsx("button",{type:"button",className:"mobile-terminal-key","aria-label":h.ariaLabel,onClick:()=>s(h.key),children:h.label},h.key)),m.jsx("button",{type:"button",className:"mobile-terminal-key mobile-terminal-key-hide","aria-label":"Hide terminal control keys",title:"Hide",onClick:o,children:"×"})]})}const _M={escape:"\x1B",tab:" ",arrowUp:"\x1B[A",arrowDown:"\x1B[B",arrowRight:"\x1B[C",arrowLeft:"\x1B[D"};function vM(e){return _M[e]}function yM(e){return/^[a-z]$/i.test(e)?String.fromCharCode(e.toUpperCase().charCodeAt(0)-64):null}const MS="--nterminal-viewport-height",NS="--nterminal-keyboard-inset-bottom",AS="data-nterminal-keyboard-visible",pg="data-nterminal-compose-open",am="nterminal:viewport-refresh",bM=120;function SM(e=window){const t=e.document.documentElement,s=e.visualViewport;function a(){const o=wM(e);o!==null&&t.style.setProperty(MS,`${o}px`),t.style.setProperty(NS,`${i1(e)}px`),t.setAttribute(AS,String(CM(e)))}return a(),s?.addEventListener("resize",a),s?.addEventListener("scroll",a),e.addEventListener("resize",a),e.addEventListener(am,a),e.addEventListener("orientationchange",a),e.addEventListener("pageshow",a),e.document.addEventListener("visibilitychange",a),()=>{s?.removeEventListener("resize",a),s?.removeEventListener("scroll",a),e.removeEventListener("resize",a),e.removeEventListener(am,a),e.removeEventListener("orientationchange",a),e.removeEventListener("pageshow",a),e.document.removeEventListener("visibilitychange",a),t.style.removeProperty(MS),t.style.removeProperty(NS),t.removeAttribute(AS)}}function wM(e){if(e.document.documentElement.hasAttribute(pg)&&ko(e.innerHeight))return e.innerHeight;const t=e.visualViewport?.height;return ko(t)?t:ko(e.innerHeight)?e.innerHeight:null}function ko(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function CM(e){return i1(e)>bM}function i1(e){const t=e.visualViewport?.height;if(!ko(t)||!ko(e.innerHeight))return 0;const s=typeof e.visualViewport?.offsetTop=="number"?e.visualViewport.offsetTop:0;return Math.max(0,Math.round(e.innerHeight-t-s))}const Vo=new Map,Oo=new Map,xM=Object.freeze({open:!1,text:""});function EM(e){let t=Oo.get(e);return t||(t=new Set,Oo.set(e,t)),t}function n1(e){const t=Oo.get(e);if(t)for(const s of Array.from(t))s()}function mg(e){return Vo.get(e)??xM}function TM(e,t){const s=EM(e);return s.add(t),()=>{s.delete(t)}}function kM(e,t){const s=mg(e);s.open!==t&&(Vo.set(e,{...s,open:t}),n1(e))}function DM(e,t){const s=mg(e);s.text!==t&&(Vo.set(e,{...s,text:t}),n1(e))}function LS(e){Vo.delete(e),Oo.delete(e)}function BS(){Vo.clear(),Oo.clear()}const OS=120,RM=420,Tu=new Set;let Ja=null;function MM({terminalId:e,onSubmit:t,disabled:s=!1}){const a=v.useMemo(()=>E=>TM(e,E),[e]),o=v.useMemo(()=>()=>mg(e),[e]),c=v.useSyncExternalStore(a,o,o),{open:h,text:f}=c,g=v.useRef(null),p=v.useRef(null),b=v.useRef(null);v.useLayoutEffect(()=>{if(!(!h||!lm()))return AM(e),()=>LM(e)},[h,e]),v.useLayoutEffect(()=>{const E=g.current?.closest(".terminal-pane");if(!E)return;function L(){E?.removeAttribute("data-compose-open"),E?.style.removeProperty("--compose-drawer-panel-height")}if(!h){L();return}const D=p.current;E.setAttribute("data-compose-open","true");function j(){const ne=D?.getBoundingClientRect().height??0;ne>0&&E?.style.setProperty("--compose-drawer-panel-height",`${Math.ceil(ne)}px`)}j();const U=[window.setTimeout(j,0),window.setTimeout(j,180),window.setTimeout(j,260)],Z=window.requestAnimationFrame?.(j)??null,ie=typeof ResizeObserver=="function"&&D?new ResizeObserver(j):null;return ie&&D&&ie.observe(D),()=>{for(const ne of U)window.clearTimeout(ne);Z!==null&&window.cancelAnimationFrame?.(Z),ie?.disconnect(),L()}},[h]),v.useEffect(()=>{h&&b.current?.focus()},[h]);function y(E){kM(e,E)}function S(E){DM(e,E)}function C(){NM(g.current),y(!1),zS()}function x(){if(s||!f)return;const E=f.replace(/\r\n/g,`
|
|
31
|
-
`).replace(/\n/g,"\r");if(E&&t(E),window.setTimeout(()=>t("\r"),OS),S(""),lm()){b.current?.blur(),zS();return}window.setTimeout(()=>b.current?.focus(),OS+20)}return m.jsxs("div",{ref:g,className:"compose-drawer","data-open":h?"true":"false",children:[m.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:[m.jsx("span",{"aria-hidden":"true",children:"▴"}),m.jsx("span",{children:"compose"}),f?m.jsx("span",{className:"compose-drawer-handle-dot","aria-label":"draft saved"}):null]}),m.jsxs("div",{ref:p,className:"compose-drawer-panel","aria-hidden":h?void 0:"true",children:[m.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:C,children:[m.jsx("span",{"aria-hidden":"true",children:"▾"}),m.jsx("span",{className:"compose-drawer-title",children:"compose"}),m.jsx("span",{className:"compose-drawer-hint","aria-hidden":"true",children:"Cmd/Ctrl+Enter to send · Enter for newline · Esc to close"}),m.jsx("span",{className:"compose-drawer-close","aria-hidden":"true",children:"×"})]}),m.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:E=>S(E.target.value),onKeyDown:E=>{if(E.key==="Enter"&&(E.metaKey||E.ctrlKey)){E.preventDefault(),x();return}E.key==="Escape"&&(E.preventDefault(),C())},placeholder:"Type a longer command here, then Cmd/Ctrl+Enter to send."}),m.jsxs("div",{className:"compose-drawer-actions",children:[m.jsx("button",{type:"button",className:"compose-drawer-clear",tabIndex:h?0:-1,onClick:()=>{S(""),b.current?.focus()},disabled:!f,children:"Clear"}),m.jsx("button",{type:"button",className:"compose-drawer-send",tabIndex:h?0:-1,onClick:x,disabled:s||!f,children:"Send"})]})]})]})}function NM(e){const t=document.activeElement;t instanceof HTMLElement&&(!e||e.contains(t))&&t.blur()}function lm(){return navigator.maxTouchPoints>0?!0:typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}function zS(){if(!lm())return;const e=()=>{window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0,Ga()};e(),window.requestAnimationFrame?.(e),window.setTimeout(e,120),window.setTimeout(e,320)}function AM(e){Ja!==null&&(window.clearTimeout(Ja),Ja=null),Tu.add(e),document.documentElement.setAttribute(pg,"true"),Ga()}function LM(e){if(Tu.delete(e),Tu.size>0||Ja!==null){Ga();return}Ja=window.setTimeout(()=>{if(Ja=null,Tu.size>0){Ga();return}document.documentElement.removeAttribute(pg),Ga()},RM),Ga()}function Ga(){window.dispatchEvent(new Event(am))}function BM(e){e.attachCustomKeyEventHandler(o=>{if(OM(o)){const c=jS(e);return c?(o.preventDefault(),o.stopPropagation(),HS(c),!1):!0}return zM(o)?(o.preventDefault(),o.stopPropagation(),jM(e),!1):!0});const t=e.element;if(!t)return{dispose(){e.attachCustomKeyEventHandler(()=>!0)}};const s=o=>{const c=jS(e);if(c){if(o.clipboardData){o.clipboardData.setData("text/plain",c),o.preventDefault();return}o.preventDefault(),HS(c)}},a=o=>{const c=o.clipboardData?.getData("text/plain");if(c===void 0)return;const h=s1(c);h!==c&&(o.preventDefault(),o.stopImmediatePropagation(),e.paste(h))};return t.addEventListener("copy",s,!0),t.addEventListener("paste",a,!0),{dispose(){t.removeEventListener("copy",s,!0),t.removeEventListener("paste",a,!0),e.attachCustomKeyEventHandler(()=>!0)}}}function OM(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 zM(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 jM(e){if(navigator.clipboard?.readText)try{const t=await navigator.clipboard.readText();if(!t)return;e.paste(s1(t))}catch{}}function jS(e){return e.hasSelection()?e.getSelection():""}function s1(e){return e.replace(/(?:\r\n|\r|\n)+$/,"")}async function HS(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}HM(e)}function HM(e){const t=document.activeElement instanceof HTMLElement?document.activeElement:null,s=document.createElement("textarea");s.value=e,s.setAttribute("readonly","true"),s.style.position="fixed",s.style.left="-9999px",s.style.top="0",s.style.opacity="0",document.body.appendChild(s),s.focus({preventScroll:!0}),s.select();try{typeof document.execCommand=="function"&&document.execCommand("copy")}finally{s.remove(),t?.focus({preventScroll:!0})}}const UM=[4,10,11,12];function PM(e,t){const s=[e.parser.registerCsiHandler({final:"c"},a=>US(a)),e.parser.registerCsiHandler({prefix:">",final:"c"},a=>US(a)),e.parser.registerCsiHandler({final:"n"},a=>IM(a)),e.parser.registerCsiHandler({prefix:"?",final:"n"},a=>KM(a)),e.parser.registerCsiHandler({final:"t"},a=>FM(a)),e.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...UM.map(a=>e.parser.registerOscHandler(a,o=>qM(o)))];return{dispose(){for(const a of s)a.dispose()}}}function US(e){return oh(e)===0}function IM(e){const t=oh(e);return t===5||t===6}function KM(e){return oh(e)===6}function FM(e){const t=oh(e);return t===14||t===16||t===18}function qM(e){return e.split(";").some(t=>t==="?")}function oh(e){const t=e[0];return typeof t=="number"?t:0}const na=new Map,WM=2*1024*1024,$M=1500,YM=25e3;function VM(e,t){let s=na.get(e);s||(s=ZM(e),na.set(e,s),ch(s)),s.listeners.add(t);const a=c=>nN(s,c),o=()=>{s.listeners.delete(t)};return{status:s.status,snapshot:s.snapshot,output:s.output.slice(),history:s.history,send:a,detach:o}}function om(e){const t=na.get(e);t&&(sN(t),na.delete(e))}function XM(e,t={}){const s=na.get(e);if(!s)return!1;s.exited=!1,s.reconnectEnabled=!0,t.preserveCachedOutputOnNextSnapshot&&(s.preserveCachedOutputOnNextSnapshot=!0),s.reconnectTimer!==null&&(window.clearTimeout(s.reconnectTimer),s.reconnectTimer=null),Xo(s);const a=s.socket;return s.socket=null,$r(s,"reconnecting"),a&&(a.readyState===WebSocket.OPEN||a.readyState===WebSocket.CONNECTING)&&a.close(),ch(s),!0}function GM(){for(const e of na.values()){if(e.status!=="unauthorized"||e.exited)continue;e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),Xo(e);const t=e.socket;e.socket=null,e.reconnectEnabled=!0,$r(e,"reconnecting"),t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),ch(e)}}function Wf(){for(const e of Array.from(na.keys()))om(e)}function ZM(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,preserveCachedOutputOnNextSnapshot:!1}}function ch(e){if(!e.reconnectEnabled)return;$r(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){$r(e,"connected");for(const s of e.pendingOut)t.send(JSON.stringify(s));e.pendingOut.length=0,e.isAlive=!0,QM(e)}}),t.addEventListener("message",s=>{if(e.socket!==t)return;const a=typeof s.data=="string"?s.data:"";if(!a)return;let o=null;try{o=JSON.parse(a)}catch{return}if(!o||typeof o.type!="string")return;if(o.type==="pong"){e.isAlive=!0;return}const c=eN(e,o);r1(e,{type:"message",message:c})}),t.addEventListener("close",s=>{if(e.socket===t){if(e.socket=null,Xo(e),s.code===1008){e.reconnectEnabled=!1,$r(e,JM(s.reason)?"unauthorized":"closed");return}if(e.exited||!e.reconnectEnabled){$r(e,"closed");return}$r(e,"reconnecting"),e.reconnectTimer=window.setTimeout(()=>{e.reconnectTimer=null,ch(e)},$M)}}),t.addEventListener("error",()=>{})}function QM(e){Xo(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)}))}},YM)}function Xo(e){e.heartbeat!==null&&(window.clearInterval(e.heartbeat),e.heartbeat=null)}function JM(e){return e.trim().toLowerCase()==="unauthorized"}function eN(e,t){return t.type==="snapshot"?(e.snapshot=t.terminal,e.history=t.history??null,e.exited=t.terminal.status==="exited",e.preserveCachedOutputOnNextSnapshot?(e.preserveCachedOutputOnNextSnapshot=!1,tN(e,t.output),$f(e),{...t,output:e.output.slice(),history:e.history}):(e.output=t.output.slice(),e.outputBytes=e.output.reduce((s,a)=>s+a.length,0),$f(e),t)):t.type==="output"?(e.output.push(t.data),e.outputBytes+=t.data.length,$f(e),t):t.type==="terminal_updated"?(e.snapshot=t.terminal,t.terminal.status==="exited"&&(e.exited=!0),t):(t.type==="exit"&&(e.exited=!0,e.snapshot&&e.snapshot.id===t.terminalId&&(e.snapshot={...e.snapshot,status:"exited",exitCode:t.exitCode})),t)}function tN(e,t){const s=iN(e.output,t);if(s===0)return;const a=t.slice(s);for(const o of a)e.output.push(o),e.outputBytes+=o.length}function iN(e,t){const s=Math.min(e.length,t.length);for(let a=s;a>0;a-=1){let o=!0;for(let c=0;c<a;c+=1)if(e[e.length-a+c]!==t[c]){o=!1;break}if(o)return a}return 0}function $f(e){for(;e.outputBytes>WM&&e.output.length>1;){const t=e.output.shift();e.outputBytes-=t.length}}function $r(e,t){e.status!==t&&(e.status=t,r1(e,{type:"status",status:t}))}function r1(e,t){for(const s of Array.from(e.listeners))s(t)}function nN(e,t){const s=e.socket;return s&&s.readyState===WebSocket.OPEN?(s.send(JSON.stringify(t)),!0):(t.type==="input"&&e.pendingOut.push(t),!1)}function sN(e){e.reconnectEnabled=!1,e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),Xo(e);const t=e.socket;e.socket=null,t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),e.listeners.clear()}const rN=[0,50,150,350],aN=[300,1200,2500],lN=1e3,oN=1e5,cm="\x1B[?1049l\x1B[?1047l\x1B[?47l",cN=new Set(["47","1047","1049"]),uN=400,hN=3,dN=3,fN=32,pN=1.42,mN=2,gN=24,_N=240,vN=60,yN=420,bN=6,SN=2,PS=[500,1500,3e3,5e3,8e3],wN=mi.lazy(()=>ig(()=>import("./TranscriptMarkdownBody-DJbLRp61.js"),__vite__mapDeps([2,1])));function IS({terminal:e,serverApi:t,active:s,visible:a=!0,canClose:o,refreshCwdOnEnter:c=!1,tabId:h,onSelect:f,onClose:g,onExit:p,onSnapshot:b,onAuthClose:y}){const S=v.useSyncExternalStore(Y0,gp,()=>Gr),C=v.useSyncExternalStore(V0,_p,()=>tl),x=v.useSyncExternalStore(X0,yp,()=>!0),E=v.useSyncExternalStore(Am,mr,()=>el),L=v.useSyncExternalStore(Gm,()=>Zm("history.toggle"),()=>"Alt+H"),D=v.useRef(null),j=v.useRef(null),U=v.useRef(null),Z=v.useRef(null),ie=v.useRef({onExit:p,onSnapshot:b}),ne=v.useRef(t.createWebSocketUrl),ae=v.useRef(y),oe=v.useRef(null),pe=v.useRef(new Map),I=v.useRef([]),q=v.useRef([]),K=v.useRef([]),z=v.useRef(0),O=v.useRef(!1),se=v.useRef(null),M=v.useRef(0),X=v.useRef(null),V=v.useRef(null),ye=v.useRef(!1),xe=v.useRef(!1),k=v.useRef(!1),Q=v.useRef(!1),le=v.useRef(null),fe=v.useRef(null),we=v.useRef(!1),Ce=v.useRef(!1),ke=v.useRef(!1),Ie=v.useRef(!1),H=v.useRef(!1),J=v.useRef(!1),Ee=v.useRef(!1),ve=v.useRef(s),ge=v.useRef(a),F=v.useRef(c),me=v.useRef(S),Se=v.useRef(C),Le=v.useRef(!1),qe=v.useRef(null),st=v.useRef(null),Ke=v.useRef(!1),St=v.useRef(null),[,Hi]=v.useState("connecting"),[Yn,lt]=v.useState(!1),[li,Zi]=v.useState(null),[_i,jt]=v.useState(!1),[Ui,vi]=v.useState(null),[$,He]=v.useState(!1),[et,ct]=v.useState(!1),[Jt,Ht]=v.useState(!1),[oi,Fi]=v.useState(null),[as,on]=v.useState(!1),wn=!!oi||um(e.currentCommand),[wt,Et]=v.useState(!1);v.useLayoutEffect(()=>{ve.current=s},[s]),v.useLayoutEffect(()=>{ge.current=a},[a]),v.useLayoutEffect(()=>{F.current=c},[c]),v.useLayoutEffect(()=>{me.current=S},[S]),v.useLayoutEffect(()=>{Se.current=C},[C]),v.useLayoutEffect(()=>{Le.current=as},[as]),v.useLayoutEffect(()=>{qe.current=oi},[oi]),v.useLayoutEffect(()=>{Ke.current=wn},[wn]),v.useEffect(()=>{a&&s&&e.status==="running"&&(dt(),Te())},[s,a,e.status]),v.useEffect(()=>{ie.current={onExit:p,onSnapshot:b}},[p,b]),v.useEffect(()=>{ne.current=t.createWebSocketUrl,ae.current=y},[t,y]),v.useEffect(()=>{let N=!1,de=null,Ue=0;const ze=zN(e.currentCommand);function Ge(){de!==null&&(window.clearTimeout(de),de=null)}function ht(){if(!ze||Ue>=PS.length||N)return;const Si=PS[Ue++];de=window.setTimeout(()=>{de=null,Bt()},Si)}async function Bt(){try{const Si=await t.getTerminalTranscriptSource(e.id);if(N)return;Fi(Si.source),Si.source||ht()}catch(Si){if(N)return;Fi(null),Yf(Si)&&ht()}}return Fi(null),e.status!=="running"?()=>{N=!0,Ge()}:(Bt(),()=>{N=!0,Ge()})},[t,e.currentCommand,e.id,e.status]),v.useEffect(()=>{const N=oi?`${e.id}:${oi.provider}:${oi.sessionId}`:null,de=st.current;de!==null&&de!==N&&Le.current&&on(!1),st.current=N},[e.id,oi?.provider,oi?.sessionId]),v.useEffect(()=>{function N(de){!ve.current||!ge.current||!qe.current||de.isComposing||de.key==="Process"||EN(de.target)||G0(de)?.id!=="history.toggle"||(de.preventDefault(),de.stopPropagation(),on(ze=>!ze))}return window.addEventListener("keydown",N,!0),()=>window.removeEventListener("keydown",N,!0)},[]),v.useEffect(()=>{const N=j.current;N&&(N.options.disableStdin=e.status==="exited"),e.status==="exited"&&Hi("closed")},[e.status]),v.useEffect(()=>{const N=j.current;N&&(N.options.fontSize=S,kf(S,Se.current).then(()=>{me.current===S&&dt()}))},[S]),v.useEffect(()=>{const N=j.current;N&&(N.options.fontFamily=mp(C),kf(me.current,C).then(()=>{Se.current===C&&dt()}))},[C]),v.useEffect(()=>{const N=j.current;N&&(N.options.theme=KS(E))},[E]),v.useEffect(()=>{const N=D.current;if(!N)return;let de=!1,Ue=null,ze=null,Ge=null,ht=null,Bt=null,Si=null,Qi=null;oe.current=null,H.current=!1,J.current=!1,Q.current=!1,bi(),ci();const Xn=me.current,cs=Se.current,un=new cM({cursorBlink:!0,convertEol:!1,disableStdin:e.status==="exited",fontFamily:mp(cs),fontSize:Xn,fontWeight:400,fontWeightBold:700,macOptionClickForcesSelection:!0,scrollback:oN,theme:{...KS(mr())}}),Zo=new ek;return un.loadAddon(Zo),ht=PM(un),j.current=un,U.current=Zo,kf(Xn,cs).then(()=>{if(de)return;un.open(N),H.current=!0,Ue=BM(un),ge.current&&ve.current&&e.status==="running"&&Te(),dt(),Bt=WN(N,un,()=>me.current*1.2,It,wi=>{Tt(wi)},Os,cn),Si=KN(N,un,It,wi=>{Tt(wi)},Os,cn);const ua=new uM;ze=un.onData(wi=>{if(Ee.current){const da=yM(wi);if(da){mt(!1),te(da);return}}const ha=ua.accept(wi);ha&&te(ha)}),Ge=un.onScroll(wi=>{if(Ce.current||Ie.current||ke.current){Mt();return}la(),Wn(un)&&Lt({scrollToBottom:!0}),It(),wi<=3&&Tt()}),Qi=new ResizeObserver(()=>{Pi()}),Qi.observe(N),J.current&&(ui(),J.current=!1,dt()),yi()}),()=>{de=!0,H.current=!1,J.current=!1,bi(),Pt(),aa(),ke.current=!1,Bt?.(),Si?.(),Qi?.disconnect(),Ue?.dispose(),ze?.dispose(),Ge?.dispose(),ht?.dispose(),un.dispose(),j.current=null,U.current=null}},[e.id]),v.useEffect(()=>{const N=ne.current(e.id),de=VM(N,Ut);return Z.current=de.send,Hi(de.status),de.status==="connected"&&dt(),de.snapshot&&(ie.current.onSnapshot(de.snapshot,{notifyCompletion:!1}),j.current&&(dt(),Yt(de.output,de.history),dt())),()=>{de.detach(),Z.current=null}},[e.id,e.status]);function Ut(N){if(N.type==="status"){Hi(N.status),N.status==="unauthorized"&&ae.current?.({source:"terminal-ws-1008",terminalId:e.id}),N.status==="connected"&&dt();return}ut(N.message)}function ci(N=[],de=null){q.current=[],K.current=mu(N),z.current=0,O.current=!1,se.current=null,ke.current=!1,M.current+=1,X.current=de,V.current=null,ye.current=!1,xe.current=!1,k.current=!1,J.current=!1,St.current=null,le.current=null,we.current=!1,lt(!1),Zi(null),jt(!1),vi(null),He(!1),ct(!1)}function Yt(N=[],de=null){ci(N,de),ei()}function ei(){if(!j.current||!H.current){J.current=!0;return}J.current=!1,ui()}async function ui(){const N=j.current;if(!N)return;const de=gu(N,we.current),Ue=de?K.current.length:z.current;await Ni(N,{liveOutputLimit:Ue,scrollToBottom:de}),j.current===N&&Mt()}function Ni(N,de={}){return new Promise(Ue=>{ke.current=!0,O.current=!1;const ze=M.current+1;M.current=ze;const Ge=Math.max(0,Math.min(de.liveOutputLimit??K.current.length,K.current.length)),ht=de.historyPages??q.current,Bt=()=>{if(j.current!==N||M.current!==ze){Ue(!1);return}try{z.current=Ge,de.scrollToBottom&&xn(N)}finally{ke.current=!1;const Qi=ls();Qi?Lt(Qi):de.applyDeferredSnapshot!==!1&&wr(),Ue(!0)}},Si=()=>{if(j.current!==N||M.current!==ze){Ue(!1);return}N.clear();const Qi=mu([...ht,...K.current.slice(0,Ge)]);if(Qi.length===0){Bt();return}for(let Xn=0;Xn<Qi.length;Xn+=1){const cs=Qi[Xn];Xn===Qi.length-1?N.write(cs,Bt):N.write(cs)}};if(N.buffer.active.type==="alternate"){N.write(cm,Si);return}Si()})}async function Tt(N=0){const de=j.current;if(k.current||!de)return;if(Wi(de)){Mt();return}const Ue=X.current;k.current=!0,lt(!0);const ze=de.buffer.active.viewportY;try{let Ge=!!(Ue&&!Ue.hasMore);if(!Ge)try{const ht=await t.getTerminalHistory(e.id,{beforeLine:Ue?.startLine??0,limit:lN}),Bt={startLine:ht.startLine,endLine:ht.endLine,hasMore:ht.hasMore};if(ht.output.length>0){await Vt(de,ht.output,ze,N)&&(X.current=Bt);return}X.current=Bt,Ge=!ht.hasMore}catch(ht){Ge=Yf(ht)}if(Ge){if(Wi(de)){Mt();return}await qi(de,ze,N)}}catch{}finally{k.current=!1,lt(!1)}}async function qi(N,de,Ue){if(!(ye.current||xe.current))try{const ze=V.current,Ge=await t.getTerminalTranscriptHistory(e.id,{...ze?{cursor:ze}:{},limit:uN}),ht=Ge.output.map(l1);if(ht.length===0){Fi(Ge.source),V.current=Ge.cursor,xe.current=!Ge.hasMore||!Ge.cursor;return}await Vt(N,ht,de,Ue)&&(Fi(Ge.source),V.current=Ge.cursor,xe.current=!Ge.hasMore||!Ge.cursor)}catch(ze){Yf(ze)&&(ye.current=!0)}}async function Vt(N,de,Ue,ze){if(Wi(N))return Mt(),!1;const Ge=[...de,...q.current],ht=PN(de);return!await Ni(N,{liveOutputLimit:z.current,scrollToBottom:!1,historyPages:Ge,applyDeferredSnapshot:!1})||j.current!==N?!1:(q.current=Ge,ul(N,Math.max(0,Ue+ht+Math.min(0,ze))),we.current=!Wn(N),It(),!0)}v.useEffect(()=>{const N=window.visualViewport;function de(){document.visibilityState==="visible"&&dt()}function Ue(){dt()}function ze(){yi()}return document.addEventListener("visibilitychange",de),window.addEventListener("pageshow",Ue),window.addEventListener("resize",ze),N?.addEventListener("resize",ze),N?.addEventListener("scroll",ze),()=>{document.removeEventListener("visibilitychange",de),window.removeEventListener("pageshow",Ue),window.removeEventListener("resize",ze),N?.removeEventListener("resize",ze),N?.removeEventListener("scroll",ze)}},[e.id]);function Ai(){const N=ne.current(e.id);Q.current=!0,St.current=null,Hi("reconnecting"),dt(),XM(N,{preserveCachedOutputOnNextSnapshot:!0})}function ut(N){if(N.type==="snapshot"&&N.terminal.id===e.id){ie.current.onSnapshot(N.terminal,{notifyCompletion:!1});const Ue=j.current;if(!Ue)return;dt();const ze=Q.current;if(Q.current=!1,ze){X.current=N.history??X.current,Mt(),dt();return}if(Vn(Ue,N.terminal)){Kt(N.output,N.history??null),Mt(),dt();return}Yt(N.output,N.history??null),dt();return}if(N.type==="terminal_updated"&&N.terminal.id===e.id){ie.current.onSnapshot(N.terminal,{notifyCompletion:!0});return}if(N.type==="output"&&N.terminalId===e.id){const Ue=u1(N.data);if(!Ue)return;K.current.push(Ue),j.current&&H.current?Lt({scrollToBottom:!0}):J.current=!0;return}const de=j.current;if(de){if(N.type==="exit"&&N.terminalId===e.id){ie.current.onExit(N.exitCode),Hi("closed");return}N.type==="error"&&de.writeln(`\r
|
|
32
|
-
[nterminal] ${N.message}`)}}function Pi(N=25){if(document.visibilityState==="hidden"||!ge.current||pe.current.has(N))return;const de=window.setTimeout(()=>{pe.current.delete(N),T()},N);pe.current.set(N,de)}function yi(){for(const N of rN)Pi(N)}function dt(){oe.current=null,yi()}function bi(){for(const N of pe.current.values())window.clearTimeout(N);pe.current.clear()}function Pt(){for(const N of I.current)window.clearTimeout(N);I.current=[]}function It(){if(Mt(),!le.current){jt(!1);return}jt(!0),aa(),fe.current=window.setTimeout(()=>{fe.current=null,jt(!1)},1200)}function Mt(){const N=j.current,de=N?IN(N):null;if(le.current=de,Zi(de),ct(!!(N&&de)),He(!!(N&&de&&!Wn(N))),de||!N||!br()){vi(null);return}vi({alternate:N.buffer.active.type==="alternate"})}function br(){const N=X.current;return q.current.length>0||!!N?.hasMore}function aa(){fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null)}function la(){const N=j.current;N&&(we.current=!Wn(N),Mt())}function Sr(N){se.current=Vf(se.current,N)}function Cn(N){const de=se.current;return se.current=null,Vf(de,N)}function ls(){const N=se.current;return se.current=null,N}function Lt(N={}){const de=j.current;if(!de||!H.current){J.current=!0;return}if(ke.current){Sr(N);return}if(O.current){Sr(N);return}const Ue=Cn(N);if(!Ue.force&&!gu(de,we.current)){Mt();return}O.current=!0;const ze=M.current,Ge=()=>{if(j.current!==de||M.current!==ze){O.current=!1;return}if(!Ue.force&&!gu(de,we.current)){O.current=!1,Mt();return}const ht=z.current,Bt=K.current[ht];if(Bt===void 0){O.current=!1,Ue.scrollToBottom&&xn(de),Mt();const Si=ls();Si?Lt(Vf(Ue,Si)):wr();return}de.write(Bt,()=>{if(j.current!==de||M.current!==ze){O.current=!1;return}z.current=ht+1,Ge()})};Ge()}function Wi(N){return!Wn(N)&&(Pn()||O.current||ke.current)}function Vn(N,de){return(Ke.current||um(de?.currentCommand))&&!Wn(N)}function Pn(){return z.current<K.current.length}function Kt(N,de){St.current={output:N,history:de,appendFromLiveOutputIndex:z.current}}function wr(){const N=j.current,de=St.current;if(!N||!de||!Wn(N)||Pn()||O.current||ke.current)return;const Ue=mu(de.output),ze=mu(K.current.slice(de.appendFromLiveOutputIndex));St.current=null,Yt(UN(Ue,ze),de.history),dt()}function Os(){Ie.current=!0}function cn(){la(),Ie.current=!1;const N=j.current;N&&Wn(N)&&Lt({scrollToBottom:!0})}function xn(N){os(()=>YS(N))&&(we.current=!1)}function ul(N,de){os(()=>(N.scrollToLine(de),!0))}function os(N){Ce.current=!0;try{return N()}finally{Ce.current=!1}}function oa(){const N=j.current;if(!N)return;const de=()=>{YS(N),we.current=!1,Mt(),Lt({force:!0,scrollToBottom:!0}),Te()};if(N.buffer.active.type==="alternate"){N.write(cm,de);return}de()}function ca(N){const de=j.current,Ue=D.current;if(!de||!Ue)return;const ze=Ue.getBoundingClientRect();if(ze.height<=0)return;const Ge=Math.max(0,Math.min(1,(N-ze.top)/ze.height)),ht=Math.round(de.buffer.active.baseY*Ge);Os();try{de.scrollToLine(ht)}finally{cn()}we.current=!Wn(de),Mt(),It(),ht<=3&&Tt()}function $i(N){N.preventDefault(),N.stopPropagation(),N.currentTarget.setPointerCapture?.(N.pointerId),ca(N.clientY)}function In(N){(N.buttons&1)!==0&&(N.preventDefault(),N.stopPropagation(),ca(N.clientY))}function T(){const N=j.current,de=U.current;if(!(!N||!de)&&!(document.visibilityState==="hidden"||!ge.current||D.current?.isConnected===!1))try{const Ue=gu(N,we.current);de.fit(),Ue&&xn(N),N.refresh(0,Math.max(0,N.rows-1)),Mt();const ze={cols:N.cols,rows:N.rows},Ge=oe.current;if(Ge&&Ge.cols===ze.cols&&Ge.rows===ze.rows)return;B({type:"resize",terminalId:e.id,cols:ze.cols,rows:ze.rows})&&(oe.current=ze)}catch{}}function B(N){const de=Z.current;return de?de(N):!1}function te(N){Lt({force:!0,scrollToBottom:!0}),B({type:"input",terminalId:e.id,data:N})&&ON(N)&&_e()}function _e(){!F.current||!ve.current||(Pt(),I.current=aN.map(N=>{const de=window.setTimeout(()=>{I.current=I.current.filter(Ue=>Ue!==de),F.current&&ve.current&&B({type:"refresh_cwd",terminalId:e.id})},N);return de}))}function Te(){Le.current||j.current?.focus()}const Oe=v.useCallback(()=>{on(!1)},[]);function Ae(){Ht(N=>{const de=!N;return Ee.current=de,de}),Te()}function mt(N){Ee.current=N,Ht(N)}function gt(N){Ee.current&&mt(!1),te(vM(N)),Te()}return m.jsxs("section",{className:"terminal-pane","data-active":s,onMouseDown:()=>{s||f()},children:[m.jsx(TN,{terminal:e,canClose:o,tabId:h,transcriptSource:oi,transcriptShortcutLabel:L,onOpenTranscript:()=>on(!0),onReload:Ai,onClose:g}),m.jsx("div",{className:"xterm-container",ref:D}),Yn?m.jsx("div",{className:"terminal-history-loader",role:"status","aria-label":"Loading older terminal output",children:m.jsx("span",{"aria-hidden":"true"})}):null,x&&li?m.jsxs("div",{className:"terminal-scroll-progress","data-active":_i,"aria-hidden":"true",children:[li.current,"/",li.total]}):x&&Ui?m.jsxs("div",{className:"terminal-scroll-progress","data-active":!1,"data-pending":"true","data-buffer":Ui.alternate?"alternate":"normal","aria-hidden":"true",children:[Ui.alternate?"alt ":"","0/?"]}):null,$?m.jsx("button",{type:"button",className:"terminal-scroll-bottom-button","aria-label":"Scroll terminal to bottom",title:"Scroll to bottom",onPointerDown:N=>N.stopPropagation(),onMouseDown:N=>N.stopPropagation(),onClick:N=>{N.stopPropagation(),oa()},children:"↓"}):null,et?m.jsx("button",{type:"button",className:"terminal-scroll-handle","aria-label":"Drag terminal scroll handle",title:"Drag to scroll",onPointerDown:$i,onPointerMove:In,children:m.jsx("span",{"aria-hidden":"true"})}):null,s&&e.status==="running"?wt?m.jsx(gM,{ctrlActive:Jt,onCtrl:Ae,onStandaloneKey:gt,onPreserveFocus:Te,onHide:()=>Et(!1)}):m.jsx("button",{type:"button",className:"mobile-terminal-key-toggle","aria-label":"Show terminal control keys",title:"Show Ctrl / Esc / Tab / arrows",onMouseDown:N=>{N.stopPropagation(),Te()},onPointerDown:N=>{N.stopPropagation(),Te()},onClick:()=>Et(!0),children:"⌨"}):null,m.jsx(MM,{terminalId:e.id,onSubmit:te,disabled:e.status!=="running"}),as&&oi?m.jsx(kN,{terminalId:e.id,serverApi:t,source:oi,fontSize:S,onClose:Oe}):null]})}function KS(e){return Wx(e)}function CN(e,t,s){const a=xN(e,t),o=FS(a*Math.max(1,s),vN,yN);return{limit:FS(Math.ceil(o/mN),gN,_N),maxLines:o}}function xN(e,t){const s=e?.clientHeight??0;if(s<=0)return fN;const a=Math.max(10,t*pN);return Math.max(1,Math.floor(s/a))}function FS(e,t,s){return Math.max(t,Math.min(s,Math.floor(e)))}function EN(e){return e instanceof HTMLElement?!!e.closest(".security-panel:not(.transcript-dialog)"):!1}function TN({terminal:e,canClose:t,tabId:s,transcriptSource:a,transcriptShortcutLabel:o,onOpenTranscript:c,onReload:h,onClose:f}){const g=N0({id:`pane-${e.id}`,disabled:!s,...s?{data:{kind:"pane",sourceTabId:s,terminalId:e.id}}:{}}),p={cursor:s?"grab":"default",opacity:g.isDragging?.5:void 0};return m.jsxs("header",{ref:g.setNodeRef,className:"terminal-pane-header",style:p,"data-dragging":g.isDragging,...g.attributes,...g.listeners,children:[m.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),m.jsx("span",{className:"terminal-pane-cwd",title:e.cwd,children:e.cwd}),m.jsx("span",{className:"terminal-pane-spacer"}),a?m.jsxs("button",{type:"button",className:"terminal-pane-transcript","data-provider":a.provider,title:`View ${Wu(a.provider)} transcript history`,"aria-label":`View ${Wu(a.provider)} transcript history`,onPointerDown:b=>b.stopPropagation(),onMouseDown:b=>b.stopPropagation(),onClick:b=>{b.stopPropagation(),c()},children:[m.jsx("span",{children:"View history"}),m.jsx("kbd",{children:o})]}):null,m.jsx("span",{className:`terminal-pane-state terminal-pane-state-${e.status}`,children:e.status}),e.status==="running"?m.jsx("button",{type:"button",className:"terminal-pane-reload","aria-label":`Reload pane ${e.title}`,title:"Reload pane output",onPointerDown:b=>b.stopPropagation(),onMouseDown:b=>b.stopPropagation(),onClick:b=>{b.stopPropagation(),h()},children:"↻"}):null,t?m.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close pane ${e.title}`,title:"Close pane",onPointerDown:b=>b.stopPropagation(),onMouseDown:b=>b.stopPropagation(),onClick:b=>{b.stopPropagation(),f()},children:"x"}):null]})}const kN=mi.memo(function({terminalId:t,serverApi:s,source:a,fontSize:o,onClose:c}){const h=v.useRef(null),f=v.useRef(0),g=v.useRef(!1),p=v.useRef(!1),b=v.useRef(null),y=v.useRef(""),[S,C]=v.useState([]),[x,E]=v.useState(!1),[L,D]=v.useState(""),[j,U]=v.useState(-1),[Z,ie]=v.useState(null),[ne,ae]=v.useState(!1),[oe,pe]=v.useState(!0),[I,q]=v.useState(!1),[K,z]=v.useState(null);v.useEffect(()=>{function H(J){J.key==="Escape"&&(J.preventDefault(),J.stopPropagation(),c())}return document.addEventListener("keydown",H,!0),()=>document.removeEventListener("keydown",H,!0)},[c]),v.useEffect(()=>{f.current+=1;const H=f.current;return g.current=!1,p.current=!0,b.current=null,C([]),ie(null),ae(!1),z(null),fe(null,"initial",H),()=>{f.current===H&&(f.current+=1)}},[s,x,a.provider,a.sessionId,t]),v.useLayoutEffect(()=>{const H=h.current;if(!H)return;if(p.current){if(oe||S.length===0)return;p.current=!1;const Ee=()=>{H.scrollTop=H.scrollHeight};Ee(),window.requestAnimationFrame?.(Ee);return}const J=b.current;J!==null&&(b.current=null,H.scrollTop+=H.scrollHeight-J)},[S,oe,x]);const O=Wu(a.provider),se=$S(S,x),M=MN(se),X=LN(M,L),V=X.length,ye=V>0?j>=0&&j<V?j:0:-1,xe=ye>=0?X[ye]?.entryIndex??null:null,k=ye>=0?X[ye]??null:null,Q=se?se.split(`
|
|
33
|
-
`).length-1:0,le=L.trim()?V>0?`${ye+1}/${V} ${V===1?"match":"matches"} · ${Q} ${Q===1?"line":"lines"}`:`0 matches · ${Q} ${Q===1?"line":"lines"}`:Q>0?`${Q} lines`:"0 lines";v.useEffect(()=>{const H=L.trim().toLowerCase();U(J=>!H||V===0?-1:y.current!==H?0:J>=0&&J<V?J:0),y.current=H},[L,V]);async function fe(H,J,Ee=f.current){if(!g.current){g.current=!0,J==="initial"?pe(!0):(q(!0),b.current=h.current?.scrollHeight??null),z(null);try{await we(H,J,Ee)}catch(ve){if(f.current!==Ee)return;z(ve instanceof Error?ve.message:"Failed to load transcript history.")}finally{f.current===Ee&&(g.current=!1,pe(!1),q(!1))}}}async function we(H,J,Ee){let ve=H,ge=0,F=[];const me=J==="initial"?SN:bN;for(;f.current===Ee;){const Se=await s.getTerminalTranscriptHistory(t,{...ve?{cursor:ve}:{},...CN(h.current,o,J==="initial"?hN:dN),includeTools:x});if(f.current!==Ee)return;const Le=WS(Se.output,a.provider,{includeTools:x}),qe=Ce(Se,J,F,Le);if(Le&&(F=[Le,...F],qe))return;if(!Se.hasMore||!Se.cursor||ge>=me){F.length>0&&C(st=>J==="older"?[...F,...st]:F);return}ve=Se.cursor,ge+=1}}function Ce(H,J,Ee,ve=WS(H.output,a.provider,{includeTools:x})){if(ie(H.cursor),ae(!!(H.hasMore&&H.cursor)),!ve)return!1;const ge=[ve,...Ee];return $S(ge,x)?(C(F=>J==="older"?[...ge,...F]:ge),!0):!1}function ke(){const H=h.current;!H||H.scrollTop>72||!ne||!Z||g.current||fe(Z,"older")}function Ie(H){V!==0&&U(J=>{const Ee=ye>=0?ye:H>0?-1:0;return((J>=0&&J<V?J:Ee)+H+V)%V})}return m.jsx("div",{className:"security-overlay transcript-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"transcript-dialog-title",onPointerDown:H=>H.stopPropagation(),onMouseDown:H=>H.stopPropagation(),onClick:H=>{H.stopPropagation(),c()},children:m.jsxs("div",{className:"security-panel transcript-dialog",onPointerDown:H=>H.stopPropagation(),onMouseDown:H=>H.stopPropagation(),onClick:H=>H.stopPropagation(),children:[m.jsxs("header",{className:"security-panel-header",children:[m.jsxs("div",{className:"transcript-dialog-title",children:[m.jsxs("h2",{id:"transcript-dialog-title",children:[O," JSONL"]}),m.jsx("span",{title:a.sessionId,children:a.sessionId})]}),m.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:c,children:"×"})]}),m.jsxs("div",{className:"transcript-dialog-controls",children:[m.jsxs("label",{className:"auth-checkbox transcript-tool-toggle",children:[m.jsx("input",{type:"checkbox",checked:x,onChange:H=>E(H.currentTarget.checked)}),"Show tool output"]}),m.jsxs("label",{className:"transcript-search",children:[m.jsx("span",{children:"Search"}),m.jsx("input",{type:"search",value:L,"aria-label":"Search JSONL transcript",placeholder:"Find in history",onChange:H=>D(H.currentTarget.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),Ie(H.shiftKey?-1:1))}})]}),m.jsxs("div",{className:"transcript-search-actions","aria-label":"Search result navigation",children:[m.jsx("button",{type:"button",onClick:()=>Ie(-1),disabled:V===0,children:"Prev"}),m.jsx("button",{type:"button",onClick:()=>Ie(1),disabled:V===0,children:"Next"})]}),m.jsx("span",{className:"transcript-result-count",children:le})]}),m.jsxs("div",{ref:h,className:"transcript-dialog-scroll","aria-label":"JSONL transcript output",onScroll:ke,children:[I?m.jsx("div",{className:"transcript-dialog-status",children:"Loading older entries..."}):null,!oe&&ne?m.jsx("div",{className:"transcript-dialog-hint",children:"Scroll up for older entries"}):null,se?m.jsx(DN,{entries:M,searchQuery:L,activeEntryIndex:xe,activeSearchMatch:k,fontSize:o}):null,oe?m.jsx("div",{className:"transcript-dialog-status",children:"Loading transcript..."}):null,!oe&&!se&&!K?m.jsx("div",{className:"transcript-dialog-status",children:"No transcript entries found."}):null,K?m.jsx("div",{className:"transcript-dialog-error",children:K}):null]})]})})});function DN({entries:e,searchQuery:t,activeEntryIndex:s,activeSearchMatch:a,fontSize:o}){const c=v.useRef(new Map);return v.useEffect(()=>{if(s===null)return;const h=c.current.get(s);if(!h||typeof h.scrollIntoView!="function")return;const f=h.querySelectorAll(".transcript-search-hit");((a?.entryIndex===s?f[a.matchIndexInEntry]:null)??h).scrollIntoView({block:"center",inline:"nearest"})},[s,a,t]),m.jsx("div",{className:"transcript-output transcript-formatted-output",style:{fontSize:o},children:e.map((h,f)=>m.jsxs("section",{ref:g=>{g?c.current.set(f,g):c.current.delete(f)},className:`transcript-entry transcript-entry-${h.kind}${s===f?" transcript-entry-search-active":""}`,children:[h.header?m.jsx("div",{className:"transcript-entry-header",children:a1(h.header,t)}):null,h.body?m.jsx("div",{className:"transcript-entry-body",children:h.kind==="tool"?m.jsx(qS,{text:h.body,searchQuery:t}):m.jsx(mi.Suspense,{fallback:m.jsx(qS,{text:h.body,searchQuery:t}),children:m.jsx(wN,{text:h.body,searchQuery:t})})}):null]},`${h.header??"plain"}-${f}`))})}function qS({text:e,searchQuery:t}){const s=e.endsWith(`
|
|
34
|
-
`)?e.slice(0,-1).split(`
|
|
35
|
-
`):e.split(`
|
|
36
|
-
`);return m.jsx("pre",{className:"transcript-entry-pre",children:s.map((a,o)=>m.jsx("span",{className:`transcript-line transcript-line-${BN(a,o===0||s[o-1]?.trim()==="")}`,children:a1(a,t)},o))})}function a1(e,t){const s=t.trim();if(!s)return e||" ";const a=e.toLowerCase(),o=s.toLowerCase(),c=[];let h=0,f=a.indexOf(o);for(;f!==-1;){f>h&&c.push(e.slice(h,f));const g=f+s.length;c.push(m.jsx("mark",{className:"transcript-search-hit",children:e.slice(f,g)},`${f}-${g}`)),h=g,f=a.indexOf(o,h)}return h<e.length&&c.push(e.slice(h)),c.length>0?c:e||" "}function RN(e,t){const s=t.trim().toLowerCase();if(!s)return 0;const a=e.toLowerCase();let o=0,c=a.indexOf(s);for(;c!==-1;)o+=1,c=a.indexOf(s,c+s.length);return o}function MN(e){const t=e.endsWith(`
|
|
37
|
-
`)?e.slice(0,-1):e;if(!t)return[];const s=[];let a=null,o="plain",c=[];function h(){const f=NN(c).join(`
|
|
38
|
-
`);(a||f)&&s.push({header:a,body:f,kind:o}),a=null,o="plain",c=[]}for(const f of t.split(`
|
|
39
|
-
`)){const g=AN(f);g?(h(),a=f,o=g):c.push(f)}return h(),s}function NN(e){let t=e.length;for(;t>0&&(e[t-1]??"").trim()==="";)t-=1;return e.slice(0,t)}function AN(e){const t=/^\[[^\]]+\]\s+(.+)$/.exec(e.trimEnd());if(!t)return null;const s=t[1]??"";return s==="User"?"user":s==="Codex"||s==="Claude"?"assistant":s==="System"?"system":/^Tool (?:call(?::|$)|output$)/.test(s)?"tool":null}function LN(e,t){const s=[];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=RN(c,t);for(let f=0;f<h;f+=1)s.push({entryIndex:a,matchIndexInEntry:f})}return s}function BN(e,t){const s=e.trim();if(!s)return"blank";const a=s.replace(/^\[[^\]]+\]\s+/,""),o=/^\[[^\]]+\]\s+/.test(s);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)||c1(s))?"tool":/^(?:\$|>|❯|➜)\s+/.test(s)?"command":/^(?:✓|✔|PASS|passed\b|success\b)/i.test(s)?"success":/^(?:✗|✘|FAIL|failed\b|error\b|traceback\b)/i.test(s)?"error":/^\[[^\]]+\]/.test(s)||/^(?:info|debug|warn)\b/i.test(s)?"dim":"plain"}function ON(e){return e.includes("\r")||e.includes(`
|
|
41
|
-
`)}function Yf(e){return e instanceof Ns&&e.status===404}function um(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 zN(e){if(um(e))return!0;if(!e)return!1;const t=e.replace(/^.*[\\/]/,"").toLowerCase();return t==="node"||t==="nodejs"}function Wu(e){return e==="codex"?"Codex":"Claude"}function WS(e,t,s={}){const a=`[nterminal] ${Wu(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=l1(o),h=s.includeTools?c:o1(c);return h?`${h}
|
|
46
|
-
`:""}function l1(e){return e.replace(/^\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z)\]/gm,(t,s)=>{const a=jN(s);return a?`[${a}]`:t})}function jN(e){const t=new Date(e);if(!Number.isFinite(t.getTime()))return null;const s=t.getFullYear(),a=lo(t.getMonth()+1),o=lo(t.getDate()),c=lo(t.getHours()),h=lo(t.getMinutes()),f=lo(t.getSeconds());return`${s}-${a}-${o} ${c}:${h}:${f}`}function lo(e){return e.toString().padStart(2,"0")}function $S(e,t){return e.map(s=>t?s:o1(s)).filter(Boolean).map(s=>s.endsWith(`
|
|
47
|
-
`)?s:`${s}
|
|
48
|
-
`).join("")}function o1(e){if(!e)return"";const t=e.split(`
|
|
49
|
-
`),s=[];let a=!1,o=!1,c=!0;for(const h of t){const f=h.trim()==="",g=c?HN(h):null;if(g&&(a=g==="tool",o=!1),c1(h)){o=!0,c=!1;continue}if(o){f?(o=!1,a||s.push(h),c=!0):c=!1;continue}a||s.push(h),c=f}return s.join(`
|
|
50
|
-
`).replace(/\n{3,}/g,`
|
|
51
|
-
|
|
52
|
-
`).trimEnd()}function HN(e){const t=e.replace(/^\[[^\]]+\]\s+/,"");return/^Tool (?:call(?::|$)|output$)/.test(t)?"tool":/^(?:User|Codex|Claude|System)$/.test(t)?"message":null}function c1(e){return/^\[tool (?:call(?::|])|output\])/.test(e.trim())}function UN(e,t){if(t.length===0)return e;let s=0;const a=Math.min(e.length,t.length);for(let o=a;o>0;o-=1){let c=!0;for(let h=0;h<o;h+=1)if(e[e.length-o+h]!==t[h]){c=!1;break}if(c){s=o;break}}return[...e,...t.slice(s)]}function PN(e){let t=0;for(const s of e){if(!s)continue;const a=s.match(/\r\n|\r|\n/g);t+=a?.length??1}return Math.max(1,t)}function mu(e){const t=[];for(const s of e){const a=u1(s);a&&t.push(a)}return t}function u1(e){return e.replace(/\x1b\[\?([0-9;:]*)([hl])/g,(t,s,a)=>{const o=s.split(";").filter(Boolean).filter(c=>!cN.has(c.split(":")[0]??""));return o.length>0?`\x1B[?${o.join(";")}${a}`:""})}function Vf(e,t={}){const s={};return(e?.force||t.force)&&(s.force=!0),(e?.scrollToBottom||t.scrollToBottom)&&(s.scrollToBottom=!0),s}function IN(e){const t=e.buffer.active,s=t.baseY+e.rows;return s<=e.rows?null:{current:Math.max(1,Math.min(s,t.viewportY+1)),total:s}}function Wn(e){return e.buffer.active.viewportY>=Math.max(0,e.buffer.active.baseY-1)}function gu(e,t){return!t||Wn(e)}function YS(e){return Wn(e)?!1:(e.scrollToLine(Math.max(0,e.buffer.active.baseY)),!0)}function KN(e,t,s,a,o,c){const h=f=>{const g=qN(f);g!==0&&(f.cancelable&&f.preventDefault(),f.stopPropagation(),FN(t,g,s,a,o,c))};return e.addEventListener("wheel",h,{capture:!0,passive:!1}),()=>{e.removeEventListener("wheel",h,{capture:!0})}}function FN(e,t,s,a,o,c){const h=()=>{o();try{e.scrollLines(t)}finally{c()}s(),t<0&&e.buffer.active.viewportY<=3&&a(t)};if(e.buffer.active.type==="alternate"){e.write(cm,h);return}h()}function qN(e){const s=e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?e.deltaY/24:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*24:e.deltaY;if(s===0)return 0;const a=s<0?Math.floor(s):Math.ceil(s);return Math.max(-30,Math.min(30,a))}function WN(e,t,s,a,o,c,h){let f=null,g=0;const p={passive:!1};function b(C){f=Xf(C),g=0}function y(C){const x=Xf(C);if(x===null){f=null,g=0;return}if(f===null){f=x;return}const E=x.clientY-f.clientY;if(f=x,C.cancelable&&C.preventDefault(),E===0)return;if($N(t)&&YN(t,x,-E)){g=0;return}g-=E/s();const L=g<0?Math.ceil(g):Math.floor(g);if(L!==0){g-=L,c();try{t.scrollLines(L)}finally{h()}a(),L<0&&t.buffer.active.viewportY<=3&&o(L)}}function S(C){if(C.touches.length>0){f=Xf(C);return}f=null,g=0}return e.addEventListener("touchstart",b,p),e.addEventListener("touchmove",y,p),e.addEventListener("touchend",S),e.addEventListener("touchcancel",S),()=>{e.removeEventListener("touchstart",b,p),e.removeEventListener("touchmove",y,p),e.removeEventListener("touchend",S),e.removeEventListener("touchcancel",S)}}function Xf(e){if(e.touches.length!==1)return null;const t=e.touches[0];return t?{clientX:t.clientX,clientY:t.clientY}:null}function $N(e){return e.buffer.active.type==="alternate"||e.modes.mouseTrackingMode!=="none"}function YN(e,t,s){const a=e.element;return a?(a.dispatchEvent(VN(t,s)),!0):!1}function VN(e,t){const s=typeof WheelEvent=="function"?WheelEvent.DOM_DELTA_PIXEL:0,a={bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:t,deltaMode:s};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 hm({node:e,terminals:t,editors:s,api:a,activeTerminalId:o,visible:c=!0,refreshCwdOnEnter:h=!1,tabId:f,dropZoneActive:g=!1,draggingTerminalId:p=null,mobileFocusLeafKey:b=null,path:y=[],totalPanes:S,onSelect:C,onClose:x,onResize:E,onExit:L,onSnapshot:D,onCloseEditor:j,onAuthClose:U}){const Z=S??dm(e);if(y.length===0&&b){const oe=fm(e),pe=oe.some(I=>I.key===b)?b:oe[0]?.key;if(oe.length>1&&pe)return m.jsx("div",{className:"mobile-focused-split",children:oe.map(I=>{const q=I.key===pe;if(I.type==="editor"){const z=s[I.editorId];return m.jsx("div",{className:"mobile-focused-pane","data-active":q,"aria-hidden":!q,children:z?m.jsx(Ab,{api:a,editor:z,canClose:Z>1,onClose:()=>j(I.editorId)}):m.jsx("div",{className:"missing-pane",children:"Editor unavailable"})},I.key)}const K=t[I.terminalId];return K?m.jsx("div",{className:"mobile-focused-pane","data-active":q,"aria-hidden":!q,children:m.jsx(IS,{terminal:K,serverApi:a,active:q,visible:c&&q,canClose:Z>1,refreshCwdOnEnter:h&&q,tabId:f,onSelect:()=>C(I.terminalId),onClose:()=>x(I.terminalId),onExit:z=>L(I.terminalId,z),onSnapshot:D,...U?{onAuthClose:U}:{}})},I.key):m.jsx("div",{className:"mobile-focused-pane","data-active":q,"aria-hidden":!q,children:m.jsx("div",{className:"missing-pane",children:"Terminal unavailable"})},I.key)})})}if(e.type==="pane"){const oe=t[e.terminalId];if(!oe)return m.jsx("div",{className:"missing-pane",children:"Terminal unavailable"});const pe=m.jsx(IS,{terminal:oe,serverApi:a,active:e.terminalId===o,visible:c,canClose:Z>1,refreshCwdOnEnter:h&&e.terminalId===o,tabId:f,onSelect:()=>C(e.terminalId),onClose:()=>x(e.terminalId),onExit:q=>L(e.terminalId,q),onSnapshot:D,...U?{onAuthClose:U}:{}});return g&&p!==e.terminalId?m.jsxs("div",{className:"pane-drop-host",children:[pe,m.jsx(_u,{terminalId:e.terminalId,side:"top"}),m.jsx(_u,{terminalId:e.terminalId,side:"right"}),m.jsx(_u,{terminalId:e.terminalId,side:"bottom"}),m.jsx(_u,{terminalId:e.terminalId,side:"left"})]}):pe}if(e.type==="editor"){const oe=s[e.editorId];return oe?m.jsx(Ab,{api:a,editor:oe,canClose:Z>1,onClose:()=>j(e.editorId)}):m.jsx("div",{className:"missing-pane",children:"Editor unavailable"})}const ie=Math.max(.1,Math.min(.9,e.ratio)),ne=1-ie,ae=e.direction==="vertical"?{gridTemplateColumns:`minmax(0, ${ie}fr) 1px minmax(0, ${ne}fr)`}:{gridTemplateRows:`minmax(0, ${ie}fr) 1px minmax(0, ${ne}fr)`};return m.jsxs("div",{className:"split-pane","data-direction":e.direction,style:ae,children:[m.jsx("div",{className:"split-cell",children:m.jsx(hm,{node:e.first,terminals:t,editors:s,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:g,draggingTerminalId:p,mobileFocusLeafKey:b,path:[...y,0],totalPanes:Z,onSelect:C,onClose:x,onResize:E,onExit:L,onSnapshot:D,onCloseEditor:j,...U?{onAuthClose:U}:{}})}),m.jsx(XN,{direction:e.direction,path:y,onResize:E}),m.jsx("div",{className:"split-cell",children:m.jsx(hm,{node:e.second,terminals:t,editors:s,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:g,draggingTerminalId:p,mobileFocusLeafKey:b,path:[...y,1],totalPanes:Z,onSelect:C,onClose:x,onResize:E,onExit:L,onSnapshot:D,onCloseEditor:j,...U?{onAuthClose:U}:{}})})]})}function _u({terminalId:e,side:t}){const{setNodeRef:s,isOver:a}=A0({id:`pane-${e}-${t}`,data:{kind:"pane-zone",terminalId:e,side:t}});return m.jsx("div",{ref:s,className:`pane-drop-zone pane-drop-zone--${t}`,"data-over":a,"aria-hidden":"true"})}function XN({direction:e,path:t,onResize:s}){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 g(b){const y=e==="vertical"?(b.clientX-f.left)/f.width:(b.clientY-f.top)/f.height;s(t,Math.min(.9,Math.max(.1,y)))}function p(){window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",p),c.classList.remove("is-dragging"),document.body.style.cursor=""}window.addEventListener("pointermove",g),window.addEventListener("pointerup",p)}return m.jsx("div",{"aria-label":"Resize panes","aria-orientation":e==="vertical"?"vertical":"horizontal",className:"split-divider","data-direction":e,onPointerDown:a,role:"separator",children:m.jsx("span",{className:"split-divider-handle","aria-hidden":"true"})})}function dm(e){return e.type==="pane"||e.type==="editor"?1:dm(e.first)+dm(e.second)}function fm(e){return e.type==="pane"?[{key:GN(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:ZN(e.editorId),type:"editor",editorId:e.editorId}]:[...fm(e.first),...fm(e.second)]}function GN(e){return`terminal:${e}`}function ZN(e){return`editor:${e}`}const gg="workspace-default",QN="NTerminal";function JN(){return{workspaces:[],activeWorkspaceId:null,terminals:{}}}function e3(e,t){switch(t.type){case"workspace.hydrated":return pm(t.terminals,t.savedTabs,t.savedWorkspaces,t.savedActiveWorkspaceId);case"workspace.created":return t3(e,{id:t.workspaceId,title:t.title});case"workspace.closed":return n3(e,t.workspaceId);case"workspace.selected":return h1(e,t.workspaceId);case"workspace.renamed":return i3(e,t.workspaceId,t.title);case"terminal.created":return d1(e,t.terminal);case"terminal.split":return s3(e,t.terminal,t.direction);case"terminal.updated":return m3(e,t.terminal);case"terminal.exited":return g3(e,t.terminalId,t.exitCode);case"terminal.closed":return p1(e,t.terminalId);case"terminal.detached":return _3(e,t.terminalId);case"editor.split":return r3(e,t.editorId,t.title,t.direction);case"editor.closed":return v3(e,t.editorId);case"pane.selected":return d3(e,t.terminalId);case"pane.resized":return f3(e,t.path,t.ratio);case"tab.selected":return l3(e,t.tabId);case"tab.renamed":return h3(e,t.tabId,t.title);case"tab.reordered":return f1(e,t.sourceTabId,t.targetIndex);case"tab.dropped_into_pane":return o3(e,t.sourceTabId,t.sourceTerminalId,t.targetTerminalId,t.side);case"terminal.extracted_to_tab":return c3(e,t.sourceTabId,t.sourceTerminalId,t.targetIndex);case"activePane.closed":return a3(e);default:return e}}function t3(e,t){if(e.workspaces.some(a=>a.id===t.id))return h1(e,t.id);const s={id:t.id,title:t.title,tabs:[],activeTabId:null};return{...e,workspaces:[...e.workspaces,s],activeWorkspaceId:s.id}}function h1(e,t){return e.workspaces.some(s=>s.id===t)?{...e,activeWorkspaceId:t}:e}function i3(e,t,s){const a=s.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 n3(e,t){if(e.workspaces.length<=1||!e.workspaces.some(f=>f.id===t))return e;const s=e.workspaces.find(f=>f.id===t),a=new Set(s?p3(s):[]),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 d1(e,t){const s=g1(e),a=ra(s)??dh(),o=_1(t);return{...s,activeWorkspaceId:a.id,terminals:{...s.terminals,[t.id]:t},workspaces:s.workspaces.map(c=>c.id===a.id?{...c,tabs:[...c.tabs,o],activeTabId:o.id}:c)}}function s3(e,t,s){const a=ra(e),o=a?hh(a):void 0;if(!a||!o)return d1(e,t);const c=o.activeTerminalId,h=zo(o.root,c,{type:"split",direction:s,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(g=>g.id===o.id?{...g,root:h,activeTerminalId:t.id}:g)}:f)}}function r3(e,t,s,a){const o=ra(e),c=o?hh(o):void 0;if(!o||!c)return e;const h=c.activeTerminalId,f=zo(c.root,h,{type:"split",direction:a,ratio:.5,first:{type:"pane",terminalId:h},second:{type:"editor",editorId:t,title:s}});return{...e,workspaces:e.workspaces.map(g=>g.id===o.id?{...g,tabs:g.tabs.map(p=>p.id===c.id?{...p,root:f,activeTerminalId:h}:p)}:g)}}function a3(e){const t=ra(e),s=t?hh(t):void 0;return s?p1(e,s.activeTerminalId):e}function l3(e,t){const s=ra(e);return!s||!s.tabs.some(a=>a.id===t)?e:{...e,workspaces:e.workspaces.map(a=>a.id===s.id?{...a,activeTabId:t}:a)}}function f1(e,t,s){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 g=Math.max(0,Math.min(h.length,s)),p=h.slice();return p.splice(g,0,f),u3(o.tabs,p)?o:{...o,tabs:p}});return a.every((o,c)=>o===e.workspaces[c])?e:{...e,workspaces:a}}function o3(e,t,s,a,o){if(s===a||!e.terminals[s]||!e.terminals[a])return e;let c=e.workspaces.map(g=>{const p=g.tabs.findIndex(x=>x.id===t);if(p<0)return g;const b=g.tabs[p];if(!b)return g;const y=jo(b.root,s);if(!y){const x=g.tabs.filter((E,L)=>L!==p);return{...g,tabs:x}}const S={...b,root:y,activeTerminalId:Un(y)[0]??b.activeTerminalId},C=g.tabs.slice();return C[p]=S,{...g,tabs:C}});const h=o==="left"||o==="right"?"vertical":"horizontal",f=o==="left"||o==="top";return c=c.map(g=>{const p=g.tabs.findIndex(E=>Un(E.root).includes(a));if(p<0)return g;const b=g.tabs[p];if(!b)return g;const y={type:"pane",terminalId:s},S={type:"split",direction:h,ratio:.5,first:f?y:{type:"pane",terminalId:a},second:f?{type:"pane",terminalId:a}:y},C=zo(b.root,a,S),x=g.tabs.slice();return x[p]={...b,root:C,activeTerminalId:s},{...g,tabs:x,activeTabId:b.id}}),g1({...e,workspaces:c})}function c3(e,t,s,a){let o=-1,c=-1;for(let L=0;L<e.workspaces.length;L+=1){const D=e.workspaces[L].tabs.findIndex(j=>j.id===t);if(D>=0){o=L,c=D;break}}if(o<0)return e;const h=e.workspaces[o],f=h.tabs[c],g=Un(f.root);if(!g.includes(s))return e;if(g.length===1)return f1(e,t,a);const p=jo(f.root,s);if(!p)return e;const b={...f,root:p,activeTerminalId:Un(p)[0]??f.activeTerminalId},y=e.terminals[s],S={id:`tab-${Date.now().toString(36)}-${s.slice(0,8)}`,title:y?.title??"",activeTerminalId:s,root:{type:"pane",terminalId:s}},C=h.tabs.slice();C[c]=b;const x=Math.max(0,Math.min(C.length,a));C.splice(x,0,S);const E=e.workspaces.slice();return E[o]={...h,tabs:C,activeTabId:S.id},{...e,workspaces:E}}function u3(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(e[s]?.id!==t[s]?.id)return!1;return!0}function h3(e,t,s){const a=s.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(h=>{let f=!1;const g=h.tabs.map(p=>p.id!==t||p.title===a?p:(o=!0,f=!0,{...p,title:a}));return f?{...h,tabs:g}:h});return o?{...e,workspaces:c}:e}function d3(e,t){const s=e.workspaces.find(o=>o.tabs.some(c=>Ho(c.root,t))),a=s?.tabs.find(o=>Ho(o.root,t));return!s||!a?e:{...e,activeWorkspaceId:s.id,workspaces:e.workspaces.map(o=>o.id===s.id?{...o,activeTabId:a.id,tabs:o.tabs.map(c=>c.id===a.id?{...c,activeTerminalId:t}:c)}:o)}}function f3(e,t,s){const a=ra(e),o=a?hh(a):void 0;if(!a||!o)return e;const c=bm(o.root,t,v1(s));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 pm(e,t,s,a){const o=Object.fromEntries(e.map(b=>[b.id,b])),c=new Set(e.map(b=>b.id)),h=new Set;let f=y3(t,s,c,h);f.length===0&&(f=[dh()]);const g=typeof a=="string"&&f.some(b=>b.id===a)?a:f[0]?.id??null,p=g??f[0]?.id??gg;for(const b of e){if(h.has(b.id))continue;const y=_1(b);f=b3(f,p,y),h.add(b.id)}return{workspaces:f.map(Go),activeWorkspaceId:g,terminals:o}}function uh(e){return Un(e.root)}function mm(e){return Sm(e.root)}function p3(e){return e.tabs.flatMap(t=>Un(t.root))}function Gf(e){const t=e.workspaces.map(s=>{const a=s.tabs.flatMap(o=>{const c=vm(o.root);return c?[{...o,root:c}]:[]});return Go({...s,tabs:a})});return{activeWorkspaceId:t.some(s=>s.id===e.activeWorkspaceId)?e.activeWorkspaceId:t[0]?.id??null,workspaces:t}}function m3(e,t){return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(s=>({...s,tabs:s.tabs.map(a=>Ho(a.root,t.id)?{...a,title:a.title||t.title}:a)}))}}function g3(e,t,s){const a=e.terminals[t];return a?{...e,terminals:{...e.terminals,[t]:{...a,status:"exited",exitCode:s}}}:e}function p1(e,t){const s={...e.terminals};return delete s[t],m1(e,t,s)}function _3(e,t){return e.terminals[t]?m1(e,t,{...e.terminals}):e}function m1(e,t,s){const a=e.workspaces.map(c=>{const h=[];for(const f of c.tabs){const g=jo(f.root,t);if(!g)continue;const p=Un(g),b=p.includes(f.activeTerminalId)?f.activeTerminalId:p[0];b&&h.push({...f,root:g,activeTerminalId:b})}return Go({...c,tabs:h})}),o=a.some(c=>c.id===e.activeWorkspaceId);return{workspaces:a,activeWorkspaceId:o?e.activeWorkspaceId:a[0]?.id??null,terminals:s}}function v3(e,t){const s=e.workspaces.map(o=>{const c=[];for(const h of o.tabs){const f=gm(h.root,t);if(!f)continue;const g=Un(f),p=g.includes(h.activeTerminalId)?h.activeTerminalId:g[0];p&&c.push({...h,root:f,activeTerminalId:p})}return Go({...o,tabs:c})}),a=s.some(o=>o.id===e.activeWorkspaceId);return{...e,workspaces:s,activeWorkspaceId:a?e.activeWorkspaceId:s[0]?.id??null}}function y3(e,t,s,a){if(t&&t.length>0){const o=[];for(const c of t)S3(c)&&o.push(VS(c,s,a));if(o.length>0)return o}return[VS({...dh(),tabs:e??[]},s,a)]}function VS(e,t,s){const a=[];for(const o of e.tabs){if(!w3(o))continue;const c=_m(o.root,t);if(!c)continue;const h=Un(c);for(const g of h)s.add(g);const f=h.includes(o.activeTerminalId)?o.activeTerminalId:h[0];f&&a.push({...o,root:c,activeTerminalId:f})}return Go({...e,tabs:a})}function g1(e){return ra(e)?e:{...e,workspaces:[dh()],activeWorkspaceId:gg}}function ra(e){return e.workspaces.find(t=>t.id===e.activeWorkspaceId)??e.workspaces[0]}function hh(e){return e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]}function dh(){return{id:gg,title:QN,tabs:[],activeTabId:null}}function Go(e){const t=e.tabs.some(s=>s.id===e.activeTabId);return{...e,activeTabId:t?e.activeTabId:e.tabs[0]?.id??null}}function b3(e,t,s){return e.map(a=>a.id===t?{...a,tabs:[...a.tabs,s],activeTabId:a.activeTabId??s.id}:a)}function _1(e){return{id:`tab-${e.id}`,title:e.title||e.id,root:{type:"pane",terminalId:e.id},activeTerminalId:e.id}}function zo(e,t,s){return e.type==="pane"?e.terminalId===t?s:e:e.type==="editor"?e:{...e,first:zo(e.first,t,s),second:zo(e.second,t,s)}}function jo(e,t){if(e.type==="pane")return e.terminalId===t?null:e;if(e.type==="editor")return e;const s=jo(e.first,t),a=jo(e.second,t);return s&&a?{...e,first:s,second:a}:s??a}function gm(e,t){if(e.type==="editor")return e.editorId===t?null:e;if(e.type==="pane")return e;const s=gm(e.first,t),a=gm(e.second,t);return s&&a?{...e,first:s,second:a}:s??a}function _m(e,t){if(e.type==="pane")return t.has(e.terminalId)?e:null;if(e.type==="editor")return null;const s=_m(e.first,t),a=_m(e.second,t);return s&&a?{...e,ratio:v1(e.ratio),first:s,second:a}:s??a}function vm(e){if(e.type==="editor")return null;if(e.type==="pane")return e;const t=vm(e.first),s=vm(e.second);return t&&s?{...e,first:t,second:s}:t??s}function S3(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 w3(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&typeof t.activeTerminalId=="string"&&ym(t.root)}function ym(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")&&ym(t.first)&&ym(t.second):!1}function bm(e,t,s){if(e.type==="pane"||e.type==="editor")return e;if(t.length===0)return e.ratio===s?e:{...e,ratio:s};const[a,...o]=t;if(a===0){const c=bm(e.first,o,s);return c===e.first?e:{...e,first:c}}if(a===1){const c=bm(e.second,o,s);return c===e.second?e:{...e,second:c}}return e}function v1(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}function Ho(e,t){return e.type==="pane"?e.terminalId===t:e.type==="editor"?!1:Ho(e.first,t)||Ho(e.second,t)}function Un(e){return e.type==="pane"?[e.terminalId]:e.type==="editor"?[]:[...Un(e.first),...Un(e.second)]}function Sm(e){return e.type==="pane"||e.type==="editor"?1:Sm(e.first)+Sm(e.second)}const yr=new Map,Uo=new Map,Po=new Map;function ol(e){return e??"__local__"}function C3(e){return{agentId:e,state:JN(),editors:{},loaded:!1,error:null,layoutRevision:null,lastPersistedLayoutJson:null,unreadCompletions:new Set,mutable:{editorIdCounter:0,saveCoord:{pendingLayoutSave:null,saveTimer:null,persistChain:Promise.resolve(),nextPersistQueued:!1,nextPersistLayout:null,queuedBaseRevision:void 0}}}}function Qt(e){const t=ol(e);let s=yr.get(t);return s||(s=C3(e),yr.set(t,s)),s}function y1(e,t){const s=ol(e);let a=Uo.get(s);return a||(a=new Set,Uo.set(s,a)),a.add(t),()=>{a.delete(t)}}function x3(e){const t=ol(e),s=Uo.get(t);if(s)for(const a of Array.from(s))a()}function cl(e,t){yr.set(ol(e),t),x3(e)}const wm=new Set;function E3(e){return wm.add(e),()=>{wm.delete(e)}}function oo(e,t){const s=Qt(e),a=ol(e);t.type==="workspace.hydrated"&&Po.delete(a);const o=e3(s.state,t);let c=s.unreadCompletions,h=null;if(t.type==="terminal.updated"){const p=s.state.terminals[t.terminal.id],b=p?.activity==="busy",y=t.terminal.activity==="busy",S=t.terminal.activity==="idle",C=A3(a);if(t.notifyCompletion===!0&&y&&C.add(t.terminal.id),t.notifyCompletion===!0&&b&&S&&C.has(t.terminal.id)){const x=T3(o,t.terminal.id);x&&(h={terminalId:t.terminal.id,tabId:x.tab.id,commandName:p?.currentCommand??null},x.workspace.activeTabId!==x.tab.id&&(c.has(x.tab.id)||(c=new Set(c),c.add(x.tab.id))))}(S||t.terminal.status==="exited")&&C.delete(t.terminal.id)}t.type==="tab.selected"&&c.has(t.tabId)&&(c=new Set(c),c.delete(t.tabId));const f=o!==s.state,g=c!==s.unreadCompletions;if((f||g)&&cl(e,{...s,state:o,unreadCompletions:c}),g&&_g(),h)for(const p of Array.from(wm))p({agentId:e,...h})}function T3(e,t){for(const s of e.workspaces)for(const a of s.tabs)if(Un(a.root).includes(t))return{workspace:s,tab:a};return null}const Cm=new Set;function k3(e){return Cm.add(e),()=>{Cm.delete(e)}}function D3(){let e=0;for(const t of yr.values())e+=t.unreadCompletions.size;return e}function _g(){for(const e of Array.from(Cm))e()}function R3(e,t){const s=Qt(e);if(!s.unreadCompletions.has(t))return;const a=new Set(s.unreadCompletions);a.delete(t),cl(e,{...s,unreadCompletions:a}),_g()}function XS(e,t){const s=Qt(e);t!==s.state&&cl(e,{...s,state:t})}function GS(e,t){const s=Qt(e),a=t(s.editors);a!==s.editors&&cl(e,{...s,editors:a})}function Kr(e,t,s){const a=Qt(e);a.loaded===t&&a.error===s||cl(e,{...a,loaded:t,error:s})}function vu(e,t,s){const a=Qt(e);a.layoutRevision===t&&a.lastPersistedLayoutJson===s||cl(e,{...a,layoutRevision:t,lastPersistedLayoutJson:s})}function M3(e){const t=Qt(e);return t.mutable.editorIdCounter+=1,t.mutable.editorIdCounter}function N3(e){const t=ol(e),s=yr.get(t);s&&s.mutable.saveCoord.saveTimer!==null&&window.clearTimeout(s.mutable.saveCoord.saveTimer);const a=s?s.unreadCompletions.size>0:!1;yr.delete(t),Uo.delete(t),Po.delete(t),a&&_g()}function Zf(){for(const e of yr.values()){const t=e.mutable.saveCoord.saveTimer;t!==null&&window.clearTimeout(t),e.unreadCompletions.size>0}yr.clear(),Uo.clear(),Po.clear()}function A3(e){let t=Po.get(e);return t||(t=new Set,Po.set(e,t)),t}function xm(e,t){let s=!1,a=!1,o=null,c=!1;for(const h of uh(e)){const f=t[h];if(f){if(f.status==="exited"){c=!0,s=!0;continue}f.activity==="busy"?(a=!0,s=!0,!o&&f.currentCommand&&(o=f.currentCommand)):f.activity==="idle"&&(s=!0)}}return s?c?{state:"exited",commandName:null}:a?{state:"busy",commandName:o}:{state:"idle",commandName:null}:null}function vg(e){return e?e.state==="busy"?e.commandName?`running: ${e.commandName}`:"running":e.state==="exited"?"exited":"idle":""}function Em(e,t){const s=t[e.activeTerminalId];return e.title||s?.title||e.activeTerminalId}function L3(e,t,s,a){return a?.state==="busy"?a.commandName?`running: ${a.commandName}`:"running":a?.state==="exited"?"exited":t[e.activeTerminalId]?.cwd||`${s} pane${s===1?"":"s"}`}function B3({tabs:e,activeTabId:t,terminals:s,unreadCompletionTabIds:a,detachedTerminals:o,onSelectTab:c,onCreateTab:h,onToggleWorkspaces:f,onCloseTerminals:g,onReattachTerminal:p,onDeleteTerminal:b,onSplitVertical:y,onSplitHorizontal:S,onRenameTab:C,activePaneAvailable:x}){const[E,L]=v.useState(null),[D,j]=v.useState(!1),[U,Z]=v.useState(null),ie=v.useRef(null),ne=e.findIndex(O=>O.id===t),ae=ne>=0?e[ne]:e[0]??null,oe=ae?xm(ae,s):null,pe=ae?mm(ae):0,I=ae?Em(ae,s):"No tab";v.useEffect(()=>{ie.current?.focus(),ie.current?.select()},[E?.tabId]),v.useEffect(()=>{if(!D)return;const O=se=>{se.key==="Escape"&&j(!1)};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[D]),v.useEffect(()=>{D&&e.length===0&&j(!1)},[D,e.length]);function q(O,se){L({tabId:O,title:se})}function K(){if(!E)return;const O=E.title.trim();O&&C(E.tabId,O),L(null)}function z(){return m.jsxs("div",{className:"terminal-pane-actions","aria-label":"Pane actions",children:[m.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split right",title:`Split right - ${mT()}`,onClick:y,disabled:!x,children:m.jsx("span",{className:"split-icon split-icon-right","aria-hidden":"true"})}),m.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split down",title:`Split down - ${gT()}`,onClick:S,disabled:!x,children:m.jsx("span",{className:"split-icon split-icon-down","aria-hidden":"true"})})]})}return m.jsxs(m.Fragment,{children:[m.jsxs("nav",{className:"terminal-tabs","aria-label":"Terminal tabs",children:[m.jsx("button",{type:"button",className:"mobile-menu-button","aria-label":"Toggle workspaces",title:"Workspaces",onClick:f,children:m.jsxs("span",{className:"hamburger-lines","aria-hidden":"true",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]})}),m.jsxs("button",{type:"button",className:"mobile-tab-current-button","aria-label":"Open tab switcher",title:I,onClick:()=>j(!0),disabled:e.length===0,children:[oe?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":oe.state,"aria-hidden":"true",title:vg(oe)}):null,m.jsx("span",{children:I}),m.jsxs("small",{children:[ne>=0?ne+1:0,"/",e.length||0,pe>1?` / ${pe}`:""]})]}),m.jsxs("div",{className:"terminal-tab-list",children:[e.map((O,se)=>{const M=uh(O),X=mm(O),V=Em(O,s),ye=O.id===t,xe=E?.tabId===O.id,k=xm(O,s),Q=a?.has(O.id)??!1;return m.jsxs(mi.Fragment,{children:[m.jsx(ZS,{index:se}),m.jsx(O3,{tab:O,active:ye,editing:xe,title:V,paneCount:X,terminalIds:M,canClose:e.length>1,editValue:xe?E.title:null,editInputRef:xe?ie:null,activity:k,unread:Q,onSelect:()=>c(O.id),onBeginRename:()=>q(O.id,V),onCloseAll:()=>g(M),onCommitRename:K,onCancelRename:()=>L(null),onRenameChange:le=>L({tabId:O.id,title:le})})]},O.id)}),m.jsx(ZS,{index:e.length}),m.jsx("button",{type:"button",className:"tab-add-button","aria-label":"New tab",title:"New tab",onClick:h,children:"+"}),(o?.length??0)>0?m.jsx("div",{className:"terminal-detached-pills","aria-label":"Detached terminals",children:(o??[]).map(O=>m.jsx(j3,{terminal:O,onReattach:()=>p?.(O.id),onDelete:()=>Z(O)},O.id))}):null]}),m.jsx("button",{type:"button",className:"mobile-tab-add-button","aria-label":"Create new tab",title:"New tab",onClick:h,children:"+"}),x?z():null]}),D?m.jsx(z3,{tabs:e,activeTabId:t,terminals:s,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:E,editInputRef:ie,onClose:()=>j(!1),onSelectTab:O=>{c(O),j(!1)},onCreateTab:()=>{h(),j(!1)},onBeginRename:q,onCloseTerminals:O=>{g(O),j(!1)},onCommitRename:K,onCancelRename:()=>L(null),onRenameChange:(O,se)=>L({tabId:O,title:se}),onReattachTerminal:O=>{p?.(O),j(!1)},onDeleteTerminal:O=>{Z(O),j(!1)}}):null,U?m.jsx(H3,{terminal:U,onCancel:()=>Z(null),onConfirm:()=>{b?.(U.id),Z(null)}}):null]})}function O3({tab:e,active:t,editing:s,title:a,paneCount:o,canClose:c,editValue:h,editInputRef:f,activity:g,unread:p,onSelect:b,onBeginRename:y,onCloseAll:S,onCommitRename:C,onCancelRename:x,onRenameChange:E}){const{attributes:L,listeners:D,setNodeRef:j,transform:U,isDragging:Z}=N0({id:`tab-${e.id}`,data:{kind:"tab",tabId:e.id,terminalId:e.activeTerminalId},disabled:s}),ie={transform:ip.Translate.toString(U),opacity:Z?.4:void 0,zIndex:Z?2:void 0};return m.jsxs("div",{ref:j,className:"terminal-tab","data-active":t,"data-dragging":Z,"data-unread":p?"true":void 0,style:ie,...L,...D,children:[g?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":g.state,"aria-hidden":"true",title:vg(g)}):null,s&&f&&h!==null?m.jsxs("form",{className:"terminal-tab-editor",onSubmit:ne=>{ne.preventDefault(),C()},children:[m.jsx("input",{ref:f,"aria-label":`Rename ${a}`,value:h,onBlur:C,onChange:ne=>E(ne.target.value),onKeyDown:ne=>{if(ne.key==="Enter"){ne.preventDefault(),C();return}ne.key==="Escape"&&(ne.preventDefault(),x())}}),m.jsx("small",{children:o})]}):m.jsxs("button",{type:"button",className:"terminal-tab-select","aria-label":`Select ${a}`,title:a,onClick:b,onDoubleClick:ne=>{ne.preventDefault(),y()},children:[m.jsx("span",{children:a}),m.jsxs("small",{children:[o," pane",o===1?"":"s"]})]}),c&&!s?m.jsx("button",{type:"button",className:"icon-button","aria-label":`Close ${a}`,title:`Close ${a}`,onPointerDown:ne=>ne.stopPropagation(),onClick:ne=>{ne.stopPropagation(),S()},children:"x"}):null]})}function z3({tabs:e,activeTabId:t,terminals:s,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:c,editInputRef:h,onClose:f,onSelectTab:g,onCreateTab:p,onBeginRename:b,onCloseTerminals:y,onCommitRename:S,onCancelRename:C,onRenameChange:x,onReattachTerminal:E,onDeleteTerminal:L}){const D=v.useRef(null);return v.useEffect(()=>{D.current?.scrollIntoView?.({block:"nearest"})},[t]),m.jsx("div",{className:"mobile-tab-sheet-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"mobile-tab-sheet-title",onClick:f,children:m.jsxs("section",{className:"mobile-tab-sheet",onClick:j=>j.stopPropagation(),children:[m.jsxs("header",{children:[m.jsxs("div",{children:[m.jsx("strong",{id:"mobile-tab-sheet-title",children:"Switch Tabs"}),m.jsxs("small",{children:[e.length," open"]})]}),m.jsxs("div",{className:"mobile-tab-sheet-header-actions",children:[m.jsx("button",{type:"button","aria-label":"New tab",title:"New tab",onClick:p,children:"+"}),m.jsx("button",{type:"button","aria-label":"Close tab switcher",title:"Close",onClick:f,children:"×"})]})]}),m.jsxs("div",{className:"mobile-tab-sheet-list",children:[e.map((j,U)=>{const Z=uh(j),ie=mm(j),ne=Em(j,s),ae=j.id===t,oe=c?.tabId===j.id,pe=xm(j,s),I=a?.has(j.id)??!1;return m.jsxs("div",{ref:ae?D:null,className:"mobile-tab-sheet-row","data-active":ae,"data-unread":I?"true":void 0,children:[oe&&c?m.jsx("form",{className:"mobile-tab-sheet-editor",onSubmit:q=>{q.preventDefault(),S()},children:m.jsx("input",{ref:h,"aria-label":`Rename ${ne}`,value:c.title,onBlur:S,onChange:q=>x(j.id,q.target.value),onKeyDown:q=>{if(q.key==="Enter"){q.preventDefault(),S();return}q.key==="Escape"&&(q.preventDefault(),C())}})}):m.jsxs("button",{type:"button",className:"mobile-tab-sheet-select","aria-label":`Switch to ${ne}`,onClick:()=>g(j.id),children:[m.jsx("span",{className:"mobile-tab-sheet-index",children:U+1}),m.jsxs("span",{className:"mobile-tab-sheet-copy",children:[m.jsx("strong",{children:ne}),m.jsx("small",{children:L3(j,s,ie,pe)})]}),m.jsxs("span",{className:"mobile-tab-sheet-meta",children:[pe?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":pe.state,"aria-hidden":"true",title:vg(pe)}):null,m.jsx("span",{children:ie})]})]}),m.jsxs("div",{className:"mobile-tab-sheet-actions",children:[oe?m.jsx("button",{type:"button","aria-label":`Done renaming ${ne}`,onClick:S,children:"Done"}):m.jsx("button",{type:"button","aria-label":`Rename ${ne}`,onClick:()=>b(j.id,ne),children:"Rename"}),e.length>1?m.jsx("button",{type:"button",className:"mobile-tab-sheet-close","aria-label":`Close ${ne}`,onClick:()=>y(Z),children:"×"}):null]})]},j.id)}),(o?.length??0)>0?m.jsxs("div",{className:"mobile-tab-sheet-detached","aria-label":"Detached terminals",children:[m.jsx("span",{children:"Detached"}),(o??[]).map(j=>{const U=j.title||j.cwd||j.id.slice(0,8);return m.jsxs("div",{className:"mobile-tab-sheet-row mobile-tab-sheet-row-detached",children:[m.jsxs("button",{type:"button",className:"mobile-tab-sheet-select","aria-label":`Re-open ${U}`,onClick:()=>E(j.id),children:[m.jsx("span",{className:"mobile-tab-sheet-index",children:"+"}),m.jsxs("span",{className:"mobile-tab-sheet-copy",children:[m.jsx("strong",{children:U}),m.jsx("small",{children:j.cwd})]}),m.jsx("span",{className:"mobile-tab-sheet-type",children:"detached"})]}),m.jsx("div",{className:"mobile-tab-sheet-actions",children:m.jsx("button",{type:"button",className:"mobile-tab-sheet-close","aria-label":`Delete ${U}`,onClick:()=>L(j),children:"×"})})]},j.id)})]}):null]})]})})}function ZS({index:e}){const{setNodeRef:t,isOver:s}=A0({id:`tab-position-${e}`,data:{kind:"tab-position",index:e}});return m.jsx("div",{ref:t,className:"terminal-tab-drop-slot","data-over":s,"aria-hidden":"true"})}function j3({terminal:e,onReattach:t,onDelete:s}){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 m.jsxs("span",{className:"terminal-detached-pill",title:o,children:[m.jsx("button",{type:"button",className:"terminal-detached-pill-open","aria-label":`Re-open ${a}`,onClick:t,children:a}),m.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(),s()},children:"×"})]})}function H3({terminal:e,onCancel:t,onConfirm:s}){const a=e.title||e.cwd||e.id.slice(0,8);return m.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"delete-terminal-title",onClick:t,children:m.jsxs("div",{className:"security-panel terminal-delete-dialog",onClick:o=>o.stopPropagation(),children:[m.jsxs("header",{className:"security-panel-header",children:[m.jsx("h2",{id:"delete-terminal-title",children:"Delete Terminal"}),m.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:t,children:"×"})]}),m.jsxs("section",{className:"terminal-delete-dialog-body",children:[m.jsx("p",{children:"Delete this terminal?"}),m.jsx("span",{children:a}),m.jsx("small",{children:"The shell session and scrollback will be destroyed."})]}),m.jsxs("div",{className:"terminal-delete-dialog-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",onClick:t,children:"Cancel"}),m.jsx("button",{type:"button",className:"terminal-delete-confirm",onClick:s,children:"Delete"})]})]})})}function U3({uploads:e,onDismiss:t,onDismissAll:s,onRetry:a,onCancel:o}){if(e.length===0)return null;const h=e.some(g=>g.status==="failed"||g.status==="partial")?"alert":"status",f=e.filter(g=>g.status==="queued"||g.status==="uploading").length;return m.jsxs("aside",{className:`upload-toast upload-toast-${q3(e)}`,role:h,"aria-live":h==="alert"?"assertive":"polite",children:[m.jsxs("header",{className:"upload-toast-header",children:[m.jsx("strong",{children:e.length===1?ku(e[0]):`Uploads ${f>0?`(${f} active)`:`(${e.length})`}`}),m.jsx("button",{type:"button","aria-label":"Dismiss upload status",onClick:s,children:"x"})]}),m.jsx("div",{className:"upload-toast-body upload-queue-body",children:e.map(g=>m.jsx(P3,{upload:g,compact:e.length>1,onDismiss:()=>t(g.id),onRetry:()=>a(g.id),onCancel:()=>o(g.id)},g.id))})]})}function P3({upload:e,compact:t,onDismiss:s,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 m.jsxs("section",{className:"upload-queue-item","data-status":e.status,"aria-label":ku(e),children:[m.jsxs("div",{className:"upload-queue-item-header",children:[m.jsx("strong",{children:ku(e)}),m.jsxs("div",{className:"upload-queue-actions",children:[f?m.jsx("button",{type:"button",onClick:o,children:"Cancel"}):null,h?m.jsx("button",{type:"button",onClick:a,children:"Retry"}):null,m.jsx("button",{type:"button","aria-label":`Dismiss ${ku(e)}`,onClick:s,children:"x"})]})]}),e.status==="queued"?m.jsx("p",{children:e.message??"Queued"}):null,e.status==="uploading"?m.jsx(I3,{toast:e}):null,c&&"message"in e&&e.message?m.jsx("p",{className:"upload-toast-muted",children:e.message}):null,c?m.jsx(K3,{response:c,compact:t}):null,e.status==="failed"&&!c&&e.message?m.jsx("p",{children:e.message}):null]})}function I3({toast:e}){const t=e.percent===null?W3(e.loaded):`${e.percent}%`;return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"upload-progress-row",children:[m.jsxs("span",{children:[e.fileCount," file",e.fileCount===1?"":"s"]}),m.jsx("span",{children:t})]}),m.jsx("div",{className:"upload-progress-track","aria-hidden":"true",children:m.jsx("span",{style:{width:e.percent===null?"100%":`${e.percent}%`}})})]})}function K3({response:e,compact:t}){const s=e.results.filter(h=>h.status==="failed"),a=e.results.filter(h=>h.status==="uploaded"),o=t?3:6,c=[...s,...a].slice(0,o);return m.jsxs(m.Fragment,{children:[m.jsx("p",{className:"upload-toast-destination",children:e.destinationCwd}),c.length>0?m.jsx("ul",{className:"upload-result-list",children:c.map((h,f)=>m.jsx(F3,{result:h},`${h.relativePath}-${f}`))}):null,e.results.length>c.length?m.jsxs("p",{className:"upload-toast-muted",children:["+",e.results.length-c.length," more"]}):null]})}function F3({result:e}){const t=e.savedRelativePath??e.relativePath,s=e.status==="uploaded"&&e.savedRelativePath!==void 0&&e.savedRelativePath!==e.relativePath;return m.jsxs("li",{"data-status":e.status,children:[m.jsx("span",{className:"upload-result-path",children:t}),s?m.jsx("span",{className:"upload-result-renamed",children:"renamed"}):null,e.status==="failed"&&e.error?m.jsx("span",{className:"upload-result-error",children:e.error}):null]})}function ku(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,s=(e.response?.uploaded??0)+(e.response?.failed??0)||e.fileCount;return`Uploaded ${t} of ${s} files`}return"Upload failed"}function q3(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 W3(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`}function $3({toast:e,onActivate:t,onDismiss:s}){if(!e)return null;const a=e,o=a.commandName?`${a.commandName} finished`:"Command finished";function c(f){f.stopPropagation(),s()}function h(f){f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),t(a))}return m.jsxs("aside",{className:"completion-toast",role:"status","aria-live":"polite",tabIndex:0,onClick:()=>t(a),onKeyDown:h,children:[m.jsx("video",{className:"completion-toast-character",src:a.assetSrc,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),m.jsxs("div",{className:"completion-toast-copy",children:[m.jsx("strong",{children:a.tabTitle}),m.jsx("span",{children:o})]}),m.jsx("button",{type:"button","aria-label":"Dismiss completion alert",onClick:c,children:"x"})]})}const Y3=yo(0,0,1,1),Rs=1e-6;function V3(e){return b1(e).map(t=>t.terminalId)}function b1(e){return vo(e,Y3).sort(Q3).map((t,s)=>({...t,index:s+1}))}function X3(e,t,s){const a=b1(e),o=a.find(h=>h.terminalId===t);return o?a.filter(h=>h.terminalId!==t).map(h=>Z3(o,h,s)).filter(h=>h!==null).sort(J3)[0]?.entry.terminalId??null:null}function G3(e,t){return!Number.isInteger(t)||t<1?null:V3(e)[t-1]??null}function vo(e,t){if(e.type==="pane")return[{terminalId:e.terminalId,bounds:t}];if(e.type==="editor")return[];const s=eA(e.ratio);if(e.direction==="vertical"){const o=t.left+(t.right-t.left)*s;return[...vo(e.first,yo(t.left,t.top,o,t.bottom)),...vo(e.second,yo(o,t.top,t.right,t.bottom))]}const a=t.top+(t.bottom-t.top)*s;return[...vo(e.first,yo(t.left,t.top,t.right,a)),...vo(e.second,yo(t.left,a,t.right,t.bottom))]}function Z3(e,t,s){const a=e.bounds,o=t.bounds,c=QS(a.left,a.right,o.left,o.right),h=QS(a.top,a.bottom,o.top,o.bottom);switch(s){case"left":return o.centerX>=a.centerX-Rs||h<=Rs?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+Rs||h<=Rs?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-Rs||c<=Rs?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+Rs||c<=Rs?null:{entry:t,primaryDistance:Math.max(0,o.top-a.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};default:return null}}function Q3(e,t){return Za(e.bounds.top,t.bounds.top)||Za(e.bounds.left,t.bounds.left)}function J3(e,t){return Za(e.primaryDistance,t.primaryDistance)||Za(e.perpendicularDistance,t.perpendicularDistance)||Za(t.overlap,e.overlap)||Za(e.entry.index,t.entry.index)}function Za(e,t){const s=e-t;return Math.abs(s)<=Rs?0:s}function QS(e,t,s,a){return Math.max(0,Math.min(t,a)-Math.max(e,s))}function yo(e,t,s,a){return{left:e,top:t,right:s,bottom:a,centerX:e+(s-e)/2,centerY:t+(a-t)/2}}function eA(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}class tA extends Error{constructor(t){super(t),this.name="UploadDropError"}}function JS(e){return e?Array.from(e.types??[]).includes("Files")||x1(e.items).some(s=>s.kind==="file")?!0:E1(e.files).length>0:!1}async function iA(e){const t=x1(e.items).filter(s=>s.kind==="file");return t.length>0?nA(t):sA(e.files)}async function nA(e){const t=[];for(const s of e){const a=oA(s);if(a){await S1(a,"",t);continue}const o=s.getAsFile();if(o){t.push({relativePath:w1(o),file:o});continue}throw new tA("Folder upload is not supported by this browser.")}return t}function sA(e){return E1(e).map(t=>({relativePath:w1(t),file:t}))}async function S1(e,t,s){const a=uA(t,e.name);if(e.isFile){const h=await rA(e);s.push({relativePath:a,file:h});return}if(!e.isDirectory)return;const o=e.createReader(),c=await aA(o);for(const h of c)await S1(h,a,s)}function rA(e){return new Promise((t,s)=>{e.file(t,a=>s(a))})}async function aA(e){const t=[];for(;;){const s=await lA(e);if(s.length===0)return t;t.push(...s)}}function lA(e){return new Promise((t,s)=>{e.readEntries(t,a=>s(a))})}function w1(e){const t=e.webkitRelativePath;return C1(typeof t=="string"&&t?t:e.name)}function oA(e){const t=e.webkitGetAsEntry?.();return cA(t)?t:null}function cA(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 uA(e,t){return C1(e?`${e}/${t}`:t)}function C1(e){return e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).join("/")}function x1(e){return e?Array.from(e):[]}function E1(e){return e?Array.from(e):[]}const e0="nterminal.terminalWorkspaces.v2",T1="nterminal.sidebarCollapsed.v1",hA=75,t0=B0.map(e=>e.url),dA=B0[0].url;function fA({api:e,serverApi:t,activeAgentId:s=null,onSelectServer:a,sessionExpiresAt:o=null,onLogout:c=async()=>{},onSessionInvalid:h}){const f=v.useMemo(()=>e??Vu(),[e]),g=v.useMemo(()=>t??Do(null),[t]),p=v.useMemo(()=>TA(s),[s]),b=v.useMemo(()=>T=>y1(s,T),[s]),y=v.useMemo(()=>()=>Qt(s),[s]),S=v.useSyncExternalStore(b,y,y),C=S.state,x=S.editors,E=!S.loaded,L=S.error,[D,j]=v.useState(!1),[U,Z]=v.useState(()=>NA()),[ie,ne]=v.useState("servers"),[ae,oe]=v.useState(!1),pe=v.useSyncExternalStore(TT,Db,Db);v.useSyncExternalStore(Gm,kb,kb);const[I,q]=v.useState(0),[K,z]=v.useState(()=>[null]),[O,se]=v.useState(0),[M,X]=v.useState(()=>[s]),[V,ye]=v.useState(()=>new Set),[xe,k]=v.useState({}),[Q,le]=v.useState(null),fe=v.useRef(null);v.useRef(!1);const we=v.useRef(0),[Ce,ke]=v.useState(null),Ie=o2(ub(T0,{activationConstraint:{distance:8}}),ub(k0,{activationConstraint:{delay:250,tolerance:5}}));v.useEffect(()=>kT(f),[f]);function H(T){const B=T.active.data.current;if(B){if(B.kind==="tab"&&typeof B.tabId=="string"&&typeof B.terminalId=="string"){ke({tabId:B.tabId,terminalId:B.terminalId});return}B.kind==="pane"&&typeof B.sourceTabId=="string"&&typeof B.terminalId=="string"&&ke({tabId:B.sourceTabId,terminalId:B.terminalId})}}function J(T){ke(null);const B=T.active.data.current,te=T.over?.data.current;if(!(!B||!te||typeof B.terminalId!="string")){if(B.kind==="tab"&&typeof B.tabId=="string"){if(te.kind==="tab-position"&&typeof te.index=="number"){ut({type:"tab.reordered",sourceTabId:B.tabId,targetIndex:te.index});return}te.kind==="pane-zone"&&typeof te.terminalId=="string"&&(te.side==="top"||te.side==="right"||te.side==="bottom"||te.side==="left")&&ut({type:"tab.dropped_into_pane",sourceTabId:B.tabId,sourceTerminalId:B.terminalId,targetTerminalId:te.terminalId,side:te.side});return}if(B.kind==="pane"&&typeof B.sourceTabId=="string"){if(te.kind==="tab-position"&&typeof te.index=="number"){ut({type:"terminal.extracted_to_tab",sourceTabId:B.sourceTabId,sourceTerminalId:B.terminalId,targetIndex:te.index});return}te.kind==="pane-zone"&&typeof te.terminalId=="string"&&(te.side==="top"||te.side==="right"||te.side==="bottom"||te.side==="left")&&ut({type:"tab.dropped_into_pane",sourceTabId:B.sourceTabId,sourceTerminalId:B.terminalId,targetTerminalId:te.terminalId,side:te.side})}}}function Ee(){ke(null)}const ve=C.workspaces.find(T=>T.id===C.activeWorkspaceId)??C.workspaces[0],ge=ve?.tabs.find(T=>T.id===ve.activeTabId)??ve?.tabs[0],F=ge?.activeTerminalId??null,me=F?C.terminals[F]:void 0,Se=CA("(max-width: 760px)"),Le=v.useMemo(()=>ge?$u(ge.root):[],[ge]),qe=ve&&ge?Ru(s,ve.id,ge.id):null,st=ge?k1(Le,ge.activeTerminalId,qe?xe[qe]:void 0):null,Ke=Se&&Le.length>1,St=v.useMemo(()=>{const T=new Set;for(const B of C.workspaces)for(const te of B.tabs)for(const _e of uh(te))T.add(_e);return Object.values(C.terminals).filter(B=>!T.has(B.id))},[C.terminals,C.workspaces]),[Hi,Yn]=v.useState([]),lt=v.useRef([]),li=v.useRef(null),[Zi,_i]=v.useState(null),[jt,Ui]=v.useState([]),[vi,$]=v.useState(()=>Jr()),He=v.useRef(0),et=v.useRef(s),ct=v.useRef(t0),Jt=v.useRef(vi),Ht=v.useRef(()=>{});Ht.current=It;const oi=v.useCallback(async()=>{try{const T=await f.listNotificationAssets();Ui(T.assets.filter(B=>B.enabled).map(B=>B.url))}catch{Ui([])}},[f]);v.useEffect(()=>{X(T=>T.some(B=>ks(B,s))?T:[...T,s])},[s]);const Fi=v.useCallback(T=>{const B=Qt(T),te=Do(T);for(const _e of Object.keys(B.state.terminals))om(te.createWebSocketUrl(_e)),LS(_e);N3(T),X(_e=>_e.filter(Te=>!ks(Te,T))),ye(_e=>{const Te=`${Du(T)}:`;let Oe=!1;const Ae=new Set;for(const mt of _e){if(mt.startsWith(Te)){Oe=!0;continue}Ae.add(mt)}return Oe?Ae:_e}),k(_e=>{const Te=`${Du(T)}:`;let Oe=!1;const Ae={};for(const[mt,gt]of Object.entries(_e)){if(mt.startsWith(Te)){Oe=!0;continue}Ae[mt]=gt}return Oe?Ae:_e})},[]);v.useEffect(()=>{let T=!1;return f.listAgents().then(B=>{if(!T){const te=B.agents.map(Te=>Te.id),_e=[null,...te];s!==null&&!te.includes(s)&&(Fi(s),a?.(null)),z(_e)}}).catch(()=>{}),()=>{T=!0}},[s,f,Fi,a,O]);const as=v.useCallback(T=>{Fi(T),se(B=>B+1),ks(T,et.current)&&a?.(null)},[Fi,a]);v.useEffect(()=>{z(T=>T.some(B=>ks(B,s))?T:[...T,s])},[s]),v.useEffect(()=>{et.current=s},[s]),v.useEffect(()=>{oi()},[oi]),v.useEffect(()=>K0(()=>$(Jr())),[]),v.useEffect(()=>{const T=B=>{Ht.current(B)};return window.addEventListener("keydown",T,!0),()=>window.removeEventListener("keydown",T,!0)},[]),v.useEffect(()=>{ct.current=jt.length>0?jt:t0},[jt]),v.useEffect(()=>{Jt.current=vi},[vi]),v.useEffect(()=>{if(!S.loaded||!ve||!ge)return;const T=Ru(s,ve.id,ge.id);ye(B=>{if(B.has(T))return B;const te=new Set(B);return te.add(T),te})},[s,S.loaded,ve?.id,ge?.id]),v.useEffect(()=>()=>{ul()},[]),v.useEffect(()=>E3(T=>{const B=Qt(T.agentId).state,te=B.workspaces.flatMap(Ae=>Ae.tabs).find(Ae=>Ae.id===T.tabId),_e=B.terminals[T.terminalId],Te=te?.title?.trim()||_e?.title||T.commandName||"terminal",Oe=document.visibilityState==="visible"&&ks(T.agentId,et.current)&&T.tabId===EA(B);if(Oe||aT({tabTitle:Te,commandName:T.commandName,terminalId:T.terminalId}),!Oe&&document.visibilityState==="visible"&&Jt.current.enabled){const Ae=He.current+1;He.current=Ae;const mt=ct.current;_i({id:Ae,agentId:T.agentId,terminalId:T.terminalId,tabId:T.tabId,tabTitle:Te,commandName:T.commandName,assetSrc:mt[Math.floor(Math.random()*mt.length)]??dA})}}),[]),v.useEffect(()=>{if(!Zi||vi.persistUntilDismissed)return;const T=window.setTimeout(()=>{_i(B=>B?.id===Zi.id?null:B)},vi.durationSeconds*1e3);return()=>window.clearTimeout(T)},[Zi,vi]),v.useEffect(()=>{fe.current?.focus(),fe.current?.select()},[Q?.workspaceId]),v.useEffect(()=>{AA(U),U&&le(null)},[U]),v.useEffect(()=>{let T=!1;async function B(){if(!Qt(s).loaded){Kr(s,!1,null);try{const _e=kA(p),[Te,Oe]=await Promise.all([g.listTerminals(),g.getTerminalLayout()]),Ae=Te.terminals.length>0?Te.terminals:[(await g.createTerminal({cols:80,rows:24})).terminal];if(!T){const mt=Oe.layout?R1(Oe.layout):null,gt=mt??_e??{},N=pm(Ae,void 0,gt.savedWorkspaces,gt.savedActiveWorkspaceId),de=Gf(N);XS(s,N),vu(s,Oe.revision,JSON.stringify(de)),Kr(s,!0,null),!mt&&_e&&os(de,{baseRevision:Oe.revision})}}catch(_e){!T&&!Ai(_e)&&Kr(s,!0,uo(_e))}}}return B(),()=>{T=!0}},[s,g,I]);function on(){Kr(s,!1,null),q(T=>T+1)}async function wn(){await Vt(async()=>{const T=await g.createTerminal({cols:80,rows:24});ut({type:"terminal.created",terminal:T.terminal})})}async function wt(T){await Vt(async()=>{const B=F?{parentTerminalId:F,cols:80,rows:24}:{cols:80,rows:24},te=await g.createTerminal(B);ut({type:"terminal.split",terminal:te.terminal,direction:T})})}async function Et(T){if(!F)throw new Error("No active pane is available.");const B=await g.readFile(T),te=`editor-${Date.now().toString(36)}-${M3(s)}`,_e=MA(B.path);GS(s,Te=>({...Te,[te]:{id:te,title:_e,rootToken:T.rootToken,path:B.path,read:B}})),qe&&k(Te=>({...Te,[qe]:D1(te)})),ut({type:"editor.split",editorId:te,title:_e,direction:"vertical"})}function Ut(T){GS(s,B=>{const te={...B};return delete te[T],te}),ut({type:"editor.closed",editorId:T})}function ci(T){Yt([T])}function Yt(T){for(const B of T)ut({type:"terminal.detached",terminalId:B})}async function ei(T){await Vt(async()=>{await Tt(T),om(g.createWebSocketUrl(T)),LS(T),ut({type:"terminal.closed",terminalId:T})})}async function ui(T,B){const te=B.trim();if(!te)return;let _e=null;for(const Te of C.workspaces){const Oe=Te.tabs.find(Ae=>Ae.id===T);if(Oe){_e=Oe.activeTerminalId;break}}if(ut({type:"tab.renamed",tabId:T,title:te}),!!_e)try{const Te=await g.renameTerminal(_e,te);Pi({type:"terminal.updated",terminal:Te.terminal})}catch(Te){Kr(s,!0,uo(Te))}}function Ni(T){const B=C.terminals[T];B&&ut({type:"terminal.created",terminal:B})}async function Tt(T){try{await g.closeTerminal(T)}catch(B){if(B instanceof Ns&&B.status===404)return;throw B}}async function qi(){await Vt(async()=>{await c()})}async function Vt(T){Kr(s,!0,null);try{await T()}catch(B){if(Ai(B))return;Kr(s,!0,uo(B))}}function Ai(T){return T instanceof Ns&&T.status===401&&!g.isAgent&&h?(h({source:"workspace-api-401",status:401,activeAgentId:s}),!0):!1}function ut(T){oo(s,T);const B=Qt(s),te=B.state;if(!B.loaded||te.workspaces.length===0)return;const _e=Gf(te);JSON.stringify(_e)!==B.lastPersistedLayoutJson&&xn(_e)}function Pi(T){oo(s,T)}function yi(T,B,te,_e){const Te=Ru(T,B,te);k(Oe=>({...Oe,[Te]:_e}))}function dt(T){qe&&k(B=>({...B,[qe]:T}))}function bi(T,B){const te=Yu(T);B?yi(s,B.workspaceId,B.tabId,te):dt(te),ut({type:"pane.selected",terminalId:T})}function Pt(T){dt(T.key),T.type==="terminal"&&ut({type:"pane.selected",terminalId:T.terminalId})}function It(T){if(ae||T.isComposing||T.key==="Process"||yA(T.target))return;const B=mA(T);if(!B)return;if(T.preventDefault(),T.stopPropagation(),B.type==="server.previous"||B.type==="server.next"){Mt(B.type==="server.next"?1:-1);return}const te=Qt(s).state,_e=te.workspaces.find(Ae=>Ae.id===te.activeWorkspaceId)??te.workspaces[0],Te=_e?.tabs.find(Ae=>Ae.id===_e.activeTabId)??_e?.tabs[0];if(B.type==="split"){if(!Te)return;wt(B.direction);return}if(!_e||!Te)return;if(B.type==="tab.previous"||B.type==="tab.next"){const Ae=vA(_e.tabs,Te.id,B.type==="tab.next"?1:-1);Ae&&ut({type:"tab.selected",tabId:Ae.id});return}if(B.type==="tab.index"){const Ae=_e.tabs[B.index-1];Ae&&ut({type:"tab.selected",tabId:Ae.id});return}const Oe=gA(Te.root,Te.activeTerminalId,B);Oe&&bi(Oe,{workspaceId:_e.id,tabId:Te.id})}function Mt(T){if(!a||K.length===0)return;const B=K.findIndex(Oe=>ks(Oe,s)),_e=((B===-1?0:B)+T+K.length)%K.length,Te=K[_e]??null;ks(Te,s)||a(Te)}function br(T){JS(T.dataTransfer)&&(T.preventDefault(),T.dataTransfer.dropEffect="copy")}function aa(T){if(!JS(T.dataTransfer))return;T.preventDefault();const B=DA(Qt(s).state),te=we.current+1;if(we.current=te,!B){ls({id:te,status:"failed",fileCount:0,message:"No active running terminal is available for upload."});return}ls({id:te,status:"queued",fileCount:0,terminalId:B.id,message:"Preparing upload..."}),la(te,B.id,T.dataTransfer)}async function la(T,B,te){try{const _e=await iA(te);if(_e.length===0)throw new Error("No files were found in the drop.");Lt(T,{id:T,status:"queued",fileCount:_e.length,message:"Queued"},{terminalId:B,files:_e})}catch(_e){Lt(T,{id:T,status:"failed",fileCount:0,message:uo(_e)},{terminalId:B})}finally{Cn()}}async function Sr(T){const B=lt.current.find(Oe=>Oe.id===T);if(!B?.terminalId||!B.files||B.files.length===0)return;const te=B.terminalId,_e=B.files,Te=new AbortController;li.current=T,Lt(T,{id:T,status:"uploading",fileCount:_e.length,loaded:0,total:null,percent:null},{terminalId:te,files:_e,abortController:Te});try{const Oe=await IT({terminalId:te,files:_e,signal:Te.signal,onProgress:N=>{Lt(T,{id:T,status:"uploading",fileCount:_e.length,loaded:N.loaded,total:N.total,percent:N.percent},{terminalId:te,files:_e,abortController:Te})}}),Ae=Oe.failed>0?Oe.uploaded>0?"partial":"failed":"success",mt=Oe.failed>0?RA(Oe):void 0,gt={id:T,status:Ae,fileCount:_e.length,response:Oe};mt&&(gt.message=mt),Lt(T,gt,{terminalId:te,files:_e})}catch(Oe){Lt(T,{id:T,status:"failed",fileCount:_e.length,message:Te.signal.aborted?"Upload canceled.":uo(Oe)},{terminalId:te,files:_e})}finally{li.current===T&&(li.current=null),Cn()}}function Cn(){if(li.current!==null)return;const T=lt.current.find(B=>B.status==="queued");T?.terminalId&&T.files&&T.files.length>0&&Sr(T.id)}function ls(T){Wi(B=>[...B,T])}function Lt(T,B,te={}){Wi(_e=>_e.map(Te=>{if(Te.id!==T)return Te;const Oe={...B},Ae=te.terminalId??Te.terminalId,mt=te.files??Te.files;return Ae!==void 0&&(Oe.terminalId=Ae),mt!==void 0&&(Oe.files=mt),te.abortController!==void 0&&(Oe.abortController=te.abortController),Oe}))}function Wi(T){const B=T(lt.current);lt.current=B,Yn(B)}function Vn(T){lt.current.find(te=>te.id===T)?.abortController?.abort(),li.current===T&&(li.current=null),Wi(te=>te.filter(_e=>_e.id!==T)),Cn()}function Pn(){for(const T of lt.current)T.abortController?.abort();li.current=null,Wi(()=>[])}function Kt(T){const B=lt.current.find(te=>te.id===T);if(B){if(B.status==="queued"){Vn(T);return}B.abortController?.abort()}}function wr(T){const B=lt.current.find(_e=>_e.id===T);if(!B?.terminalId||!B.files||B.files.length===0)return;const te=Os(B);if(te.length===0){Lt(T,{id:T,status:"failed",fileCount:B.fileCount,message:"No failed files are available to retry."},{terminalId:B.terminalId,files:B.files});return}Lt(T,{id:T,status:"queued",fileCount:te.length,message:"Queued"},{terminalId:B.terminalId,files:te}),Cn()}function Os(T){const B=T.files??[],te="response"in T?T.response:void 0;if(!te)return B;const _e=te.results.filter(Ae=>Ae.status==="failed").map(Ae=>Ae.relativePath);if(_e.length===0)return[];const Te=new Map;for(const Ae of B){const mt=Te.get(Ae.relativePath)??[];mt.push(Ae),Te.set(Ae.relativePath,mt)}const Oe=[];for(const Ae of _e){const gt=Te.get(Ae)?.shift();gt&&Oe.push(gt)}return Oe}function cn(T){const te=Qt(T.agentId).state.workspaces.find(_e=>_e.tabs.some(Te=>Te.id===T.tabId));te&&yi(T.agentId,te.id,T.tabId,Yu(T.terminalId)),oo(T.agentId,{type:"pane.selected",terminalId:T.terminalId}),R3(T.agentId,T.tabId),ks(T.agentId,s)||a?.(T.agentId),_i(null)}function xn(T){const B=Qt(s).mutable.saveCoord;B.pendingLayoutSave=T,co(T,p),B.saveTimer!==null&&window.clearTimeout(B.saveTimer),B.saveTimer=window.setTimeout(()=>{B.saveTimer=null;const te=B.pendingLayoutSave;B.pendingLayoutSave=null,te&&os(te)},hA)}function ul(){const T=Qt(s).mutable.saveCoord;T.saveTimer!==null&&(window.clearTimeout(T.saveTimer),T.saveTimer=null);const B=T.pendingLayoutSave;T.pendingLayoutSave=null,B&&(co(B,p),os(B))}function os(T,B={}){const te=Qt(s).mutable.saveCoord;te.nextPersistLayout=T,B.baseRevision!==void 0&&(te.queuedBaseRevision=B.baseRevision),!te.nextPersistQueued&&(te.nextPersistQueued=!0,te.persistChain=te.persistChain.then(async()=>{te.nextPersistQueued=!1;const _e=te.nextPersistLayout,Te=te.queuedBaseRevision;te.nextPersistLayout=null,te.queuedBaseRevision=void 0,_e&&await oa(_e,Te!==void 0?{baseRevision:Te}:{})}))}async function oa(T,B={}){const te=Qt(s),_e=B.baseRevision??te.layoutRevision,Te={layout:T,...typeof _e=="number"?{baseRevision:_e}:{}};try{const Oe=await g.saveTerminalLayout(Te),Ae=Oe.layout??T;vu(s,Oe.revision,JSON.stringify(Ae)),co(Ae,p);return}catch(Oe){if(Oe instanceof Ns&&Oe.status===409)try{const Ae=await g.getTerminalLayout();if(Ae.layout){const mt=Qt(s).state,gt=pm(Object.values(mt.terminals),void 0,Ae.layout.workspaces,Ae.layout.activeWorkspaceId),N=Gf(gt);XS(s,gt),vu(s,Ae.revision,JSON.stringify(N)),co(N,p)}else vu(s,Ae.revision,te.lastPersistedLayoutJson);return}catch{}co(T,p)}}const ca=LA(o),$i=!U||D,In=$i?ie:"servers";return m.jsx(oE,{sensors:Ie,onDragStart:H,onDragEnd:J,onDragCancel:Ee,children:m.jsxs("main",{className:"terminal-shell","data-collapsed":U,"data-sidebar-open":D,onDragOver:br,onDrop:aa,children:[m.jsx("button",{type:"button",className:"workspace-backdrop","aria-label":"Close workspaces",onClick:()=>j(!1)}),m.jsxs("aside",{className:"workspace-sidebar",children:[m.jsxs("header",{className:"workspace-brand",children:[$i?m.jsx(h0,{height:20}):m.jsx(u0,{size:24}),m.jsx("button",{type:"button",className:"sidebar-collapse-button","aria-label":U?"Expand sidebar":"Collapse sidebar",title:U?"Expand sidebar":"Collapse sidebar",onClick:()=>Z(T=>!T),children:U?">":"<"}),m.jsx("button",{type:"button",className:"sidebar-drawer-close-button","aria-label":"Close workspaces",title:"Close workspaces",onClick:()=>j(!1),children:"x"})]}),m.jsxs("div",{className:`workspace-sidebar-content workspace-sidebar-content--${In==="files"?"files":"servers"}`,children:[$i?m.jsxs("div",{className:"workspace-sidebar-tabs",role:"tablist","aria-label":"Sidebar mode",children:[m.jsx("button",{type:"button",role:"tab","aria-selected":ie==="servers",onClick:()=>{ne("servers"),le(null)},children:"Servers"}),m.jsx("button",{type:"button",role:"tab","aria-selected":ie==="files",onClick:()=>{ne("files"),le(null)},children:"Files"})]}):null,In==="servers"&&$i?m.jsx("nav",{className:"workspace-nav","aria-label":"Servers",children:m.jsx(Tf,{api:f,activeAgentId:s,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:O})}):null,$i?null:m.jsx("nav",{className:"workspace-nav workspace-nav--collapsed","aria-label":"Servers",children:m.jsx(Tf,{api:f,activeAgentId:s,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:O,compact:!0})}),In==="files"?m.jsxs(m.Fragment,{children:[$i?m.jsx("nav",{className:"workspace-nav workspace-nav--compact","aria-label":"Servers",children:m.jsx(Tf,{api:f,activeAgentId:s,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:O})}):null,m.jsx($T,{api:g,activeTerminalId:F,activeTerminalCwd:me?.cwd??null,onOpenFile:Et})]}):null]}),m.jsxs("div",{className:"workspace-sidebar-footer",children:[$i?m.jsx("span",{children:ca}):null,m.jsxs("div",{className:"workspace-sidebar-footer-actions",children:[m.jsxs("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"settings",title:"Settings",onClick:()=>oe(!0),children:[m.jsx(n0,{name:"settings"}),pe.hasUpdates?m.jsx("span",{className:"update-pulse-dot","aria-hidden":"true"}):null]}),$i?m.jsx("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"logout",title:"Logout",onClick:()=>{qi()},children:m.jsx(n0,{name:"logout"})}):null]})]})]}),ae?m.jsx(zT,{api:f,onClose:()=>oe(!1),updateAvailable:pe.hasUpdates,onNotificationAssetsChanged:()=>{oi()},onAgentRemoved:as}):null,m.jsxs("section",{className:"terminal-main","aria-label":"Terminal workspace","data-mobile-pane-switcher":Ke?"true":void 0,children:[m.jsx(B3,{tabs:ve?.tabs??[],activeTabId:ve?.activeTabId??null,terminals:C.terminals,unreadCompletionTabIds:S.unreadCompletions,detachedTerminals:St,onSelectTab:T=>ut({type:"tab.selected",tabId:T}),onCreateTab:()=>{wn()},onToggleWorkspaces:()=>j(T=>!T),onCloseTerminals:T=>Yt(T),onReattachTerminal:T=>Ni(T),onDeleteTerminal:T=>{ei(T)},onSplitVertical:()=>{wt("vertical")},onSplitHorizontal:()=>{wt("horizontal")},onRenameTab:(T,B)=>{ui(T,B)},activePaneAvailable:!!F}),Ke?m.jsx(SA,{targets:Le,activeLeafKey:st,terminals:C.terminals,editors:x,onSelect:Pt}):null,L?m.jsxs("div",{className:"workspace-error",role:"alert",children:[m.jsx("span",{children:L}),m.jsxs("div",{className:"workspace-error-actions",children:[m.jsx("button",{type:"button",onClick:on,children:"Retry"}),s!==null&&a?m.jsx("button",{type:"button",onClick:()=>a(null),children:"Main server"}):null]})]}):null,m.jsxs("section",{className:"workspace-body","aria-busy":E,children:[E?m.jsx("div",{className:"workspace-placeholder",children:"Opening shell..."}):null,!E&&!ge?m.jsx(bA,{onCreate:()=>{wn()}}):null,M.map(T=>{const B=ks(T,s);return m.jsx(pA,{agentId:T,active:B,activeServerApi:B?g:void 0,visitedTabKeys:V,refreshCwdOnEnter:B&&In==="files",draggingTab:B?Ce:null,mobileSplitFocus:Se,mobileFocusedLeafByTabKey:xe,onSelect:te=>{B&&bi(te)},onClose:te=>{B&&ci(te)},onCloseEditor:te=>{B&&Ut(te)},onResize:(te,_e)=>{B&&ut({type:"pane.resized",path:te,ratio:_e})},onExit:(te,_e)=>{B?Pi({type:"terminal.exited",terminalId:te,exitCode:_e}):oo(T,{type:"terminal.exited",terminalId:te,exitCode:_e})},onSnapshot:(te,_e)=>{const Te={type:"terminal.updated",terminal:te,notifyCompletion:_e?.notifyCompletion===!0};B?Pi(Te):oo(T,Te)},...T===null&&h?{onAuthClose:te=>h({...te,source:te?.source??"terminal-ws-1008",activeAgentId:T})}:{}},Du(T))})]}),m.jsx($3,{toast:Zi,onActivate:cn,onDismiss:()=>_i(null)}),m.jsx(U3,{uploads:Hi,onDismiss:Vn,onDismissAll:Pn,onRetry:wr,onCancel:Kt})]})]})})}function pA({agentId:e,active:t,activeServerApi:s,visitedTabKeys:a,refreshCwdOnEnter:o,draggingTab:c,mobileSplitFocus:h,mobileFocusedLeafByTabKey:f,onSelect:g,onClose:p,onCloseEditor:b,onResize:y,onExit:S,onSnapshot:C,onAuthClose:x}){const E=v.useMemo(()=>pe=>y1(e,pe),[e]),L=v.useMemo(()=>()=>Qt(e),[e]),D=v.useSyncExternalStore(E,L,L),j=v.useMemo(()=>Do(e),[e]),U=s??j,Z=D.state,ie=Z.workspaces.find(pe=>pe.id===Z.activeWorkspaceId)??Z.workspaces[0],ne=ie?.id??null,oe=(ie?.tabs.find(pe=>pe.id===ie.activeTabId)??ie?.tabs[0])?.id??null;return!D.loaded||Z.workspaces.length===0?null:m.jsx("div",{className:"workspace-server-surface","data-active":t,"aria-hidden":!t,children:Z.workspaces.flatMap(pe=>pe.tabs.map(I=>{const q=t&&pe.id===ne&&I.id===oe,K=Ru(e,pe.id,I.id),z=$u(I.root),O=h&&z.length>1?k1(z,I.activeTerminalId,f[K]):null;return!q&&!a.has(K)?null:m.jsx("div",{className:"workspace-tab-surface","data-active":q,"aria-hidden":!q,children:m.jsx(hm,{node:I.root,terminals:Z.terminals,editors:D.editors,api:U,activeTerminalId:I.activeTerminalId,visible:q,refreshCwdOnEnter:q&&o,tabId:I.id,dropZoneActive:q&&c!==null,draggingTerminalId:q?c?.terminalId??null:null,mobileFocusLeafKey:O,onSelect:g,onClose:p,onCloseEditor:b,onResize:y,onExit:S,onSnapshot:C,...x?{onAuthClose:x}:{}})},`${pe.id}:${I.id}`)}))})}function mA(e){const t=G0(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 s=_A(e.key);return s?{type:"pane.direction",direction:s}:null}return null}function gA(e,t,s){switch(s.type){case"pane.direction":return X3(e,t,s.direction);case"pane.index":return G3(e,s.index);default:return null}}function _A(e){switch(e){case"ArrowLeft":return"left";case"ArrowRight":return"right";case"ArrowUp":return"up";case"ArrowDown":return"down";default:return null}}function vA(e,t,s){if(e.length===0)return null;const a=e.findIndex(c=>c.id===t);return e[((a===-1?0:a)+s+e.length)%e.length]??null}function $u(e){return e.type==="pane"?[{key:Yu(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:D1(e.editorId),type:"editor",editorId:e.editorId,title:e.title}]:[...$u(e.first),...$u(e.second)]}function k1(e,t,s){if(s&&e.some(o=>o.key===s))return s;const a=t?Yu(t):null;return a&&e.some(o=>o.key===a)?a:e[0]?.key??null}function Yu(e){return`terminal:${e}`}function D1(e){return`editor:${e}`}function yA(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 bA({onCreate:e}){return m.jsxs("div",{className:"empty-workspace",children:[m.jsx("span",{children:"No terminal is open."}),m.jsx("button",{type:"button",onClick:e,children:"New tab"})]})}function SA({targets:e,activeLeafKey:t,terminals:s,editors:a,onSelect:o}){const[c,h]=v.useState(!1);if(e.length<=1)return null;const f=t?e.findIndex(S=>S.key===t):-1,g=f>=0?f:0,p=e[g]??e[0],b=i0(p,s,a);function y(S){const C=(g+S+e.length)%e.length,x=e[C];x&&o(x)}return m.jsxs("div",{className:"mobile-pane-switcher",role:"group","aria-label":"Pane switcher",children:[m.jsx("button",{type:"button","aria-label":"Previous pane",onClick:()=>y(-1),children:"<"}),m.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 ",g+1,"/",e.length," | ",b]}),m.jsx("button",{type:"button","aria-label":"Next pane",onClick:()=>y(1),children:">"}),c?m.jsx("div",{className:"mobile-pane-sheet-backdrop",onClick:()=>h(!1),children:m.jsxs("section",{className:"mobile-pane-sheet",role:"dialog","aria-modal":"true","aria-label":"Pane switcher",onClick:S=>S.stopPropagation(),children:[m.jsxs("header",{children:[m.jsx("strong",{children:"Panes"}),m.jsx("button",{type:"button","aria-label":"Close pane switcher",onClick:()=>h(!1),children:"x"})]}),m.jsx("div",{className:"mobile-pane-sheet-list",children:e.map((S,C)=>{const x=i0(S,s,a),E=wA(S,s,a),L=S.key===p.key;return m.jsxs("button",{type:"button","data-active":L,onClick:()=>{o(S),h(!1)},children:[m.jsx("span",{className:"mobile-pane-sheet-index",children:C+1}),m.jsxs("span",{className:"mobile-pane-sheet-copy",children:[m.jsx("strong",{children:x}),m.jsx("small",{children:E})]}),m.jsx("span",{className:"mobile-pane-sheet-type",children:S.type})]},S.key)})})]})}):null]})}function i0(e,t,s){if(e.type==="editor")return s[e.editorId]?.title||e.title||e.editorId;const a=t[e.terminalId];return a?.title||a?.cwd||e.terminalId}function wA(e,t,s){if(e.type==="editor"){const c=s[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,s]=v.useState(()=>xA(e));return v.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function"){s(!1);return}const a=window.matchMedia(e),o=()=>s(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 xA(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function ks(e,t){return e===t}function EA(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 Du(e){return e??"__local__"}function Ru(e,t,s){return`${Du(e)}:${t}:${s}`}function TA(e){return e?{workspaceKey:`${e0}:${e}`}:{workspaceKey:e0}}function kA(e){const t=localStorage.getItem(e.workspaceKey);if(!t)return null;try{const s=JSON.parse(t),a=L0(s);return a?R1(a):null}catch{return null}}function R1(e){const t=L0(e);return t?{savedWorkspaces:t.workspaces,savedActiveWorkspaceId:t.activeWorkspaceId}:null}function co(e,t){if(e.workspaces.length>0){localStorage.setItem(t.workspaceKey,JSON.stringify(e));return}localStorage.removeItem(t.workspaceKey)}function DA(e){const t=e.workspaces.find(o=>o.id===e.activeWorkspaceId)??e.workspaces[0],s=t?.tabs.find(o=>o.id===t.activeTabId)??t?.tabs[0],a=s?e.terminals[s.activeTerminalId]:void 0;return a?.status==="running"?a:null}function RA(e){return e.results.find(t=>t.status==="failed"&&t.error)?.error}function MA(e){return e.split("/").filter(Boolean).pop()??e}function NA(){try{return localStorage.getItem(T1)==="true"}catch{return!1}}function AA(e){try{localStorage.setItem(T1,e?"true":"false")}catch{}}function LA(e){if(!e)return"session · local";const t=Date.parse(e);if(!Number.isFinite(t))return"session · local";const s=t-Date.now();if(s<=0)return"session · expired";const a=Math.max(1,Math.floor(s/6e4));return a<60?`session · ${a}m left`:`session · ${Math.floor(a/60)}h left`}function n0({name:e}){return m.jsxs("svg",{className:"workspace-footer-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[e==="settings"?m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M4 7h9"}),m.jsx("path",{d:"M17 7h3"}),m.jsx("circle",{cx:"15",cy:"7",r:"2"}),m.jsx("path",{d:"M4 12h3"}),m.jsx("path",{d:"M11 12h9"}),m.jsx("circle",{cx:"9",cy:"12",r:"2"}),m.jsx("path",{d:"M4 17h9"}),m.jsx("path",{d:"M17 17h3"}),m.jsx("circle",{cx:"15",cy:"17",r:"2"})]}):null,e==="logout"?m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M10 6H6v12h4"}),m.jsx("path",{d:"M13 8l4 4-4 4"}),m.jsx("path",{d:"M8 12h9"})]}):null]})}function uo(e){return e instanceof Error?e.message:"Request failed"}function BA({api:e,onDone:t}){const[s,a]=v.useState(null),[o,c]=v.useState(null),[h,f]=v.useState(""),[g,p]=v.useState(!1),[b,y]=v.useState(null),[S,C]=v.useState(null);v.useEffect(()=>{let E=!1;return e.setupTotp().then(L=>{E||(a(L.qrDataUrl),c(L.secret))}).catch(L=>{E||C(L instanceof Error?L.message:"Failed to generate QR code")}),()=>{E=!0}},[e]);async function x(E){if(E.preventDefault(),!!o){p(!0),y(null);try{await e.activateTotp({secret:o,otp:h}),t()}catch(L){y(L instanceof Error?L.message:"Verification failed")}finally{p(!1)}}}return S?m.jsx("p",{className:"form-error",children:S}):!s||!o?m.jsx("p",{className:"muted",children:"Generating authenticator setup..."}):m.jsxs("div",{className:"totp-setup",children:[m.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."}),m.jsx("div",{className:"totp-qr-container",children:m.jsx("img",{src:s,alt:"TOTP QR code",width:192,height:192})}),m.jsxs("details",{className:"totp-secret-details",children:[m.jsx("summary",{children:"Can't scan? Enter manually"}),m.jsx("p",{className:"totp-secret-text",children:o})]}),m.jsxs("form",{className:"auth-form",onSubmit:x,children:[m.jsxs("label",{children:["Verification code",m.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:h,onChange:E=>f(E.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),b?m.jsx("p",{className:"form-error",children:b}):null,m.jsx("button",{type:"submit",disabled:g||h.length!==6,children:"Activate 2FA"})]})]})}function OA(e){return{source:Qf(e?.source)||"unknown",...typeof e?.status=="number"?{status:e.status}:{},...e?.activeAgentId!==void 0?{activeAgentId:e.activeAgentId}:{},...e?.terminalId?{terminalId:Qf(e.terminalId)}:{},...e?.detail?{detail:Qf(e.detail)}:{}}}function zA(e){return{invalidationSource:e.source}}function jA(e){bn("auth.session_invalid.request",M1(e)),!(typeof console>"u"||typeof console.warn!="function")&&(console.warn("[nterminal] session invalid requested",e),eh("session-invalid-request").catch(()=>{}))}function HA(e,t){bn("auth.session_invalid.result",{...M1(e),authenticated:t}),!(typeof console>"u"||typeof console.warn!="function")&&(console.warn("[nterminal] session invalid check result",{...e,authenticated:t}),eh("session-invalid-result").catch(()=>{}))}function M1(e){return{source:e.source,...typeof e.status=="number"?{status:e.status}:{},...e.activeAgentId!==void 0?{activeAgentId:e.activeAgentId}:{},...e.terminalId?{terminalId:e.terminalId}:{},...e.detail?{detail:e.detail}:{}}}function Qf(e){return e?e.replace(/[^a-zA-Z0-9_.:-]/g,"_").slice(0,96):""}function UA({api:e,serverApi:t,activeAgentId:s=null,onSelectServer:a}){const o=v.useMemo(()=>e??Vu(),[e]),c=v.useMemo(()=>t??Do(null),[t]),[h,f]=v.useState(null),[g,p]=v.useState(null),b=v.useRef(null),y=v.useRef("loading");v.useEffect(()=>{let D=!1;return o.getSession().then(j=>{D||(f(j),p(null))}).catch(j=>{D||(p(Qr(j)),f(null))}),()=>{D=!0}},[o]);const S=FA(h);v.useEffect(()=>{const D=y.current;bn("auth.view",{view:S,previousView:D,authenticated:h?.authenticated??null,passwordSet:h?.passwordSet??null,totpEnabled:h?.totpEnabled??null,deviceTrusted:h?.deviceTrusted??null,currentIpWhitelisted:h?.currentIpWhitelisted??null}),D==="workspace"&&S!=="workspace"&&eh(`auth-left-workspace-${S}`).catch(()=>{}),y.current=S},[h,S]);async function C(){const D=await o.getSession();f(D),p(null)}async function x(){Wf(),Zf(),BS(),p(null),f(null);try{await C()}catch(D){p(Qr(D))}}function E(D){const j=OA(D);if(jA(j),b.current)return b.current;const U=(async()=>{p(null);try{const Z=await o.getSession(zA(j));if(HA(j,Z.authenticated),f(Z),Z.authenticated){GM();return}Wf(),Zf(),BS()}catch(Z){p(Qr(Z))}finally{b.current=null}})();return b.current=U,U}if(S==="workspace")return m.jsx(fA,{api:o,serverApi:c,activeAgentId:s,onSelectServer:a,sessionExpiresAt:h?.expiresAt??null,onSessionInvalid:D=>{E(D)},onLogout:async()=>{Wf(),Zf();const D=await o.logout();f(D)}});const L={loading:"Terminal",setup_password:"Set password",setup_totp:"Set up 2FA",login:"Unlock terminal",reauth:"Verify it’s you",workspace:"Terminal"};return m.jsxs("main",{className:"auth-screen",children:[m.jsxs("div",{className:"auth-background","aria-hidden":"true",children:[m.jsx("div",{className:"auth-grid"}),m.jsx("div",{className:"auth-glow"})]}),m.jsxs("section",{className:"auth-panel","aria-busy":S==="loading",children:[m.jsxs("header",{className:"auth-header",children:[m.jsxs("div",{className:"auth-brand",children:[m.jsx(u0,{size:26}),m.jsxs("div",{children:[m.jsx(h0,{height:17}),m.jsx("p",{className:"auth-host",children:"local terminal"})]})]}),m.jsx("h1",{children:L[S]})]}),g?m.jsx("p",{className:"form-error",children:g}):null,S==="loading"?m.jsx("p",{className:"muted",children:"Checking session..."}):null,S==="loading"&&g?m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{x()},children:"Retry"}):null,S==="setup_password"?m.jsx(PA,{api:o,onSession:D=>{f(D)}}):null,S==="setup_totp"?m.jsx(BA,{api:o,onDone:()=>{C()}}):null,S==="login"?m.jsx(IA,{api:o,session:h,onSession:f,onRefresh:C}):null,S==="reauth"?m.jsx(KA,{api:o,session:h,onSession:f,onFullLogin:()=>f(D=>D&&{...D,deviceTrusted:!1})}):null]})]})}function PA({api:e,onSession:t}){const[s,a]=v.useState(""),[o,c]=v.useState(""),[h,f]=v.useState(!1),[g,p]=v.useState(null);async function b(y){y.preventDefault(),f(!0),p(null);try{if(s!==o){p("Passwords do not match");return}t(await e.setupPassword({password:s}))}catch(S){p(Qr(S))}finally{f(!1)}}return m.jsxs("form",{className:"auth-form",onSubmit:b,children:[m.jsxs("label",{children:["Password",m.jsx("input",{autoFocus:!0,value:s,onChange:y=>a(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),m.jsxs("label",{children:["Confirm password",m.jsx("input",{value:o,onChange:y=>c(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),g?m.jsx("p",{className:"form-error",children:g}):null,m.jsx("button",{type:"submit",disabled:h||s.length<8||o.length<8,children:"Set password"})]})}function IA({api:e,session:t,onSession:s,onRefresh:a}){const[o,c]=v.useState(""),[h,f]=v.useState(""),[g,p]=v.useState(!1),[b,y]=v.useState(!1),[S,C]=v.useState(null),x=t?.totpEnabled??!1,E=t?.currentIpWhitelisted??!1;async function L(D){D.preventDefault(),y(!0),C(null);try{s(await e.login({password:o,...x?{otp:h}:{},rememberNetwork:g}))}catch(j){C(Qr(j))}finally{y(!1)}}return m.jsxs("form",{className:"auth-form",onSubmit:L,children:[m.jsxs("label",{children:["Password",m.jsx("input",{autoFocus:!0,type:"password",value:o,onChange:D=>c(D.currentTarget.value),required:!0})]}),x?m.jsxs("label",{children:["Authenticator code",m.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,E?null:m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:g,onChange:D=>p(D.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),S?m.jsx("p",{className:"form-error",children:S}):null,m.jsxs("div",{className:"button-row",children:[m.jsx("button",{type:"submit",disabled:b||o.length===0||x&&h.length!==6,children:"Unlock"}),m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a()},disabled:b,children:"Refresh"})]})]})}function KA({api:e,session:t,onSession:s,onFullLogin:a}){const o=t?.currentIpWhitelisted??!1,[c,h]=v.useState(""),[f,g]=v.useState(!1),[p,b]=v.useState(!1),[y,S]=v.useState(!1),[C,x]=v.useState(!1),[E,L]=v.useState(null),D=mi.useCallback(async(U,Z)=>{b(!0),L(null);try{s(await e.reauth({...U?{otp:U}:{},rememberNetwork:Z}))}catch(ie){L(Qr(ie))}finally{b(!1)}},[e,s]);v.useEffect(()=>{if(o){let U=!1;S(!0),x(!1),L(null);const Z=window.setTimeout(()=>{U||x(!0)},6e3);return e.reauth({rememberNetwork:!1}).then(ie=>{U||s(ie)}).catch(ie=>{U||(L(Qr(ie)),x(!0))}).finally(()=>{window.clearTimeout(Z),U||S(!1)}),()=>{U=!0,window.clearTimeout(Z)}}},[e,o,s]);async function j(U){U.preventDefault(),await D(c,f)}return o&&y&&!C&&!E?m.jsx("p",{className:"muted",children:"Reconnecting from a trusted network…"}):m.jsxs("form",{className:"auth-form",onSubmit:j,children:[o&&C&&!E?m.jsx("p",{className:"muted",children:"Automatic verification is taking longer than expected. You can enter a code or use password login."}):null,m.jsx("p",{className:"muted",children:"This device is remembered. Enter your authenticator code to continue."}),m.jsxs("label",{children:["Authenticator code",m.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:c,onChange:U=>h(U.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:f,onChange:U=>g(U.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),E?m.jsx("p",{className:"form-error",children:E}):null,m.jsxs("div",{className:"button-row",children:[m.jsx("button",{type:"submit",disabled:p||c.length!==6,children:"Continue"}),m.jsx("button",{type:"button",className:"secondary-button",onClick:a,disabled:p,children:"Use password instead"})]})]})}function FA(e){return e?e.passwordSet?e.authenticated&&!e.totpEnabled?"setup_totp":e.authenticated?"workspace":e.deviceTrusted&&e.totpEnabled?"reauth":"login":"setup_password":"loading"}function Qr(e){return e instanceof Error?e.message:"Request failed"}const s0="NTerminal",Tm="nterminal.activeAgentId";function qA(){const[e,t]=v.useState(()=>WA()),s=v.useMemo(()=>Vu(),[]),a=v.useMemo(()=>Do(e),[e]);v.useEffect(()=>{const c=()=>{const h=D3();document.title=h>0?`(${h}) ${s0}`:s0};return c(),k3(c)},[]);function o(c){$A(c),t(c)}return m.jsx(UA,{api:s,activeAgentId:e,serverApi:a,onSelectServer:o})}function WA(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Tm);return e&&e.trim()?e:null}catch{return null}}function $A(e){if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(Tm,e);return}window.localStorage.removeItem(Tm)}catch{}}const r0=["gesturestart","gesturechange","gestureend"],YA=[".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 VA(e=window){if(!GA(e))return()=>{};const t={passive:!1},s=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||!XA(c.target))&&a(c)}for(const c of r0)s.addEventListener(c,a,t);return s.addEventListener("touchmove",o,t),s.addEventListener("dblclick",a,t),()=>{for(const c of r0)s.removeEventListener(c,a,t);s.removeEventListener("touchmove",o,t),s.removeEventListener("dblclick",a,t)}}function XA(e){return e instanceof Element&&e.closest(YA)!==null}function GA(e){return e.navigator.maxTouchPoints>0?!0:typeof e.matchMedia=="function"&&e.matchMedia("(pointer: coarse)").matches}jE();SM();VA();Nm();Kx.createRoot(document.getElementById("root")).render(m.jsx(mi.StrictMode,{children:m.jsx(qA,{})}));export{mi as R,Lx as g,m as j};
|