nterminal 1.2.1 → 1.2.3

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.
Files changed (37) hide show
  1. package/README.md +28 -11
  2. package/assets/brand/app-icon-1024.png +0 -0
  3. package/assets/brand/app-icon-384.png +0 -0
  4. package/assets/brand/apple-touch-icon-360.png +0 -0
  5. package/assets/brand/favicon-32.png +0 -0
  6. package/assets/brand/favicon-64.png +0 -0
  7. package/assets/brand/favicon-96.png +0 -0
  8. package/assets/brand/favicon.svg +2 -2
  9. package/assets/brand/nterminal-mark-64.png +0 -0
  10. package/assets/brand/nterminal-mark.svg +3 -3
  11. package/dist/client/apple-touch-icon.png +0 -0
  12. package/dist/client/assets/{MarkdownPreview-DTYgRoOA.js → MarkdownPreview-DfZZD0C0.js} +1 -1
  13. package/dist/client/assets/index-CMVGLebq.js +43 -0
  14. package/dist/client/assets/{index-k9_HL1r3.css → index-DiQ82H7w.css} +1 -1
  15. package/dist/client/brand/nterminal-mark-64.png +0 -0
  16. package/dist/client/brand/nterminal-mark.svg +3 -3
  17. package/dist/client/icons/app-icon-1024.png +0 -0
  18. package/dist/client/icons/app-icon-384.png +0 -0
  19. package/dist/client/icons/favicon-32.png +0 -0
  20. package/dist/client/icons/favicon-64.png +0 -0
  21. package/dist/client/icons/favicon-96.png +0 -0
  22. package/dist/client/icons/favicon.svg +2 -2
  23. package/dist/client/index.html +2 -2
  24. package/docs/configuration.md +7 -1
  25. package/docs/features.md +8 -1
  26. package/docs/onboarding.md +11 -9
  27. package/package.json +1 -1
  28. package/public/apple-touch-icon.png +0 -0
  29. package/public/brand/nterminal-mark-64.png +0 -0
  30. package/public/brand/nterminal-mark.svg +3 -3
  31. package/public/icons/app-icon-1024.png +0 -0
  32. package/public/icons/app-icon-384.png +0 -0
  33. package/public/icons/favicon-32.png +0 -0
  34. package/public/icons/favicon-64.png +0 -0
  35. package/public/icons/favicon-96.png +0 -0
  36. package/public/icons/favicon.svg +2 -2
  37. package/dist/client/assets/index-CUY8xEOb.js +0 -38
@@ -1,38 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function UC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kd={exports:{}},Tl={};var hy;function PC(){if(hy)return Tl;hy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var p in o)p!=="key"&&(c[p]=o[p])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:d,ref:o!==void 0?o:null,props:c}}return Tl.Fragment=t,Tl.jsx=n,Tl.jsxs=n,Tl}var dy;function KC(){return dy||(dy=1,Kd.exports=PC()),Kd.exports}var m=KC(),Id={exports:{}},Oe={};var fy;function IC(){if(fy)return Oe;fy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),w=Symbol.iterator;function x(k){return k===null||typeof k!="object"?null:(k=w&&k[w]||k["@@iterator"],typeof k=="function"?k:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,N={};function D(k,I,ne){this.props=k,this.context=I,this.refs=N,this.updater=ne||C}D.prototype.isReactComponent={},D.prototype.setState=function(k,I){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,I,"setState")},D.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function ie(){}ie.prototype=D.prototype;function R(k,I,ne){this.props=k,this.context=I,this.refs=N,this.updater=ne||C}var H=R.prototype=new ie;H.constructor=R,E(H,D.prototype),H.isPureReactComponent=!0;var j=Array.isArray;function W(){}var B={H:null,A:null,T:null,S:null},oe=Object.prototype.hasOwnProperty;function ce(k,I,ne){var he=ne.ref;return{$$typeof:e,type:k,key:I,ref:he!==void 0?he:null,props:ne}}function ue(k,I){return ce(k.type,I,k.props)}function Q(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function G(k){var I={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(ne){return I[ne]})}var K=/\/+/g;function J(k,I){return typeof k=="object"&&k!==null&&k.key!=null?G(""+k.key):I.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(W,W):(k.status="pending",k.then(function(I){k.status==="pending"&&(k.status="fulfilled",k.value=I)},function(I){k.status==="pending"&&(k.status="rejected",k.reason=I)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function M(k,I,ne,he,_e){var me=typeof k;(me==="undefined"||me==="boolean")&&(k=null);var Ee=!1;if(k===null)Ee=!0;else switch(me){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(k.$$typeof){case e:case t:Ee=!0;break;case S:return Ee=k._init,M(Ee(k._payload),I,ne,he,_e)}}if(Ee)return _e=_e(k),Ee=he===""?"."+J(k,0):he,j(_e)?(ne="",Ee!=null&&(ne=Ee.replace(K,"$&/")+"/"),M(_e,I,ne,"",function(Me){return Me})):_e!=null&&(Q(_e)&&(_e=ue(_e,ne+(_e.key==null||k&&k.key===_e.key?"":(""+_e.key).replace(K,"$&/")+"/")+Ee)),I.push(_e)),1;Ee=0;var De=he===""?".":he+":";if(j(k))for(var Ce=0;Ce<k.length;Ce++)he=k[Ce],me=De+J(he,Ce),Ee+=M(he,I,ne,me,_e);else if(Ce=x(k),typeof Ce=="function")for(k=Ce.call(k),Ce=0;!(he=k.next()).done;)he=he.value,me=De+J(he,Ce++),Ee+=M(he,I,ne,me,_e);else if(me==="object"){if(typeof k.then=="function")return M(se(k),I,ne,he,_e);throw I=String(k),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return Ee}function Y(k,I,ne){if(k==null)return k;var he=[],_e=0;return M(k,he,"","",function(me){return I.call(ne,me,_e++)}),he}function X(k){if(k._status===-1){var I=k._result;I=I(),I.then(function(ne){(k._status===0||k._status===-1)&&(k._status=1,k._result=ne)},function(ne){(k._status===0||k._status===-1)&&(k._status=2,k._result=ne)}),k._status===-1&&(k._status=0,k._result=I)}if(k._status===1)return k._result.default;throw k._result}var pe=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=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(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},ye={map:Y,forEach:function(k,I,ne){Y(k,function(){I.apply(this,arguments)},ne)},count:function(k){var I=0;return Y(k,function(){I++}),I},toArray:function(k){return Y(k,function(I){return I})||[]},only:function(k){if(!Q(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return Oe.Activity=y,Oe.Children=ye,Oe.Component=D,Oe.Fragment=n,Oe.Profiler=o,Oe.PureComponent=R,Oe.StrictMode=a,Oe.Suspense=_,Oe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,Oe.__COMPILER_RUNTIME={__proto__:null,c:function(k){return B.H.useMemoCache(k)}},Oe.cache=function(k){return function(){return k.apply(null,arguments)}},Oe.cacheSignal=function(){return null},Oe.cloneElement=function(k,I,ne){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var he=E({},k.props),_e=k.key;if(I!=null)for(me in I.key!==void 0&&(_e=""+I.key),I)!oe.call(I,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&I.ref===void 0||(he[me]=I[me]);var me=arguments.length-2;if(me===1)he.children=ne;else if(1<me){for(var Ee=Array(me),De=0;De<me;De++)Ee[De]=arguments[De+2];he.children=Ee}return ce(k.type,_e,he)},Oe.createContext=function(k){return k={$$typeof:d,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:c,_context:k},k},Oe.createElement=function(k,I,ne){var he,_e={},me=null;if(I!=null)for(he in I.key!==void 0&&(me=""+I.key),I)oe.call(I,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(_e[he]=I[he]);var Ee=arguments.length-2;if(Ee===1)_e.children=ne;else if(1<Ee){for(var De=Array(Ee),Ce=0;Ce<Ee;Ce++)De[Ce]=arguments[Ce+2];_e.children=De}if(k&&k.defaultProps)for(he in Ee=k.defaultProps,Ee)_e[he]===void 0&&(_e[he]=Ee[he]);return ce(k,me,_e)},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(k){return{$$typeof:p,render:k}},Oe.isValidElement=Q,Oe.lazy=function(k){return{$$typeof:S,_payload:{_status:-1,_result:k},_init:X}},Oe.memo=function(k,I){return{$$typeof:f,type:k,compare:I===void 0?null:I}},Oe.startTransition=function(k){var I=B.T,ne={};B.T=ne;try{var he=k(),_e=B.S;_e!==null&&_e(ne,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(W,pe)}catch(me){pe(me)}finally{I!==null&&ne.types!==null&&(I.types=ne.types),B.T=I}},Oe.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Oe.use=function(k){return B.H.use(k)},Oe.useActionState=function(k,I,ne){return B.H.useActionState(k,I,ne)},Oe.useCallback=function(k,I){return B.H.useCallback(k,I)},Oe.useContext=function(k){return B.H.useContext(k)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(k,I){return B.H.useDeferredValue(k,I)},Oe.useEffect=function(k,I){return B.H.useEffect(k,I)},Oe.useEffectEvent=function(k){return B.H.useEffectEvent(k)},Oe.useId=function(){return B.H.useId()},Oe.useImperativeHandle=function(k,I,ne){return B.H.useImperativeHandle(k,I,ne)},Oe.useInsertionEffect=function(k,I){return B.H.useInsertionEffect(k,I)},Oe.useLayoutEffect=function(k,I){return B.H.useLayoutEffect(k,I)},Oe.useMemo=function(k,I){return B.H.useMemo(k,I)},Oe.useOptimistic=function(k,I){return B.H.useOptimistic(k,I)},Oe.useReducer=function(k,I,ne){return B.H.useReducer(k,I,ne)},Oe.useRef=function(k){return B.H.useRef(k)},Oe.useState=function(k){return B.H.useState(k)},Oe.useSyncExternalStore=function(k,I,ne){return B.H.useSyncExternalStore(k,I,ne)},Oe.useTransition=function(){return B.H.useTransition()},Oe.version="19.2.6",Oe}var py;function Ip(){return py||(py=1,Id.exports=IC()),Id.exports}var v=Ip();const ki=UC(v);var Fd={exports:{}},kl={},qd={exports:{}},Wd={};var _y;function FC(){return _y||(_y=1,(function(e){function t(M,Y){var X=M.length;M.push(Y);e:for(;0<X;){var pe=X-1>>>1,ye=M[pe];if(0<o(ye,Y))M[pe]=Y,M[X]=ye,X=pe;else break e}}function n(M){return M.length===0?null:M[0]}function a(M){if(M.length===0)return null;var Y=M[0],X=M.pop();if(X!==Y){M[0]=X;e:for(var pe=0,ye=M.length,k=ye>>>1;pe<k;){var I=2*(pe+1)-1,ne=M[I],he=I+1,_e=M[he];if(0>o(ne,X))he<ye&&0>o(_e,ne)?(M[pe]=_e,M[he]=X,pe=he):(M[pe]=ne,M[I]=X,pe=I);else if(he<ye&&0>o(_e,X))M[pe]=_e,M[he]=X,pe=he;else break e}}return Y}function o(M,Y){var X=M.sortIndex-Y.sortIndex;return X!==0?X:M.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var _=[],f=[],S=1,y=null,w=3,x=!1,C=!1,E=!1,N=!1,D=typeof setTimeout=="function"?setTimeout:null,ie=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function H(M){for(var Y=n(f);Y!==null;){if(Y.callback===null)a(f);else if(Y.startTime<=M)a(f),Y.sortIndex=Y.expirationTime,t(_,Y);else break;Y=n(f)}}function j(M){if(E=!1,H(M),!C)if(n(_)!==null)C=!0,W||(W=!0,G());else{var Y=n(f);Y!==null&&se(j,Y.startTime-M)}}var W=!1,B=-1,oe=5,ce=-1;function ue(){return N?!0:!(e.unstable_now()-ce<oe)}function Q(){if(N=!1,W){var M=e.unstable_now();ce=M;var Y=!0;try{e:{C=!1,E&&(E=!1,ie(B),B=-1),x=!0;var X=w;try{t:{for(H(M),y=n(_);y!==null&&!(y.expirationTime>M&&ue());){var pe=y.callback;if(typeof pe=="function"){y.callback=null,w=y.priorityLevel;var ye=pe(y.expirationTime<=M);if(M=e.unstable_now(),typeof ye=="function"){y.callback=ye,H(M),Y=!0;break t}y===n(_)&&a(_),H(M)}else a(_);y=n(_)}if(y!==null)Y=!0;else{var k=n(f);k!==null&&se(j,k.startTime-M),Y=!1}}break e}finally{y=null,w=X,x=!1}Y=void 0}}finally{Y?G():W=!1}}}var G;if(typeof R=="function")G=function(){R(Q)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,J=K.port2;K.port1.onmessage=Q,G=function(){J.postMessage(null)}}else G=function(){D(Q,0)};function se(M,Y){B=D(function(){M(e.unstable_now())},Y)}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 w},e.unstable_next=function(M){switch(w){case 1:case 2:case 3:var Y=3;break;default:Y=w}var X=w;w=Y;try{return M()}finally{w=X}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(M,Y){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var X=w;w=M;try{return Y()}finally{w=X}},e.unstable_scheduleCallback=function(M,Y,X){var pe=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?pe+X:pe):X=pe,M){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=X+ye,M={id:S++,callback:Y,priorityLevel:M,startTime:X,expirationTime:ye,sortIndex:-1},X>pe?(M.sortIndex=X,t(f,M),n(_)===null&&M===n(f)&&(E?(ie(B),B=-1):E=!0,se(j,X-pe))):(M.sortIndex=ye,t(_,M),C||x||(C=!0,W||(W=!0,G()))),M},e.unstable_shouldYield=ue,e.unstable_wrapCallback=function(M){var Y=w;return function(){var X=w;w=Y;try{return M.apply(this,arguments)}finally{w=X}}}})(Wd)),Wd}var my;function qC(){return my||(my=1,qd.exports=FC()),qd.exports}var Yd={exports:{}},Mi={};var gy;function WC(){if(gy)return Mi;gy=1;var e=Ip();function t(_){var f="https://react.dev/errors/"+_;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)f+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+_+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(_,f,S){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:_,containerInfo:f,implementation:S}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(_,f){if(_==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Mi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Mi.createPortal=function(_,f){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return c(_,f,null,S)},Mi.flushSync=function(_){var f=d.T,S=a.p;try{if(d.T=null,a.p=2,_)return _()}finally{d.T=f,a.p=S,a.d.f()}},Mi.preconnect=function(_,f){typeof _=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,a.d.C(_,f))},Mi.prefetchDNS=function(_){typeof _=="string"&&a.d.D(_)},Mi.preinit=function(_,f){if(typeof _=="string"&&f&&typeof f.as=="string"){var S=f.as,y=p(S,f.crossOrigin),w=typeof f.integrity=="string"?f.integrity:void 0,x=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;S==="style"?a.d.S(_,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:w,fetchPriority:x}):S==="script"&&a.d.X(_,{crossOrigin:y,integrity:w,fetchPriority:x,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Mi.preinitModule=function(_,f){if(typeof _=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var S=p(f.as,f.crossOrigin);a.d.M(_,{crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&a.d.M(_)},Mi.preload=function(_,f){if(typeof _=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var S=f.as,y=p(S,f.crossOrigin);a.d.L(_,S,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Mi.preloadModule=function(_,f){if(typeof _=="string")if(f){var S=p(f.as,f.crossOrigin);a.d.m(_,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else a.d.m(_)},Mi.requestFormReset=function(_){a.d.r(_)},Mi.unstable_batchedUpdates=function(_,f){return _(f)},Mi.useFormState=function(_,f,S){return d.H.useFormState(_,f,S)},Mi.useFormStatus=function(){return d.H.useHostTransitionStatus()},Mi.version="19.2.6",Mi}var vy;function pb(){if(vy)return Yd.exports;vy=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(),Yd.exports=WC(),Yd.exports}var yy;function YC(){if(yy)return kl;yy=1;var e=qC(),t=Ip(),n=pb();function a(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function c(i){var s=i,r=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(r=s.return),i=s.return;while(i)}return s.tag===3?r:null}function d(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function p(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function _(i){if(c(i)!==i)throw Error(a(188))}function f(i){var s=i.alternate;if(!s){if(s=c(i),s===null)throw Error(a(188));return s!==i?null:i}for(var r=i,l=s;;){var u=r.return;if(u===null)break;var h=u.alternate;if(h===null){if(l=u.return,l!==null){r=l;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===r)return _(u),i;if(h===l)return _(u),s;h=h.sibling}throw Error(a(188))}if(r.return!==l.return)r=u,l=h;else{for(var g=!1,b=u.child;b;){if(b===r){g=!0,r=u,l=h;break}if(b===l){g=!0,l=u,r=h;break}b=b.sibling}if(!g){for(b=h.child;b;){if(b===r){g=!0,r=h,l=u;break}if(b===l){g=!0,l=h,r=u;break}b=b.sibling}if(!g)throw Error(a(189))}}if(r.alternate!==l)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?i:s}function S(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=S(i),s!==null)return s;i=i.sibling}return null}var y=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),ie=Symbol.for("react.consumer"),R=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),ue=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function G(i){return i===null||typeof i!="object"?null:(i=Q&&i[Q]||i["@@iterator"],typeof i=="function"?i:null)}var K=Symbol.for("react.client.reference");function J(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===K?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case E:return"Fragment";case D:return"Profiler";case N:return"StrictMode";case j:return"Suspense";case W:return"SuspenseList";case ce:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case C:return"Portal";case R:return i.displayName||"Context";case ie:return(i._context.displayName||"Context")+".Consumer";case H:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case B:return s=i.displayName||null,s!==null?s:J(i.type)||"Memo";case oe:s=i._payload,i=i._init;try{return J(i(s))}catch{}}return null}var se=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},pe=[],ye=-1;function k(i){return{current:i}}function I(i){0>ye||(i.current=pe[ye],pe[ye]=null,ye--)}function ne(i,s){ye++,pe[ye]=i.current,i.current=s}var he=k(null),_e=k(null),me=k(null),Ee=k(null);function De(i,s){switch(ne(me,s),ne(_e,i),ne(he,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Lv(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Lv(s),i=Ov(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}I(he),ne(he,i)}function Ce(){I(he),I(_e),I(me)}function Me(i){i.memoizedState!==null&&ne(Ee,i);var s=he.current,r=Ov(s,i.type);s!==r&&(ne(_e,i),ne(he,r))}function et(i){_e.current===i&&(I(he),I(_e)),Ee.current===i&&(I(Ee),wl._currentValue=X)}var tt,Ne;function ee(i){if(tt===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);tt=s&&s[1]||"",Ne=-1<r.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+tt+i+Ne}var Te=!1;function xe(i,s){if(!i||Te)return"";Te=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch($){var F=$}Reflect.construct(i,[],re)}else{try{re.call()}catch($){F=$}i.call(re.prototype)}}else{try{throw Error()}catch($){F=$}(re=i())&&typeof re.catch=="function"&&re.catch(function(){})}}catch($){if($&&F&&typeof $.stack=="string")return[$.stack,F.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),g=h[0],b=h[1];if(g&&b){var T=g.split(`
4
- `),P=b.split(`
5
- `);for(u=l=0;l<T.length&&!T[l].includes("DetermineComponentFrameRoot");)l++;for(;u<P.length&&!P[u].includes("DetermineComponentFrameRoot");)u++;if(l===T.length||u===P.length)for(l=T.length-1,u=P.length-1;1<=l&&0<=u&&T[l]!==P[u];)u--;for(;1<=l&&0<=u;l--,u--)if(T[l]!==P[u]){if(l!==1||u!==1)do if(l--,u--,0>u||T[l]!==P[u]){var Z=`
6
- `+T[l].replace(" at new "," at ");return i.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",i.displayName)),Z}while(1<=l&&0<=u);break}}}finally{Te=!1,Error.prepareStackTrace=r}return(r=i?i.displayName||i.name:"")?ee(r):""}function ze(i,s){switch(i.tag){case 26:case 27:case 5:return ee(i.type);case 16:return ee("Lazy");case 13:return i.child!==s&&s!==null?ee("Suspense Fallback"):ee("Suspense");case 19:return ee("SuspenseList");case 0:case 15:return xe(i.type,!1);case 11:return xe(i.type.render,!1);case 1:return xe(i.type,!0);case 31:return ee("Activity");default:return""}}function qe(i){try{var s="",r=null;do s+=ze(i,r),r=i,i=i.return;while(i);return s}catch(l){return`
7
- Error generating stack: `+l.message+`
8
- `+l.stack}}var vt=Object.prototype.hasOwnProperty,ct=e.unstable_scheduleCallback,V=e.unstable_cancelCallback,He=e.unstable_shouldYield,it=e.unstable_requestPaint,rt=e.unstable_now,Es=e.unstable_getCurrentPriorityLevel,ls=e.unstable_ImmediatePriority,ci=e.unstable_UserBlockingPriority,ui=e.unstable_NormalPriority,Bi=e.unstable_LowPriority,Si=e.unstable_IdlePriority,ei=e.log,Ws=e.unstable_setDisableYieldValue,Li=null,ti=null;function bi(i){if(typeof ei=="function"&&Ws(i),ti&&typeof ti.setStrictMode=="function")try{ti.setStrictMode(Li,i)}catch{}}var Yt=Math.clz32?Math.clz32:or,Ys=Math.log,$s=Math.LN2;function or(i){return i>>>=0,i===0?32:31-(Ys(i)/$s|0)|0}var Ts=256,ks=262144,dt=4194304;function ft(i){var s=i&42;if(s!==0)return s;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Dt(i,s,r){var l=i.pendingLanes;if(l===0)return 0;var u=0,h=i.suspendedLanes,g=i.pingedLanes;i=i.warmLanes;var b=l&134217727;return b!==0?(l=b&~h,l!==0?u=ft(l):(g&=b,g!==0?u=ft(g):r||(r=b&~i,r!==0&&(u=ft(r))))):(b=l&~h,b!==0?u=ft(b):g!==0?u=ft(g):r||(r=l&~i,r!==0&&(u=ft(r)))),u===0?0:s!==0&&s!==u&&(s&h)===0&&(h=u&-u,r=s&-s,h>=r||h===32&&(r&4194048)!==0)?s:u}function Xe(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function Kt(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Nt(){var i=dt;return dt<<=1,(dt&62914560)===0&&(dt=4194304),i}function at(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function hi(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Rt(i,s,r,l,u,h){var g=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 b=i.entanglements,T=i.expirationTimes,P=i.hiddenUpdates;for(r=g&~r;0<r;){var Z=31-Yt(r),re=1<<Z;b[Z]=0,T[Z]=-1;var F=P[Z];if(F!==null)for(P[Z]=null,Z=0;Z<F.length;Z++){var $=F[Z];$!==null&&($.lane&=-536870913)}r&=~re}l!==0&&ii(i,l,0),h!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=h&~(g&~s))}function ii(i,s,r){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-Yt(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|r&261930}function wt(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var l=31-Yt(r),u=1<<l;u&s|i[l]&s&&(i[l]|=s),r&=~u}}function Ri(i,s){var r=s&-s;return r=(r&42)!==0?1:Ui(r),(r&(i.suspendedLanes|s))!==0?0:r}function Ui(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 si(){var i=Y.p;return i!==0?i:(i=window.event,i===void 0?32:ny(i.type))}function os(i,s){var r=Y.p;try{return Y.p=i,s()}finally{Y.p=r}}var wi=Math.random().toString(36).slice(2),yt="__reactFiber$"+wi,Ot="__reactProps$"+wi,cs="__reactContainer$"+wi,Vs="__reactEvents$"+wi,Ds="__reactListeners$"+wi,bn="__reactHandles$"+wi,L="__reactResources$"+wi,q="__reactMarker$"+wi;function le(i){delete i[yt],delete i[Ot],delete i[Vs],delete i[Ds],delete i[bn]}function ve(i){var s=i[yt];if(s)return s;for(var r=i.parentNode;r;){if(s=r[cs]||r[yt]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=Iv(i);i!==null;){if(r=i[yt])return r;i=Iv(i)}return s}i=r,r=i.parentNode}return null}function Re(i){if(i=i[yt]||i[cs]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function Ge(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(a(33))}function Le(i){var s=i[L];return s||(s=i[L]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function lt(i){i[q]=!0}var zt=new Set,Ls={};function Gi(i,s){wn(i,s),wn(i+"Capture",s)}function wn(i,s){for(Ls[i]=s,i=0;i<s.length;i++)zt.add(s[i])}var z=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]*$"),fe={},Pe={};function Fe(i){return vt.call(Pe,i)?!0:vt.call(fe,i)?!1:z.test(i)?Pe[i]=!0:(fe[i]=!0,!1)}function Je(i,s,r){if(Fe(s))if(r===null)i.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var l=s.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+r)}}function xt(i,s,r){if(r===null)i.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+r)}}function di(i,s,r,l){if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttributeNS(s,r,""+l)}}function Ct(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Rs(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function cr(i,s,r){var l=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var u=l.get,h=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(g){r=""+g,h.call(this,g)}}),Object.defineProperty(i,s,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(g){r=""+g},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Pr(i){if(!i._valueTracker){var s=Rs(i)?"checked":"value";i._valueTracker=cr(i,s,""+i[s])}}function Ki(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var r=s.getValue(),l="";return i&&(l=Rs(i)?i.checked?"true":"false":i.value),i=l,i!==r?(s.setValue(i),!0):!1}function ur(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 Ou=/[\n"\\]/g;function It(i){return i.replace(Ou,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Kr(i,s,r,l,u,h,g,b){i.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?i.type=g:i.removeAttribute("type"),s!=null?g==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+Ct(s)):i.value!==""+Ct(s)&&(i.value=""+Ct(s)):g!=="submit"&&g!=="reset"||i.removeAttribute("value"),s!=null?zu(i,g,Ct(s)):r!=null?zu(i,g,Ct(r)):l!=null&&i.removeAttribute("value"),u==null&&h!=null&&(i.defaultChecked=!!h),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?i.name=""+Ct(b):i.removeAttribute("name")}function ja(i,s,r,l,u,h,g,b){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(i.type=h),s!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||s!=null)){Pr(i);return}r=r!=null?""+Ct(r):"",s=s!=null?""+Ct(s):r,b||s===i.value||(i.value=s),i.defaultValue=s}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=b?i.checked:!!l,i.defaultChecked=!!l,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(i.name=g),Pr(i)}function zu(i,s,r){s==="number"&&ur(i.ownerDocument)===i||i.defaultValue===""+r||(i.defaultValue=""+r)}function Ir(i,s,r,l){if(i=i.options,s){s={};for(var u=0;u<r.length;u++)s["$"+r[u]]=!0;for(r=0;r<i.length;r++)u=s.hasOwnProperty("$"+i[r].value),i[r].selected!==u&&(i[r].selected=u),u&&l&&(i[r].defaultSelected=!0)}else{for(r=""+Ct(r),s=null,u=0;u<i.length;u++){if(i[u].value===r){i[u].selected=!0,l&&(i[u].defaultSelected=!0);return}s!==null||i[u].disabled||(s=i[u])}s!==null&&(s.selected=!0)}}function R_(i,s,r){if(s!=null&&(s=""+Ct(s),s!==i.value&&(i.value=s),r==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=r!=null?""+Ct(r):""}function M_(i,s,r,l){if(s==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=""),s=r}r=Ct(s),i.defaultValue=r,l=i.textContent,l===r&&l!==""&&l!==null&&(i.value=l),Pr(i)}function Fr(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var Lw=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 A_(i,s,r){var l=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":l?i.setProperty(s,r):typeof r!="number"||r===0||Lw.has(s)?s==="float"?i.cssFloat=r:i[s]=(""+r).trim():i[s]=r+"px"}function N_(i,s,r){if(s!=null&&typeof s!="object")throw Error(a(62));if(i=i.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var u in s)l=s[u],s.hasOwnProperty(u)&&r[u]!==l&&A_(i,u,l)}else for(var h in s)s.hasOwnProperty(h)&&A_(i,h,s[h])}function Hu(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 Ow=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"]]),zw=/^[\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 Co(i){return zw.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Xs(){}var ju=null;function Uu(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var qr=null,Wr=null;function B_(i){var s=Re(i);if(s&&(i=s.stateNode)){var r=i[Ot]||null;e:switch(i=s.stateNode,s.type){case"input":if(Kr(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=i;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+It(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var l=r[s];if(l!==i&&l.form===i.form){var u=l[Ot]||null;if(!u)throw Error(a(90));Kr(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(s=0;s<r.length;s++)l=r[s],l.form===i.form&&Ki(l)}break e;case"textarea":R_(i,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&Ir(i,!!r.multiple,s,!1)}}}var Pu=!1;function L_(i,s,r){if(Pu)return i(s,r);Pu=!0;try{var l=i(s);return l}finally{if(Pu=!1,(qr!==null||Wr!==null)&&(uc(),qr&&(s=qr,i=Wr,Wr=qr=null,B_(s),i)))for(s=0;s<i.length;s++)B_(i[s])}}function Ua(i,s){var r=i.stateNode;if(r===null)return null;var l=r[Ot]||null;if(l===null)return null;r=l[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(i=i.type,l=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!l;break e;default:i=!1}if(i)return null;if(r&&typeof r!="function")throw Error(a(231,s,typeof r));return r}var Gs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ku=!1;if(Gs)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){Ku=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{Ku=!1}var Cn=null,Iu=null,xo=null;function O_(){if(xo)return xo;var i,s=Iu,r=s.length,l,u="value"in Cn?Cn.value:Cn.textContent,h=u.length;for(i=0;i<r&&s[i]===u[i];i++);var g=r-i;for(l=1;l<=g&&s[r-l]===u[h-l];l++);return xo=u.slice(i,1<l?1-l:void 0)}function Eo(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function To(){return!0}function z_(){return!1}function Ii(i){function s(r,l,u,h,g){this._reactName=r,this._targetInst=u,this.type=l,this.nativeEvent=h,this.target=g,this.currentTarget=null;for(var b in i)i.hasOwnProperty(b)&&(r=i[b],this[b]=r?r(h):h[b]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?To:z_,this.isPropagationStopped=z_,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=To)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=To)},persist:function(){},isPersistent:To}),s}var hr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ko=Ii(hr),Ka=y({},hr,{view:0,detail:0}),Hw=Ii(Ka),Fu,qu,Ia,Do=y({},Ka,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yu,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!==Ia&&(Ia&&i.type==="mousemove"?(Fu=i.screenX-Ia.screenX,qu=i.screenY-Ia.screenY):qu=Fu=0,Ia=i),Fu)},movementY:function(i){return"movementY"in i?i.movementY:qu}}),H_=Ii(Do),jw=y({},Do,{dataTransfer:0}),Uw=Ii(jw),Pw=y({},Ka,{relatedTarget:0}),Wu=Ii(Pw),Kw=y({},hr,{animationName:0,elapsedTime:0,pseudoElement:0}),Iw=Ii(Kw),Fw=y({},hr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),qw=Ii(Fw),Ww=y({},hr,{data:0}),j_=Ii(Ww),Yw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$w={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"},Vw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xw(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=Vw[i])?!!s[i]:!1}function Yu(){return Xw}var Gw=y({},Ka,{key:function(i){if(i.key){var s=Yw[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Eo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?$w[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yu,charCode:function(i){return i.type==="keypress"?Eo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Eo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Zw=Ii(Gw),Qw=y({},Do,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),U_=Ii(Qw),Jw=y({},Ka,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yu}),e1=Ii(Jw),t1=y({},hr,{propertyName:0,elapsedTime:0,pseudoElement:0}),i1=Ii(t1),s1=y({},Do,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),n1=Ii(s1),r1=y({},hr,{newState:0,oldState:0}),a1=Ii(r1),l1=[9,13,27,32],$u=Gs&&"CompositionEvent"in window,Fa=null;Gs&&"documentMode"in document&&(Fa=document.documentMode);var o1=Gs&&"TextEvent"in window&&!Fa,P_=Gs&&(!$u||Fa&&8<Fa&&11>=Fa),K_=" ",I_=!1;function F_(i,s){switch(i){case"keyup":return l1.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q_(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Yr=!1;function c1(i,s){switch(i){case"compositionend":return q_(s);case"keypress":return s.which!==32?null:(I_=!0,K_);case"textInput":return i=s.data,i===K_&&I_?null:i;default:return null}}function u1(i,s){if(Yr)return i==="compositionend"||!$u&&F_(i,s)?(i=O_(),xo=Iu=Cn=null,Yr=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return P_&&s.locale!=="ko"?null:s.data;default:return null}}var h1={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function W_(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!h1[i.type]:s==="textarea"}function Y_(i,s,r,l){qr?Wr?Wr.push(l):Wr=[l]:qr=l,s=gc(s,"onChange"),0<s.length&&(r=new ko("onChange","change",null,r,l),i.push({event:r,listeners:s}))}var qa=null,Wa=null;function d1(i){Dv(i,0)}function Ro(i){var s=Ge(i);if(Ki(s))return i}function $_(i,s){if(i==="change")return s}var V_=!1;if(Gs){var Vu;if(Gs){var Xu="oninput"in document;if(!Xu){var X_=document.createElement("div");X_.setAttribute("oninput","return;"),Xu=typeof X_.oninput=="function"}Vu=Xu}else Vu=!1;V_=Vu&&(!document.documentMode||9<document.documentMode)}function G_(){qa&&(qa.detachEvent("onpropertychange",Z_),Wa=qa=null)}function Z_(i){if(i.propertyName==="value"&&Ro(Wa)){var s=[];Y_(s,Wa,i,Uu(i)),L_(d1,s)}}function f1(i,s,r){i==="focusin"?(G_(),qa=s,Wa=r,qa.attachEvent("onpropertychange",Z_)):i==="focusout"&&G_()}function p1(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Ro(Wa)}function _1(i,s){if(i==="click")return Ro(s)}function m1(i,s){if(i==="input"||i==="change")return Ro(s)}function g1(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var Zi=typeof Object.is=="function"?Object.is:g1;function Ya(i,s){if(Zi(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var r=Object.keys(i),l=Object.keys(s);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var u=r[l];if(!vt.call(s,u)||!Zi(i[u],s[u]))return!1}return!0}function Q_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function J_(i,s){var r=Q_(i);i=0;for(var l;r;){if(r.nodeType===3){if(l=i+r.textContent.length,i<=s&&l>=s)return{node:r,offset:s-i};i=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Q_(r)}}function em(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?em(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function tm(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=ur(i.document);s instanceof i.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)i=s.contentWindow;else break;s=ur(i.document)}return s}function Gu(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var v1=Gs&&"documentMode"in document&&11>=document.documentMode,$r=null,Zu=null,$a=null,Qu=!1;function im(i,s,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Qu||$r==null||$r!==ur(l)||(l=$r,"selectionStart"in l&&Gu(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}),$a&&Ya($a,l)||($a=l,l=gc(Zu,"onSelect"),0<l.length&&(s=new ko("onSelect","select",null,s,r),i.push({event:s,listeners:l}),s.target=$r)))}function dr(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var Vr={animationend:dr("Animation","AnimationEnd"),animationiteration:dr("Animation","AnimationIteration"),animationstart:dr("Animation","AnimationStart"),transitionrun:dr("Transition","TransitionRun"),transitionstart:dr("Transition","TransitionStart"),transitioncancel:dr("Transition","TransitionCancel"),transitionend:dr("Transition","TransitionEnd")},Ju={},sm={};Gs&&(sm=document.createElement("div").style,"AnimationEvent"in window||(delete Vr.animationend.animation,delete Vr.animationiteration.animation,delete Vr.animationstart.animation),"TransitionEvent"in window||delete Vr.transitionend.transition);function fr(i){if(Ju[i])return Ju[i];if(!Vr[i])return i;var s=Vr[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in sm)return Ju[i]=s[r];return i}var nm=fr("animationend"),rm=fr("animationiteration"),am=fr("animationstart"),y1=fr("transitionrun"),S1=fr("transitionstart"),b1=fr("transitioncancel"),lm=fr("transitionend"),om=new Map,eh="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(" ");eh.push("scrollEnd");function Ms(i,s){om.set(i,s),Gi(s,[i])}var Mo=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},us=[],Xr=0,th=0;function Ao(){for(var i=Xr,s=th=Xr=0;s<i;){var r=us[s];us[s++]=null;var l=us[s];us[s++]=null;var u=us[s];us[s++]=null;var h=us[s];if(us[s++]=null,l!==null&&u!==null){var g=l.pending;g===null?u.next=u:(u.next=g.next,g.next=u),l.pending=u}h!==0&&cm(r,u,h)}}function No(i,s,r,l){us[Xr++]=i,us[Xr++]=s,us[Xr++]=r,us[Xr++]=l,th|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function ih(i,s,r,l){return No(i,s,r,l),Bo(i)}function pr(i,s){return No(i,null,null,s),Bo(i)}function cm(i,s,r){i.lanes|=r;var l=i.alternate;l!==null&&(l.lanes|=r);for(var u=!1,h=i.return;h!==null;)h.childLanes|=r,l=h.alternate,l!==null&&(l.childLanes|=r),h.tag===22&&(i=h.stateNode,i===null||i._visibility&1||(u=!0)),i=h,h=h.return;return i.tag===3?(h=i.stateNode,u&&s!==null&&(u=31-Yt(r),i=h.hiddenUpdates,l=i[u],l===null?i[u]=[s]:l.push(s),s.lane=r|536870912),h):null}function Bo(i){if(50<_l)throw _l=0,hd=null,Error(a(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Gr={};function w1(i,s,r,l){this.tag=i,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qi(i,s,r,l){return new w1(i,s,r,l)}function sh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Zs(i,s){var r=i.alternate;return r===null?(r=Qi(i.tag,s,i.key,i.mode),r.elementType=i.elementType,r.type=i.type,r.stateNode=i.stateNode,r.alternate=i,i.alternate=r):(r.pendingProps=s,r.type=i.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=i.flags&65011712,r.childLanes=i.childLanes,r.lanes=i.lanes,r.child=i.child,r.memoizedProps=i.memoizedProps,r.memoizedState=i.memoizedState,r.updateQueue=i.updateQueue,s=i.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=i.sibling,r.index=i.index,r.ref=i.ref,r.refCleanup=i.refCleanup,r}function um(i,s){i.flags&=65011714;var r=i.alternate;return r===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=r.childLanes,i.lanes=r.lanes,i.child=r.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=r.memoizedProps,i.memoizedState=r.memoizedState,i.updateQueue=r.updateQueue,i.type=r.type,s=r.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Lo(i,s,r,l,u,h){var g=0;if(l=i,typeof i=="function")sh(i)&&(g=1);else if(typeof i=="string")g=kC(i,r,he.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case ce:return i=Qi(31,r,s,u),i.elementType=ce,i.lanes=h,i;case E:return _r(r.children,u,h,s);case N:g=8,u|=24;break;case D:return i=Qi(12,r,s,u|2),i.elementType=D,i.lanes=h,i;case j:return i=Qi(13,r,s,u),i.elementType=j,i.lanes=h,i;case W:return i=Qi(19,r,s,u),i.elementType=W,i.lanes=h,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case R:g=10;break e;case ie:g=9;break e;case H:g=11;break e;case B:g=14;break e;case oe:g=16,l=null;break e}g=29,r=Error(a(130,i===null?"null":typeof i,"")),l=null}return s=Qi(g,r,s,u),s.elementType=i,s.type=l,s.lanes=h,s}function _r(i,s,r,l){return i=Qi(7,i,l,s),i.lanes=r,i}function nh(i,s,r){return i=Qi(6,i,null,s),i.lanes=r,i}function hm(i){var s=Qi(18,null,null,0);return s.stateNode=i,s}function rh(i,s,r){return s=Qi(4,i.children!==null?i.children:[],i.key,s),s.lanes=r,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var dm=new WeakMap;function hs(i,s){if(typeof i=="object"&&i!==null){var r=dm.get(i);return r!==void 0?r:(s={value:i,source:s,stack:qe(s)},dm.set(i,s),s)}return{value:i,source:s,stack:qe(s)}}var Zr=[],Qr=0,Oo=null,Va=0,ds=[],fs=0,xn=null,Os=1,zs="";function Qs(i,s){Zr[Qr++]=Va,Zr[Qr++]=Oo,Oo=i,Va=s}function fm(i,s,r){ds[fs++]=Os,ds[fs++]=zs,ds[fs++]=xn,xn=i;var l=Os;i=zs;var u=32-Yt(l)-1;l&=~(1<<u),r+=1;var h=32-Yt(s)+u;if(30<h){var g=u-u%5;h=(l&(1<<g)-1).toString(32),l>>=g,u-=g,Os=1<<32-Yt(s)+u|r<<u|l,zs=h+i}else Os=1<<h|r<<u|l,zs=i}function ah(i){i.return!==null&&(Qs(i,1),fm(i,1,0))}function lh(i){for(;i===Oo;)Oo=Zr[--Qr],Zr[Qr]=null,Va=Zr[--Qr],Zr[Qr]=null;for(;i===xn;)xn=ds[--fs],ds[fs]=null,zs=ds[--fs],ds[fs]=null,Os=ds[--fs],ds[fs]=null}function pm(i,s){ds[fs++]=Os,ds[fs++]=zs,ds[fs++]=xn,Os=s.id,zs=s.overflow,xn=i}var Ci=null,Et=null,Ze=!1,En=null,ps=!1,oh=Error(a(519));function Tn(i){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xa(hs(s,i)),oh}function _m(i){var s=i.stateNode,r=i.type,l=i.memoizedProps;switch(s[yt]=i,s[Ot]=l,r){case"dialog":Ye("cancel",s),Ye("close",s);break;case"iframe":case"object":case"embed":Ye("load",s);break;case"video":case"audio":for(r=0;r<gl.length;r++)Ye(gl[r],s);break;case"source":Ye("error",s);break;case"img":case"image":case"link":Ye("error",s),Ye("load",s);break;case"details":Ye("toggle",s);break;case"input":Ye("invalid",s),ja(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ye("invalid",s);break;case"textarea":Ye("invalid",s),M_(s,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||l.suppressHydrationWarning===!0||Nv(s.textContent,r)?(l.popover!=null&&(Ye("beforetoggle",s),Ye("toggle",s)),l.onScroll!=null&&Ye("scroll",s),l.onScrollEnd!=null&&Ye("scrollend",s),l.onClick!=null&&(s.onclick=Xs),s=!0):s=!1,s||Tn(i,!0)}function mm(i){for(Ci=i.return;Ci;)switch(Ci.tag){case 5:case 31:case 13:ps=!1;return;case 27:case 3:ps=!0;return;default:Ci=Ci.return}}function Jr(i){if(i!==Ci)return!1;if(!Ze)return mm(i),Ze=!0,!1;var s=i.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=i.type,r=!(r!=="form"&&r!=="button")||Td(i.type,i.memoizedProps)),r=!r),r&&Et&&Tn(i),mm(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Et=Kv(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Et=Kv(i)}else s===27?(s=Et,Pn(i.type)?(i=Ad,Ad=null,Et=i):Et=s):Et=Ci?ms(i.stateNode.nextSibling):null;return!0}function mr(){Et=Ci=null,Ze=!1}function ch(){var i=En;return i!==null&&(Yi===null?Yi=i:Yi.push.apply(Yi,i),En=null),i}function Xa(i){En===null?En=[i]:En.push(i)}var uh=k(null),gr=null,Js=null;function kn(i,s,r){ne(uh,s._currentValue),s._currentValue=r}function en(i){i._currentValue=uh.current,I(uh)}function hh(i,s,r){for(;i!==null;){var l=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,l!==null&&(l.childLanes|=s)):l!==null&&(l.childLanes&s)!==s&&(l.childLanes|=s),i===r)break;i=i.return}}function dh(i,s,r,l){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var h=u.dependencies;if(h!==null){var g=u.child;h=h.firstContext;e:for(;h!==null;){var b=h;h=u;for(var T=0;T<s.length;T++)if(b.context===s[T]){h.lanes|=r,b=h.alternate,b!==null&&(b.lanes|=r),hh(h.return,r,i),l||(g=null);break e}h=b.next}}else if(u.tag===18){if(g=u.return,g===null)throw Error(a(341));g.lanes|=r,h=g.alternate,h!==null&&(h.lanes|=r),hh(g,r,i),g=null}else g=u.child;if(g!==null)g.return=u;else for(g=u;g!==null;){if(g===i){g=null;break}if(u=g.sibling,u!==null){u.return=g.return,g=u;break}g=g.return}u=g}}function ea(i,s,r,l){i=null;for(var u=s,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var g=u.alternate;if(g===null)throw Error(a(387));if(g=g.memoizedProps,g!==null){var b=u.type;Zi(u.pendingProps.value,g.value)||(i!==null?i.push(b):i=[b])}}else if(u===Ee.current){if(g=u.alternate,g===null)throw Error(a(387));g.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(wl):i=[wl])}u=u.return}i!==null&&dh(s,i,r,l),s.flags|=262144}function zo(i){for(i=i.firstContext;i!==null;){if(!Zi(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function vr(i){gr=i,Js=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function xi(i){return gm(gr,i)}function Ho(i,s){return gr===null&&vr(i),gm(i,s)}function gm(i,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},Js===null){if(i===null)throw Error(a(308));Js=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else Js=Js.next=s;return r}var C1=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(r,l){i.push(l)}};this.abort=function(){s.aborted=!0,i.forEach(function(r){return r()})}},x1=e.unstable_scheduleCallback,E1=e.unstable_NormalPriority,$t={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fh(){return{controller:new C1,data:new Map,refCount:0}}function Ga(i){i.refCount--,i.refCount===0&&x1(E1,function(){i.controller.abort()})}var Za=null,ph=0,ta=0,ia=null;function T1(i,s){if(Za===null){var r=Za=[];ph=0,ta=gd(),ia={status:"pending",value:void 0,then:function(l){r.push(l)}}}return ph++,s.then(vm,vm),s}function vm(){if(--ph===0&&Za!==null){ia!==null&&(ia.status="fulfilled");var i=Za;Za=null,ta=0,ia=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function k1(i,s){var r=[],l={status:"pending",value:null,reason:null,then:function(u){r.push(u)}};return i.then(function(){l.status="fulfilled",l.value=s;for(var u=0;u<r.length;u++)(0,r[u])(s)},function(u){for(l.status="rejected",l.reason=u,u=0;u<r.length;u++)(0,r[u])(void 0)}),l}var ym=M.S;M.S=function(i,s){iv=rt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&T1(i,s),ym!==null&&ym(i,s)};var yr=k(null);function _h(){var i=yr.current;return i!==null?i:St.pooledCache}function jo(i,s){s===null?ne(yr,yr.current):ne(yr,s.pool)}function Sm(){var i=_h();return i===null?null:{parent:$t._currentValue,pool:i}}var sa=Error(a(460)),mh=Error(a(474)),Uo=Error(a(542)),Po={then:function(){}};function bm(i){return i=i.status,i==="fulfilled"||i==="rejected"}function wm(i,s,r){switch(r=i[r],r===void 0?i.push(s):r!==s&&(s.then(Xs,Xs),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,xm(i),i;default:if(typeof s.status=="string")s.then(Xs,Xs);else{if(i=St,i!==null&&100<i.shellSuspendCounter)throw Error(a(482));i=s,i.status="pending",i.then(function(l){if(s.status==="pending"){var u=s;u.status="fulfilled",u.value=l}},function(l){if(s.status==="pending"){var u=s;u.status="rejected",u.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,xm(i),i}throw br=s,sa}}function Sr(i){try{var s=i._init;return s(i._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(br=r,sa):r}}var br=null;function Cm(){if(br===null)throw Error(a(459));var i=br;return br=null,i}function xm(i){if(i===sa||i===Uo)throw Error(a(483))}var na=null,Qa=0;function Ko(i){var s=Qa;return Qa+=1,na===null&&(na=[]),wm(na,i,s)}function Ja(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function Io(i,s){throw s.$$typeof===w?Error(a(525)):(i=Object.prototype.toString.call(s),Error(a(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function Em(i){function s(O,A){if(i){var U=O.deletions;U===null?(O.deletions=[A],O.flags|=16):U.push(A)}}function r(O,A){if(!i)return null;for(;A!==null;)s(O,A),A=A.sibling;return null}function l(O){for(var A=new Map;O!==null;)O.key!==null?A.set(O.key,O):A.set(O.index,O),O=O.sibling;return A}function u(O,A){return O=Zs(O,A),O.index=0,O.sibling=null,O}function h(O,A,U){return O.index=U,i?(U=O.alternate,U!==null?(U=U.index,U<A?(O.flags|=67108866,A):U):(O.flags|=67108866,A)):(O.flags|=1048576,A)}function g(O){return i&&O.alternate===null&&(O.flags|=67108866),O}function b(O,A,U,te){return A===null||A.tag!==6?(A=nh(U,O.mode,te),A.return=O,A):(A=u(A,U),A.return=O,A)}function T(O,A,U,te){var ke=U.type;return ke===E?Z(O,A,U.props.children,te,U.key):A!==null&&(A.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===oe&&Sr(ke)===A.type)?(A=u(A,U.props),Ja(A,U),A.return=O,A):(A=Lo(U.type,U.key,U.props,null,O.mode,te),Ja(A,U),A.return=O,A)}function P(O,A,U,te){return A===null||A.tag!==4||A.stateNode.containerInfo!==U.containerInfo||A.stateNode.implementation!==U.implementation?(A=rh(U,O.mode,te),A.return=O,A):(A=u(A,U.children||[]),A.return=O,A)}function Z(O,A,U,te,ke){return A===null||A.tag!==7?(A=_r(U,O.mode,te,ke),A.return=O,A):(A=u(A,U),A.return=O,A)}function re(O,A,U){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=nh(""+A,O.mode,U),A.return=O,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case x:return U=Lo(A.type,A.key,A.props,null,O.mode,U),Ja(U,A),U.return=O,U;case C:return A=rh(A,O.mode,U),A.return=O,A;case oe:return A=Sr(A),re(O,A,U)}if(se(A)||G(A))return A=_r(A,O.mode,U,null),A.return=O,A;if(typeof A.then=="function")return re(O,Ko(A),U);if(A.$$typeof===R)return re(O,Ho(O,A),U);Io(O,A)}return null}function F(O,A,U,te){var ke=A!==null?A.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return ke!==null?null:b(O,A,""+U,te);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case x:return U.key===ke?T(O,A,U,te):null;case C:return U.key===ke?P(O,A,U,te):null;case oe:return U=Sr(U),F(O,A,U,te)}if(se(U)||G(U))return ke!==null?null:Z(O,A,U,te,null);if(typeof U.then=="function")return F(O,A,Ko(U),te);if(U.$$typeof===R)return F(O,A,Ho(O,U),te);Io(O,U)}return null}function $(O,A,U,te,ke){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return O=O.get(U)||null,b(A,O,""+te,ke);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case x:return O=O.get(te.key===null?U:te.key)||null,T(A,O,te,ke);case C:return O=O.get(te.key===null?U:te.key)||null,P(A,O,te,ke);case oe:return te=Sr(te),$(O,A,U,te,ke)}if(se(te)||G(te))return O=O.get(U)||null,Z(A,O,te,ke,null);if(typeof te.then=="function")return $(O,A,U,Ko(te),ke);if(te.$$typeof===R)return $(O,A,U,Ho(A,te),ke);Io(A,te)}return null}function Se(O,A,U,te){for(var ke=null,st=null,we=A,Ue=A=0,Ve=null;we!==null&&Ue<U.length;Ue++){we.index>Ue?(Ve=we,we=null):Ve=we.sibling;var nt=F(O,we,U[Ue],te);if(nt===null){we===null&&(we=Ve);break}i&&we&&nt.alternate===null&&s(O,we),A=h(nt,A,Ue),st===null?ke=nt:st.sibling=nt,st=nt,we=Ve}if(Ue===U.length)return r(O,we),Ze&&Qs(O,Ue),ke;if(we===null){for(;Ue<U.length;Ue++)we=re(O,U[Ue],te),we!==null&&(A=h(we,A,Ue),st===null?ke=we:st.sibling=we,st=we);return Ze&&Qs(O,Ue),ke}for(we=l(we);Ue<U.length;Ue++)Ve=$(we,O,Ue,U[Ue],te),Ve!==null&&(i&&Ve.alternate!==null&&we.delete(Ve.key===null?Ue:Ve.key),A=h(Ve,A,Ue),st===null?ke=Ve:st.sibling=Ve,st=Ve);return i&&we.forEach(function(Wn){return s(O,Wn)}),Ze&&Qs(O,Ue),ke}function Ae(O,A,U,te){if(U==null)throw Error(a(151));for(var ke=null,st=null,we=A,Ue=A=0,Ve=null,nt=U.next();we!==null&&!nt.done;Ue++,nt=U.next()){we.index>Ue?(Ve=we,we=null):Ve=we.sibling;var Wn=F(O,we,nt.value,te);if(Wn===null){we===null&&(we=Ve);break}i&&we&&Wn.alternate===null&&s(O,we),A=h(Wn,A,Ue),st===null?ke=Wn:st.sibling=Wn,st=Wn,we=Ve}if(nt.done)return r(O,we),Ze&&Qs(O,Ue),ke;if(we===null){for(;!nt.done;Ue++,nt=U.next())nt=re(O,nt.value,te),nt!==null&&(A=h(nt,A,Ue),st===null?ke=nt:st.sibling=nt,st=nt);return Ze&&Qs(O,Ue),ke}for(we=l(we);!nt.done;Ue++,nt=U.next())nt=$(we,O,Ue,nt.value,te),nt!==null&&(i&&nt.alternate!==null&&we.delete(nt.key===null?Ue:nt.key),A=h(nt,A,Ue),st===null?ke=nt:st.sibling=nt,st=nt);return i&&we.forEach(function(jC){return s(O,jC)}),Ze&&Qs(O,Ue),ke}function mt(O,A,U,te){if(typeof U=="object"&&U!==null&&U.type===E&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case x:e:{for(var ke=U.key;A!==null;){if(A.key===ke){if(ke=U.type,ke===E){if(A.tag===7){r(O,A.sibling),te=u(A,U.props.children),te.return=O,O=te;break e}}else if(A.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===oe&&Sr(ke)===A.type){r(O,A.sibling),te=u(A,U.props),Ja(te,U),te.return=O,O=te;break e}r(O,A);break}else s(O,A);A=A.sibling}U.type===E?(te=_r(U.props.children,O.mode,te,U.key),te.return=O,O=te):(te=Lo(U.type,U.key,U.props,null,O.mode,te),Ja(te,U),te.return=O,O=te)}return g(O);case C:e:{for(ke=U.key;A!==null;){if(A.key===ke)if(A.tag===4&&A.stateNode.containerInfo===U.containerInfo&&A.stateNode.implementation===U.implementation){r(O,A.sibling),te=u(A,U.children||[]),te.return=O,O=te;break e}else{r(O,A);break}else s(O,A);A=A.sibling}te=rh(U,O.mode,te),te.return=O,O=te}return g(O);case oe:return U=Sr(U),mt(O,A,U,te)}if(se(U))return Se(O,A,U,te);if(G(U)){if(ke=G(U),typeof ke!="function")throw Error(a(150));return U=ke.call(U),Ae(O,A,U,te)}if(typeof U.then=="function")return mt(O,A,Ko(U),te);if(U.$$typeof===R)return mt(O,A,Ho(O,U),te);Io(O,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,A!==null&&A.tag===6?(r(O,A.sibling),te=u(A,U),te.return=O,O=te):(r(O,A),te=nh(U,O.mode,te),te.return=O,O=te),g(O)):r(O,A)}return function(O,A,U,te){try{Qa=0;var ke=mt(O,A,U,te);return na=null,ke}catch(we){if(we===sa||we===Uo)throw we;var st=Qi(29,we,null,O.mode);return st.lanes=te,st.return=O,st}}}var wr=Em(!0),Tm=Em(!1),Dn=!1;function gh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vh(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Rn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Mn(i,s,r){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(ot&2)!==0){var u=l.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),l.pending=s,s=Bo(i),cm(i,null,r),s}return No(i,l,s,r),Bo(i)}function el(i,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,wt(i,r)}}function yh(i,s){var r=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var u=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var g={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?u=h=g:h=h.next=g,r=r.next}while(r!==null);h===null?u=h=s:h=h.next=s}else u=h=s;r={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},i.updateQueue=r;return}i=r.lastBaseUpdate,i===null?r.firstBaseUpdate=s:i.next=s,r.lastBaseUpdate=s}var Sh=!1;function tl(){if(Sh){var i=ia;if(i!==null)throw i}}function il(i,s,r,l){Sh=!1;var u=i.updateQueue;Dn=!1;var h=u.firstBaseUpdate,g=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var T=b,P=T.next;T.next=null,g===null?h=P:g.next=P,g=T;var Z=i.alternate;Z!==null&&(Z=Z.updateQueue,b=Z.lastBaseUpdate,b!==g&&(b===null?Z.firstBaseUpdate=P:b.next=P,Z.lastBaseUpdate=T))}if(h!==null){var re=u.baseState;g=0,Z=P=T=null,b=h;do{var F=b.lane&-536870913,$=F!==b.lane;if($?($e&F)===F:(l&F)===F){F!==0&&F===ta&&(Sh=!0),Z!==null&&(Z=Z.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var Se=i,Ae=b;F=s;var mt=r;switch(Ae.tag){case 1:if(Se=Ae.payload,typeof Se=="function"){re=Se.call(mt,re,F);break e}re=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ae.payload,F=typeof Se=="function"?Se.call(mt,re,F):Se,F==null)break e;re=y({},re,F);break e;case 2:Dn=!0}}F=b.callback,F!==null&&(i.flags|=64,$&&(i.flags|=8192),$=u.callbacks,$===null?u.callbacks=[F]:$.push(F))}else $={lane:F,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Z===null?(P=Z=$,T=re):Z=Z.next=$,g|=F;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;$=b,b=$.next,$.next=null,u.lastBaseUpdate=$,u.shared.pending=null}}while(!0);Z===null&&(T=re),u.baseState=T,u.firstBaseUpdate=P,u.lastBaseUpdate=Z,h===null&&(u.shared.lanes=0),On|=g,i.lanes=g,i.memoizedState=re}}function km(i,s){if(typeof i!="function")throw Error(a(191,i));i.call(s)}function Dm(i,s){var r=i.callbacks;if(r!==null)for(i.callbacks=null,i=0;i<r.length;i++)km(r[i],s)}var ra=k(null),Fo=k(0);function Rm(i,s){i=un,ne(Fo,i),ne(ra,s),un=i|s.baseLanes}function bh(){ne(Fo,un),ne(ra,ra.current)}function wh(){un=Fo.current,I(ra),I(Fo)}var Ji=k(null),_s=null;function An(i){var s=i.alternate;ne(Ft,Ft.current&1),ne(Ji,i),_s===null&&(s===null||ra.current!==null||s.memoizedState!==null)&&(_s=i)}function Ch(i){ne(Ft,Ft.current),ne(Ji,i),_s===null&&(_s=i)}function Mm(i){i.tag===22?(ne(Ft,Ft.current),ne(Ji,i),_s===null&&(_s=i)):Nn()}function Nn(){ne(Ft,Ft.current),ne(Ji,Ji.current)}function es(i){I(Ji),_s===i&&(_s=null),I(Ft)}var Ft=k(0);function qo(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Rd(r)||Md(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var tn=0,je=null,pt=null,Vt=null,Wo=!1,aa=!1,Cr=!1,Yo=0,sl=0,la=null,D1=0;function Ht(){throw Error(a(321))}function xh(i,s){if(s===null)return!1;for(var r=0;r<s.length&&r<i.length;r++)if(!Zi(i[r],s[r]))return!1;return!0}function Eh(i,s,r,l,u,h){return tn=h,je=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,M.H=i===null||i.memoizedState===null?fg:Ph,Cr=!1,h=r(l,u),Cr=!1,aa&&(h=Nm(s,r,l,u)),Am(i),h}function Am(i){M.H=al;var s=pt!==null&&pt.next!==null;if(tn=0,Vt=pt=je=null,Wo=!1,sl=0,la=null,s)throw Error(a(300));i===null||Xt||(i=i.dependencies,i!==null&&zo(i)&&(Xt=!0))}function Nm(i,s,r,l){je=i;var u=0;do{if(aa&&(la=null),sl=0,aa=!1,25<=u)throw Error(a(301));if(u+=1,Vt=pt=null,i.updateQueue!=null){var h=i.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}M.H=pg,h=s(r,l)}while(aa);return h}function R1(){var i=M.H,s=i.useState()[0];return s=typeof s.then=="function"?nl(s):s,i=i.useState()[0],(pt!==null?pt.memoizedState:null)!==i&&(je.flags|=1024),s}function Th(){var i=Yo!==0;return Yo=0,i}function kh(i,s,r){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~r}function Dh(i){if(Wo){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}Wo=!1}tn=0,Vt=pt=je=null,aa=!1,sl=Yo=0,la=null}function Oi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?je.memoizedState=Vt=i:Vt=Vt.next=i,Vt}function qt(){if(pt===null){var i=je.alternate;i=i!==null?i.memoizedState:null}else i=pt.next;var s=Vt===null?je.memoizedState:Vt.next;if(s!==null)Vt=s,pt=i;else{if(i===null)throw je.alternate===null?Error(a(467)):Error(a(310));pt=i,i={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},Vt===null?je.memoizedState=Vt=i:Vt=Vt.next=i}return Vt}function $o(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function nl(i){var s=sl;return sl+=1,la===null&&(la=[]),i=wm(la,i,s),s=je,(Vt===null?s.memoizedState:Vt.next)===null&&(s=s.alternate,M.H=s===null||s.memoizedState===null?fg:Ph),i}function Vo(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return nl(i);if(i.$$typeof===R)return xi(i)}throw Error(a(438,String(i)))}function Rh(i){var s=null,r=je.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var l=je.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(u){return u.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=$o(),je.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(i),l=0;l<i;l++)r[l]=ue;return s.index++,r}function sn(i,s){return typeof s=="function"?s(i):s}function Xo(i){var s=qt();return Mh(s,pt,i)}function Mh(i,s,r){var l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var u=i.baseQueue,h=l.pending;if(h!==null){if(u!==null){var g=u.next;u.next=h.next,h.next=g}s.baseQueue=u=h,l.pending=null}if(h=i.baseState,u===null)i.memoizedState=h;else{s=u.next;var b=g=null,T=null,P=s,Z=!1;do{var re=P.lane&-536870913;if(re!==P.lane?($e&re)===re:(tn&re)===re){var F=P.revertLane;if(F===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),re===ta&&(Z=!0);else if((tn&F)===F){P=P.next,F===ta&&(Z=!0);continue}else re={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},T===null?(b=T=re,g=h):T=T.next=re,je.lanes|=F,On|=F;re=P.action,Cr&&r(h,re),h=P.hasEagerState?P.eagerState:r(h,re)}else F={lane:re,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},T===null?(b=T=F,g=h):T=T.next=F,je.lanes|=re,On|=re;P=P.next}while(P!==null&&P!==s);if(T===null?g=h:T.next=b,!Zi(h,i.memoizedState)&&(Xt=!0,Z&&(r=ia,r!==null)))throw r;i.memoizedState=h,i.baseState=g,i.baseQueue=T,l.lastRenderedState=h}return u===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Ah(i){var s=qt(),r=s.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=i;var l=r.dispatch,u=r.pending,h=s.memoizedState;if(u!==null){r.pending=null;var g=u=u.next;do h=i(h,g.action),g=g.next;while(g!==u);Zi(h,s.memoizedState)||(Xt=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),r.lastRenderedState=h}return[h,l]}function Bm(i,s,r){var l=je,u=qt(),h=Ze;if(h){if(r===void 0)throw Error(a(407));r=r()}else r=s();var g=!Zi((pt||u).memoizedState,r);if(g&&(u.memoizedState=r,Xt=!0),u=u.queue,Lh(zm.bind(null,l,u,i),[i]),u.getSnapshot!==s||g||Vt!==null&&Vt.memoizedState.tag&1){if(l.flags|=2048,oa(9,{destroy:void 0},Om.bind(null,l,u,r,s),null),St===null)throw Error(a(349));h||(tn&127)!==0||Lm(l,s,r)}return r}function Lm(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=je.updateQueue,s===null?(s=$o(),je.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function Om(i,s,r,l){s.value=r,s.getSnapshot=l,Hm(s)&&jm(i)}function zm(i,s,r){return r(function(){Hm(s)&&jm(i)})}function Hm(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!Zi(i,r)}catch{return!0}}function jm(i){var s=pr(i,2);s!==null&&$i(s,i,2)}function Nh(i){var s=Oi();if(typeof i=="function"){var r=i;if(i=r(),Cr){bi(!0);try{r()}finally{bi(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sn,lastRenderedState:i},s}function Um(i,s,r,l){return i.baseState=r,Mh(i,pt,typeof l=="function"?l:sn)}function M1(i,s,r,l,u){if(Qo(i))throw Error(a(485));if(i=s.action,i!==null){var h={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){h.listeners.push(g)}};M.T!==null?r(!0):h.isTransition=!1,l(h),r=s.pending,r===null?(h.next=s.pending=h,Pm(s,h)):(h.next=r.next,s.pending=r.next=h)}}function Pm(i,s){var r=s.action,l=s.payload,u=i.state;if(s.isTransition){var h=M.T,g={};M.T=g;try{var b=r(u,l),T=M.S;T!==null&&T(g,b),Km(i,s,b)}catch(P){Bh(i,s,P)}finally{h!==null&&g.types!==null&&(h.types=g.types),M.T=h}}else try{h=r(u,l),Km(i,s,h)}catch(P){Bh(i,s,P)}}function Km(i,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){Im(i,s,l)},function(l){return Bh(i,s,l)}):Im(i,s,r)}function Im(i,s,r){s.status="fulfilled",s.value=r,Fm(s),i.state=r,s=i.pending,s!==null&&(r=s.next,r===s?i.pending=null:(r=r.next,s.next=r,Pm(i,r)))}function Bh(i,s,r){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=r,Fm(s),s=s.next;while(s!==l)}i.action=null}function Fm(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function qm(i,s){return s}function Wm(i,s){if(Ze){var r=St.formState;if(r!==null){e:{var l=je;if(Ze){if(Et){t:{for(var u=Et,h=ps;u.nodeType!==8;){if(!h){u=null;break t}if(u=ms(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){Et=ms(u.nextSibling),l=u.data==="F!";break e}}Tn(l)}l=!1}l&&(s=r[0])}}return r=Oi(),r.memoizedState=r.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qm,lastRenderedState:s},r.queue=l,r=ug.bind(null,je,l),l.dispatch=r,l=Nh(!1),h=Uh.bind(null,je,!1,l.queue),l=Oi(),u={state:s,dispatch:null,action:i,pending:null},l.queue=u,r=M1.bind(null,je,u,h,r),u.dispatch=r,l.memoizedState=i,[s,r,!1]}function Ym(i){var s=qt();return $m(s,pt,i)}function $m(i,s,r){if(s=Mh(i,s,qm)[0],i=Xo(sn)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=nl(s)}catch(g){throw g===sa?Uo:g}else l=s;s=qt();var u=s.queue,h=u.dispatch;return r!==s.memoizedState&&(je.flags|=2048,oa(9,{destroy:void 0},A1.bind(null,u,r),null)),[l,h,i]}function A1(i,s){i.action=s}function Vm(i){var s=qt(),r=pt;if(r!==null)return $m(s,r,i);qt(),s=s.memoizedState,r=qt();var l=r.queue.dispatch;return r.memoizedState=i,[s,l,!1]}function oa(i,s,r,l){return i={tag:i,create:r,deps:l,inst:s,next:null},s=je.updateQueue,s===null&&(s=$o(),je.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=i.next=i:(l=r.next,r.next=i,i.next=l,s.lastEffect=i),i}function Xm(){return qt().memoizedState}function Go(i,s,r,l){var u=Oi();je.flags|=i,u.memoizedState=oa(1|s,{destroy:void 0},r,l===void 0?null:l)}function Zo(i,s,r,l){var u=qt();l=l===void 0?null:l;var h=u.memoizedState.inst;pt!==null&&l!==null&&xh(l,pt.memoizedState.deps)?u.memoizedState=oa(s,h,r,l):(je.flags|=i,u.memoizedState=oa(1|s,h,r,l))}function Gm(i,s){Go(8390656,8,i,s)}function Lh(i,s){Zo(2048,8,i,s)}function N1(i){je.flags|=4;var s=je.updateQueue;if(s===null)s=$o(),je.updateQueue=s,s.events=[i];else{var r=s.events;r===null?s.events=[i]:r.push(i)}}function Zm(i){var s=qt().memoizedState;return N1({ref:s,nextImpl:i}),function(){if((ot&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function Qm(i,s){return Zo(4,2,i,s)}function Jm(i,s){return Zo(4,4,i,s)}function eg(i,s){if(typeof s=="function"){i=i();var r=s(i);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function tg(i,s,r){r=r!=null?r.concat([i]):null,Zo(4,4,eg.bind(null,s,i),r)}function Oh(){}function ig(i,s){var r=qt();s=s===void 0?null:s;var l=r.memoizedState;return s!==null&&xh(s,l[1])?l[0]:(r.memoizedState=[i,s],i)}function sg(i,s){var r=qt();s=s===void 0?null:s;var l=r.memoizedState;if(s!==null&&xh(s,l[1]))return l[0];if(l=i(),Cr){bi(!0);try{i()}finally{bi(!1)}}return r.memoizedState=[l,s],l}function zh(i,s,r){return r===void 0||(tn&1073741824)!==0&&($e&261930)===0?i.memoizedState=s:(i.memoizedState=r,i=nv(),je.lanes|=i,On|=i,r)}function ng(i,s,r,l){return Zi(r,s)?r:ra.current!==null?(i=zh(i,r,l),Zi(i,s)||(Xt=!0),i):(tn&42)===0||(tn&1073741824)!==0&&($e&261930)===0?(Xt=!0,i.memoizedState=r):(i=nv(),je.lanes|=i,On|=i,s)}function rg(i,s,r,l,u){var h=Y.p;Y.p=h!==0&&8>h?h:8;var g=M.T,b={};M.T=b,Uh(i,!1,s,r);try{var T=u(),P=M.S;if(P!==null&&P(b,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var Z=k1(T,l);rl(i,s,Z,ss(i))}else rl(i,s,l,ss(i))}catch(re){rl(i,s,{then:function(){},status:"rejected",reason:re},ss())}finally{Y.p=h,g!==null&&b.types!==null&&(g.types=b.types),M.T=g}}function B1(){}function Hh(i,s,r,l){if(i.tag!==5)throw Error(a(476));var u=ag(i).queue;rg(i,u,s,X,r===null?B1:function(){return lg(i),r(l)})}function ag(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sn,lastRenderedState:X},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sn,lastRenderedState:r},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function lg(i){var s=ag(i);s.next===null&&(s=i.alternate.memoizedState),rl(i,s.next.queue,{},ss())}function jh(){return xi(wl)}function og(){return qt().memoizedState}function cg(){return qt().memoizedState}function L1(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var r=ss();i=Rn(r);var l=Mn(s,i,r);l!==null&&($i(l,s,r),el(l,s,r)),s={cache:fh()},i.payload=s;return}s=s.return}}function O1(i,s,r){var l=ss();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Qo(i)?hg(s,r):(r=ih(i,s,r,l),r!==null&&($i(r,i,l),dg(r,s,l)))}function ug(i,s,r){var l=ss();rl(i,s,r,l)}function rl(i,s,r,l){var u={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Qo(i))hg(s,u);else{var h=i.alternate;if(i.lanes===0&&(h===null||h.lanes===0)&&(h=s.lastRenderedReducer,h!==null))try{var g=s.lastRenderedState,b=h(g,r);if(u.hasEagerState=!0,u.eagerState=b,Zi(b,g))return No(i,s,u,0),St===null&&Ao(),!1}catch{}if(r=ih(i,s,u,l),r!==null)return $i(r,i,l),dg(r,s,l),!0}return!1}function Uh(i,s,r,l){if(l={lane:2,revertLane:gd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Qo(i)){if(s)throw Error(a(479))}else s=ih(i,r,l,2),s!==null&&$i(s,i,2)}function Qo(i){var s=i.alternate;return i===je||s!==null&&s===je}function hg(i,s){aa=Wo=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function dg(i,s,r){if((r&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,wt(i,r)}}var al={readContext:xi,use:Vo,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};al.useEffectEvent=Ht;var fg={readContext:xi,use:Vo,useCallback:function(i,s){return Oi().memoizedState=[i,s===void 0?null:s],i},useContext:xi,useEffect:Gm,useImperativeHandle:function(i,s,r){r=r!=null?r.concat([i]):null,Go(4194308,4,eg.bind(null,s,i),r)},useLayoutEffect:function(i,s){return Go(4194308,4,i,s)},useInsertionEffect:function(i,s){Go(4,2,i,s)},useMemo:function(i,s){var r=Oi();s=s===void 0?null:s;var l=i();if(Cr){bi(!0);try{i()}finally{bi(!1)}}return r.memoizedState=[l,s],l},useReducer:function(i,s,r){var l=Oi();if(r!==void 0){var u=r(s);if(Cr){bi(!0);try{r(s)}finally{bi(!1)}}}else u=s;return l.memoizedState=l.baseState=u,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:u},l.queue=i,i=i.dispatch=O1.bind(null,je,i),[l.memoizedState,i]},useRef:function(i){var s=Oi();return i={current:i},s.memoizedState=i},useState:function(i){i=Nh(i);var s=i.queue,r=ug.bind(null,je,s);return s.dispatch=r,[i.memoizedState,r]},useDebugValue:Oh,useDeferredValue:function(i,s){var r=Oi();return zh(r,i,s)},useTransition:function(){var i=Nh(!1);return i=rg.bind(null,je,i.queue,!0,!1),Oi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,r){var l=je,u=Oi();if(Ze){if(r===void 0)throw Error(a(407));r=r()}else{if(r=s(),St===null)throw Error(a(349));($e&127)!==0||Lm(l,s,r)}u.memoizedState=r;var h={value:r,getSnapshot:s};return u.queue=h,Gm(zm.bind(null,l,h,i),[i]),l.flags|=2048,oa(9,{destroy:void 0},Om.bind(null,l,h,r,s),null),r},useId:function(){var i=Oi(),s=St.identifierPrefix;if(Ze){var r=zs,l=Os;r=(l&~(1<<32-Yt(l)-1)).toString(32)+r,s="_"+s+"R_"+r,r=Yo++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=D1++,s="_"+s+"r_"+r.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:jh,useFormState:Wm,useActionState:Wm,useOptimistic:function(i){var s=Oi();s.memoizedState=s.baseState=i;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=Uh.bind(null,je,!0,r),r.dispatch=s,[i,s]},useMemoCache:Rh,useCacheRefresh:function(){return Oi().memoizedState=L1.bind(null,je)},useEffectEvent:function(i){var s=Oi(),r={impl:i};return s.memoizedState=r,function(){if((ot&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},Ph={readContext:xi,use:Vo,useCallback:ig,useContext:xi,useEffect:Lh,useImperativeHandle:tg,useInsertionEffect:Qm,useLayoutEffect:Jm,useMemo:sg,useReducer:Xo,useRef:Xm,useState:function(){return Xo(sn)},useDebugValue:Oh,useDeferredValue:function(i,s){var r=qt();return ng(r,pt.memoizedState,i,s)},useTransition:function(){var i=Xo(sn)[0],s=qt().memoizedState;return[typeof i=="boolean"?i:nl(i),s]},useSyncExternalStore:Bm,useId:og,useHostTransitionStatus:jh,useFormState:Ym,useActionState:Ym,useOptimistic:function(i,s){var r=qt();return Um(r,pt,i,s)},useMemoCache:Rh,useCacheRefresh:cg};Ph.useEffectEvent=Zm;var pg={readContext:xi,use:Vo,useCallback:ig,useContext:xi,useEffect:Lh,useImperativeHandle:tg,useInsertionEffect:Qm,useLayoutEffect:Jm,useMemo:sg,useReducer:Ah,useRef:Xm,useState:function(){return Ah(sn)},useDebugValue:Oh,useDeferredValue:function(i,s){var r=qt();return pt===null?zh(r,i,s):ng(r,pt.memoizedState,i,s)},useTransition:function(){var i=Ah(sn)[0],s=qt().memoizedState;return[typeof i=="boolean"?i:nl(i),s]},useSyncExternalStore:Bm,useId:og,useHostTransitionStatus:jh,useFormState:Vm,useActionState:Vm,useOptimistic:function(i,s){var r=qt();return pt!==null?Um(r,pt,i,s):(r.baseState=i,[i,r.queue.dispatch])},useMemoCache:Rh,useCacheRefresh:cg};pg.useEffectEvent=Zm;function Kh(i,s,r,l){s=i.memoizedState,r=r(l,s),r=r==null?s:y({},s,r),i.memoizedState=r,i.lanes===0&&(i.updateQueue.baseState=r)}var Ih={enqueueSetState:function(i,s,r){i=i._reactInternals;var l=ss(),u=Rn(l);u.payload=s,r!=null&&(u.callback=r),s=Mn(i,u,l),s!==null&&($i(s,i,l),el(s,i,l))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var l=ss(),u=Rn(l);u.tag=1,u.payload=s,r!=null&&(u.callback=r),s=Mn(i,u,l),s!==null&&($i(s,i,l),el(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=ss(),l=Rn(r);l.tag=2,s!=null&&(l.callback=s),s=Mn(i,l,r),s!==null&&($i(s,i,r),el(s,i,r))}};function _g(i,s,r,l,u,h,g){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,h,g):s.prototype&&s.prototype.isPureReactComponent?!Ya(r,l)||!Ya(u,h):!0}function mg(i,s,r,l){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,l),s.state!==i&&Ih.enqueueReplaceState(s,s.state,null)}function xr(i,s){var r=s;if("ref"in s){r={};for(var l in s)l!=="ref"&&(r[l]=s[l])}if(i=i.defaultProps){r===s&&(r=y({},r));for(var u in i)r[u]===void 0&&(r[u]=i[u])}return r}function gg(i){Mo(i)}function vg(i){console.error(i)}function yg(i){Mo(i)}function Jo(i,s){try{var r=i.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Sg(i,s,r){try{var l=i.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Fh(i,s,r){return r=Rn(r),r.tag=3,r.payload={element:null},r.callback=function(){Jo(i,s)},r}function bg(i){return i=Rn(i),i.tag=3,i}function wg(i,s,r,l){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var h=l.value;i.payload=function(){return u(h)},i.callback=function(){Sg(s,r,l)}}var g=r.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(i.callback=function(){Sg(s,r,l),typeof u!="function"&&(zn===null?zn=new Set([this]):zn.add(this));var b=l.stack;this.componentDidCatch(l.value,{componentStack:b!==null?b:""})})}function z1(i,s,r,l,u){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=r.alternate,s!==null&&ea(s,r,u,!0),r=Ji.current,r!==null){switch(r.tag){case 31:case 13:return _s===null?hc():r.alternate===null&&jt===0&&(jt=3),r.flags&=-257,r.flags|=65536,r.lanes=u,l===Po?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([l]):s.add(l),pd(i,l,u)),!1;case 22:return r.flags|=65536,l===Po?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([l]):r.add(l)),pd(i,l,u)),!1}throw Error(a(435,r.tag))}return pd(i,l,u),hc(),!1}if(Ze)return s=Ji.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,l!==oh&&(i=Error(a(422),{cause:l}),Xa(hs(i,r)))):(l!==oh&&(s=Error(a(423),{cause:l}),Xa(hs(s,r))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,l=hs(l,r),u=Fh(i.stateNode,l,u),yh(i,u),jt!==4&&(jt=2)),!1;var h=Error(a(520),{cause:l});if(h=hs(h,r),pl===null?pl=[h]:pl.push(h),jt!==4&&(jt=2),s===null)return!0;l=hs(l,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,i=u&-u,r.lanes|=i,i=Fh(r.stateNode,l,i),yh(r,i),!1;case 1:if(s=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(zn===null||!zn.has(h))))return r.flags|=65536,u&=-u,r.lanes|=u,u=bg(u),wg(u,i,r,l),yh(r,u),!1}r=r.return}while(r!==null);return!1}var qh=Error(a(461)),Xt=!1;function Ei(i,s,r,l){s.child=i===null?Tm(s,null,r,l):wr(s,i.child,r,l)}function Cg(i,s,r,l,u){r=r.render;var h=s.ref;if("ref"in l){var g={};for(var b in l)b!=="ref"&&(g[b]=l[b])}else g=l;return vr(s),l=Eh(i,s,r,g,h,u),b=Th(),i!==null&&!Xt?(kh(i,s,u),nn(i,s,u)):(Ze&&b&&ah(s),s.flags|=1,Ei(i,s,l,u),s.child)}function xg(i,s,r,l,u){if(i===null){var h=r.type;return typeof h=="function"&&!sh(h)&&h.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=h,Eg(i,s,h,l,u)):(i=Lo(r.type,null,l,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(h=i.child,!Qh(i,u)){var g=h.memoizedProps;if(r=r.compare,r=r!==null?r:Ya,r(g,l)&&i.ref===s.ref)return nn(i,s,u)}return s.flags|=1,i=Zs(h,l),i.ref=s.ref,i.return=s,s.child=i}function Eg(i,s,r,l,u){if(i!==null){var h=i.memoizedProps;if(Ya(h,l)&&i.ref===s.ref)if(Xt=!1,s.pendingProps=l=h,Qh(i,u))(i.flags&131072)!==0&&(Xt=!0);else return s.lanes=i.lanes,nn(i,s,u)}return Wh(i,s,r,l,u)}function Tg(i,s,r,l){var u=l.children,h=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((s.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,i!==null){for(l=s.child=i.child,u=0;l!==null;)u=u|l.lanes|l.childLanes,l=l.sibling;l=u&~h}else l=0,s.child=null;return kg(i,s,h,r,l)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&jo(s,h!==null?h.cachePool:null),h!==null?Rm(s,h):bh(),Mm(s);else return l=s.lanes=536870912,kg(i,s,h!==null?h.baseLanes|r:r,r,l)}else h!==null?(jo(s,h.cachePool),Rm(s,h),Nn(),s.memoizedState=null):(i!==null&&jo(s,null),bh(),Nn());return Ei(i,s,u,r),s.child}function ll(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function kg(i,s,r,l,u){var h=_h();return h=h===null?null:{parent:$t._currentValue,pool:h},s.memoizedState={baseLanes:r,cachePool:h},i!==null&&jo(s,null),bh(),Mm(s),i!==null&&ea(i,s,l,!0),s.childLanes=u,null}function ec(i,s){return s=ic({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Dg(i,s,r){return wr(s,i.child,null,r),i=ec(s,s.pendingProps),i.flags|=2,es(s),s.memoizedState=null,i}function H1(i,s,r){var l=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Ze){if(l.mode==="hidden")return i=ec(s,l),s.lanes=536870912,ll(null,i);if(Ch(s),(i=Et)?(i=Pv(i,ps),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:xn!==null?{id:Os,overflow:zs}:null,retryLane:536870912,hydrationErrors:null},r=hm(i),r.return=s,s.child=r,Ci=s,Et=null)):i=null,i===null)throw Tn(s);return s.lanes=536870912,null}return ec(s,l)}var h=i.memoizedState;if(h!==null){var g=h.dehydrated;if(Ch(s),u)if(s.flags&256)s.flags&=-257,s=Dg(i,s,r);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(a(558));else if(Xt||ea(i,s,r,!1),u=(r&i.childLanes)!==0,Xt||u){if(l=St,l!==null&&(g=Ri(l,r),g!==0&&g!==h.retryLane))throw h.retryLane=g,pr(i,g),$i(l,i,g),qh;hc(),s=Dg(i,s,r)}else i=h.treeContext,Et=ms(g.nextSibling),Ci=s,Ze=!0,En=null,ps=!1,i!==null&&pm(s,i),s=ec(s,l),s.flags|=4096;return s}return i=Zs(i.child,{mode:l.mode,children:l.children}),i.ref=s.ref,s.child=i,i.return=s,i}function tc(i,s){var r=s.ref;if(r===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(i===null||i.ref!==r)&&(s.flags|=4194816)}}function Wh(i,s,r,l,u){return vr(s),r=Eh(i,s,r,l,void 0,u),l=Th(),i!==null&&!Xt?(kh(i,s,u),nn(i,s,u)):(Ze&&l&&ah(s),s.flags|=1,Ei(i,s,r,u),s.child)}function Rg(i,s,r,l,u,h){return vr(s),s.updateQueue=null,r=Nm(s,l,r,u),Am(i),l=Th(),i!==null&&!Xt?(kh(i,s,h),nn(i,s,h)):(Ze&&l&&ah(s),s.flags|=1,Ei(i,s,r,h),s.child)}function Mg(i,s,r,l,u){if(vr(s),s.stateNode===null){var h=Gr,g=r.contextType;typeof g=="object"&&g!==null&&(h=xi(g)),h=new r(l,h),s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Ih,s.stateNode=h,h._reactInternals=s,h=s.stateNode,h.props=l,h.state=s.memoizedState,h.refs={},gh(s),g=r.contextType,h.context=typeof g=="object"&&g!==null?xi(g):Gr,h.state=s.memoizedState,g=r.getDerivedStateFromProps,typeof g=="function"&&(Kh(s,r,g,l),h.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(g=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),g!==h.state&&Ih.enqueueReplaceState(h,h.state,null),il(s,l,h,u),tl(),h.state=s.memoizedState),typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){h=s.stateNode;var b=s.memoizedProps,T=xr(r,b);h.props=T;var P=h.context,Z=r.contextType;g=Gr,typeof Z=="object"&&Z!==null&&(g=xi(Z));var re=r.getDerivedStateFromProps;Z=typeof re=="function"||typeof h.getSnapshotBeforeUpdate=="function",b=s.pendingProps!==b,Z||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(b||P!==g)&&mg(s,h,l,g),Dn=!1;var F=s.memoizedState;h.state=F,il(s,l,h,u),tl(),P=s.memoizedState,b||F!==P||Dn?(typeof re=="function"&&(Kh(s,r,re,l),P=s.memoizedState),(T=Dn||_g(s,r,T,l,F,P,g))?(Z||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(s.flags|=4194308)):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=P),h.props=l,h.state=P,h.context=g,l=T):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{h=s.stateNode,vh(i,s),g=s.memoizedProps,Z=xr(r,g),h.props=Z,re=s.pendingProps,F=h.context,P=r.contextType,T=Gr,typeof P=="object"&&P!==null&&(T=xi(P)),b=r.getDerivedStateFromProps,(P=typeof b=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(g!==re||F!==T)&&mg(s,h,l,T),Dn=!1,F=s.memoizedState,h.state=F,il(s,l,h,u),tl();var $=s.memoizedState;g!==re||F!==$||Dn||i!==null&&i.dependencies!==null&&zo(i.dependencies)?(typeof b=="function"&&(Kh(s,r,b,l),$=s.memoizedState),(Z=Dn||_g(s,r,Z,l,F,$,T)||i!==null&&i.dependencies!==null&&zo(i.dependencies))?(P||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,$,T),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,$,T)),typeof h.componentDidUpdate=="function"&&(s.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof h.componentDidUpdate!="function"||g===i.memoizedProps&&F===i.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||g===i.memoizedProps&&F===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=$),h.props=l,h.state=$,h.context=T,l=Z):(typeof h.componentDidUpdate!="function"||g===i.memoizedProps&&F===i.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||g===i.memoizedProps&&F===i.memoizedState||(s.flags|=1024),l=!1)}return h=l,tc(i,s),l=(s.flags&128)!==0,h||l?(h=s.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:h.render(),s.flags|=1,i!==null&&l?(s.child=wr(s,i.child,null,u),s.child=wr(s,null,r,u)):Ei(i,s,r,u),s.memoizedState=h.state,i=s.child):i=nn(i,s,u),i}function Ag(i,s,r,l){return mr(),s.flags|=256,Ei(i,s,r,l),s.child}var Yh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $h(i){return{baseLanes:i,cachePool:Sm()}}function Vh(i,s,r){return i=i!==null?i.childLanes&~r:0,s&&(i|=is),i}function Ng(i,s,r){var l=s.pendingProps,u=!1,h=(s.flags&128)!==0,g;if((g=h)||(g=i!==null&&i.memoizedState===null?!1:(Ft.current&2)!==0),g&&(u=!0,s.flags&=-129),g=(s.flags&32)!==0,s.flags&=-33,i===null){if(Ze){if(u?An(s):Nn(),(i=Et)?(i=Pv(i,ps),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:xn!==null?{id:Os,overflow:zs}:null,retryLane:536870912,hydrationErrors:null},r=hm(i),r.return=s,s.child=r,Ci=s,Et=null)):i=null,i===null)throw Tn(s);return Md(i)?s.lanes=32:s.lanes=536870912,null}var b=l.children;return l=l.fallback,u?(Nn(),u=s.mode,b=ic({mode:"hidden",children:b},u),l=_r(l,u,r,null),b.return=s,l.return=s,b.sibling=l,s.child=b,l=s.child,l.memoizedState=$h(r),l.childLanes=Vh(i,g,r),s.memoizedState=Yh,ll(null,l)):(An(s),Xh(s,b))}var T=i.memoizedState;if(T!==null&&(b=T.dehydrated,b!==null)){if(h)s.flags&256?(An(s),s.flags&=-257,s=Gh(i,s,r)):s.memoizedState!==null?(Nn(),s.child=i.child,s.flags|=128,s=null):(Nn(),b=l.fallback,u=s.mode,l=ic({mode:"visible",children:l.children},u),b=_r(b,u,r,null),b.flags|=2,l.return=s,b.return=s,l.sibling=b,s.child=l,wr(s,i.child,null,r),l=s.child,l.memoizedState=$h(r),l.childLanes=Vh(i,g,r),s.memoizedState=Yh,s=ll(null,l));else if(An(s),Md(b)){if(g=b.nextSibling&&b.nextSibling.dataset,g)var P=g.dgst;g=P,l=Error(a(419)),l.stack="",l.digest=g,Xa({value:l,source:null,stack:null}),s=Gh(i,s,r)}else if(Xt||ea(i,s,r,!1),g=(r&i.childLanes)!==0,Xt||g){if(g=St,g!==null&&(l=Ri(g,r),l!==0&&l!==T.retryLane))throw T.retryLane=l,pr(i,l),$i(g,i,l),qh;Rd(b)||hc(),s=Gh(i,s,r)}else Rd(b)?(s.flags|=192,s.child=i.child,s=null):(i=T.treeContext,Et=ms(b.nextSibling),Ci=s,Ze=!0,En=null,ps=!1,i!==null&&pm(s,i),s=Xh(s,l.children),s.flags|=4096);return s}return u?(Nn(),b=l.fallback,u=s.mode,T=i.child,P=T.sibling,l=Zs(T,{mode:"hidden",children:l.children}),l.subtreeFlags=T.subtreeFlags&65011712,P!==null?b=Zs(P,b):(b=_r(b,u,r,null),b.flags|=2),b.return=s,l.return=s,l.sibling=b,s.child=l,ll(null,l),l=s.child,b=i.child.memoizedState,b===null?b=$h(r):(u=b.cachePool,u!==null?(T=$t._currentValue,u=u.parent!==T?{parent:T,pool:T}:u):u=Sm(),b={baseLanes:b.baseLanes|r,cachePool:u}),l.memoizedState=b,l.childLanes=Vh(i,g,r),s.memoizedState=Yh,ll(i.child,l)):(An(s),r=i.child,i=r.sibling,r=Zs(r,{mode:"visible",children:l.children}),r.return=s,r.sibling=null,i!==null&&(g=s.deletions,g===null?(s.deletions=[i],s.flags|=16):g.push(i)),s.child=r,s.memoizedState=null,r)}function Xh(i,s){return s=ic({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function ic(i,s){return i=Qi(22,i,null,s),i.lanes=0,i}function Gh(i,s,r){return wr(s,i.child,null,r),i=Xh(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Bg(i,s,r){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),hh(i.return,s,r)}function Zh(i,s,r,l,u,h){var g=i.memoizedState;g===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:u,treeForkCount:h}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=l,g.tail=r,g.tailMode=u,g.treeForkCount=h)}function Lg(i,s,r){var l=s.pendingProps,u=l.revealOrder,h=l.tail;l=l.children;var g=Ft.current,b=(g&2)!==0;if(b?(g=g&1|2,s.flags|=128):g&=1,ne(Ft,g),Ei(i,s,l,r),l=Ze?Va:0,!b&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Bg(i,r,s);else if(i.tag===19)Bg(i,r,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(u){case"forwards":for(r=s.child,u=null;r!==null;)i=r.alternate,i!==null&&qo(i)===null&&(u=r),r=r.sibling;r=u,r===null?(u=s.child,s.child=null):(u=r.sibling,r.sibling=null),Zh(s,!1,u,r,h,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,u=s.child,s.child=null;u!==null;){if(i=u.alternate,i!==null&&qo(i)===null){s.child=u;break}i=u.sibling,u.sibling=r,r=u,u=i}Zh(s,!0,r,null,h,l);break;case"together":Zh(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function nn(i,s,r){if(i!==null&&(s.dependencies=i.dependencies),On|=s.lanes,(r&s.childLanes)===0)if(i!==null){if(ea(i,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(a(153));if(s.child!==null){for(i=s.child,r=Zs(i,i.pendingProps),s.child=r,r.return=s;i.sibling!==null;)i=i.sibling,r=r.sibling=Zs(i,i.pendingProps),r.return=s;r.sibling=null}return s.child}function Qh(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&zo(i)))}function j1(i,s,r){switch(s.tag){case 3:De(s,s.stateNode.containerInfo),kn(s,$t,i.memoizedState.cache),mr();break;case 27:case 5:Me(s);break;case 4:De(s,s.stateNode.containerInfo);break;case 10:kn(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Ch(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(An(s),s.flags|=128,null):(r&s.child.childLanes)!==0?Ng(i,s,r):(An(s),i=nn(i,s,r),i!==null?i.sibling:null);An(s);break;case 19:var u=(i.flags&128)!==0;if(l=(r&s.childLanes)!==0,l||(ea(i,s,r,!1),l=(r&s.childLanes)!==0),u){if(l)return Lg(i,s,r);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ne(Ft,Ft.current),l)break;return null;case 22:return s.lanes=0,Tg(i,s,r,s.pendingProps);case 24:kn(s,$t,i.memoizedState.cache)}return nn(i,s,r)}function Og(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps)Xt=!0;else{if(!Qh(i,r)&&(s.flags&128)===0)return Xt=!1,j1(i,s,r);Xt=(i.flags&131072)!==0}else Xt=!1,Ze&&(s.flags&1048576)!==0&&fm(s,Va,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=Sr(s.elementType),s.type=i,typeof i=="function")sh(i)?(l=xr(i,l),s.tag=1,s=Mg(null,s,i,l,r)):(s.tag=0,s=Wh(null,s,i,l,r));else{if(i!=null){var u=i.$$typeof;if(u===H){s.tag=11,s=Cg(null,s,i,l,r);break e}else if(u===B){s.tag=14,s=xg(null,s,i,l,r);break e}}throw s=J(i)||i,Error(a(306,s,""))}}return s;case 0:return Wh(i,s,s.type,s.pendingProps,r);case 1:return l=s.type,u=xr(l,s.pendingProps),Mg(i,s,l,u,r);case 3:e:{if(De(s,s.stateNode.containerInfo),i===null)throw Error(a(387));l=s.pendingProps;var h=s.memoizedState;u=h.element,vh(i,s),il(s,l,null,r);var g=s.memoizedState;if(l=g.cache,kn(s,$t,l),l!==h.cache&&dh(s,[$t],r,!0),tl(),l=g.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:g.cache},s.updateQueue.baseState=h,s.memoizedState=h,s.flags&256){s=Ag(i,s,l,r);break e}else if(l!==u){u=hs(Error(a(424)),s),Xa(u),s=Ag(i,s,l,r);break e}else for(i=s.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Et=ms(i.firstChild),Ci=s,Ze=!0,En=null,ps=!0,r=Tm(s,null,l,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(mr(),l===u){s=nn(i,s,r);break e}Ei(i,s,l,r)}s=s.child}return s;case 26:return tc(i,s),i===null?(r=Yv(s.type,null,s.pendingProps,null))?s.memoizedState=r:Ze||(r=s.type,i=s.pendingProps,l=vc(me.current).createElement(r),l[yt]=s,l[Ot]=i,Ti(l,r,i),lt(l),s.stateNode=l):s.memoizedState=Yv(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Me(s),i===null&&Ze&&(l=s.stateNode=Fv(s.type,s.pendingProps,me.current),Ci=s,ps=!0,u=Et,Pn(s.type)?(Ad=u,Et=ms(l.firstChild)):Et=u),Ei(i,s,s.pendingProps.children,r),tc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Ze&&((u=l=Et)&&(l=pC(l,s.type,s.pendingProps,ps),l!==null?(s.stateNode=l,Ci=s,Et=ms(l.firstChild),ps=!1,u=!0):u=!1),u||Tn(s)),Me(s),u=s.type,h=s.pendingProps,g=i!==null?i.memoizedProps:null,l=h.children,Td(u,h)?l=null:g!==null&&Td(u,g)&&(s.flags|=32),s.memoizedState!==null&&(u=Eh(i,s,R1,null,null,r),wl._currentValue=u),tc(i,s),Ei(i,s,l,r),s.child;case 6:return i===null&&Ze&&((i=r=Et)&&(r=_C(r,s.pendingProps,ps),r!==null?(s.stateNode=r,Ci=s,Et=null,i=!0):i=!1),i||Tn(s)),null;case 13:return Ng(i,s,r);case 4:return De(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=wr(s,null,l,r):Ei(i,s,l,r),s.child;case 11:return Cg(i,s,s.type,s.pendingProps,r);case 7:return Ei(i,s,s.pendingProps,r),s.child;case 8:return Ei(i,s,s.pendingProps.children,r),s.child;case 12:return Ei(i,s,s.pendingProps.children,r),s.child;case 10:return l=s.pendingProps,kn(s,s.type,l.value),Ei(i,s,l.children,r),s.child;case 9:return u=s.type._context,l=s.pendingProps.children,vr(s),u=xi(u),l=l(u),s.flags|=1,Ei(i,s,l,r),s.child;case 14:return xg(i,s,s.type,s.pendingProps,r);case 15:return Eg(i,s,s.type,s.pendingProps,r);case 19:return Lg(i,s,r);case 31:return H1(i,s,r);case 22:return Tg(i,s,r,s.pendingProps);case 24:return vr(s),l=xi($t),i===null?(u=_h(),u===null&&(u=St,h=fh(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=r),u=h),s.memoizedState={parent:l,cache:u},gh(s),kn(s,$t,u)):((i.lanes&r)!==0&&(vh(i,s),il(s,null,null,r),tl()),u=i.memoizedState,h=s.memoizedState,u.parent!==l?(u={parent:l,cache:l},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),kn(s,$t,l)):(l=h.cache,kn(s,$t,l),l!==u.cache&&dh(s,[$t],r,!0))),Ei(i,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function rn(i){i.flags|=4}function Jh(i,s,r,l,u){if((s=(i.mode&32)!==0)&&(s=!1),s){if(i.flags|=16777216,(u&335544128)===u)if(i.stateNode.complete)i.flags|=8192;else if(ov())i.flags|=8192;else throw br=Po,mh}else i.flags&=-16777217}function zg(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Zv(s))if(ov())i.flags|=8192;else throw br=Po,mh}function sc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Nt():536870912,i.lanes|=s,da|=s)}function ol(i,s){if(!Ze)switch(i.tailMode){case"hidden":s=i.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?i.tail=null:r.sibling=null;break;case"collapsed":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function Tt(i){var s=i.alternate!==null&&i.alternate.child===i.child,r=0,l=0;if(s)for(var u=i.child;u!==null;)r|=u.lanes|u.childLanes,l|=u.subtreeFlags&65011712,l|=u.flags&65011712,u.return=i,u=u.sibling;else for(u=i.child;u!==null;)r|=u.lanes|u.childLanes,l|=u.subtreeFlags,l|=u.flags,u.return=i,u=u.sibling;return i.subtreeFlags|=l,i.childLanes=r,s}function U1(i,s,r){var l=s.pendingProps;switch(lh(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Tt(s),null;case 1:return Tt(s),null;case 3:return r=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),en($t),Ce(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(i===null||i.child===null)&&(Jr(s)?rn(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ch())),Tt(s),null;case 26:var u=s.type,h=s.memoizedState;return i===null?(rn(s),h!==null?(Tt(s),zg(s,h)):(Tt(s),Jh(s,u,null,l,r))):h?h!==i.memoizedState?(rn(s),Tt(s),zg(s,h)):(Tt(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&rn(s),Tt(s),Jh(s,u,i,l,r)),null;case 27:if(et(s),r=me.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&rn(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return Tt(s),null}i=he.current,Jr(s)?_m(s):(i=Fv(u,l,r),s.stateNode=i,rn(s))}return Tt(s),null;case 5:if(et(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&rn(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return Tt(s),null}if(h=he.current,Jr(s))_m(s);else{var g=vc(me.current);switch(h){case 1:h=g.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=g.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=g.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=g.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=g.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?g.createElement("select",{is:l.is}):g.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?g.createElement(u,{is:l.is}):g.createElement(u)}}h[yt]=s,h[Ot]=l;e:for(g=s.child;g!==null;){if(g.tag===5||g.tag===6)h.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===s)break e;for(;g.sibling===null;){if(g.return===null||g.return===s)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}s.stateNode=h;e:switch(Ti(h,u,l),u){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&rn(s)}}return Tt(s),Jh(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,r),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&rn(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(a(166));if(i=me.current,Jr(s)){if(i=s.stateNode,r=s.memoizedProps,l=null,u=Ci,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}i[yt]=s,i=!!(i.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||Nv(i.nodeValue,r)),i||Tn(s,!0)}else i=vc(i).createTextNode(l),i[yt]=s,s.stateNode=i}return Tt(s),null;case 31:if(r=s.memoizedState,i===null||i.memoizedState!==null){if(l=Jr(s),r!==null){if(i===null){if(!l)throw Error(a(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(557));i[yt]=s}else mr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Tt(s),i=!1}else r=ch(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=r),i=!0;if(!i)return s.flags&256?(es(s),s):(es(s),null);if((s.flags&128)!==0)throw Error(a(558))}return Tt(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=Jr(s),l!==null&&l.dehydrated!==null){if(i===null){if(!u)throw Error(a(318));if(u=s.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(a(317));u[yt]=s}else mr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Tt(s),u=!1}else u=ch(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(es(s),s):(es(s),null)}return es(s),(s.flags&128)!==0?(s.lanes=r,s):(r=l!==null,i=i!==null&&i.memoizedState!==null,r&&(l=s.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==u&&(l.flags|=2048)),r!==i&&r&&(s.child.flags|=8192),sc(s,s.updateQueue),Tt(s),null);case 4:return Ce(),i===null&&bd(s.stateNode.containerInfo),Tt(s),null;case 10:return en(s.type),Tt(s),null;case 19:if(I(Ft),l=s.memoizedState,l===null)return Tt(s),null;if(u=(s.flags&128)!==0,h=l.rendering,h===null)if(u)ol(l,!1);else{if(jt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(h=qo(i),h!==null){for(s.flags|=128,ol(l,!1),i=h.updateQueue,s.updateQueue=i,sc(s,i),s.subtreeFlags=0,i=r,r=s.child;r!==null;)um(r,i),r=r.sibling;return ne(Ft,Ft.current&1|2),Ze&&Qs(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&rt()>oc&&(s.flags|=128,u=!0,ol(l,!1),s.lanes=4194304)}else{if(!u)if(i=qo(h),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,sc(s,i),ol(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Ze)return Tt(s),null}else 2*rt()-l.renderingStartTime>oc&&r!==536870912&&(s.flags|=128,u=!0,ol(l,!1),s.lanes=4194304);l.isBackwards?(h.sibling=s.child,s.child=h):(i=l.last,i!==null?i.sibling=h:s.child=h,l.last=h)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=rt(),i.sibling=null,r=Ft.current,ne(Ft,u?r&1|2:r&1),Ze&&Qs(s,l.treeForkCount),i):(Tt(s),null);case 22:case 23:return es(s),wh(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(r&536870912)!==0&&(s.flags&128)===0&&(Tt(s),s.subtreeFlags&6&&(s.flags|=8192)):Tt(s),r=s.updateQueue,r!==null&&sc(s,r.retryQueue),r=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==r&&(s.flags|=2048),i!==null&&I(yr),null;case 24:return r=null,i!==null&&(r=i.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),en($t),Tt(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function P1(i,s){switch(lh(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return en($t),Ce(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return et(s),null;case 31:if(s.memoizedState!==null){if(es(s),s.alternate===null)throw Error(a(340));mr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(es(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(a(340));mr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return I(Ft),null;case 4:return Ce(),null;case 10:return en(s.type),null;case 22:case 23:return es(s),wh(),i!==null&&I(yr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return en($t),null;case 25:return null;default:return null}}function Hg(i,s){switch(lh(s),s.tag){case 3:en($t),Ce();break;case 26:case 27:case 5:et(s);break;case 4:Ce();break;case 31:s.memoizedState!==null&&es(s);break;case 13:es(s);break;case 19:I(Ft);break;case 10:en(s.type);break;case 22:case 23:es(s),wh(),i!==null&&I(yr);break;case 24:en($t)}}function cl(i,s){try{var r=s.updateQueue,l=r!==null?r.lastEffect:null;if(l!==null){var u=l.next;r=u;do{if((r.tag&i)===i){l=void 0;var h=r.create,g=r.inst;l=h(),g.destroy=l}r=r.next}while(r!==u)}}catch(b){ht(s,s.return,b)}}function Bn(i,s,r){try{var l=s.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var h=u.next;l=h;do{if((l.tag&i)===i){var g=l.inst,b=g.destroy;if(b!==void 0){g.destroy=void 0,u=s;var T=r,P=b;try{P()}catch(Z){ht(u,T,Z)}}}l=l.next}while(l!==h)}}catch(Z){ht(s,s.return,Z)}}function jg(i){var s=i.updateQueue;if(s!==null){var r=i.stateNode;try{Dm(s,r)}catch(l){ht(i,i.return,l)}}}function Ug(i,s,r){r.props=xr(i.type,i.memoizedProps),r.state=i.memoizedState;try{r.componentWillUnmount()}catch(l){ht(i,s,l)}}function ul(i,s){try{var r=i.ref;if(r!==null){switch(i.tag){case 26:case 27:case 5:var l=i.stateNode;break;case 30:l=i.stateNode;break;default:l=i.stateNode}typeof r=="function"?i.refCleanup=r(l):r.current=l}}catch(u){ht(i,s,u)}}function Hs(i,s){var r=i.ref,l=i.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(u){ht(i,s,u)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){ht(i,s,u)}else r.current=null}function Pg(i){var s=i.type,r=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&l.focus();break e;case"img":r.src?l.src=r.src:r.srcSet&&(l.srcset=r.srcSet)}}catch(u){ht(i,i.return,u)}}function ed(i,s,r){try{var l=i.stateNode;oC(l,i.type,r,s),l[Ot]=s}catch(u){ht(i,i.return,u)}}function Kg(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Pn(i.type)||i.tag===4}function td(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Kg(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&&Pn(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 id(i,s,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(i,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(i),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Xs));else if(l!==4&&(l===27&&Pn(i.type)&&(r=i.stateNode,s=null),i=i.child,i!==null))for(id(i,s,r),i=i.sibling;i!==null;)id(i,s,r),i=i.sibling}function nc(i,s,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?r.insertBefore(i,s):r.appendChild(i);else if(l!==4&&(l===27&&Pn(i.type)&&(r=i.stateNode),i=i.child,i!==null))for(nc(i,s,r),i=i.sibling;i!==null;)nc(i,s,r),i=i.sibling}function Ig(i){var s=i.stateNode,r=i.memoizedProps;try{for(var l=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Ti(s,l,r),s[yt]=i,s[Ot]=r}catch(h){ht(i,i.return,h)}}var an=!1,Gt=!1,sd=!1,Fg=typeof WeakSet=="function"?WeakSet:Set,fi=null;function K1(i,s){if(i=i.containerInfo,xd=Ec,i=tm(i),Gu(i)){if("selectionStart"in i)var r={start:i.selectionStart,end:i.selectionEnd};else e:{r=(r=i.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var u=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var g=0,b=-1,T=-1,P=0,Z=0,re=i,F=null;t:for(;;){for(var $;re!==r||u!==0&&re.nodeType!==3||(b=g+u),re!==h||l!==0&&re.nodeType!==3||(T=g+l),re.nodeType===3&&(g+=re.nodeValue.length),($=re.firstChild)!==null;)F=re,re=$;for(;;){if(re===i)break t;if(F===r&&++P===u&&(b=g),F===h&&++Z===l&&(T=g),($=re.nextSibling)!==null)break;re=F,F=re.parentNode}re=$}r=b===-1||T===-1?null:{start:b,end:T}}else r=null}r=r||{start:0,end:0}}else r=null;for(Ed={focusedElem:i,selectionRange:r},Ec=!1,fi=s;fi!==null;)if(s=fi,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,fi=i;else for(;fi!==null;){switch(s=fi,h=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(r=0;r<i.length;r++)u=i[r],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&h!==null){i=void 0,r=s,u=h.memoizedProps,h=h.memoizedState,l=r.stateNode;try{var Se=xr(r.type,u);i=l.getSnapshotBeforeUpdate(Se,h),l.__reactInternalSnapshotBeforeUpdate=i}catch(Ae){ht(r,r.return,Ae)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,r=i.nodeType,r===9)Dd(i);else if(r===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Dd(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(a(163))}if(i=s.sibling,i!==null){i.return=s.return,fi=i;break}fi=s.return}}function qg(i,s,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:on(i,r),l&4&&cl(5,r);break;case 1:if(on(i,r),l&4)if(i=r.stateNode,s===null)try{i.componentDidMount()}catch(g){ht(r,r.return,g)}else{var u=xr(r.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(g){ht(r,r.return,g)}}l&64&&jg(r),l&512&&ul(r,r.return);break;case 3:if(on(i,r),l&64&&(i=r.updateQueue,i!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{Dm(i,s)}catch(g){ht(r,r.return,g)}}break;case 27:s===null&&l&4&&Ig(r);case 26:case 5:on(i,r),s===null&&l&4&&Pg(r),l&512&&ul(r,r.return);break;case 12:on(i,r);break;case 31:on(i,r),l&4&&$g(i,r);break;case 13:on(i,r),l&4&&Vg(i,r),l&64&&(i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(r=G1.bind(null,r),mC(i,r))));break;case 22:if(l=r.memoizedState!==null||an,!l){s=s!==null&&s.memoizedState!==null||Gt,u=an;var h=Gt;an=l,(Gt=s)&&!h?cn(i,r,(r.subtreeFlags&8772)!==0):on(i,r),an=u,Gt=h}break;case 30:break;default:on(i,r)}}function Wg(i){var s=i.alternate;s!==null&&(i.alternate=null,Wg(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&le(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Mt=null,Fi=!1;function ln(i,s,r){for(r=r.child;r!==null;)Yg(i,s,r),r=r.sibling}function Yg(i,s,r){if(ti&&typeof ti.onCommitFiberUnmount=="function")try{ti.onCommitFiberUnmount(Li,r)}catch{}switch(r.tag){case 26:Gt||Hs(r,s),ln(i,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Gt||Hs(r,s);var l=Mt,u=Fi;Pn(r.type)&&(Mt=r.stateNode,Fi=!1),ln(i,s,r),yl(r.stateNode),Mt=l,Fi=u;break;case 5:Gt||Hs(r,s);case 6:if(l=Mt,u=Fi,Mt=null,ln(i,s,r),Mt=l,Fi=u,Mt!==null)if(Fi)try{(Mt.nodeType===9?Mt.body:Mt.nodeName==="HTML"?Mt.ownerDocument.body:Mt).removeChild(r.stateNode)}catch(h){ht(r,s,h)}else try{Mt.removeChild(r.stateNode)}catch(h){ht(r,s,h)}break;case 18:Mt!==null&&(Fi?(i=Mt,jv(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.stateNode),Sa(i)):jv(Mt,r.stateNode));break;case 4:l=Mt,u=Fi,Mt=r.stateNode.containerInfo,Fi=!0,ln(i,s,r),Mt=l,Fi=u;break;case 0:case 11:case 14:case 15:Bn(2,r,s),Gt||Bn(4,r,s),ln(i,s,r);break;case 1:Gt||(Hs(r,s),l=r.stateNode,typeof l.componentWillUnmount=="function"&&Ug(r,s,l)),ln(i,s,r);break;case 21:ln(i,s,r);break;case 22:Gt=(l=Gt)||r.memoizedState!==null,ln(i,s,r),Gt=l;break;default:ln(i,s,r)}}function $g(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Sa(i)}catch(r){ht(s,s.return,r)}}}function Vg(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Sa(i)}catch(r){ht(s,s.return,r)}}function I1(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new Fg),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new Fg),s;default:throw Error(a(435,i.tag))}}function rc(i,s){var r=I1(i);s.forEach(function(l){if(!r.has(l)){r.add(l);var u=Z1.bind(null,i,l);l.then(u,u)}})}function qi(i,s){var r=s.deletions;if(r!==null)for(var l=0;l<r.length;l++){var u=r[l],h=i,g=s,b=g;e:for(;b!==null;){switch(b.tag){case 27:if(Pn(b.type)){Mt=b.stateNode,Fi=!1;break e}break;case 5:Mt=b.stateNode,Fi=!1;break e;case 3:case 4:Mt=b.stateNode.containerInfo,Fi=!0;break e}b=b.return}if(Mt===null)throw Error(a(160));Yg(h,g,u),Mt=null,Fi=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Xg(s,i),s=s.sibling}var As=null;function Xg(i,s){var r=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:qi(s,i),Wi(i),l&4&&(Bn(3,i,i.return),cl(3,i),Bn(5,i,i.return));break;case 1:qi(s,i),Wi(i),l&512&&(Gt||r===null||Hs(r,r.return)),l&64&&an&&(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=As;if(qi(s,i),Wi(i),l&512&&(Gt||r===null||Hs(r,r.return)),l&4){var h=r!==null?r.memoizedState:null;if(l=i.memoizedState,r===null)if(l===null)if(i.stateNode===null){e:{l=i.type,r=i.memoizedProps,u=u.ownerDocument||u;t:switch(l){case"title":h=u.getElementsByTagName("title")[0],(!h||h[q]||h[yt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(l),u.head.insertBefore(h,u.querySelector("head > title"))),Ti(h,l,r),h[yt]=i,lt(h),l=h;break e;case"link":var g=Xv("link","href",u).get(l+(r.href||""));if(g){for(var b=0;b<g.length;b++)if(h=g[b],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){g.splice(b,1);break t}}h=u.createElement(l),Ti(h,l,r),u.head.appendChild(h);break;case"meta":if(g=Xv("meta","content",u).get(l+(r.content||""))){for(b=0;b<g.length;b++)if(h=g[b],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){g.splice(b,1);break t}}h=u.createElement(l),Ti(h,l,r),u.head.appendChild(h);break;default:throw Error(a(468,l))}h[yt]=i,lt(h),l=h}i.stateNode=l}else Gv(u,i.type,i.stateNode);else i.stateNode=Vv(u,l,i.memoizedProps);else h!==l?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,l===null?Gv(u,i.type,i.stateNode):Vv(u,l,i.memoizedProps)):l===null&&i.stateNode!==null&&ed(i,i.memoizedProps,r.memoizedProps)}break;case 27:qi(s,i),Wi(i),l&512&&(Gt||r===null||Hs(r,r.return)),r!==null&&l&4&&ed(i,i.memoizedProps,r.memoizedProps);break;case 5:if(qi(s,i),Wi(i),l&512&&(Gt||r===null||Hs(r,r.return)),i.flags&32){u=i.stateNode;try{Fr(u,"")}catch(Se){ht(i,i.return,Se)}}l&4&&i.stateNode!=null&&(u=i.memoizedProps,ed(i,u,r!==null?r.memoizedProps:u)),l&1024&&(sd=!0);break;case 6:if(qi(s,i),Wi(i),l&4){if(i.stateNode===null)throw Error(a(162));l=i.memoizedProps,r=i.stateNode;try{r.nodeValue=l}catch(Se){ht(i,i.return,Se)}}break;case 3:if(bc=null,u=As,As=yc(s.containerInfo),qi(s,i),As=u,Wi(i),l&4&&r!==null&&r.memoizedState.isDehydrated)try{Sa(s.containerInfo)}catch(Se){ht(i,i.return,Se)}sd&&(sd=!1,Gg(i));break;case 4:l=As,As=yc(i.stateNode.containerInfo),qi(s,i),Wi(i),As=l;break;case 12:qi(s,i),Wi(i);break;case 31:qi(s,i),Wi(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,rc(i,l)));break;case 13:qi(s,i),Wi(i),i.child.flags&8192&&i.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(lc=rt()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,rc(i,l)));break;case 22:u=i.memoizedState!==null;var T=r!==null&&r.memoizedState!==null,P=an,Z=Gt;if(an=P||u,Gt=Z||T,qi(s,i),Gt=Z,an=P,Wi(i),l&8192)e:for(s=i.stateNode,s._visibility=u?s._visibility&-2:s._visibility|1,u&&(r===null||T||an||Gt||Er(i)),r=null,s=i;;){if(s.tag===5||s.tag===26){if(r===null){T=r=s;try{if(h=T.stateNode,u)g=h.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{b=T.stateNode;var re=T.memoizedProps.style,F=re!=null&&re.hasOwnProperty("display")?re.display:null;b.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(Se){ht(T,T.return,Se)}}}else if(s.tag===6){if(r===null){T=s;try{T.stateNode.nodeValue=u?"":T.memoizedProps}catch(Se){ht(T,T.return,Se)}}}else if(s.tag===18){if(r===null){T=s;try{var $=T.stateNode;u?Uv($,!0):Uv(T.stateNode,!1)}catch(Se){ht(T,T.return,Se)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=i.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,rc(i,r))));break;case 19:qi(s,i),Wi(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,rc(i,l)));break;case 30:break;case 21:break;default:qi(s,i),Wi(i)}}function Wi(i){var s=i.flags;if(s&2){try{for(var r,l=i.return;l!==null;){if(Kg(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var u=r.stateNode,h=td(i);nc(i,h,u);break;case 5:var g=r.stateNode;r.flags&32&&(Fr(g,""),r.flags&=-33);var b=td(i);nc(i,b,g);break;case 3:case 4:var T=r.stateNode.containerInfo,P=td(i);id(i,P,T);break;default:throw Error(a(161))}}catch(Z){ht(i,i.return,Z)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Gg(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;Gg(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function on(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)qg(i,s.alternate,s),s=s.sibling}function Er(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:Bn(4,s,s.return),Er(s);break;case 1:Hs(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&Ug(s,s.return,r),Er(s);break;case 27:yl(s.stateNode);case 26:case 5:Hs(s,s.return),Er(s);break;case 22:s.memoizedState===null&&Er(s);break;case 30:Er(s);break;default:Er(s)}i=i.sibling}}function cn(i,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,u=i,h=s,g=h.flags;switch(h.tag){case 0:case 11:case 15:cn(u,h,r),cl(4,h);break;case 1:if(cn(u,h,r),l=h,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(P){ht(l,l.return,P)}if(l=h,u=l.updateQueue,u!==null){var b=l.stateNode;try{var T=u.shared.hiddenCallbacks;if(T!==null)for(u.shared.hiddenCallbacks=null,u=0;u<T.length;u++)km(T[u],b)}catch(P){ht(l,l.return,P)}}r&&g&64&&jg(h),ul(h,h.return);break;case 27:Ig(h);case 26:case 5:cn(u,h,r),r&&l===null&&g&4&&Pg(h),ul(h,h.return);break;case 12:cn(u,h,r);break;case 31:cn(u,h,r),r&&g&4&&$g(u,h);break;case 13:cn(u,h,r),r&&g&4&&Vg(u,h);break;case 22:h.memoizedState===null&&cn(u,h,r),ul(h,h.return);break;case 30:break;default:cn(u,h,r)}s=s.sibling}}function nd(i,s){var r=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==r&&(i!=null&&i.refCount++,r!=null&&Ga(r))}function rd(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&Ga(i))}function Ns(i,s,r,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Zg(i,s,r,l),s=s.sibling}function Zg(i,s,r,l){var u=s.flags;switch(s.tag){case 0:case 11:case 15:Ns(i,s,r,l),u&2048&&cl(9,s);break;case 1:Ns(i,s,r,l);break;case 3:Ns(i,s,r,l),u&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&Ga(i)));break;case 12:if(u&2048){Ns(i,s,r,l),i=s.stateNode;try{var h=s.memoizedProps,g=h.id,b=h.onPostCommit;typeof b=="function"&&b(g,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(T){ht(s,s.return,T)}}else Ns(i,s,r,l);break;case 31:Ns(i,s,r,l);break;case 13:Ns(i,s,r,l);break;case 23:break;case 22:h=s.stateNode,g=s.alternate,s.memoizedState!==null?h._visibility&2?Ns(i,s,r,l):hl(i,s):h._visibility&2?Ns(i,s,r,l):(h._visibility|=2,ca(i,s,r,l,(s.subtreeFlags&10256)!==0||!1)),u&2048&&nd(g,s);break;case 24:Ns(i,s,r,l),u&2048&&rd(s.alternate,s);break;default:Ns(i,s,r,l)}}function ca(i,s,r,l,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var h=i,g=s,b=r,T=l,P=g.flags;switch(g.tag){case 0:case 11:case 15:ca(h,g,b,T,u),cl(8,g);break;case 23:break;case 22:var Z=g.stateNode;g.memoizedState!==null?Z._visibility&2?ca(h,g,b,T,u):hl(h,g):(Z._visibility|=2,ca(h,g,b,T,u)),u&&P&2048&&nd(g.alternate,g);break;case 24:ca(h,g,b,T,u),u&&P&2048&&rd(g.alternate,g);break;default:ca(h,g,b,T,u)}s=s.sibling}}function hl(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=i,l=s,u=l.flags;switch(l.tag){case 22:hl(r,l),u&2048&&nd(l.alternate,l);break;case 24:hl(r,l),u&2048&&rd(l.alternate,l);break;default:hl(r,l)}s=s.sibling}}var dl=8192;function ua(i,s,r){if(i.subtreeFlags&dl)for(i=i.child;i!==null;)Qg(i,s,r),i=i.sibling}function Qg(i,s,r){switch(i.tag){case 26:ua(i,s,r),i.flags&dl&&i.memoizedState!==null&&DC(r,As,i.memoizedState,i.memoizedProps);break;case 5:ua(i,s,r);break;case 3:case 4:var l=As;As=yc(i.stateNode.containerInfo),ua(i,s,r),As=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=dl,dl=16777216,ua(i,s,r),dl=l):ua(i,s,r));break;default:ua(i,s,r)}}function Jg(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function fl(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var l=s[r];fi=l,tv(l,i)}Jg(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)ev(i),i=i.sibling}function ev(i){switch(i.tag){case 0:case 11:case 15:fl(i),i.flags&2048&&Bn(9,i,i.return);break;case 3:fl(i);break;case 12:fl(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,ac(i)):fl(i);break;default:fl(i)}}function ac(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var l=s[r];fi=l,tv(l,i)}Jg(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:Bn(8,s,s.return),ac(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,ac(s));break;default:ac(s)}i=i.sibling}}function tv(i,s){for(;fi!==null;){var r=fi;switch(r.tag){case 0:case 11:case 15:Bn(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var l=r.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ga(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,fi=l;else e:for(r=i;fi!==null;){l=fi;var u=l.sibling,h=l.return;if(Wg(l),l===r){fi=null;break e}if(u!==null){u.return=h,fi=u;break e}fi=h}}}var F1={getCacheForType:function(i){var s=xi($t),r=s.data.get(i);return r===void 0&&(r=i(),s.data.set(i,r)),r},cacheSignal:function(){return xi($t).controller.signal}},q1=typeof WeakMap=="function"?WeakMap:Map,ot=0,St=null,We=null,$e=0,ut=0,ts=null,Ln=!1,ha=!1,ad=!1,un=0,jt=0,On=0,Tr=0,ld=0,is=0,da=0,pl=null,Yi=null,od=!1,lc=0,iv=0,oc=1/0,cc=null,zn=null,ni=0,Hn=null,fa=null,hn=0,cd=0,ud=null,sv=null,_l=0,hd=null;function ss(){return(ot&2)!==0&&$e!==0?$e&-$e:M.T!==null?gd():si()}function nv(){if(is===0)if(($e&536870912)===0||Ze){var i=ks;ks<<=1,(ks&3932160)===0&&(ks=262144),is=i}else is=536870912;return i=Ji.current,i!==null&&(i.flags|=32),is}function $i(i,s,r){(i===St&&(ut===2||ut===9)||i.cancelPendingCommit!==null)&&(pa(i,0),jn(i,$e,is,!1)),hi(i,r),((ot&2)===0||i!==St)&&(i===St&&((ot&2)===0&&(Tr|=r),jt===4&&jn(i,$e,is,!1)),js(i))}function rv(i,s,r){if((ot&6)!==0)throw Error(a(327));var l=!r&&(s&127)===0&&(s&i.expiredLanes)===0||Xe(i,s),u=l?$1(i,s):fd(i,s,!0),h=l;do{if(u===0){ha&&!l&&jn(i,s,0,!1);break}else{if(r=i.current.alternate,h&&!W1(r)){u=fd(i,s,!1),h=!1;continue}if(u===2){if(h=s,i.errorRecoveryDisabledLanes&h)var g=0;else g=i.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){s=g;e:{var b=i;u=pl;var T=b.current.memoizedState.isDehydrated;if(T&&(pa(b,g).flags|=256),g=fd(b,g,!1),g!==2){if(ad&&!T){b.errorRecoveryDisabledLanes|=h,Tr|=h,u=4;break e}h=Yi,Yi=u,h!==null&&(Yi===null?Yi=h:Yi.push.apply(Yi,h))}u=g}if(h=!1,u!==2)continue}}if(u===1){pa(i,0),jn(i,s,0,!0);break}e:{switch(l=i,h=u,h){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:jn(l,s,is,!Ln);break e;case 2:Yi=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(u=lc+300-rt(),10<u)){if(jn(l,s,is,!Ln),Dt(l,0,!0)!==0)break e;hn=s,l.timeoutHandle=zv(av.bind(null,l,r,Yi,cc,od,s,is,Tr,da,Ln,h,"Throttled",-0,0),u);break e}av(l,r,Yi,cc,od,s,is,Tr,da,Ln,h,null,-0,0)}}break}while(!0);js(i)}function av(i,s,r,l,u,h,g,b,T,P,Z,re,F,$){if(i.timeoutHandle=-1,re=s.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xs},Qg(s,h,re);var Se=(h&62914560)===h?lc-rt():(h&4194048)===h?iv-rt():0;if(Se=RC(re,Se),Se!==null){hn=h,i.cancelPendingCommit=Se(pv.bind(null,i,s,h,r,l,u,g,b,T,Z,re,null,F,$)),jn(i,h,g,!P);return}}pv(i,s,h,r,l,u,g,b,T)}function W1(i){for(var s=i;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var l=0;l<r.length;l++){var u=r[l],h=u.getSnapshot;u=u.value;try{if(!Zi(h(),u))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function jn(i,s,r,l){s&=~ld,s&=~Tr,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var u=s;0<u;){var h=31-Yt(u),g=1<<h;l[h]=-1,u&=~g}r!==0&&ii(i,r,s)}function uc(){return(ot&6)===0?(ml(0),!1):!0}function dd(){if(We!==null){if(ut===0)var i=We.return;else i=We,Js=gr=null,Dh(i),na=null,Qa=0,i=We;for(;i!==null;)Hg(i.alternate,i),i=i.return;We=null}}function pa(i,s){var r=i.timeoutHandle;r!==-1&&(i.timeoutHandle=-1,hC(r)),r=i.cancelPendingCommit,r!==null&&(i.cancelPendingCommit=null,r()),hn=0,dd(),St=i,We=r=Zs(i.current,null),$e=s,ut=0,ts=null,Ln=!1,ha=Xe(i,s),ad=!1,da=is=ld=Tr=On=jt=0,Yi=pl=null,od=!1,(s&8)!==0&&(s|=s&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=s;0<l;){var u=31-Yt(l),h=1<<u;s|=i[u],l&=~h}return un=s,Ao(),r}function lv(i,s){je=null,M.H=al,s===sa||s===Uo?(s=Cm(),ut=3):s===mh?(s=Cm(),ut=4):ut=s===qh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ts=s,We===null&&(jt=1,Jo(i,hs(s,i.current)))}function ov(){var i=Ji.current;return i===null?!0:($e&4194048)===$e?_s===null:($e&62914560)===$e||($e&536870912)!==0?i===_s:!1}function cv(){var i=M.H;return M.H=al,i===null?al:i}function uv(){var i=M.A;return M.A=F1,i}function hc(){jt=4,Ln||($e&4194048)!==$e&&Ji.current!==null||(ha=!0),(On&134217727)===0&&(Tr&134217727)===0||St===null||jn(St,$e,is,!1)}function fd(i,s,r){var l=ot;ot|=2;var u=cv(),h=uv();(St!==i||$e!==s)&&(cc=null,pa(i,s)),s=!1;var g=jt;e:do try{if(ut!==0&&We!==null){var b=We,T=ts;switch(ut){case 8:dd(),g=6;break e;case 3:case 2:case 9:case 6:Ji.current===null&&(s=!0);var P=ut;if(ut=0,ts=null,_a(i,b,T,P),r&&ha){g=0;break e}break;default:P=ut,ut=0,ts=null,_a(i,b,T,P)}}Y1(),g=jt;break}catch(Z){lv(i,Z)}while(!0);return s&&i.shellSuspendCounter++,Js=gr=null,ot=l,M.H=u,M.A=h,We===null&&(St=null,$e=0,Ao()),g}function Y1(){for(;We!==null;)hv(We)}function $1(i,s){var r=ot;ot|=2;var l=cv(),u=uv();St!==i||$e!==s?(cc=null,oc=rt()+500,pa(i,s)):ha=Xe(i,s);e:do try{if(ut!==0&&We!==null){s=We;var h=ts;t:switch(ut){case 1:ut=0,ts=null,_a(i,s,h,1);break;case 2:case 9:if(bm(h)){ut=0,ts=null,dv(s);break}s=function(){ut!==2&&ut!==9||St!==i||(ut=7),js(i)},h.then(s,s);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:bm(h)?(ut=0,ts=null,dv(s)):(ut=0,ts=null,_a(i,s,h,7));break;case 5:var g=null;switch(We.tag){case 26:g=We.memoizedState;case 5:case 27:var b=We;if(g?Zv(g):b.stateNode.complete){ut=0,ts=null;var T=b.sibling;if(T!==null)We=T;else{var P=b.return;P!==null?(We=P,dc(P)):We=null}break t}}ut=0,ts=null,_a(i,s,h,5);break;case 6:ut=0,ts=null,_a(i,s,h,6);break;case 8:dd(),jt=6;break e;default:throw Error(a(462))}}V1();break}catch(Z){lv(i,Z)}while(!0);return Js=gr=null,M.H=l,M.A=u,ot=r,We!==null?0:(St=null,$e=0,Ao(),jt)}function V1(){for(;We!==null&&!He();)hv(We)}function hv(i){var s=Og(i.alternate,i,un);i.memoizedProps=i.pendingProps,s===null?dc(i):We=s}function dv(i){var s=i,r=s.alternate;switch(s.tag){case 15:case 0:s=Rg(r,s,s.pendingProps,s.type,void 0,$e);break;case 11:s=Rg(r,s,s.pendingProps,s.type.render,s.ref,$e);break;case 5:Dh(s);default:Hg(r,s),s=We=um(s,un),s=Og(r,s,un)}i.memoizedProps=i.pendingProps,s===null?dc(i):We=s}function _a(i,s,r,l){Js=gr=null,Dh(s),na=null,Qa=0;var u=s.return;try{if(z1(i,u,s,r,$e)){jt=1,Jo(i,hs(r,i.current)),We=null;return}}catch(h){if(u!==null)throw We=u,h;jt=1,Jo(i,hs(r,i.current)),We=null;return}s.flags&32768?(Ze||l===1?i=!0:ha||($e&536870912)!==0?i=!1:(Ln=i=!0,(l===2||l===9||l===3||l===6)&&(l=Ji.current,l!==null&&l.tag===13&&(l.flags|=16384))),fv(s,i)):dc(s)}function dc(i){var s=i;do{if((s.flags&32768)!==0){fv(s,Ln);return}i=s.return;var r=U1(s.alternate,s,un);if(r!==null){We=r;return}if(s=s.sibling,s!==null){We=s;return}We=s=i}while(s!==null);jt===0&&(jt=5)}function fv(i,s){do{var r=P1(i.alternate,i);if(r!==null){r.flags&=32767,We=r;return}if(r=i.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(i=i.sibling,i!==null)){We=i;return}We=i=r}while(i!==null);jt=6,We=null}function pv(i,s,r,l,u,h,g,b,T){i.cancelPendingCommit=null;do fc();while(ni!==0);if((ot&6)!==0)throw Error(a(327));if(s!==null){if(s===i.current)throw Error(a(177));if(h=s.lanes|s.childLanes,h|=th,Rt(i,r,h,g,b,T),i===St&&(We=St=null,$e=0),fa=s,Hn=i,hn=r,cd=h,ud=u,sv=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,Q1(ui,function(){return yv(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=M.T,M.T=null,u=Y.p,Y.p=2,g=ot,ot|=4;try{K1(i,s,r)}finally{ot=g,Y.p=u,M.T=l}}ni=1,_v(),mv(),gv()}}function _v(){if(ni===1){ni=0;var i=Hn,s=fa,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var l=Y.p;Y.p=2;var u=ot;ot|=4;try{Xg(s,i);var h=Ed,g=tm(i.containerInfo),b=h.focusedElem,T=h.selectionRange;if(g!==b&&b&&b.ownerDocument&&em(b.ownerDocument.documentElement,b)){if(T!==null&&Gu(b)){var P=T.start,Z=T.end;if(Z===void 0&&(Z=P),"selectionStart"in b)b.selectionStart=P,b.selectionEnd=Math.min(Z,b.value.length);else{var re=b.ownerDocument||document,F=re&&re.defaultView||window;if(F.getSelection){var $=F.getSelection(),Se=b.textContent.length,Ae=Math.min(T.start,Se),mt=T.end===void 0?Ae:Math.min(T.end,Se);!$.extend&&Ae>mt&&(g=mt,mt=Ae,Ae=g);var O=J_(b,Ae),A=J_(b,mt);if(O&&A&&($.rangeCount!==1||$.anchorNode!==O.node||$.anchorOffset!==O.offset||$.focusNode!==A.node||$.focusOffset!==A.offset)){var U=re.createRange();U.setStart(O.node,O.offset),$.removeAllRanges(),Ae>mt?($.addRange(U),$.extend(A.node,A.offset)):(U.setEnd(A.node,A.offset),$.addRange(U))}}}}for(re=[],$=b;$=$.parentNode;)$.nodeType===1&&re.push({element:$,left:$.scrollLeft,top:$.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<re.length;b++){var te=re[b];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Ec=!!xd,Ed=xd=null}finally{ot=u,Y.p=l,M.T=r}}i.current=s,ni=2}}function mv(){if(ni===2){ni=0;var i=Hn,s=fa,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var l=Y.p;Y.p=2;var u=ot;ot|=4;try{qg(i,s.alternate,s)}finally{ot=u,Y.p=l,M.T=r}}ni=3}}function gv(){if(ni===4||ni===3){ni=0,it();var i=Hn,s=fa,r=hn,l=sv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?ni=5:(ni=0,fa=Hn=null,vv(i,i.pendingLanes));var u=i.pendingLanes;if(u===0&&(zn=null),Pi(r),s=s.stateNode,ti&&typeof ti.onCommitFiberRoot=="function")try{ti.onCommitFiberRoot(Li,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=M.T,u=Y.p,Y.p=2,M.T=null;try{for(var h=i.onRecoverableError,g=0;g<l.length;g++){var b=l[g];h(b.value,{componentStack:b.stack})}}finally{M.T=s,Y.p=u}}(hn&3)!==0&&fc(),js(i),u=i.pendingLanes,(r&261930)!==0&&(u&42)!==0?i===hd?_l++:(_l=0,hd=i):_l=0,ml(0)}}function vv(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,Ga(s)))}function fc(){return _v(),mv(),gv(),yv()}function yv(){if(ni!==5)return!1;var i=Hn,s=cd;cd=0;var r=Pi(hn),l=M.T,u=Y.p;try{Y.p=32>r?32:r,M.T=null,r=ud,ud=null;var h=Hn,g=hn;if(ni=0,fa=Hn=null,hn=0,(ot&6)!==0)throw Error(a(331));var b=ot;if(ot|=4,ev(h.current),Zg(h,h.current,g,r),ot=b,ml(0,!1),ti&&typeof ti.onPostCommitFiberRoot=="function")try{ti.onPostCommitFiberRoot(Li,h)}catch{}return!0}finally{Y.p=u,M.T=l,vv(i,s)}}function Sv(i,s,r){s=hs(r,s),s=Fh(i.stateNode,s,2),i=Mn(i,s,2),i!==null&&(hi(i,2),js(i))}function ht(i,s,r){if(i.tag===3)Sv(i,i,r);else for(;s!==null;){if(s.tag===3){Sv(s,i,r);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(zn===null||!zn.has(l))){i=hs(r,i),r=bg(2),l=Mn(s,r,2),l!==null&&(wg(r,l,s,i),hi(l,2),js(l));break}}s=s.return}}function pd(i,s,r){var l=i.pingCache;if(l===null){l=i.pingCache=new q1;var u=new Set;l.set(s,u)}else u=l.get(s),u===void 0&&(u=new Set,l.set(s,u));u.has(r)||(ad=!0,u.add(r),i=X1.bind(null,i,s,r),s.then(i,i))}function X1(i,s,r){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&r,i.warmLanes&=~r,St===i&&($e&r)===r&&(jt===4||jt===3&&($e&62914560)===$e&&300>rt()-lc?(ot&2)===0&&pa(i,0):ld|=r,da===$e&&(da=0)),js(i)}function bv(i,s){s===0&&(s=Nt()),i=pr(i,s),i!==null&&(hi(i,s),js(i))}function G1(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),bv(i,r)}function Z1(i,s){var r=0;switch(i.tag){case 31:case 13:var l=i.stateNode,u=i.memoizedState;u!==null&&(r=u.retryLane);break;case 19:l=i.stateNode;break;case 22:l=i.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(s),bv(i,r)}function Q1(i,s){return ct(i,s)}var pc=null,ma=null,_d=!1,_c=!1,md=!1,Un=0;function js(i){i!==ma&&i.next===null&&(ma===null?pc=ma=i:ma=ma.next=i),_c=!0,_d||(_d=!0,eC())}function ml(i,s){if(!md&&_c){md=!0;do for(var r=!1,l=pc;l!==null;){if(i!==0){var u=l.pendingLanes;if(u===0)var h=0;else{var g=l.suspendedLanes,b=l.pingedLanes;h=(1<<31-Yt(42|i)+1)-1,h&=u&~(g&~b),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,Ev(l,h))}else h=$e,h=Dt(l,l===St?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||Xe(l,h)||(r=!0,Ev(l,h));l=l.next}while(r);md=!1}}function J1(){wv()}function wv(){_c=_d=!1;var i=0;Un!==0&&uC()&&(i=Un);for(var s=rt(),r=null,l=pc;l!==null;){var u=l.next,h=Cv(l,s);h===0?(l.next=null,r===null?pc=u:r.next=u,u===null&&(ma=r)):(r=l,(i!==0||(h&3)!==0)&&(_c=!0)),l=u}ni!==0&&ni!==5||ml(i),Un!==0&&(Un=0)}function Cv(i,s){for(var r=i.suspendedLanes,l=i.pingedLanes,u=i.expirationTimes,h=i.pendingLanes&-62914561;0<h;){var g=31-Yt(h),b=1<<g,T=u[g];T===-1?((b&r)===0||(b&l)!==0)&&(u[g]=Kt(b,s)):T<=s&&(i.expiredLanes|=b),h&=~b}if(s=St,r=$e,r=Dt(i,i===s?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,r===0||i===s&&(ut===2||ut===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&V(l),i.callbackNode=null,i.callbackPriority=0;if((r&3)===0||Xe(i,r)){if(s=r&-r,s===i.callbackPriority)return s;switch(l!==null&&V(l),Pi(r)){case 2:case 8:r=ci;break;case 32:r=ui;break;case 268435456:r=Si;break;default:r=ui}return l=xv.bind(null,i),r=ct(r,l),i.callbackPriority=s,i.callbackNode=r,s}return l!==null&&l!==null&&V(l),i.callbackPriority=2,i.callbackNode=null,2}function xv(i,s){if(ni!==0&&ni!==5)return i.callbackNode=null,i.callbackPriority=0,null;var r=i.callbackNode;if(fc()&&i.callbackNode!==r)return null;var l=$e;return l=Dt(i,i===St?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(rv(i,l,s),Cv(i,rt()),i.callbackNode!=null&&i.callbackNode===r?xv.bind(null,i):null)}function Ev(i,s){if(fc())return null;rv(i,s,!0)}function eC(){dC(function(){(ot&6)!==0?ct(ls,J1):wv()})}function gd(){if(Un===0){var i=ta;i===0&&(i=Ts,Ts<<=1,(Ts&261888)===0&&(Ts=256)),Un=i}return Un}function Tv(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Co(""+i)}function kv(i,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,i.id&&r.setAttribute("form",i.id),s.parentNode.insertBefore(r,s),i=new FormData(i),r.parentNode.removeChild(r),i}function tC(i,s,r,l,u){if(s==="submit"&&r&&r.stateNode===u){var h=Tv((u[Ot]||null).action),g=l.submitter;g&&(s=(s=g[Ot]||null)?Tv(s.formAction):g.getAttribute("formAction"),s!==null&&(h=s,g=null));var b=new ko("action","action",null,l,u);i.push({event:b,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Un!==0){var T=g?kv(u,g):new FormData(u);Hh(r,{pending:!0,data:T,method:u.method,action:h},null,T)}}else typeof h=="function"&&(b.preventDefault(),T=g?kv(u,g):new FormData(u),Hh(r,{pending:!0,data:T,method:u.method,action:h},h,T))},currentTarget:u}]})}}for(var vd=0;vd<eh.length;vd++){var yd=eh[vd],iC=yd.toLowerCase(),sC=yd[0].toUpperCase()+yd.slice(1);Ms(iC,"on"+sC)}Ms(nm,"onAnimationEnd"),Ms(rm,"onAnimationIteration"),Ms(am,"onAnimationStart"),Ms("dblclick","onDoubleClick"),Ms("focusin","onFocus"),Ms("focusout","onBlur"),Ms(y1,"onTransitionRun"),Ms(S1,"onTransitionStart"),Ms(b1,"onTransitionCancel"),Ms(lm,"onTransitionEnd"),wn("onMouseEnter",["mouseout","mouseover"]),wn("onMouseLeave",["mouseout","mouseover"]),wn("onPointerEnter",["pointerout","pointerover"]),wn("onPointerLeave",["pointerout","pointerover"]),Gi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Gi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Gi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Gi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Gi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Gi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),nC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(gl));function Dv(i,s){s=(s&4)!==0;for(var r=0;r<i.length;r++){var l=i[r],u=l.event;l=l.listeners;e:{var h=void 0;if(s)for(var g=l.length-1;0<=g;g--){var b=l[g],T=b.instance,P=b.currentTarget;if(b=b.listener,T!==h&&u.isPropagationStopped())break e;h=b,u.currentTarget=P;try{h(u)}catch(Z){Mo(Z)}u.currentTarget=null,h=T}else for(g=0;g<l.length;g++){if(b=l[g],T=b.instance,P=b.currentTarget,b=b.listener,T!==h&&u.isPropagationStopped())break e;h=b,u.currentTarget=P;try{h(u)}catch(Z){Mo(Z)}u.currentTarget=null,h=T}}}}function Ye(i,s){var r=s[Vs];r===void 0&&(r=s[Vs]=new Set);var l=i+"__bubble";r.has(l)||(Rv(s,i,2,!1),r.add(l))}function Sd(i,s,r){var l=0;s&&(l|=4),Rv(r,i,l,s)}var mc="_reactListening"+Math.random().toString(36).slice(2);function bd(i){if(!i[mc]){i[mc]=!0,zt.forEach(function(r){r!=="selectionchange"&&(nC.has(r)||Sd(r,!1,i),Sd(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[mc]||(s[mc]=!0,Sd("selectionchange",!1,s))}}function Rv(i,s,r,l){switch(ny(s)){case 2:var u=NC;break;case 8:u=BC;break;default:u=zd}r=u.bind(null,s,r,i),u=void 0,!Ku||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),l?u!==void 0?i.addEventListener(s,r,{capture:!0,passive:u}):i.addEventListener(s,r,!0):u!==void 0?i.addEventListener(s,r,{passive:u}):i.addEventListener(s,r,!1)}function wd(i,s,r,l,u){var h=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var g=l.tag;if(g===3||g===4){var b=l.stateNode.containerInfo;if(b===u)break;if(g===4)for(g=l.return;g!==null;){var T=g.tag;if((T===3||T===4)&&g.stateNode.containerInfo===u)return;g=g.return}for(;b!==null;){if(g=ve(b),g===null)return;if(T=g.tag,T===5||T===6||T===26||T===27){l=h=g;continue e}b=b.parentNode}}l=l.return}L_(function(){var P=h,Z=Uu(r),re=[];e:{var F=om.get(i);if(F!==void 0){var $=ko,Se=i;switch(i){case"keypress":if(Eo(r)===0)break e;case"keydown":case"keyup":$=Zw;break;case"focusin":Se="focus",$=Wu;break;case"focusout":Se="blur",$=Wu;break;case"beforeblur":case"afterblur":$=Wu;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":$=H_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$=Uw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$=e1;break;case nm:case rm:case am:$=Iw;break;case lm:$=i1;break;case"scroll":case"scrollend":$=Hw;break;case"wheel":$=n1;break;case"copy":case"cut":case"paste":$=qw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$=U_;break;case"toggle":case"beforetoggle":$=a1}var Ae=(s&4)!==0,mt=!Ae&&(i==="scroll"||i==="scrollend"),O=Ae?F!==null?F+"Capture":null:F;Ae=[];for(var A=P,U;A!==null;){var te=A;if(U=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||U===null||O===null||(te=Ua(A,O),te!=null&&Ae.push(vl(A,te,U))),mt)break;A=A.return}0<Ae.length&&(F=new $(F,Se,null,r,Z),re.push({event:F,listeners:Ae}))}}if((s&7)===0){e:{if(F=i==="mouseover"||i==="pointerover",$=i==="mouseout"||i==="pointerout",F&&r!==ju&&(Se=r.relatedTarget||r.fromElement)&&(ve(Se)||Se[cs]))break e;if(($||F)&&(F=Z.window===Z?Z:(F=Z.ownerDocument)?F.defaultView||F.parentWindow:window,$?(Se=r.relatedTarget||r.toElement,$=P,Se=Se?ve(Se):null,Se!==null&&(mt=c(Se),Ae=Se.tag,Se!==mt||Ae!==5&&Ae!==27&&Ae!==6)&&(Se=null)):($=null,Se=P),$!==Se)){if(Ae=H_,te="onMouseLeave",O="onMouseEnter",A="mouse",(i==="pointerout"||i==="pointerover")&&(Ae=U_,te="onPointerLeave",O="onPointerEnter",A="pointer"),mt=$==null?F:Ge($),U=Se==null?F:Ge(Se),F=new Ae(te,A+"leave",$,r,Z),F.target=mt,F.relatedTarget=U,te=null,ve(Z)===P&&(Ae=new Ae(O,A+"enter",Se,r,Z),Ae.target=U,Ae.relatedTarget=mt,te=Ae),mt=te,$&&Se)t:{for(Ae=rC,O=$,A=Se,U=0,te=O;te;te=Ae(te))U++;te=0;for(var ke=A;ke;ke=Ae(ke))te++;for(;0<U-te;)O=Ae(O),U--;for(;0<te-U;)A=Ae(A),te--;for(;U--;){if(O===A||A!==null&&O===A.alternate){Ae=O;break t}O=Ae(O),A=Ae(A)}Ae=null}else Ae=null;$!==null&&Mv(re,F,$,Ae,!1),Se!==null&&mt!==null&&Mv(re,mt,Se,Ae,!0)}}e:{if(F=P?Ge(P):window,$=F.nodeName&&F.nodeName.toLowerCase(),$==="select"||$==="input"&&F.type==="file")var st=$_;else if(W_(F))if(V_)st=m1;else{st=p1;var we=f1}else $=F.nodeName,!$||$.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?P&&Hu(P.elementType)&&(st=$_):st=_1;if(st&&(st=st(i,P))){Y_(re,st,r,Z);break e}we&&we(i,F,P),i==="focusout"&&P&&F.type==="number"&&P.memoizedProps.value!=null&&zu(F,"number",F.value)}switch(we=P?Ge(P):window,i){case"focusin":(W_(we)||we.contentEditable==="true")&&($r=we,Zu=P,$a=null);break;case"focusout":$a=Zu=$r=null;break;case"mousedown":Qu=!0;break;case"contextmenu":case"mouseup":case"dragend":Qu=!1,im(re,r,Z);break;case"selectionchange":if(v1)break;case"keydown":case"keyup":im(re,r,Z)}var Ue;if($u)e:{switch(i){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else Yr?F_(i,r)&&(Ve="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(Ve="onCompositionStart");Ve&&(P_&&r.locale!=="ko"&&(Yr||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&Yr&&(Ue=O_()):(Cn=Z,Iu="value"in Cn?Cn.value:Cn.textContent,Yr=!0)),we=gc(P,Ve),0<we.length&&(Ve=new j_(Ve,i,null,r,Z),re.push({event:Ve,listeners:we}),Ue?Ve.data=Ue:(Ue=q_(r),Ue!==null&&(Ve.data=Ue)))),(Ue=o1?c1(i,r):u1(i,r))&&(Ve=gc(P,"onBeforeInput"),0<Ve.length&&(we=new j_("onBeforeInput","beforeinput",null,r,Z),re.push({event:we,listeners:Ve}),we.data=Ue)),tC(re,i,P,r,Z)}Dv(re,s)})}function vl(i,s,r){return{instance:i,listener:s,currentTarget:r}}function gc(i,s){for(var r=s+"Capture",l=[];i!==null;){var u=i,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=Ua(i,r),u!=null&&l.unshift(vl(i,u,h)),u=Ua(i,s),u!=null&&l.push(vl(i,u,h))),i.tag===3)return l;i=i.return}return[]}function rC(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Mv(i,s,r,l,u){for(var h=s._reactName,g=[];r!==null&&r!==l;){var b=r,T=b.alternate,P=b.stateNode;if(b=b.tag,T!==null&&T===l)break;b!==5&&b!==26&&b!==27||P===null||(T=P,u?(P=Ua(r,h),P!=null&&g.unshift(vl(r,P,T))):u||(P=Ua(r,h),P!=null&&g.push(vl(r,P,T)))),r=r.return}g.length!==0&&i.push({event:s,listeners:g})}var aC=/\r\n?/g,lC=/\u0000|\uFFFD/g;function Av(i){return(typeof i=="string"?i:""+i).replace(aC,`
9
- `).replace(lC,"")}function Nv(i,s){return s=Av(s),Av(i)===s}function _t(i,s,r,l,u,h){switch(r){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Fr(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Fr(i,""+l);break;case"className":xt(i,"class",l);break;case"tabIndex":xt(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":xt(i,r,l);break;case"style":N_(i,l,h);break;case"data":if(s!=="object"){xt(i,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||r!=="href")){i.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=Co(""+l),i.setAttribute(r,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(r==="formAction"?(s!=="input"&&_t(i,s,"name",u.name,u,null),_t(i,s,"formEncType",u.formEncType,u,null),_t(i,s,"formMethod",u.formMethod,u,null),_t(i,s,"formTarget",u.formTarget,u,null)):(_t(i,s,"encType",u.encType,u,null),_t(i,s,"method",u.method,u,null),_t(i,s,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=Co(""+l),i.setAttribute(r,l);break;case"onClick":l!=null&&(i.onclick=Xs);break;case"onScroll":l!=null&&Ye("scroll",i);break;case"onScrollEnd":l!=null&&Ye("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(u.children!=null)throw Error(a(60));i.innerHTML=r}}break;case"multiple":i.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":i.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){i.removeAttribute("xlink:href");break}r=Co(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,""+l):i.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,""):i.removeAttribute(r);break;case"capture":case"download":l===!0?i.setAttribute(r,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,l):i.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(r,l):i.removeAttribute(r);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(r):i.setAttribute(r,l);break;case"popover":Ye("beforetoggle",i),Ye("toggle",i),Je(i,"popover",l);break;case"xlinkActuate":di(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":di(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":di(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":di(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":di(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":di(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":di(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":di(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":di(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Je(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=Ow.get(r)||r,Je(i,r,l))}}function Cd(i,s,r,l,u,h){switch(r){case"style":N_(i,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(u.children!=null)throw Error(a(60));i.innerHTML=r}}break;case"children":typeof l=="string"?Fr(i,l):(typeof l=="number"||typeof l=="bigint")&&Fr(i,""+l);break;case"onScroll":l!=null&&Ye("scroll",i);break;case"onScrollEnd":l!=null&&Ye("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Xs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ls.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),s=r.slice(2,u?r.length-7:void 0),h=i[Ot]||null,h=h!=null?h[r]:null,typeof h=="function"&&i.removeEventListener(s,h,u),typeof l=="function")){typeof h!="function"&&h!==null&&(r in i?i[r]=null:i.hasAttribute(r)&&i.removeAttribute(r)),i.addEventListener(s,l,u);break e}r in i?i[r]=l:l===!0?i.setAttribute(r,""):Je(i,r,l)}}}function Ti(i,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",i),Ye("load",i);var l=!1,u=!1,h;for(h in r)if(r.hasOwnProperty(h)){var g=r[h];if(g!=null)switch(h){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:_t(i,s,h,g,r,null)}}u&&_t(i,s,"srcSet",r.srcSet,r,null),l&&_t(i,s,"src",r.src,r,null);return;case"input":Ye("invalid",i);var b=h=g=u=null,T=null,P=null;for(l in r)if(r.hasOwnProperty(l)){var Z=r[l];if(Z!=null)switch(l){case"name":u=Z;break;case"type":g=Z;break;case"checked":T=Z;break;case"defaultChecked":P=Z;break;case"value":h=Z;break;case"defaultValue":b=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(a(137,s));break;default:_t(i,s,l,Z,r,null)}}ja(i,h,b,T,P,g,u,!1);return;case"select":Ye("invalid",i),l=g=h=null;for(u in r)if(r.hasOwnProperty(u)&&(b=r[u],b!=null))switch(u){case"value":h=b;break;case"defaultValue":g=b;break;case"multiple":l=b;default:_t(i,s,u,b,r,null)}s=h,r=g,i.multiple=!!l,s!=null?Ir(i,!!l,s,!1):r!=null&&Ir(i,!!l,r,!0);return;case"textarea":Ye("invalid",i),h=u=l=null;for(g in r)if(r.hasOwnProperty(g)&&(b=r[g],b!=null))switch(g){case"value":l=b;break;case"defaultValue":u=b;break;case"children":h=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(a(91));break;default:_t(i,s,g,b,r,null)}M_(i,l,u,h);return;case"option":for(T in r)r.hasOwnProperty(T)&&(l=r[T],l!=null)&&(T==="selected"?i.selected=l&&typeof l!="function"&&typeof l!="symbol":_t(i,s,T,l,r,null));return;case"dialog":Ye("beforetoggle",i),Ye("toggle",i),Ye("cancel",i),Ye("close",i);break;case"iframe":case"object":Ye("load",i);break;case"video":case"audio":for(l=0;l<gl.length;l++)Ye(gl[l],i);break;case"image":Ye("error",i),Ye("load",i);break;case"details":Ye("toggle",i);break;case"embed":case"source":case"link":Ye("error",i),Ye("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(P in r)if(r.hasOwnProperty(P)&&(l=r[P],l!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:_t(i,s,P,l,r,null)}return;default:if(Hu(s)){for(Z in r)r.hasOwnProperty(Z)&&(l=r[Z],l!==void 0&&Cd(i,s,Z,l,r,void 0));return}}for(b in r)r.hasOwnProperty(b)&&(l=r[b],l!=null&&_t(i,s,b,l,r,null))}function oC(i,s,r,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,g=null,b=null,T=null,P=null,Z=null;for($ in r){var re=r[$];if(r.hasOwnProperty($)&&re!=null)switch($){case"checked":break;case"value":break;case"defaultValue":T=re;default:l.hasOwnProperty($)||_t(i,s,$,null,l,re)}}for(var F in l){var $=l[F];if(re=r[F],l.hasOwnProperty(F)&&($!=null||re!=null))switch(F){case"type":h=$;break;case"name":u=$;break;case"checked":P=$;break;case"defaultChecked":Z=$;break;case"value":g=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(a(137,s));break;default:$!==re&&_t(i,s,F,$,l,re)}}Kr(i,g,b,T,P,Z,h,u);return;case"select":$=g=b=F=null;for(h in r)if(T=r[h],r.hasOwnProperty(h)&&T!=null)switch(h){case"value":break;case"multiple":$=T;default:l.hasOwnProperty(h)||_t(i,s,h,null,l,T)}for(u in l)if(h=l[u],T=r[u],l.hasOwnProperty(u)&&(h!=null||T!=null))switch(u){case"value":F=h;break;case"defaultValue":b=h;break;case"multiple":g=h;default:h!==T&&_t(i,s,u,h,l,T)}s=b,r=g,l=$,F!=null?Ir(i,!!r,F,!1):!!l!=!!r&&(s!=null?Ir(i,!!r,s,!0):Ir(i,!!r,r?[]:"",!1));return;case"textarea":$=F=null;for(b in r)if(u=r[b],r.hasOwnProperty(b)&&u!=null&&!l.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:_t(i,s,b,null,l,u)}for(g in l)if(u=l[g],h=r[g],l.hasOwnProperty(g)&&(u!=null||h!=null))switch(g){case"value":F=u;break;case"defaultValue":$=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(a(91));break;default:u!==h&&_t(i,s,g,u,l,h)}R_(i,F,$);return;case"option":for(var Se in r)F=r[Se],r.hasOwnProperty(Se)&&F!=null&&!l.hasOwnProperty(Se)&&(Se==="selected"?i.selected=!1:_t(i,s,Se,null,l,F));for(T in l)F=l[T],$=r[T],l.hasOwnProperty(T)&&F!==$&&(F!=null||$!=null)&&(T==="selected"?i.selected=F&&typeof F!="function"&&typeof F!="symbol":_t(i,s,T,F,l,$));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 Ae in r)F=r[Ae],r.hasOwnProperty(Ae)&&F!=null&&!l.hasOwnProperty(Ae)&&_t(i,s,Ae,null,l,F);for(P in l)if(F=l[P],$=r[P],l.hasOwnProperty(P)&&F!==$&&(F!=null||$!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(a(137,s));break;default:_t(i,s,P,F,l,$)}return;default:if(Hu(s)){for(var mt in r)F=r[mt],r.hasOwnProperty(mt)&&F!==void 0&&!l.hasOwnProperty(mt)&&Cd(i,s,mt,void 0,l,F);for(Z in l)F=l[Z],$=r[Z],!l.hasOwnProperty(Z)||F===$||F===void 0&&$===void 0||Cd(i,s,Z,F,l,$);return}}for(var O in r)F=r[O],r.hasOwnProperty(O)&&F!=null&&!l.hasOwnProperty(O)&&_t(i,s,O,null,l,F);for(re in l)F=l[re],$=r[re],!l.hasOwnProperty(re)||F===$||F==null&&$==null||_t(i,s,re,F,l,$)}function Bv(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function cC(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var u=r[l],h=u.transferSize,g=u.initiatorType,b=u.duration;if(h&&b&&Bv(g)){for(g=0,b=u.responseEnd,l+=1;l<r.length;l++){var T=r[l],P=T.startTime;if(P>b)break;var Z=T.transferSize,re=T.initiatorType;Z&&Bv(re)&&(T=T.responseEnd,g+=Z*(T<b?1:(b-P)/(T-P)))}if(--l,s+=8*(h+g)/(u.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var xd=null,Ed=null;function vc(i){return i.nodeType===9?i:i.ownerDocument}function Lv(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 Ov(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function Td(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var kd=null;function uC(){var i=window.event;return i&&i.type==="popstate"?i===kd?!1:(kd=i,!0):(kd=null,!1)}var zv=typeof setTimeout=="function"?setTimeout:void 0,hC=typeof clearTimeout=="function"?clearTimeout:void 0,Hv=typeof Promise=="function"?Promise:void 0,dC=typeof queueMicrotask=="function"?queueMicrotask:typeof Hv<"u"?function(i){return Hv.resolve(null).then(i).catch(fC)}:zv;function fC(i){setTimeout(function(){throw i})}function Pn(i){return i==="head"}function jv(i,s){var r=s,l=0;do{var u=r.nextSibling;if(i.removeChild(r),u&&u.nodeType===8)if(r=u.data,r==="/$"||r==="/&"){if(l===0){i.removeChild(u),Sa(s);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")yl(i.ownerDocument.documentElement);else if(r==="head"){r=i.ownerDocument.head,yl(r);for(var h=r.firstChild;h;){var g=h.nextSibling,b=h.nodeName;h[q]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=g}}else r==="body"&&yl(i.ownerDocument.body);r=u}while(r);Sa(s)}function Uv(i,s){var r=i;i=0;do{var l=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),l&&l.nodeType===8)if(r=l.data,r==="/$"){if(i===0)break;i--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||i++;r=l}while(r)}function Dd(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Dd(r),le(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}i.removeChild(r)}}function pC(i,s,r,l){for(;i.nodeType===1;){var u=r;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[q])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(h=i.getAttribute("rel"),h==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(h!==u.rel||i.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||i.getAttribute("title")!==(u.title==null?null:u.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(h=i.getAttribute("src"),(h!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===h)return i}else return i;if(i=ms(i.nextSibling),i===null)break}return null}function _C(i,s,r){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=ms(i.nextSibling),i===null))return null;return i}function Pv(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=ms(i.nextSibling),i===null))return null;return i}function Rd(i){return i.data==="$?"||i.data==="$~"}function Md(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function mC(i,s){var r=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||r.readyState!=="loading")s();else{var l=function(){s(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function ms(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var Ad=null;function Kv(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"||r==="/&"){if(s===0)return ms(i.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}i=i.nextSibling}return null}function Iv(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return i;s--}else r!=="/$"&&r!=="/&"||s++}i=i.previousSibling}return null}function Fv(i,s,r){switch(s=vc(r),i){case"html":if(i=s.documentElement,!i)throw Error(a(452));return i;case"head":if(i=s.head,!i)throw Error(a(453));return i;case"body":if(i=s.body,!i)throw Error(a(454));return i;default:throw Error(a(451))}}function yl(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);le(i)}var gs=new Map,qv=new Set;function yc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var dn=Y.d;Y.d={f:gC,r:vC,D:yC,C:SC,L:bC,m:wC,X:xC,S:CC,M:EC};function gC(){var i=dn.f(),s=uc();return i||s}function vC(i){var s=Re(i);s!==null&&s.tag===5&&s.type==="form"?lg(s):dn.r(i)}var ga=typeof document>"u"?null:document;function Wv(i,s,r){var l=ga;if(l&&typeof s=="string"&&s){var u=It(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),qv.has(u)||(qv.add(u),i={rel:i,crossOrigin:r,href:s},l.querySelector(u)===null&&(s=l.createElement("link"),Ti(s,"link",i),lt(s),l.head.appendChild(s)))}}function yC(i){dn.D(i),Wv("dns-prefetch",i,null)}function SC(i,s){dn.C(i,s),Wv("preconnect",i,s)}function bC(i,s,r){dn.L(i,s,r);var l=ga;if(l&&i&&s){var u='link[rel="preload"][as="'+It(s)+'"]';s==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+It(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+It(r.imageSizes)+'"]')):u+='[href="'+It(i)+'"]';var h=u;switch(s){case"style":h=va(i);break;case"script":h=ya(i)}gs.has(h)||(i=y({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:i,as:s},r),gs.set(h,i),l.querySelector(u)!==null||s==="style"&&l.querySelector(Sl(h))||s==="script"&&l.querySelector(bl(h))||(s=l.createElement("link"),Ti(s,"link",i),lt(s),l.head.appendChild(s)))}}function wC(i,s){dn.m(i,s);var r=ga;if(r&&i){var l=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+It(l)+'"][href="'+It(i)+'"]',h=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=ya(i)}if(!gs.has(h)&&(i=y({rel:"modulepreload",href:i},s),gs.set(h,i),r.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(bl(h)))return}l=r.createElement("link"),Ti(l,"link",i),lt(l),r.head.appendChild(l)}}}function CC(i,s,r){dn.S(i,s,r);var l=ga;if(l&&i){var u=Le(l).hoistableStyles,h=va(i);s=s||"default";var g=u.get(h);if(!g){var b={loading:0,preload:null};if(g=l.querySelector(Sl(h)))b.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},r),(r=gs.get(h))&&Nd(i,r);var T=g=l.createElement("link");lt(T),Ti(T,"link",i),T._p=new Promise(function(P,Z){T.onload=P,T.onerror=Z}),T.addEventListener("load",function(){b.loading|=1}),T.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Sc(g,s,l)}g={type:"stylesheet",instance:g,count:1,state:b},u.set(h,g)}}}function xC(i,s){dn.X(i,s);var r=ga;if(r&&i){var l=Le(r).hoistableScripts,u=ya(i),h=l.get(u);h||(h=r.querySelector(bl(u)),h||(i=y({src:i,async:!0},s),(s=gs.get(u))&&Bd(i,s),h=r.createElement("script"),lt(h),Ti(h,"link",i),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function EC(i,s){dn.M(i,s);var r=ga;if(r&&i){var l=Le(r).hoistableScripts,u=ya(i),h=l.get(u);h||(h=r.querySelector(bl(u)),h||(i=y({src:i,async:!0,type:"module"},s),(s=gs.get(u))&&Bd(i,s),h=r.createElement("script"),lt(h),Ti(h,"link",i),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function Yv(i,s,r,l){var u=(u=me.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"?(s=va(r.href),r=Le(u).hoistableStyles,l=r.get(s),l||(l={type:"style",instance:null,count:0,state:null},r.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){i=va(r.href);var h=Le(u).hoistableStyles,g=h.get(i);if(g||(u=u.ownerDocument||u,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(i,g),(h=u.querySelector(Sl(i)))&&!h._p&&(g.instance=h,g.state.loading=5),gs.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},gs.set(i,r),h||TC(u,i,r,g.state))),s&&l===null)throw Error(a(528,""));return g}if(s&&l!==null)throw Error(a(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=ya(r),r=Le(u).hoistableScripts,l=r.get(s),l||(l={type:"script",instance:null,count:0,state:null},r.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,i))}}function va(i){return'href="'+It(i)+'"'}function Sl(i){return'link[rel="stylesheet"]['+i+"]"}function $v(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function TC(i,s,r,l){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=i.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),Ti(s,"link",r),lt(s),i.head.appendChild(s))}function ya(i){return'[src="'+It(i)+'"]'}function bl(i){return"script[async]"+i}function Vv(i,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+It(r.href)+'"]');if(l)return s.instance=l,lt(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"),lt(l),Ti(l,"style",u),Sc(l,r.precedence,i),s.instance=l;case"stylesheet":u=va(r.href);var h=i.querySelector(Sl(u));if(h)return s.state.loading|=4,s.instance=h,lt(h),h;l=$v(r),(u=gs.get(u))&&Nd(l,u),h=(i.ownerDocument||i).createElement("link"),lt(h);var g=h;return g._p=new Promise(function(b,T){g.onload=b,g.onerror=T}),Ti(h,"link",l),s.state.loading|=4,Sc(h,r.precedence,i),s.instance=h;case"script":return h=ya(r.src),(u=i.querySelector(bl(h)))?(s.instance=u,lt(u),u):(l=r,(u=gs.get(h))&&(l=y({},r),Bd(l,u)),i=i.ownerDocument||i,u=i.createElement("script"),lt(u),Ti(u,"link",l),i.head.appendChild(u),s.instance=u);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,Sc(l,r.precedence,i));return s.instance}function Sc(i,s,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,h=u,g=0;g<l.length;g++){var b=l[g];if(b.dataset.precedence===s)h=b;else if(h!==u)break}h?h.parentNode.insertBefore(i,h.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(i,s.firstChild))}function Nd(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Bd(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var bc=null;function Xv(i,s,r){if(bc===null){var l=new Map,u=bc=new Map;u.set(r,l)}else u=bc,l=u.get(r),l||(l=new Map,u.set(r,l));if(l.has(i))return l;for(l.set(i,null),r=r.getElementsByTagName(i),u=0;u<r.length;u++){var h=r[u];if(!(h[q]||h[yt]||i==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var g=h.getAttribute(s)||"";g=i+g;var b=l.get(g);b?b.push(h):l.set(g,[h])}}return l}function Gv(i,s,r){i=i.ownerDocument||i,i.head.insertBefore(r,s==="title"?i.querySelector("head > title"):null)}function kC(i,s,r){if(r===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(i=s.disabled,typeof s.precedence=="string"&&i==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Zv(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function DC(i,s,r,l){if(r.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=va(l.href),h=s.querySelector(Sl(u));if(h){s=h._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=wc.bind(i),s.then(i,i)),r.state.loading|=4,r.instance=h,lt(h);return}h=s.ownerDocument||s,l=$v(l),(u=gs.get(u))&&Nd(l,u),h=h.createElement("link"),lt(h);var g=h;g._p=new Promise(function(b,T){g.onload=b,g.onerror=T}),Ti(h,"link",l),r.instance=h}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(i.count++,r=wc.bind(i),s.addEventListener("load",r),s.addEventListener("error",r))}}var Ld=0;function RC(i,s){return i.stylesheets&&i.count===0&&xc(i,i.stylesheets),0<i.count||0<i.imgCount?function(r){var l=setTimeout(function(){if(i.stylesheets&&xc(i,i.stylesheets),i.unsuspend){var h=i.unsuspend;i.unsuspend=null,h()}},6e4+s);0<i.imgBytes&&Ld===0&&(Ld=62500*cC());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&xc(i,i.stylesheets),i.unsuspend)){var h=i.unsuspend;i.unsuspend=null,h()}},(i.imgBytes>Ld?50:800)+s);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function wc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)xc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Cc=null;function xc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Cc=new Map,s.forEach(MC,i),Cc=null,wc.call(i))}function MC(i,s){if(!(s.state.loading&4)){var r=Cc.get(i);if(r)var l=r.get(null);else{r=new Map,Cc.set(i,r);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var g=u[h];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(r.set(g.dataset.precedence,g),l=g)}l&&r.set(null,l)}u=s.instance,g=u.getAttribute("data-precedence"),h=r.get(g)||l,h===l&&r.set(null,u),r.set(g,u),this.count++,l=wc.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),h?h.parentNode.insertBefore(u,h.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var wl={$$typeof:R,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function AC(i,s,r,l,u,h,g,b,T){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=at(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=at(0),this.hiddenUpdates=at(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function Qv(i,s,r,l,u,h,g,b,T,P,Z,re){return i=new AC(i,s,r,g,T,P,Z,re,b),s=1,h===!0&&(s|=24),h=Qi(3,null,null,s),i.current=h,h.stateNode=i,s=fh(),s.refCount++,i.pooledCache=s,s.refCount++,h.memoizedState={element:l,isDehydrated:r,cache:s},gh(h),i}function Jv(i){return i?(i=Gr,i):Gr}function ey(i,s,r,l,u,h){u=Jv(u),l.context===null?l.context=u:l.pendingContext=u,l=Rn(s),l.payload={element:r},h=h===void 0?null:h,h!==null&&(l.callback=h),r=Mn(i,l,s),r!==null&&($i(r,i,s),el(r,i,s))}function ty(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<s?r:s}}function Od(i,s){ty(i,s),(i=i.alternate)&&ty(i,s)}function iy(i){if(i.tag===13||i.tag===31){var s=pr(i,67108864);s!==null&&$i(s,i,67108864),Od(i,67108864)}}function sy(i){if(i.tag===13||i.tag===31){var s=ss();s=Ui(s);var r=pr(i,s);r!==null&&$i(r,i,s),Od(i,s)}}var Ec=!0;function NC(i,s,r,l){var u=M.T;M.T=null;var h=Y.p;try{Y.p=2,zd(i,s,r,l)}finally{Y.p=h,M.T=u}}function BC(i,s,r,l){var u=M.T;M.T=null;var h=Y.p;try{Y.p=8,zd(i,s,r,l)}finally{Y.p=h,M.T=u}}function zd(i,s,r,l){if(Ec){var u=Hd(l);if(u===null)wd(i,s,l,Tc,r),ry(i,l);else if(OC(u,i,s,r,l))l.stopPropagation();else if(ry(i,l),s&4&&-1<LC.indexOf(i)){for(;u!==null;){var h=Re(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var g=ft(h.pendingLanes);if(g!==0){var b=h;for(b.pendingLanes|=2,b.entangledLanes|=2;g;){var T=1<<31-Yt(g);b.entanglements[1]|=T,g&=~T}js(h),(ot&6)===0&&(oc=rt()+500,ml(0))}}break;case 31:case 13:b=pr(h,2),b!==null&&$i(b,h,2),uc(),Od(h,2)}if(h=Hd(l),h===null&&wd(i,s,l,Tc,r),h===u)break;u=h}u!==null&&l.stopPropagation()}else wd(i,s,l,null,r)}}function Hd(i){return i=Uu(i),jd(i)}var Tc=null;function jd(i){if(Tc=null,i=ve(i),i!==null){var s=c(i);if(s===null)i=null;else{var r=s.tag;if(r===13){if(i=d(s),i!==null)return i;i=null}else if(r===31){if(i=p(s),i!==null)return i;i=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Tc=i,null}function ny(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(Es()){case ls:return 2;case ci:return 8;case ui:case Bi:return 32;case Si:return 268435456;default:return 32}default:return 32}}var Ud=!1,Kn=null,In=null,Fn=null,Cl=new Map,xl=new Map,qn=[],LC="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 ry(i,s){switch(i){case"focusin":case"focusout":Kn=null;break;case"dragenter":case"dragleave":In=null;break;case"mouseover":case"mouseout":Fn=null;break;case"pointerover":case"pointerout":Cl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":xl.delete(s.pointerId)}}function El(i,s,r,l,u,h){return i===null||i.nativeEvent!==h?(i={blockedOn:s,domEventName:r,eventSystemFlags:l,nativeEvent:h,targetContainers:[u]},s!==null&&(s=Re(s),s!==null&&iy(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function OC(i,s,r,l,u){switch(s){case"focusin":return Kn=El(Kn,i,s,r,l,u),!0;case"dragenter":return In=El(In,i,s,r,l,u),!0;case"mouseover":return Fn=El(Fn,i,s,r,l,u),!0;case"pointerover":var h=u.pointerId;return Cl.set(h,El(Cl.get(h)||null,i,s,r,l,u)),!0;case"gotpointercapture":return h=u.pointerId,xl.set(h,El(xl.get(h)||null,i,s,r,l,u)),!0}return!1}function ay(i){var s=ve(i.target);if(s!==null){var r=c(s);if(r!==null){if(s=r.tag,s===13){if(s=d(r),s!==null){i.blockedOn=s,os(i.priority,function(){sy(r)});return}}else if(s===31){if(s=p(r),s!==null){i.blockedOn=s,os(i.priority,function(){sy(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){i.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}i.blockedOn=null}function kc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=Hd(i.nativeEvent);if(r===null){r=i.nativeEvent;var l=new r.constructor(r.type,r);ju=l,r.target.dispatchEvent(l),ju=null}else return s=Re(r),s!==null&&iy(s),i.blockedOn=r,!1;s.shift()}return!0}function ly(i,s,r){kc(i)&&r.delete(s)}function zC(){Ud=!1,Kn!==null&&kc(Kn)&&(Kn=null),In!==null&&kc(In)&&(In=null),Fn!==null&&kc(Fn)&&(Fn=null),Cl.forEach(ly),xl.forEach(ly)}function Dc(i,s){i.blockedOn===s&&(i.blockedOn=null,Ud||(Ud=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,zC)))}var Rc=null;function oy(i){Rc!==i&&(Rc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Rc===i&&(Rc=null);for(var s=0;s<i.length;s+=3){var r=i[s],l=i[s+1],u=i[s+2];if(typeof l!="function"){if(jd(l||r)===null)continue;break}var h=Re(r);h!==null&&(i.splice(s,3),s-=3,Hh(h,{pending:!0,data:u,method:r.method,action:l},l,u))}}))}function Sa(i){function s(T){return Dc(T,i)}Kn!==null&&Dc(Kn,i),In!==null&&Dc(In,i),Fn!==null&&Dc(Fn,i),Cl.forEach(s),xl.forEach(s);for(var r=0;r<qn.length;r++){var l=qn[r];l.blockedOn===i&&(l.blockedOn=null)}for(;0<qn.length&&(r=qn[0],r.blockedOn===null);)ay(r),r.blockedOn===null&&qn.shift();if(r=(i.ownerDocument||i).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var u=r[l],h=r[l+1],g=u[Ot]||null;if(typeof h=="function")g||oy(r);else if(g){var b=null;if(h&&h.hasAttribute("formAction")){if(u=h,g=h[Ot]||null)b=g.formAction;else if(jd(u)!==null)continue}else b=g.action;typeof b=="function"?r[l+1]=b:(r.splice(l,3),l-=3),oy(r)}}}function cy(){function i(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(g){return u=g})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,u=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),u!==null&&(u(),u=null)}}}function Pd(i){this._internalRoot=i}Mc.prototype.render=Pd.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(a(409));var r=s.current,l=ss();ey(r,l,i,s,null,null)},Mc.prototype.unmount=Pd.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;ey(i.current,2,null,i,null,null),uc(),s[cs]=null}};function Mc(i){this._internalRoot=i}Mc.prototype.unstable_scheduleHydration=function(i){if(i){var s=si();i={blockedOn:null,target:i,priority:s};for(var r=0;r<qn.length&&s!==0&&s<qn[r].priority;r++);qn.splice(r,0,i),r===0&&ay(i)}};var uy=t.version;if(uy!=="19.2.6")throw Error(a(527,uy,"19.2.6"));Y.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(a(188)):(i=Object.keys(i).join(","),Error(a(268,i)));return i=f(s),i=i!==null?S(i):null,i=i===null?null:i.stateNode,i};var HC={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ac=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ac.isDisabled&&Ac.supportsFiber)try{Li=Ac.inject(HC),ti=Ac}catch{}}return kl.createRoot=function(i,s){if(!o(i))throw Error(a(299));var r=!1,l="",u=gg,h=vg,g=yg;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(h=s.onCaughtError),s.onRecoverableError!==void 0&&(g=s.onRecoverableError)),s=Qv(i,1,!1,null,null,r,l,null,u,h,g,cy),i[cs]=s.current,bd(i),new Pd(s)},kl.hydrateRoot=function(i,s,r){if(!o(i))throw Error(a(299));var l=!1,u="",h=gg,g=vg,b=yg,T=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(g=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError),r.formState!==void 0&&(T=r.formState)),s=Qv(i,1,!0,s,r??null,l,u,T,h,g,b,cy),s.context=Jv(null),r=s.current,l=ss(),l=Ui(l),u=Rn(l),u.callback=null,Mn(r,u,l),r=l,s.current.lanes=r,hi(s,r),js(s),i[cs]=s.current,bd(i),new Mc(s)},kl.version="19.2.6",kl}var Sy;function $C(){if(Sy)return Fd.exports;Sy=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(),Fd.exports=YC(),Fd.exports}var VC=$C();class gn extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status}function bu(e=fetch){return{getSession:()=>be(e,"/api/auth/session"),setupPassword:t=>be(e,"/api/auth/password",Qe("POST",t)),login:t=>be(e,"/api/auth/login",Qe("POST",t)),reauth:t=>be(e,"/api/auth/reauth",Qe("POST",t)),logout:()=>be(e,"/api/auth/logout",{method:"POST",credentials:"same-origin"}),setupTotp:()=>be(e,"/api/auth/totp/setup",{method:"POST",credentials:"same-origin"}),activateTotp:t=>be(e,"/api/auth/totp/activate",Qe("POST",t)),disableTotp:()=>be(e,"/api/auth/totp",{method:"DELETE",credentials:"same-origin"}),listDevices:()=>be(e,"/api/auth/devices"),revokeDevice:async t=>{await xa(e,`/api/auth/devices/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listNetworks:()=>be(e,"/api/auth/networks"),addNetwork:t=>be(e,"/api/auth/networks",Qe("POST",t)),removeNetwork:async t=>{await xa(e,`/api/auth/networks/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listAgents:()=>be(e,"/api/agents"),addAgent:t=>be(e,"/api/agents",Qe("POST",t)),renameAgent:(t,n)=>be(e,`/api/agents/${encodeURIComponent(t)}`,Qe("PATCH",{name:n})),getMainInfo:()=>be(e,"/api/main"),renameMain:t=>be(e,"/api/main",Qe("PATCH",{name:t})),removeAgent:async t=>{await xa(e,`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},pingAgent:t=>be(e,`/api/agents/${encodeURIComponent(t)}/ping`),getMainStats:()=>be(e,"/api/stats"),getAgentStats:t=>be(e,`/api/agents/${encodeURIComponent(t)}/stats`),getVersion:()=>be(e,"/api/version"),checkUpdate:()=>be(e,"/api/update/check",{method:"POST",credentials:"same-origin"}),runUpdate:()=>be(e,"/api/update",{method:"POST",credentials:"same-origin"}),getAgentVersion:t=>be(e,`/api/agents/${encodeURIComponent(t)}/version`),checkAgentUpdate:t=>be(e,`/api/agents/${encodeURIComponent(t)}/update/check`,{method:"POST",credentials:"same-origin"}),runAgentUpdate:t=>be(e,`/api/agents/${encodeURIComponent(t)}/update`,{method:"POST",credentials:"same-origin"}),listTerminals:()=>be(e,"/api/terminals"),getTerminalLayout:()=>be(e,"/api/terminal-layout"),saveTerminalLayout:t=>be(e,"/api/terminal-layout",Qe("PUT",t)),createFileRoot:t=>be(e,"/api/files/root",Qe("POST",t)),listFiles:t=>be(e,"/api/files/list",Qe("POST",t)),readFile:t=>be(e,"/api/files/read",Qe("POST",t)),writeFile:t=>be(e,"/api/files/write",Qe("POST",t)),createFileEntry:t=>be(e,"/api/files/create",Qe("POST",t)),moveFileEntry:t=>be(e,"/api/files/move",Qe("POST",t)),previewDeleteFileEntry:t=>be(e,"/api/files/delete-preview",Qe("POST",t)),deleteFileEntry:t=>be(e,"/api/files/delete",Qe("POST",t)),openFileInTerminal:t=>be(e,"/api/files/open",Qe("POST",t)),previewFile:t=>_b(e,"/api/files/preview",Qe("POST",t)),createTerminal:(t={})=>be(e,"/api/terminals",Qe("POST",t)),closeTerminal:async t=>{await xa(e,`/api/terminals/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},renameTerminal:(t,n)=>be(e,`/api/terminals/${encodeURIComponent(t)}`,Qe("PATCH",{title:n})),getTerminalHistory:(t,n={})=>be(e,`/api/terminals/${encodeURIComponent(t)}/history${Jc(n)}`),getTerminalTranscriptHistory:(t,n={})=>be(e,`/api/terminals/${encodeURIComponent(t)}/transcript-history${Jc(n)}`),getTerminalTranscriptSource:t=>be(e,`/api/terminals/${encodeURIComponent(t)}/transcript-source`),listNotificationAssets:()=>be(e,"/api/notification-assets"),uploadNotificationAsset:t=>{const n=new FormData;return n.append("asset",t),be(e,"/api/notification-assets",{method:"POST",credentials:"same-origin",body:n})},updateNotificationAssetSelection:t=>be(e,"/api/notification-assets/selection",Qe("PUT",t)),deleteNotificationAsset:async t=>{await xa(e,`/api/notification-assets/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})}}}function wu(e,t=fetch){const n=a=>e?`/api/agents/${encodeURIComponent(e)}/${a}`:`/api/${a}`;return{isAgent:e!==null,listTerminals:()=>be(t,n("terminals")),createTerminal:(a={})=>be(t,n("terminals"),Qe("POST",a)),closeTerminal:async a=>{await xa(t,n(`terminals/${encodeURIComponent(a)}`),{method:"DELETE",credentials:"same-origin"})},renameTerminal:(a,o)=>be(t,n(`terminals/${encodeURIComponent(a)}`),Qe("PATCH",{title:o})),getTerminalHistory:(a,o={})=>be(t,`${n(`terminals/${encodeURIComponent(a)}/history`)}${Jc(o)}`),getTerminalTranscriptHistory:(a,o={})=>be(t,`${n(`terminals/${encodeURIComponent(a)}/transcript-history`)}${Jc(o)}`),getTerminalTranscriptSource:a=>be(t,n(`terminals/${encodeURIComponent(a)}/transcript-source`)),getTerminalLayout:()=>be(t,n("terminal-layout")),saveTerminalLayout:a=>be(t,n("terminal-layout"),Qe("PUT",a)),createFileRoot:a=>be(t,n("files/root"),Qe("POST",a)),listFiles:a=>be(t,n("files/list"),Qe("POST",a)),readFile:a=>be(t,n("files/read"),Qe("POST",a)),writeFile:a=>be(t,n("files/write"),Qe("POST",a)),createFileEntry:a=>be(t,n("files/create"),Qe("POST",a)),moveFileEntry:a=>be(t,n("files/move"),Qe("POST",a)),previewDeleteFileEntry:a=>be(t,n("files/delete-preview"),Qe("POST",a)),deleteFileEntry:a=>be(t,n("files/delete"),Qe("POST",a)),openFileInTerminal:a=>be(t,n("files/open"),Qe("POST",a)),previewFile:a=>_b(t,n("files/preview"),Qe("POST",a)),createWebSocketUrl:(a,o=window.location.href)=>XC(n(`terminals/${encodeURIComponent(a)}/ws`),o)}}function XC(e,t){const n=new URL(t);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.pathname=e,n.search="",n.hash="",n.toString()}function Qe(e,t){return{method:e,headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)}}function Jc(e){const t=new URLSearchParams;e.beforeLine!==void 0&&t.set("beforeLine",String(e.beforeLine)),e.cursor!==void 0&&t.set("cursor",e.cursor),e.limit!==void 0&&t.set("limit",String(e.limit));const n=t.toString();return n?`?${n}`:""}async function be(e,t,n){const a=await e(t,n??{credentials:"same-origin"});await Fp(a);try{return await a.json()}catch{throw new gn(a.status,"invalid_json_response")}}async function xa(e,t,n){const a=await e(t,n);await Fp(a)}async function _b(e,t,n){const a=await e(t,n);return await Fp(a),a.blob()}async function Fp(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json(),a=typeof n.error=="string"?n.error:n.message;typeof a=="string"&&a.trim()&&(t=a)}catch{}throw new gn(e.status,t)}function mb({size:e=22}){return m.jsx("img",{className:"nterminal-mark",src:"/brand/nterminal-mark.svg",width:e,height:e,alt:"","aria-hidden":"true"})}function gb({height:e=18}){const t=Math.round(7.147058823529412*e);return m.jsx("img",{className:"nterminal-wordmark",src:"/brand/nterminal-wordmark.svg",width:t,height:e,alt:"NTerminal"})}var jl=pb();const Cu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ba(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function qp(e){return"nodeType"in e}function Xi(e){var t,n;return e?Ba(e)?e:qp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Wp(e){const{Document:t}=Xi(e);return e instanceof t}function ho(e){return Ba(e)?!1:e instanceof Xi(e).HTMLElement}function vb(e){return e instanceof Xi(e).SVGElement}function La(e){return e?Ba(e)?e.document:qp(e)?Wp(e)?e:ho(e)||vb(e)?e.ownerDocument:document:document:document}const nr=Cu?v.useLayoutEffect:v.useEffect;function Yp(e){const t=v.useRef(e);return nr(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return t.current==null?void 0:t.current(...a)},[])}function GC(){const e=v.useRef(null),t=v.useCallback((a,o)=>{e.current=setInterval(a,o)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ql(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return nr(()=>{n.current!==e&&(n.current=e)},t),n}function fo(e,t){const n=v.useRef();return v.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function eu(e){const t=Yp(e),n=v.useRef(null),a=v.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,a]}function bf(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let $d={};function xu(e,t){return v.useMemo(()=>{if(t)return t;const n=$d[e]==null?0:$d[e]+1;return $d[e]=n,e+"-"+n},[e,t])}function yb(e){return function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return a.reduce((c,d)=>{const p=Object.entries(d);for(const[_,f]of p){const S=c[_];S!=null&&(c[_]=S+e*f)}return c},{...t})}}const Da=yb(1),tu=yb(-1);function ZC(e){return"clientX"in e&&"clientY"in e}function Sb(e){if(!e)return!1;const{KeyboardEvent:t}=Xi(e.target);return t&&e instanceof t}function QC(e){if(!e)return!1;const{TouchEvent:t}=Xi(e.target);return t&&e instanceof t}function wf(e){if(QC(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ZC(e)?{x:e.clientX,y:e.clientY}:null}const Cf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Cf.Translate.toString(e),Cf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),by="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function JC(e){return e.matches(by)?e:e.querySelector(by)}const ex={display:"none"};function tx(e){let{id:t,value:n}=e;return ki.createElement("div",{id:t,style:ex},n)}function ix(e){let{id:t,announcement:n,ariaLiveType:a="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ki.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":!0},n)}function sx(){const[e,t]=v.useState("");return{announce:v.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const bb=v.createContext(null);function nx(e){const t=v.useContext(bb);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function rx(){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(d=>{var p;return(p=d[o])==null?void 0:p.call(d,c)})},[e]),t]}const ax={draggable:`
10
- To pick up a draggable item, press the space bar.
11
- While dragging, use the arrow keys to move the item.
12
- Press space again to drop the item in its new position, or press escape to cancel.
13
- `},lx={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ox(e){let{announcements:t=lx,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=ax}=e;const{announce:c,announcement:d}=sx(),p=xu("DndLiveRegion"),[_,f]=v.useState(!1);if(v.useEffect(()=>{f(!0)},[]),nx(v.useMemo(()=>({onDragStart(y){let{active:w}=y;c(t.onDragStart({active:w}))},onDragMove(y){let{active:w,over:x}=y;t.onDragMove&&c(t.onDragMove({active:w,over:x}))},onDragOver(y){let{active:w,over:x}=y;c(t.onDragOver({active:w,over:x}))},onDragEnd(y){let{active:w,over:x}=y;c(t.onDragEnd({active:w,over:x}))},onDragCancel(y){let{active:w,over:x}=y;c(t.onDragCancel({active:w,over:x}))}}),[c,t])),!_)return null;const S=ki.createElement(ki.Fragment,null,ki.createElement(tx,{id:a,value:o.draggable}),ki.createElement(ix,{id:p,announcement:d}));return n?jl.createPortal(S,n):S}var li;(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"})(li||(li={}));function iu(){}function wy(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function cx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const Bs=Object.freeze({x:0,y:0});function ux(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function hx(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function dx(e,t){const n=Math.max(t.top,e.top),a=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),c=Math.min(t.top+t.height,e.top+e.height),d=o-a,p=c-n;if(a<o&&n<c){const _=t.width*t.height,f=e.width*e.height,S=d*p,y=S/(_+f-S);return Number(y.toFixed(4))}return 0}const fx=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const o=[];for(const c of a){const{id:d}=c,p=n.get(d);if(p){const _=dx(p,t);_>0&&o.push({id:d,data:{droppableContainer:c,value:_}})}}return o.sort(ux)};function px(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wb(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Bs}function _x(e){return function(n){for(var a=arguments.length,o=new Array(a>1?a-1:0),c=1;c<a;c++)o[c-1]=arguments[c];return o.reduce((d,p)=>({...d,top:d.top+e*p.y,bottom:d.bottom+e*p.y,left:d.left+e*p.x,right:d.right+e*p.x}),{...n})}}const mx=_x(1);function gx(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 vx(e,t,n){const a=gx(t);if(!a)return e;const{scaleX:o,scaleY:c,x:d,y:p}=a,_=e.left-d-(1-o)*parseFloat(n),f=e.top-p-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),S=o?e.width/o:e.width,y=c?e.height/c:e.height;return{width:S,height:y,top:f,right:_+S,bottom:f+y,left:_}}const yx={ignoreTransform:!1};function po(e,t){t===void 0&&(t=yx);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:S}=Xi(e).getComputedStyle(e);f&&(n=vx(n,f,S))}const{top:a,left:o,width:c,height:d,bottom:p,right:_}=n;return{top:a,left:o,width:c,height:d,bottom:p,right:_}}function Cy(e){return po(e,{ignoreTransform:!0})}function Sx(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function bx(e,t){return t===void 0&&(t=Xi(e).getComputedStyle(e)),t.position==="fixed"}function wx(e,t){t===void 0&&(t=Xi(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const c=t[o];return typeof c=="string"?n.test(c):!1})}function $p(e,t){const n=[];function a(o){if(t!=null&&n.length>=t||!o)return n;if(Wp(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!ho(o)||vb(o)||n.includes(o))return n;const c=Xi(e).getComputedStyle(o);return o!==e&&wx(o,c)&&n.push(o),bx(o,c)?n:a(o.parentNode)}return e?a(e):n}function Cb(e){const[t]=$p(e,1);return t??null}function Vd(e){return!Cu||!e?null:Ba(e)?e:qp(e)?Wp(e)||e===La(e).scrollingElement?window:ho(e)?e:null:null}function xb(e){return Ba(e)?e.scrollX:e.scrollLeft}function Eb(e){return Ba(e)?e.scrollY:e.scrollTop}function xf(e){return{x:xb(e),y:Eb(e)}}var _i;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(_i||(_i={}));function Tb(e){return!Cu||!e?!1:e===document.scrollingElement}function kb(e){const t={x:0,y:0},n=Tb(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,c=e.scrollLeft<=t.x,d=e.scrollTop>=a.y,p=e.scrollLeft>=a.x;return{isTop:o,isLeft:c,isBottom:d,isRight:p,maxScroll:a,minScroll:t}}const Cx={x:.2,y:.2};function xx(e,t,n,a,o){let{top:c,left:d,right:p,bottom:_}=n;a===void 0&&(a=10),o===void 0&&(o=Cx);const{isTop:f,isBottom:S,isLeft:y,isRight:w}=kb(e),x={x:0,y:0},C={x:0,y:0},E={height:t.height*o.y,width:t.width*o.x};return!f&&c<=t.top+E.height?(x.y=_i.Backward,C.y=a*Math.abs((t.top+E.height-c)/E.height)):!S&&_>=t.bottom-E.height&&(x.y=_i.Forward,C.y=a*Math.abs((t.bottom-E.height-_)/E.height)),!w&&p>=t.right-E.width?(x.x=_i.Forward,C.x=a*Math.abs((t.right-E.width-p)/E.width)):!y&&d<=t.left+E.width&&(x.x=_i.Backward,C.x=a*Math.abs((t.left+E.width-d)/E.width)),{direction:x,speed:C}}function Ex(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:t,left:n,right:a,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:a,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Db(e){return e.reduce((t,n)=>Da(t,xf(n)),Bs)}function Tx(e){return e.reduce((t,n)=>t+xb(n),0)}function kx(e){return e.reduce((t,n)=>t+Eb(n),0)}function Dx(e,t){if(t===void 0&&(t=po),!e)return;const{top:n,left:a,bottom:o,right:c}=t(e);Cb(e)&&(o<=0||c<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Rx=[["x",["left","right"],Tx],["y",["top","bottom"],kx]];class Vp{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=$p(n),o=Db(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,d,p]of Rx)for(const _ of d)Object.defineProperty(this,_,{get:()=>{const f=p(a),S=o[c]-f;return this.rect[_]+S},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Yl{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=t}add(t,n,a){var o;(o=this.target)==null||o.addEventListener(t,n,a),this.listeners.push([t,n,a])}}function Mx(e){const{EventTarget:t}=Xi(e);return e instanceof t?e:La(e)}function Xd(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var Ss;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Ss||(Ss={}));function xy(e){e.preventDefault()}function Ax(e){e.stopPropagation()}var bt;(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"})(bt||(bt={}));const Rb={start:[bt.Space,bt.Enter],cancel:[bt.Esc],end:[bt.Space,bt.Enter,bt.Tab]},Nx=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case bt.Right:return{...n,x:n.x+25};case bt.Left:return{...n,x:n.x-25};case bt.Down:return{...n,y:n.y+25};case bt.Up:return{...n,y:n.y-25}}};class Mb{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Yl(La(n)),this.windowListeners=new Yl(Xi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ss.Resize,this.handleCancel),this.windowListeners.add(Ss.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ss.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&Dx(a),n(Bs)}handleKeyDown(t){if(Sb(t)){const{active:n,context:a,options:o}=this.props,{keyboardCodes:c=Rb,coordinateGetter:d=Nx,scrollBehavior:p="smooth"}=o,{code:_}=t;if(c.end.includes(_)){this.handleEnd(t);return}if(c.cancel.includes(_)){this.handleCancel(t);return}const{collisionRect:f}=a.current,S=f?{x:f.left,y:f.top}:Bs;this.referenceCoordinates||(this.referenceCoordinates=S);const y=d(t,{active:n,context:a.current,currentCoordinates:S});if(y){const w=tu(y,S),x={x:0,y:0},{scrollableAncestors:C}=a.current;for(const E of C){const N=t.code,{isTop:D,isRight:ie,isLeft:R,isBottom:H,maxScroll:j,minScroll:W}=kb(E),B=Ex(E),oe={x:Math.min(N===bt.Right?B.right-B.width/2:B.right,Math.max(N===bt.Right?B.left:B.left+B.width/2,y.x)),y:Math.min(N===bt.Down?B.bottom-B.height/2:B.bottom,Math.max(N===bt.Down?B.top:B.top+B.height/2,y.y))},ce=N===bt.Right&&!ie||N===bt.Left&&!R,ue=N===bt.Down&&!H||N===bt.Up&&!D;if(ce&&oe.x!==y.x){const Q=E.scrollLeft+w.x,G=N===bt.Right&&Q<=j.x||N===bt.Left&&Q>=W.x;if(G&&!w.y){E.scrollTo({left:Q,behavior:p});return}G?x.x=E.scrollLeft-Q:x.x=N===bt.Right?E.scrollLeft-j.x:E.scrollLeft-W.x,x.x&&E.scrollBy({left:-x.x,behavior:p});break}else if(ue&&oe.y!==y.y){const Q=E.scrollTop+w.y,G=N===bt.Down&&Q<=j.y||N===bt.Up&&Q>=W.y;if(G&&!w.x){E.scrollTo({top:Q,behavior:p});return}G?x.y=E.scrollTop-Q:x.y=N===bt.Down?E.scrollTop-j.y:E.scrollTop-W.y,x.y&&E.scrollBy({top:-x.y,behavior:p});break}}this.handleMove(t,Da(tu(y,this.referenceCoordinates),x))}}}handleMove(t,n){const{onMove:a}=this.props;t.preventDefault(),a(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Mb.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=Rb,onActivation:o}=t,{active:c}=n;const{code:d}=e.nativeEvent;if(a.start.includes(d)){const p=c.activatorNode.current;return p&&e.target!==p?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Ey(e){return!!(e&&"distance"in e)}function Ty(e){return!!(e&&"delay"in e)}class Xp{constructor(t,n,a){var o;a===void 0&&(a=Mx(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:c}=t,{target:d}=c;this.props=t,this.events=n,this.document=La(d),this.documentListeners=new Yl(this.document),this.listeners=new Yl(a),this.windowListeners=new Yl(Xi(d)),this.initialCoordinates=(o=wf(c))!=null?o:Bs,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ss.Resize,this.handleCancel),this.windowListeners.add(Ss.DragStart,xy),this.windowListeners.add(Ss.VisibilityChange,this.handleCancel),this.windowListeners.add(Ss.ContextMenu,xy),this.documentListeners.add(Ss.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ty(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Ey(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:o}=this.props;o(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ss.Click,Ax,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ss.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:o,props:c}=this,{onMove:d,options:{activationConstraint:p}}=c;if(!o)return;const _=(n=wf(t))!=null?n:Bs,f=tu(o,_);if(!a&&p){if(Ey(p)){if(p.tolerance!=null&&Xd(f,p.tolerance))return this.handleCancel();if(Xd(f,p.distance))return this.handleStart()}if(Ty(p)&&Xd(f,p.tolerance))return this.handleCancel();this.handlePending(p,f);return}t.cancelable&&t.preventDefault(),d(_)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===bt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Bx={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ab extends Xp{constructor(t){const{event:n}=t,a=La(n.target);super(t,Bx,a)}}Ab.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!n.isPrimary||n.button!==0?!1:(a?.({event:n}),!0)}}];const Lx={move:{name:"mousemove"},end:{name:"mouseup"}};var Ef;(function(e){e[e.RightClick=2]="RightClick"})(Ef||(Ef={}));class Nb extends Xp{constructor(t){super(t,Lx,La(t.event.target))}}Nb.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===Ef.RightClick?!1:(a?.({event:n}),!0)}}];const Gd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Bb extends Xp{constructor(t){super(t,Gd)}static setup(){return window.addEventListener(Gd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Gd.move.name,t)};function t(){}}}Bb.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:o}=n;return o.length>1?!1:(a?.({event:n}),!0)}}];var $l;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})($l||($l={}));var su;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(su||(su={}));function Ox(e){let{acceleration:t,activator:n=$l.Pointer,canScroll:a,draggingRect:o,enabled:c,interval:d=5,order:p=su.TreeOrder,pointerCoordinates:_,scrollableAncestors:f,scrollableAncestorRects:S,delta:y,threshold:w}=e;const x=Hx({delta:y,disabled:!c}),[C,E]=GC(),N=v.useRef({x:0,y:0}),D=v.useRef({x:0,y:0}),ie=v.useMemo(()=>{switch(n){case $l.Pointer:return _?{top:_.y,bottom:_.y,left:_.x,right:_.x}:null;case $l.DraggableRect:return o}},[n,o,_]),R=v.useRef(null),H=v.useCallback(()=>{const W=R.current;if(!W)return;const B=N.current.x*D.current.x,oe=N.current.y*D.current.y;W.scrollBy(B,oe)},[]),j=v.useMemo(()=>p===su.TreeOrder?[...f].reverse():f,[p,f]);v.useEffect(()=>{if(!c||!f.length||!ie){E();return}for(const W of j){if(a?.(W)===!1)continue;const B=f.indexOf(W),oe=S[B];if(!oe)continue;const{direction:ce,speed:ue}=xx(W,oe,ie,t,w);for(const Q of["x","y"])x[Q][ce[Q]]||(ue[Q]=0,ce[Q]=0);if(ue.x>0||ue.y>0){E(),R.current=W,C(H,d),N.current=ue,D.current=ce;return}}N.current={x:0,y:0},D.current={x:0,y:0},E()},[t,H,a,E,c,d,JSON.stringify(ie),JSON.stringify(x),C,f,j,S,JSON.stringify(w)])}const zx={x:{[_i.Backward]:!1,[_i.Forward]:!1},y:{[_i.Backward]:!1,[_i.Forward]:!1}};function Hx(e){let{delta:t,disabled:n}=e;const a=bf(t);return fo(o=>{if(n||!a||!o)return zx;const c={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[_i.Backward]:o.x[_i.Backward]||c.x===-1,[_i.Forward]:o.x[_i.Forward]||c.x===1},y:{[_i.Backward]:o.y[_i.Backward]||c.y===-1,[_i.Forward]:o.y[_i.Forward]||c.y===1}}},[n,t,a])}function jx(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return fo(o=>{var c;return t==null?null:(c=a??o)!=null?c:null},[a,t])}function Ux(e,t){return v.useMemo(()=>e.reduce((n,a)=>{const{sensor:o}=a,c=o.activators.map(d=>({eventName:d.eventName,handler:t(d.handler,a)}));return[...n,...c]},[]),[e,t])}var Jl;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Jl||(Jl={}));var Tf;(function(e){e.Optimized="optimized"})(Tf||(Tf={}));const ky=new Map;function Px(e,t){let{dragging:n,dependencies:a,config:o}=t;const[c,d]=v.useState(null),{frequency:p,measure:_,strategy:f}=o,S=v.useRef(e),y=N(),w=Ql(y),x=v.useCallback(function(D){D===void 0&&(D=[]),!w.current&&d(ie=>ie===null?D:ie.concat(D.filter(R=>!ie.includes(R))))},[w]),C=v.useRef(null),E=fo(D=>{if(y&&!n)return ky;if(!D||D===ky||S.current!==e||c!=null){const ie=new Map;for(let R of e){if(!R)continue;if(c&&c.length>0&&!c.includes(R.id)&&R.rect.current){ie.set(R.id,R.rect.current);continue}const H=R.node.current,j=H?new Vp(_(H),H):null;R.rect.current=j,j&&ie.set(R.id,j)}return ie}return D},[e,c,n,y,_]);return v.useEffect(()=>{S.current=e},[e]),v.useEffect(()=>{y||x()},[n,y]),v.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),v.useEffect(()=>{y||typeof p!="number"||C.current!==null||(C.current=setTimeout(()=>{x(),C.current=null},p))},[p,y,x,...a]),{droppableRects:E,measureDroppableContainers:x,measuringScheduled:c!=null};function N(){switch(f){case Jl.Always:return!1;case Jl.BeforeDragging:return n;default:return!n}}}function Lb(e,t){return fo(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Kx(e,t){return Lb(e,t)}function Ix(e){let{callback:t,disabled:n}=e;const a=Yp(t),o=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(a)},[a,n]);return v.useEffect(()=>()=>o?.disconnect(),[o]),o}function Eu(e){let{callback:t,disabled:n}=e;const a=Yp(t),o=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(a)},[n]);return v.useEffect(()=>()=>o?.disconnect(),[o]),o}function Fx(e){return new Vp(po(e),e)}function Dy(e,t,n){t===void 0&&(t=Fx);const[a,o]=v.useState(null);function c(){o(_=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=_??n)!=null?f:null}const S=t(e);return JSON.stringify(_)===JSON.stringify(S)?_:S})}const d=Ix({callback(_){if(e)for(const f of _){const{type:S,target:y}=f;if(S==="childList"&&y instanceof HTMLElement&&y.contains(e)){c();break}}}}),p=Eu({callback:c});return nr(()=>{c(),e?(p?.observe(e),d?.observe(document.body,{childList:!0,subtree:!0})):(p?.disconnect(),d?.disconnect())},[e]),a}function qx(e){const t=Lb(e);return wb(e,t)}const Ry=[];function Wx(e){const t=v.useRef(e),n=fo(a=>e?a&&a!==Ry&&e&&t.current&&e.parentNode===t.current.parentNode?a:$p(e):Ry,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function Yx(e){const[t,n]=v.useState(null),a=v.useRef(e),o=v.useCallback(c=>{const d=Vd(c.target);d&&n(p=>p?(p.set(d,xf(d)),new Map(p)):null)},[]);return v.useEffect(()=>{const c=a.current;if(e!==c){d(c);const p=e.map(_=>{const f=Vd(_);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,xf(f)]):null}).filter(_=>_!=null);n(p.length?new Map(p):null),a.current=e}return()=>{d(e),d(c)};function d(p){p.forEach(_=>{const f=Vd(_);f?.removeEventListener("scroll",o)})}},[o,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,d)=>Da(c,d),Bs):Db(e):Bs,[e,t])}function My(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const a=e!==Bs;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?tu(e,n.current):Bs}function $x(e){v.useEffect(()=>{if(!Cu)return;const t=e.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Vx(e,t){return v.useMemo(()=>e.reduce((n,a)=>{let{eventName:o,handler:c}=a;return n[o]=d=>{c(d,t)},n},{}),[e,t])}function Ob(e){return v.useMemo(()=>e?Sx(e):null,[e])}const Ay=[];function Xx(e,t){t===void 0&&(t=po);const[n]=e,a=Ob(n?Xi(n):null),[o,c]=v.useState(Ay);function d(){c(()=>e.length?e.map(_=>Tb(_)?a:new Vp(t(_),_)):Ay)}const p=Eu({callback:d});return nr(()=>{p?.disconnect(),d(),e.forEach(_=>p?.observe(_))},[e]),o}function Gx(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ho(t)?t:e}function Zx(e){let{measure:t}=e;const[n,a]=v.useState(null),o=v.useCallback(f=>{for(const{target:S}of f)if(ho(S)){a(y=>{const w=t(S);return y?{...y,width:w.width,height:w.height}:w});break}},[t]),c=Eu({callback:o}),d=v.useCallback(f=>{const S=Gx(f);c?.disconnect(),S&&c?.observe(S),a(S?t(S):null)},[t,c]),[p,_]=eu(d);return v.useMemo(()=>({nodeRef:p,rect:n,setRef:_}),[n,p,_])}const Qx=[{sensor:Ab,options:{}},{sensor:Mb,options:{}}],Jx={current:{}},Wc={draggable:{measure:Cy},droppable:{measure:Cy,strategy:Jl.WhileDragging,frequency:Tf.Optimized},dragOverlay:{measure:po}};class Vl extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,a;return(n=(a=this.get(t))==null?void 0:a.node.current)!=null?n:void 0}}const eE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Vl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:iu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Wc,measureDroppableContainers:iu,windowRect:null,measuringScheduled:!1},tE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:iu,draggableNodes:new Map,over:null,measureDroppableContainers:iu},Tu=v.createContext(tE),iE=v.createContext(eE);function sE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Vl}}}function nE(e,t){switch(t.type){case li.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case li.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 li.DragEnd:case li.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case li.RegisterDroppable:{const{element:n}=t,{id:a}=n,o=new Vl(e.droppable.containers);return o.set(a,n),{...e,droppable:{...e.droppable,containers:o}}}case li.SetDroppableDisabled:{const{id:n,key:a,disabled:o}=t,c=e.droppable.containers.get(n);if(!c||a!==c.key)return e;const d=new Vl(e.droppable.containers);return d.set(n,{...c,disabled:o}),{...e,droppable:{...e.droppable,containers:d}}}case li.UnregisterDroppable:{const{id:n,key:a}=t,o=e.droppable.containers.get(n);if(!o||a!==o.key)return e;const c=new Vl(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function rE(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:o}=v.useContext(Tu),c=bf(a),d=bf(n?.id);return v.useEffect(()=>{if(!t&&!a&&c&&d!=null){if(!Sb(c)||document.activeElement===c.target)return;const p=o.get(d);if(!p)return;const{activatorNode:_,node:f}=p;if(!_.current&&!f.current)return;requestAnimationFrame(()=>{for(const S of[_.current,f.current]){if(!S)continue;const y=JC(S);if(y){y.focus();break}}})}},[a,t,o,d,c]),null}function aE(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((o,c)=>c({transform:o,...a}),n):n}function lE(e){return v.useMemo(()=>({draggable:{...Wc.draggable,...e?.draggable},droppable:{...Wc.droppable,...e?.droppable},dragOverlay:{...Wc.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function oE(e){let{activeNode:t,measure:n,initialRect:a,config:o=!0}=e;const c=v.useRef(!1),{x:d,y:p}=typeof o=="boolean"?{x:o,y:o}:o;nr(()=>{if(!d&&!p||!t){c.current=!1;return}if(c.current||!a)return;const f=t?.node.current;if(!f||f.isConnected===!1)return;const S=n(f),y=wb(S,a);if(d||(y.x=0),p||(y.y=0),c.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const w=Cb(f);w&&w.scrollBy({top:y.y,left:y.x})}},[t,d,p,a,n])}const zb=v.createContext({...Bs,scaleX:1,scaleY:1});var Qn;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Qn||(Qn={}));const cE=v.memo(function(t){var n,a,o,c;let{id:d,accessibility:p,autoScroll:_=!0,children:f,sensors:S=Qx,collisionDetection:y=fx,measuring:w,modifiers:x,...C}=t;const E=v.useReducer(nE,void 0,sE),[N,D]=E,[ie,R]=rx(),[H,j]=v.useState(Qn.Uninitialized),W=H===Qn.Initialized,{draggable:{active:B,nodes:oe,translate:ce},droppable:{containers:ue}}=N,Q=B!=null?oe.get(B):null,G=v.useRef({initial:null,translated:null}),K=v.useMemo(()=>{var dt;return B!=null?{id:B,data:(dt=Q?.data)!=null?dt:Jx,rect:G}:null},[B,Q]),J=v.useRef(null),[se,M]=v.useState(null),[Y,X]=v.useState(null),pe=Ql(C,Object.values(C)),ye=xu("DndDescribedBy",d),k=v.useMemo(()=>ue.getEnabled(),[ue]),I=lE(w),{droppableRects:ne,measureDroppableContainers:he,measuringScheduled:_e}=Px(k,{dragging:W,dependencies:[ce.x,ce.y],config:I.droppable}),me=jx(oe,B),Ee=v.useMemo(()=>Y?wf(Y):null,[Y]),De=ks(),Ce=Kx(me,I.draggable.measure);oE({activeNode:B!=null?oe.get(B):null,config:De.layoutShiftCompensation,initialRect:Ce,measure:I.draggable.measure});const Me=Dy(me,I.draggable.measure,Ce),et=Dy(me?me.parentElement:null),tt=v.useRef({activatorEvent:null,active:null,activeNode:me,collisionRect:null,collisions:null,droppableRects:ne,draggableNodes:oe,draggingNode:null,draggingNodeRect:null,droppableContainers:ue,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ne=ue.getNodeFor((n=tt.current.over)==null?void 0:n.id),ee=Zx({measure:I.dragOverlay.measure}),Te=(a=ee.nodeRef.current)!=null?a:me,xe=W?(o=ee.rect)!=null?o:Me:null,ze=!!(ee.nodeRef.current&&ee.rect),qe=qx(ze?null:Me),vt=Ob(Te?Xi(Te):null),ct=Wx(W?Ne??me:null),V=Xx(ct),He=aE(x,{transform:{x:ce.x-qe.x,y:ce.y-qe.y,scaleX:1,scaleY:1},activatorEvent:Y,active:K,activeNodeRect:Me,containerNodeRect:et,draggingNodeRect:xe,over:tt.current.over,overlayNodeRect:ee.rect,scrollableAncestors:ct,scrollableAncestorRects:V,windowRect:vt}),it=Ee?Da(Ee,ce):null,rt=Yx(ct),Es=My(rt),ls=My(rt,[Me]),ci=Da(He,Es),ui=xe?mx(xe,He):null,Bi=K&&ui?y({active:K,collisionRect:ui,droppableRects:ne,droppableContainers:k,pointerCoordinates:it}):null,Si=hx(Bi,"id"),[ei,Ws]=v.useState(null),Li=ze?He:Da(He,ls),ti=px(Li,(c=ei?.rect)!=null?c:null,Me),bi=v.useRef(null),Yt=v.useCallback((dt,ft)=>{let{sensor:Dt,options:Xe}=ft;if(J.current==null)return;const Kt=oe.get(J.current);if(!Kt)return;const Nt=dt.nativeEvent,at=new Dt({active:J.current,activeNode:Kt,event:Nt,options:Xe,context:tt,onAbort(Rt){if(!oe.get(Rt))return;const{onDragAbort:wt}=pe.current,Ri={id:Rt};wt?.(Ri),ie({type:"onDragAbort",event:Ri})},onPending(Rt,ii,wt,Ri){if(!oe.get(Rt))return;const{onDragPending:Pi}=pe.current,si={id:Rt,constraint:ii,initialCoordinates:wt,offset:Ri};Pi?.(si),ie({type:"onDragPending",event:si})},onStart(Rt){const ii=J.current;if(ii==null)return;const wt=oe.get(ii);if(!wt)return;const{onDragStart:Ri}=pe.current,Ui={activatorEvent:Nt,active:{id:ii,data:wt.data,rect:G}};jl.unstable_batchedUpdates(()=>{Ri?.(Ui),j(Qn.Initializing),D({type:li.DragStart,initialCoordinates:Rt,active:ii}),ie({type:"onDragStart",event:Ui}),M(bi.current),X(Nt)})},onMove(Rt){D({type:li.DragMove,coordinates:Rt})},onEnd:hi(li.DragEnd),onCancel:hi(li.DragCancel)});bi.current=at;function hi(Rt){return async function(){const{active:wt,collisions:Ri,over:Ui,scrollAdjustedTranslate:Pi}=tt.current;let si=null;if(wt&&Pi){const{cancelDrop:os}=pe.current;si={activatorEvent:Nt,active:wt,collisions:Ri,delta:Pi,over:Ui},Rt===li.DragEnd&&typeof os=="function"&&await Promise.resolve(os(si))&&(Rt=li.DragCancel)}J.current=null,jl.unstable_batchedUpdates(()=>{D({type:Rt}),j(Qn.Uninitialized),Ws(null),M(null),X(null),bi.current=null;const os=Rt===li.DragEnd?"onDragEnd":"onDragCancel";if(si){const wi=pe.current[os];wi?.(si),ie({type:os,event:si})}})}}},[oe]),Ys=v.useCallback((dt,ft)=>(Dt,Xe)=>{const Kt=Dt.nativeEvent,Nt=oe.get(Xe);if(J.current!==null||!Nt||Kt.dndKit||Kt.defaultPrevented)return;const at={active:Nt};dt(Dt,ft.options,at)===!0&&(Kt.dndKit={capturedBy:ft.sensor},J.current=Xe,Yt(Dt,ft))},[oe,Yt]),$s=Ux(S,Ys);$x(S),nr(()=>{Me&&H===Qn.Initializing&&j(Qn.Initialized)},[Me,H]),v.useEffect(()=>{const{onDragMove:dt}=pe.current,{active:ft,activatorEvent:Dt,collisions:Xe,over:Kt}=tt.current;if(!ft||!Dt)return;const Nt={active:ft,activatorEvent:Dt,collisions:Xe,delta:{x:ci.x,y:ci.y},over:Kt};jl.unstable_batchedUpdates(()=>{dt?.(Nt),ie({type:"onDragMove",event:Nt})})},[ci.x,ci.y]),v.useEffect(()=>{const{active:dt,activatorEvent:ft,collisions:Dt,droppableContainers:Xe,scrollAdjustedTranslate:Kt}=tt.current;if(!dt||J.current==null||!ft||!Kt)return;const{onDragOver:Nt}=pe.current,at=Xe.get(Si),hi=at&&at.rect.current?{id:at.id,rect:at.rect.current,data:at.data,disabled:at.disabled}:null,Rt={active:dt,activatorEvent:ft,collisions:Dt,delta:{x:Kt.x,y:Kt.y},over:hi};jl.unstable_batchedUpdates(()=>{Ws(hi),Nt?.(Rt),ie({type:"onDragOver",event:Rt})})},[Si]),nr(()=>{tt.current={activatorEvent:Y,active:K,activeNode:me,collisionRect:ui,collisions:Bi,droppableRects:ne,draggableNodes:oe,draggingNode:Te,draggingNodeRect:xe,droppableContainers:ue,over:ei,scrollableAncestors:ct,scrollAdjustedTranslate:ci},G.current={initial:xe,translated:ui}},[K,me,Bi,ui,oe,Te,xe,ne,ue,ei,ct,ci]),Ox({...De,delta:ce,draggingRect:ui,pointerCoordinates:it,scrollableAncestors:ct,scrollableAncestorRects:V});const or=v.useMemo(()=>({active:K,activeNode:me,activeNodeRect:Me,activatorEvent:Y,collisions:Bi,containerNodeRect:et,dragOverlay:ee,draggableNodes:oe,droppableContainers:ue,droppableRects:ne,over:ei,measureDroppableContainers:he,scrollableAncestors:ct,scrollableAncestorRects:V,measuringConfiguration:I,measuringScheduled:_e,windowRect:vt}),[K,me,Me,Y,Bi,et,ee,oe,ue,ne,ei,he,ct,V,I,_e,vt]),Ts=v.useMemo(()=>({activatorEvent:Y,activators:$s,active:K,activeNodeRect:Me,ariaDescribedById:{draggable:ye},dispatch:D,draggableNodes:oe,over:ei,measureDroppableContainers:he}),[Y,$s,K,Me,D,ye,oe,ei,he]);return ki.createElement(bb.Provider,{value:R},ki.createElement(Tu.Provider,{value:Ts},ki.createElement(iE.Provider,{value:or},ki.createElement(zb.Provider,{value:ti},f)),ki.createElement(rE,{disabled:p?.restoreFocus===!1})),ki.createElement(ox,{...p,hiddenTextDescribedById:ye}));function ks(){const dt=se?.autoScrollEnabled===!1,ft=typeof _=="object"?_.enabled===!1:_===!1,Dt=W&&!dt&&!ft;return typeof _=="object"?{..._,enabled:Dt}:{enabled:Dt}}}),uE=v.createContext(null),Ny="button",hE="Draggable";function Hb(e){let{id:t,data:n,disabled:a=!1,attributes:o}=e;const c=xu(hE),{activators:d,activatorEvent:p,active:_,activeNodeRect:f,ariaDescribedById:S,draggableNodes:y,over:w}=v.useContext(Tu),{role:x=Ny,roleDescription:C="draggable",tabIndex:E=0}=o??{},N=_?.id===t,D=v.useContext(N?zb:uE),[ie,R]=eu(),[H,j]=eu(),W=Vx(d,t),B=Ql(n);nr(()=>(y.set(t,{id:t,key:c,node:ie,activatorNode:H,data:B}),()=>{const ce=y.get(t);ce&&ce.key===c&&y.delete(t)}),[y,t]);const oe=v.useMemo(()=>({role:x,tabIndex:E,"aria-disabled":a,"aria-pressed":N&&x===Ny?!0:void 0,"aria-roledescription":C,"aria-describedby":S.draggable}),[a,x,E,N,C,S.draggable]);return{active:_,activatorEvent:p,activeNodeRect:f,attributes:oe,isDragging:N,listeners:a?void 0:W,node:ie,over:w,setNodeRef:R,setActivatorNodeRef:j,transform:D}}const dE="Droppable",fE={timeout:25};function jb(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:o}=e;const c=xu(dE),{active:d,dispatch:p,over:_,measureDroppableContainers:f}=v.useContext(Tu),S=v.useRef({disabled:n}),y=v.useRef(!1),w=v.useRef(null),x=v.useRef(null),{disabled:C,updateMeasurementsFor:E,timeout:N}={...fE,...o},D=Ql(E??a),ie=v.useCallback(()=>{if(!y.current){y.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{f(Array.isArray(D.current)?D.current:[D.current]),x.current=null},N)},[N]),R=Eu({callback:ie,disabled:C||!d}),H=v.useCallback((oe,ce)=>{R&&(ce&&(R.unobserve(ce),y.current=!1),oe&&R.observe(oe))},[R]),[j,W]=eu(H),B=Ql(t);return v.useEffect(()=>{!R||!j.current||(R.disconnect(),y.current=!1,R.observe(j.current))},[j,R]),v.useEffect(()=>(p({type:li.RegisterDroppable,element:{id:a,key:c,disabled:n,node:j,rect:w,data:B}}),()=>p({type:li.UnregisterDroppable,key:c,id:a})),[a]),v.useEffect(()=>{n!==S.current.disabled&&(p({type:li.SetDroppableDisabled,id:a,key:c,disabled:n}),S.current.disabled=n)},[a,c,n,p]),{active:d,rect:w,isOver:_?.id===a,node:j,over:_,setNodeRef:W}}const pE=128,_E=512,mE=64,gE=4096;function Ub(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>pE)return null;const n=t.workspaces.map(vE);return n.some(a=>a===null)?null:{activeWorkspaceId:t.activeWorkspaceId,workspaces:n}}function vE(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>_E)return null;const n=t.tabs.map(Pb);return n.some(a=>a===null)?null:{id:t.id,title:t.title,activeTabId:t.activeTabId,tabs:n}}function yE(e){return Pb(e)!==null}function Pb(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.title!="string"||typeof t.activeTerminalId!="string")return null;const n=SE(t.root);return n?{id:t.id,title:t.title,activeTerminalId:t.activeTerminalId,root:n}:null}function SE(e){if(!e||typeof e!="object")return null;let t=0;return kf(e,1,()=>(t+=1,t<=gE))}function kf(e,t,n){if(!e||typeof e!="object"||t>mE||!n())return null;const a=e;if(a.type==="pane")return typeof a.terminalId=="string"?{type:"pane",terminalId:a.terminalId}:null;if(a.type!=="split"||a.direction!=="horizontal"&&a.direction!=="vertical")return null;const o=kf(a.first,t+1,n),c=kf(a.second,t+1,n);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 Kb=[{id:"builtin-character-2260",filename:"character-2260.mp4",contentType:"video/mp4",size:123288,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2260.mp4"},{id:"builtin-character-2272",filename:"character-2272.mp4",contentType:"video/mp4",size:55873,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2272.mp4"},{id:"builtin-character-2258",filename:"character-2258.mp4",contentType:"video/mp4",size:112612,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2258.mp4"}];function By(e){return e===void 0?"unknown":e==="error"?"offline":"ok"}function Ly(e){const t=e.trim();return t?t.charAt(0).toUpperCase():"?"}const Oy="Local",wE=3e4;function Zd(e){return e===void 0?"":e==="error"?"offline":[`CPU ${ws(e.cpuPercent)} ${Gp(e)}`,`MEM ${ws(e.memoryPercent)} ${vn(e.memoryUsedBytes,e.memoryTotalBytes)}`,`DISK ${ws(e.diskPercent)} ${vn(e.diskUsedBytes,e.diskTotalBytes)}`,`SWAP ${ws(e.swapPercent)} ${vn(e.swapUsedBytes,e.swapTotalBytes)}`].join(" · ")}function CE(e){if(!(e===void 0||e==="error"))return[`CPU ${ws(e.cpuPercent)} (${Gp(e)})`,`RAM ${ws(e.memoryPercent)} (${vn(e.memoryUsedBytes,e.memoryTotalBytes)})`,`Disk ${ws(e.diskPercent)} (${vn(e.diskUsedBytes,e.diskTotalBytes)})`,`Swap ${ws(e.swapPercent)} (${vn(e.swapUsedBytes,e.swapTotalBytes)})`].join(" · ")}function ws(e){return typeof e=="number"&&Number.isFinite(e)?`${Math.round(e)}%`:"–"}function Gp(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`:`${Df(e.cpuPercent/100*t)}/${t} cores`}function vn(e,t){return!zy(e)||!zy(t)?"–/–":xE(e,t)}function xE(e,t){const n=t>=1073741824?"GB":t>=1048576?"MB":"KB",a=n==="GB"?1024**3:n==="MB"?1024**2:1024;return`${Df(e/a)}/${Df(t/a)} ${n}`}function Df(e){return e>=10||Number.isInteger(e)?e.toFixed(0):e.toFixed(1)}function zy(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function EE(e){return[{label:"CPU",percent:ws(e.cpuPercent),detail:Gp(e)},{label:"MEM",percent:ws(e.memoryPercent),detail:vn(e.memoryUsedBytes,e.memoryTotalBytes)},{label:"DISK",percent:ws(e.diskPercent),detail:vn(e.diskUsedBytes,e.diskTotalBytes)},{label:"SWAP",percent:ws(e.swapPercent),detail:vn(e.swapUsedBytes,e.swapTotalBytes)}]}function Hy({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:CE(e),children:EE(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",children:t.percent}),m.jsx("span",{className:"server-list-stat-detail",children:t.detail})]},t.label))})}function Qd({api:e,activeAgentId:t,onSelectServer:n,onSessionInvalid:a,compact:o=!1}){const[c,d]=v.useState([]),[p,_]=v.useState(null),[f,S]=v.useState(null),[y,w]=v.useState(""),x=v.useRef(null),[C,E]=v.useState({});v.useEffect(()=>{let j=!1;return e.listAgents().then(W=>{j||d(W.agents)}).catch(()=>{}),e.getMainInfo().then(W=>{j||_(W.name)}).catch(()=>{}),()=>{j=!0}},[e]),v.useEffect(()=>{f&&(x.current?.focus(),x.current?.select())},[f]),v.useEffect(()=>{let j=!1;async function W(){let oe=!1;const ce=[{key:"__main__",load:()=>e.getMainStats()},...c.map(Q=>({key:Q.id,load:()=>e.getAgentStats(Q.id)}))],ue=await Promise.all(ce.map(async Q=>{try{return[Q.key,await Q.load()]}catch(G){return G instanceof gn&&G.status===401?(oe=!0,[Q.key,"error"]):[Q.key,"error"]}}));if(!j){if(oe){a?.();return}E(Q=>{const G={};for(const[J,se]of ue)G[J]=se;const K=new Set(["__main__",...c.map(J=>J.id)]);for(const J of Object.keys(Q))!K.has(J)||J in G||(G[J]=Q[J]);return G})}}W();const B=window.setInterval(()=>{W()},wE);return()=>{j=!0,window.clearInterval(B)}},[e,c,a]);function N(j){j==="main"?(w(p??""),S({kind:"main"})):(w(j.name),S({kind:"agent",id:j.id}))}async function D(){if(!f)return;const j=y.trim(),W=f;if(S(null),W.kind==="main"){const B=j||"";try{const oe=await e.renameMain(B);_(oe.name)}catch{}}else{if(!j)return;const B=c.find(oe=>oe.id===W.id)?.name;d(oe=>oe.map(ce=>ce.id===W.id?{...ce,name:j}:ce));try{await e.renameAgent(W.id,j)}catch{B!==void 0&&d(oe=>oe.map(ce=>ce.id===W.id?{...ce,name:B}:ce))}}}function ie(){S(null)}const R=p?.trim()||Oy,H=f?.kind==="main";return o?m.jsxs("div",{className:"server-list server-list--compact",children:[m.jsxs("button",{type:"button",className:`server-list-chip${t===null?" server-list-chip--active":""}`,onClick:()=>n(null),"aria-label":R,title:`${R}${Zd(C.__main__)?` — ${Zd(C.__main__)}`:""}`,children:[m.jsx("span",{className:"server-list-chip-initial",children:Ly(R)}),m.jsx("span",{className:"server-list-chip-pip","data-status":By(C.__main__)})]}),c.map(j=>{const W=C[j.id],B=Zd(W);return m.jsxs("button",{type:"button",className:`server-list-chip${t===j.id?" server-list-chip--active":""}`,onClick:()=>n(j.id),"aria-label":j.name,title:`${j.name}${B?` — ${B}`:""}`,children:[m.jsx("span",{className:"server-list-chip-initial",children:Ly(j.name)}),m.jsx("span",{className:"server-list-chip-pip","data-status":By(W)})]},j.id)})]}):m.jsxs("div",{className:"server-list",children:[m.jsx("div",{className:"server-list-row",children:H?m.jsx("form",{className:"server-list-editor",onSubmit:j=>{j.preventDefault(),D()},children:m.jsx("input",{ref:x,"aria-label":"Rename main server",value:y,onChange:j=>w(j.target.value),onBlur:()=>{D()},onKeyDown:j=>{j.key==="Escape"&&(j.preventDefault(),ie())},placeholder:Oy})}):m.jsxs("button",{type:"button",className:`server-list-item${t===null?" server-list-item--active":""}`,onClick:()=>n(null),onDoubleClick:j=>{j.preventDefault(),N("main")},title:"Double-click to rename",children:[m.jsxs("span",{className:"server-list-item-header",children:[m.jsx("span",{className:"server-list-dot"}),m.jsx("span",{className:"server-list-name",children:R})]}),m.jsx(Hy,{entry:C.__main__})]})}),c.map(j=>{const W=f?.kind==="agent"&&f.id===j.id;return m.jsx("div",{className:"server-list-row",children:W?m.jsx("form",{className:"server-list-editor",onSubmit:B=>{B.preventDefault(),D()},children:m.jsx("input",{ref:x,"aria-label":`Rename ${j.name}`,value:y,onChange:B=>w(B.target.value),onBlur:()=>{D()},onKeyDown:B=>{B.key==="Escape"&&(B.preventDefault(),ie())}})}):m.jsxs("button",{type:"button",className:`server-list-item${t===j.id?" server-list-item--active":""}`,onClick:()=>n(j.id),onDoubleClick:B=>{B.preventDefault(),N({id:j.id,name:j.name})},title:"Double-click to rename",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.url,children:j.name})]}),m.jsx(Hy,{entry:C[j.id]})]})},j.id)})]})}function TE({api:e}){const[t,n]=v.useState([]),[a,o]=v.useState([]),[c,d]=v.useState(!1),[p,_]=v.useState(null),[f,S]=v.useState(""),[y,w]=v.useState("");async function x(){try{const[D,ie,R]=await Promise.all([e.listDevices(),e.listNetworks(),e.getSession()]);n(D.devices),o(ie.networks),d(R.totpEnabled),_(null)}catch(D){_(D instanceof Error?D.message:"Failed to load")}}v.useEffect(()=>{x()},[]);async function C(D){await e.revokeDevice(D),await x()}async function E(D){await e.removeNetwork(D),await x()}async function N(D){D.preventDefault(),_(null);try{await e.addNetwork({value:f.trim(),label:y.trim()}),S(""),w(""),await x()}catch(ie){_(ie instanceof Error?ie.message:"Failed to add network")}}return m.jsxs(m.Fragment,{children:[p?m.jsx("p",{className:"form-error",children:p}):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:()=>{C(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:N,children:[m.jsx("input",{type:"text",placeholder:"IP or CIDR (e.g. 203.0.113.4 or 192.168.0.0/24)",value:f,onChange:D=>S(D.currentTarget.value),required:!0}),m.jsx("input",{type:"text",placeholder:"Label (optional)",value:y,onChange:D=>w(D.currentTarget.value)}),m.jsx("button",{type:"submit",disabled:!f.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 x()},children:"Disable 2FA"})]}):null]})}const Ib="nterminal.notifications.completionEnabled",Zp="nterminal.notifications.completionToastEnabled",Qp="nterminal.notifications.completionToastDurationSeconds",Jp="nterminal.notifications.completionToastPersistent",Rf="nterminal:completion-toast-display",Xl=6.5,Mf=2,Af=60;function ku(){return typeof window<"u"&&"Notification"in window}function Fb(){try{return window.localStorage.getItem(Ib)==="true"}catch{return!1}}function jy(e){try{window.localStorage.setItem(Ib,e?"true":"false")}catch{}}function Lr(){return{enabled:ME(),durationSeconds:RE(),persistUntilDismissed:AE()}}function kE(e){if(typeof window<"u"){try{window.localStorage.setItem(Zp,e?"true":"false")}catch{}t_()}return Lr()}function Uy(e){const t=Wb(e);if(typeof window<"u"){try{window.localStorage.setItem(Qp,String(t))}catch{}t_()}return Lr()}function DE(e){if(typeof window<"u"){try{window.localStorage.setItem(Jp,e?"true":"false")}catch{}t_()}return Lr()}function qb(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===Zp||n.key===Qp||n.key===Jp)&&e()};return window.addEventListener(Rf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Rf,e),window.removeEventListener("storage",t)}}function e_(){return ku()?window.Notification.permission:"unsupported"}function RE(){if(typeof window>"u")return Xl;try{const e=window.localStorage.getItem(Qp);return e===null?Xl:Wb(Number(e))}catch{return Xl}}function ME(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(Zp)!=="false"}catch{return!0}}function AE(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Jp)==="true"}catch{return!1}}function Wb(e){if(!Number.isFinite(e))return Xl;const t=Math.round(e*2)/2;return Math.max(Mf,Math.min(Af,t))}function t_(){typeof window<"u"&&window.dispatchEvent(new CustomEvent(Rf))}async function NE(){if(!ku())return"unsupported";try{return await window.Notification.requestPermission()}catch{return e_()}}function BE(e){if(!ku()||e_()!=="granted"||!Fb()||typeof document<"u"&&document.visibilityState==="visible")return;const t=e.commandName?`${e.commandName} finished`:"Command finished";try{new Notification(`NTerminal · ${e.tabTitle}`,{body:t,tag:e.terminalId,icon:"/icons/app-icon-384.png",silent:!0})}catch{}}const LE=1500,i_="nterminal.terminal.fontSize",s_="nterminal.terminal.fontFamily",Nf="nterminal:terminal-font-size",Bf="nterminal:terminal-font-family",Lf=11,Of=20,Nr=14,nu=[{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:[]}],Ra="meslo";zf(Ra);async function Jd(e=Nr,t=Ra){if(typeof document>"u"||!document.fonts)return;const n=Vb(t).webFontFamilies;if(n.length===0)return;const a=Promise.all(n.map(o=>document.fonts.load(`${e}px ${o}`))).then(()=>{}).catch(()=>{});await Promise.race([a,new Promise(o=>{globalThis.setTimeout(o,LE)})])}function Yb(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return Nr;const n=Math.round(t);return Math.max(Lf,Math.min(Of,n))}function $b(e){return nu.some(t=>t.id===e)?e:Ra}function zf(e){return Vb(e).cssFamily}function Vb(e){return nu.find(t=>t.id===e)??nu[0]}function Hf(){if(typeof window>"u")return Nr;try{const e=window.localStorage.getItem(i_);return e?Yb(e):Nr}catch{return Nr}}function jf(){if(typeof window>"u")return Ra;try{return $b(window.localStorage.getItem(s_))}catch{return Ra}}function Nc(e){const t=Yb(e);if(typeof window>"u")return t;try{window.localStorage.setItem(i_,String(t))}catch{}return window.dispatchEvent(new CustomEvent(Nf,{detail:t})),t}function OE(e){const t=$b(e);if(typeof window>"u")return t;try{window.localStorage.setItem(s_,t)}catch{}return window.dispatchEvent(new CustomEvent(Bf,{detail:t})),t}function Xb(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===i_&&e()};return window.addEventListener(Nf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Nf,e),window.removeEventListener("storage",t)}}function Gb(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===s_&&e()};return window.addEventListener(Bf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Bf,e),window.removeEventListener("storage",t)}}const n_="nterminal.terminal.showScrollProgress",Uf="nterminal:terminal-scroll-progress";function Pf(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(n_)!=="false"}catch{return!0}}function zE(e){if(typeof window<"u"){try{window.localStorage.setItem(n_,e?"true":"false")}catch{}window.dispatchEvent(new CustomEvent(Uf,{detail:e}))}return e}function Zb(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===n_&&e()};return window.addEventListener(Uf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Uf,e),window.removeEventListener("storage",t)}}const r_="nterminal.shortcuts.workspace.v1",Kf="nterminal:workspace-shortcuts",eo=[{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"}],a_={"server.previous":Ni("ArrowUp",{ctrlKey:!0}),"server.next":Ni("ArrowDown",{ctrlKey:!0}),"tab.previous":Ni("ArrowLeft",{ctrlKey:!0}),"tab.next":Ni("ArrowRight",{ctrlKey:!0}),"tab.index":Ni("Digit",{ctrlKey:!0,altKey:!0}),"pane.index":Ni("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.right":Ni("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Ni("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})},HE={"server.previous":Ni("BracketLeft",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"server.next":Ni("BracketRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"tab.previous":Ni("BracketLeft",{ctrlKey:!0,altKey:!0}),"tab.next":Ni("BracketRight",{ctrlKey:!0,altKey:!0}),"tab.index":Ni("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"pane.index":Ni("Digit",{ctrlKey:!0,altKey:!0}),"split.right":Ni("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Ni("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})};function Or(){const e=t0(a_);if(typeof window>"u")return e;try{const t=window.localStorage.getItem(r_);if(!t)return e;const n=JSON.parse(t);for(const a of eo){const o=n[a.id];if(YE(o)){const c=i0(o,a);WE(c,HE[a.id])||(e[a.id]=c)}}}catch{return e}return e}function Py(){return JSON.stringify(Or())}function jE(e,t){const n=Or(),a=eo.find(o=>o.id===e);return a&&(n[e]=i0(t,a),l_(n)),n}function UE(e){const t=Or();return t[e]={...a_[e]},l_(t),t}function PE(){const e=t0(a_);return l_(e),e}function Qb(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===r_&&e()};return window.addEventListener(Kf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Kf,e),window.removeEventListener("storage",t)}}function KE(e,t){const n=n0(e);return!n||VE(n)||t.indexed&&s0(e)===null?null:{ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,code:t.indexed?"Digit":n}}function IE(e){const t=Or();for(const n of eo){const a=t[n.id];if(!(!a||!$E(e,a))){if(n.indexed){if(a.code!=="Digit")continue;const o=s0(e);if(o!==null)return{id:n.id,index:o};continue}if(n0(e)===a.code)return{id:n.id,index:null}}}return null}function Jb(e){return e0(Or()[e])}function e0(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(XE(e.code)),t.join("+")}const FE=()=>Jb("split.right"),qE=()=>Jb("split.down");function Ni(e,t){return{ctrlKey:t.ctrlKey??!1,altKey:t.altKey??!1,shiftKey:t.shiftKey??!1,metaKey:t.metaKey??!1,code:e}}function t0(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{...n}]))}function WE(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey&&e.code===t.code}function l_(e){if(!(typeof window>"u")){try{window.localStorage.setItem(r_,JSON.stringify(e))}catch{}window.dispatchEvent(new CustomEvent(Kf))}}function i0(e,t){return{ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,shiftKey:!!e.shiftKey,metaKey:!!e.metaKey,code:t.indexed?"Digit":e.code}}function YE(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 $E(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey}function s0(e){const t=/^Digit([1-9])$/.exec(e.code);return t?.[1]?Number(t[1]):/^[1-9]$/.test(e.key)?Number(e.key):null}function n0(e){if(e.code)return e.code;if(/^[a-z]$/i.test(e.key))return`Key${e.key.toUpperCase()}`;if(/^[0-9]$/.test(e.key))return`Digit${e.key}`;switch(e.key){case"[":case"{":return"BracketLeft";case"]":case"}":return"BracketRight";case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Tab":case"Enter":case"Escape":case"Space":return e.key==="Space"?"Space":e.key;default:return null}}function VE(e){return e==="ControlLeft"||e==="ControlRight"||e==="AltLeft"||e==="AltRight"||e==="ShiftLeft"||e==="ShiftRight"||e==="MetaLeft"||e==="MetaRight"}function XE(e){if(e==="Digit")return"1-9";const t=/^Digit([0-9])$/.exec(e);if(t?.[1])return t[1];const n=/^Key([A-Z])$/.exec(e);if(n?.[1])return n[1];switch(e){case"BracketLeft":return"[";case"BracketRight":return"]";case"ArrowLeft":return"Left";case"ArrowRight":return"Right";case"ArrowUp":return"Up";case"ArrowDown":return"Down";case"Space":return"Space";default:return e.replace(/^(Numpad|Digit|Key)/,"")}}const o_="nterminal.theme.accent",If="nterminal:theme-accent",to=[{id:"aqua",label:"Aqua Teal",accent:"#5EEAD4",soft:"rgba(94, 234, 212, 0.10)",glow:"rgba(94, 234, 212, 0.55)",xtermSelection:"#1f3f45"},{id:"signal-red",label:"Signal Red",accent:"#FF2A3D",soft:"rgba(255, 42, 61, 0.12)",glow:"rgba(255, 42, 61, 0.52)",xtermSelection:"#4a1b22"}],ru="aqua";function _o(e){return to.some(t=>t.id===e)?e:ru}function c_(e){return to.find(t=>t.id===e)??to[0]}function rr(){if(typeof window>"u")return ru;try{return _o(window.localStorage.getItem(o_))}catch{return ru}}function GE(e){const t=_o(e);if(typeof window<"u"){try{window.localStorage.setItem(o_,t)}catch{}u_(t),window.dispatchEvent(new CustomEvent(If,{detail:t}))}return t}function u_(e=rr()){if(typeof document>"u")return;const t=c_(_o(e)),n=document.documentElement;n.style.setProperty("--nt-accent",t.accent),n.style.setProperty("--nt-accent-soft",t.soft),n.style.setProperty("--nt-accent-glow",t.glow)}function ZE(e=rr()){return c_(_o(e)).accent}function QE(e=rr()){return c_(_o(e)).xtermSelection}function r0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===o_&&(u_(rr()),e())};return window.addEventListener(If,e),window.addEventListener("storage",t),()=>{window.removeEventListener(If,e),window.removeEventListener("storage",t)}}const a0=3600*1e3,JE="local",Ff=new Set,ir=new Map;let ar={checking:!1,hasUpdates:!1,lastCheckedAt:null},h_=null,Gl=null,au=0,Zn=null;function e2(e){return Ff.add(e),()=>{Ff.delete(e)}}function Ky(){return ar}function t2(e){const t=a2();h_=e,d_(),qf(e,t);const n=()=>{if(document.visibilityState!=="visible"||!lr(e,t))return;const a=ar.lastCheckedAt;(a===null||Date.now()-a>=a0)&&qf(e,t)};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n),lr(e,t)&&r2()}}function i2(e,t){ir.set(e,l0(t)),Ma({...ar,hasUpdates:f_(),lastCheckedAt:Date.now()})}function Iy(e){e===void 0?ir.clear():ir.set(e,!1),Ma({...ar,hasUpdates:f_()})}async function qf(e,t){if(!lr(e,t))return;if(Zn&&Zn.api===e&&Zn.runId===t)return Zn.promise;Ma({...ar,checking:!0});const n=s2(e,t).finally(()=>{Zn?.promise===n&&(Zn=null),lr(e,t)&&(Ma({...ar,checking:!1,lastCheckedAt:Date.now()}),n2(e,t))});return Zn={api:e,runId:t,promise:n},n}async function s2(e,t){try{const n=await e.listAgents();if(!lr(e,t))return;const a=[{key:JE,check:()=>e.checkUpdate()},...n.agents.map(c=>({key:c.id,check:()=>e.checkAgentUpdate(c.id)}))],o=new Map;if(await Promise.all(a.map(async c=>{try{const d=await c.check();o.set(c.key,l0(d))}catch{o.set(c.key,ir.get(c.key)??!1)}})),!lr(e,t))return;ir.clear();for(const[c,d]of o)ir.set(c,d);Ma({...ar,hasUpdates:f_()})}catch{}}function n2(e,t){lr(e,t)&&(d_(),Gl=window.setTimeout(()=>{Gl=null,lr(e,t)&&qf(e,t)},a0))}function r2(){au+=1,d_(),h_=null,Zn=null,ir.clear(),Ma({checking:!1,hasUpdates:!1,lastCheckedAt:null})}function d_(){Gl!==null&&(window.clearTimeout(Gl),Gl=null)}function a2(){return au+=1,au}function lr(e,t){return h_===e&&au===t}function l0(e){return e.updateAvailable===!0?!0:typeof e.behind=="number"&&e.behind>0}function f_(){return Array.from(ir.values()).some(Boolean)}function Ma(e){ar=e;for(const t of Array.from(Ff))t()}const l2=e=>new Promise(t=>setTimeout(t,e));function o2({api:e}){const[t,n]=v.useState([{key:"local",id:null,name:"Local (main)"}]),[a,o]=v.useState({}),[c,d]=v.useState(!1);function p(R,H){o(j=>({...j,[R]:{...j[R],...H}}))}const _=R=>R.id===null?e.getVersion():e.getAgentVersion(R.id),f=R=>R.id===null?e.checkUpdate():e.checkAgentUpdate(R.id),S=R=>R.id===null?e.runUpdate():e.runAgentUpdate(R.id);v.useEffect(()=>{let R=!1;return e.listAgents().then(H=>{if(R)return;const j=[{key:"local",id:null,name:"Local (main)"},...H.agents.map(W=>({key:W.id,id:W.id,name:W.name}))];n(j);for(const W of j)_(W).then(B=>p(W.key,{version:B})).catch(B=>p(W.key,{error:B instanceof Error?B.message:"unreachable"}))}).catch(()=>{}),()=>{R=!0}},[]);async function y(R){p(R.key,{busy:!0,status:"checking…",error:void 0});try{const H=await f(R);i2(R.key,H),p(R.key,{behind:H.behind,latestVersion:H.latestVersion,updateAvailable:H.updateAvailable,status:D(H),busy:!1})}catch(H){p(R.key,{busy:!1,error:H instanceof Error?H.message:"check failed"})}}async function w(){d(!0),await Promise.all(t.map(R=>y(R))),d(!1)}async function x(R,H){const j=Date.now()+18e4;for(;Date.now()<j;){await l2(3e3);try{const W=await _(R);if(H?.runningCommit&&W.runningCommit&&W.runningCommit!==H.runningCommit||H?.installMode==="package"&&W.runningVersion!==H.runningVersion)return W}catch{}}return null}async function C(R){const H=a[R.key]?.version;p(R.key,{busy:!0,status:"updating…",error:void 0});let j;try{j=await S(R)}catch(B){return p(R.key,{busy:!1,error:B instanceof Error?B.message:"update failed"}),"failed"}if(!j.ok)return p(R.key,{busy:!1,status:void 0,error:j.message}),"failed";if(!j.changed)return p(R.key,{busy:!1,status:"already up to date",behind:0}),Iy(R.key),"unchanged";p(R.key,{status:H?.installMode==="package"?"restarting…":"rebuilding & restarting…"});const W=await x(R,H);return W?(p(R.key,{busy:!1,version:W,behind:0,updateAvailable:!1,status:"updated"}),Iy(R.key),"updated"):(p(R.key,{busy:!1,status:void 0,error:"timed out — check the server log"}),"failed")}async function E(){d(!0);const R=t.filter(B=>B.id!==null),H=t.find(B=>B.id===null);if((await Promise.all(R.map(B=>C(B)))).filter(B=>B==="failed").length>0){d(!1);return}if(H&&await C(H)==="updated"){window.location.reload();return}d(!1)}function N(R){return R?R.error?R.error:R.status?R.status:R.version?`v${R.version.version}`:"…":"…"}function D(R){return R.error?R.error:typeof R.updateAvailable=="boolean"?R.updateAvailable?`latest v${R.latestVersion??"available"}`:"up to date":R.behind===0?"up to date":`${R.behind??"unknown"} behind`}function ie(R){const H=R?.version;if(!H)return"";const j=H.runningCommit??H.commit??null,W=j?j.slice(0,8):null;return H.installMode==="package"?`npm package v${H.runningVersion}`:`${H.branch??""}${W?` @ ${W}`:""}${H.dirty?" (modified)":""}`.trim()}return m.jsxs("section",{className:"security-section",children:[m.jsx("h3",{children:"Updates"}),m.jsxs("div",{className:"update-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{w()},disabled:c,children:"Check for updates"}),m.jsx("button",{type:"button",onClick:()=>{E()},disabled:c,children:"Update all"})]}),m.jsx("ul",{className:"security-list",children:t.map(R=>{const H=a[R.key],j=ie(H),W=H?.version!==void 0&&!H?.busy&&!c;return m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsx("span",{className:"security-item-label",children:R.name}),m.jsxs("span",{className:"security-item-meta",children:[j?`${j} — `:"",N(H)]})]}),m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{C(R)},disabled:!W,children:H?.busy?"…":"Update"})]},R.key)})}),m.jsxs("p",{className:"muted",children:["Git checkouts run ",m.jsx("code",{children:"git pull --ff-only"})," then rebuild and restart. npm package installs compare against the npm registry, run ",m.jsx("code",{children:"npm install -g nterminal@latest"}),", then restart."]})]})}const Bc=[{id:"terminal",label:"Terminal"},{id:"shortcuts",label:"Shortcuts"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"},{id:"updates",label:"Updates"}];function c2({onClose:e,api:t,updateAvailable:n=!1,onNotificationAssetsChanged:a}){const o=v.useMemo(()=>t??bu(),[t]),[c,d]=v.useState(()=>Hf()),[p,_]=v.useState(()=>jf()),[f,S]=v.useState(()=>Pf()),[y,w]=v.useState(()=>rr()),[x,C]=v.useState(()=>Or()),[E,N]=v.useState(null),[D,ie]=v.useState(null),[R,H]=v.useState("terminal"),[j,W]=v.useState(()=>Fb()),[B,oe]=v.useState(()=>Lr()),[ce,ue]=v.useState(()=>e_()),[Q,G]=v.useState([]),[K,J]=v.useState([]),[se,M]=v.useState([]),[Y,X]=v.useState(5*1024*1024),[pe,ye]=v.useState(!1),[k,I]=v.useState(null),ne=v.useRef(null),he=v.useRef(null),_e=v.useRef({terminal:null,shortcuts:null,notifications:null,security:null,updates:null}),me=v.useMemo(()=>new Set(K),[K]),Ee=!u2(K,se);v.useEffect(()=>Xb(()=>d(Hf())),[]),v.useEffect(()=>Gb(()=>_(jf())),[]),v.useEffect(()=>Zb(()=>S(Pf())),[]),v.useEffect(()=>r0(()=>w(rr())),[]),v.useEffect(()=>Qb(()=>C(Or())),[]),v.useEffect(()=>qb(()=>oe(Lr())),[]),v.useEffect(()=>{if(!E)return;const V=eo.find(it=>it.id===E);if(!V)return;const He=it=>{if(it.preventDefault(),it.stopPropagation(),it.key==="Escape"){N(null),ie(null);return}const rt=KE(it,V);if(!rt){ie(V.indexed?"Press a shortcut ending in a number from 1 to 9.":"Press a complete shortcut.");return}C(jE(E,rt)),N(null),ie(null)};return window.addEventListener("keydown",He,!0),()=>window.removeEventListener("keydown",He,!0)},[E]),v.useEffect(()=>{let V=!1;return o.listNotificationAssets().then(He=>{V||ee(He)}).catch(He=>{V||I(Lc(He))}),()=>{V=!0}},[o]);function De(V){d(Nc(Number(V)))}function Ce(V){oe(Uy(Number(V)))}function Me(V){H(V),_e.current[V]?.scrollIntoView?.({block:"start",behavior:"smooth"})}function et(){const V=he.current;if(!V)return;if(V.scrollTop+V.clientHeight>=V.scrollHeight-2){H(Bc[Bc.length-1].id);return}const He=V.getBoundingClientRect();let it="terminal",rt=0;for(const Es of Bc){const ls=_e.current[Es.id];if(!ls)continue;const ci=ls.getBoundingClientRect(),ui=Math.max(ci.top,He.top),Bi=Math.min(ci.bottom,He.bottom),Si=Math.max(0,Bi-ui);Si>rt&&(it=Es.id,rt=Si)}H(it)}function tt(V){C(UE(V)),N(null),ie(null)}function Ne(){C(PE()),N(null),ie(null)}function ee(V){const He=V.assets.filter(it=>it.enabled).map(it=>it.id);G(V.assets),J(He),M(He),X(V.maxFileBytes),I(null)}async function Te(){if(j){jy(!1),W(!1);return}let V=ce;V==="default"&&(V=await NE(),ue(V)),V==="granted"&&(jy(!0),W(!0))}async function xe(V){const He=V?.[0];if(He){if(He.size>Y){I(`File must be ${ef(Y)} or smaller.`),qe();return}if(He.type!=="video/mp4"&&He.type!=="video/webm"){I("Upload an MP4 or WebM video."),qe();return}ye(!0),I(null);try{await o.uploadNotificationAsset(He),ee(await o.listNotificationAssets()),a?.()}catch(it){I(Lc(it))}finally{ye(!1),qe()}}}async function ze(V){ye(!0),I(null);try{await o.deleteNotificationAsset(V),ee(await o.listNotificationAssets()),a?.()}catch(He){I(Lc(He))}finally{ye(!1)}}function qe(){ne.current&&(ne.current.value="")}function vt(V,He){const it=new Set(K);if(He?it.add(V):it.delete(V),it.size===0){I("Keep at least one toast video selected.");return}I(null),J(Array.from(it))}async function ct(){if(K.length===0){I("Keep at least one toast video selected.");return}ye(!0),I(null);try{const V=await o.updateNotificationAssetSelection({enabledAssetIds:K});ee(V),a?.()}catch(V){I(Lc(V))}finally{ye(!1)}}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:V=>V.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:Bc.map(V=>m.jsxs("button",{type:"button","data-active":R===V.id?"true":"false","aria-current":R===V.id?"true":void 0,onClick:()=>Me(V.id),children:[V.label,V.id==="updates"&&n?m.jsx("span",{className:"update-pulse-dot settings-update-dot","aria-hidden":"true"}):null]},V.id))}),m.jsxs("div",{ref:he,className:"settings-content",onScroll:et,children:[m.jsxs("section",{id:"settings-terminal",ref:V=>{_e.current.terminal=V},className:"security-section settings-section",children:[m.jsx("h3",{children:"Terminal"}),m.jsxs("label",{className:"settings-control",children:[m.jsx("span",{children:"Font size"}),m.jsxs("span",{className:"settings-control-value",children:[c,"px"]}),m.jsx("input",{type:"range",min:Lf,max:Of,step:1,value:c,"aria-label":"Terminal font size",onChange:V=>De(V.currentTarget.value)})]}),m.jsxs("div",{className:"settings-stepper-row",children:[m.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>d(Nc(c-1)),children:"-"}),m.jsx("input",{type:"number",min:Lf,max:Of,step:1,value:c,"aria-label":"Terminal font size value",onChange:V=>De(V.currentTarget.value)}),m.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>d(Nc(c+1)),children:"+"}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:()=>d(Nc(Nr)),children:"Reset"})]}),m.jsxs("label",{className:"settings-control",children:[m.jsx("span",{children:"Font family"}),m.jsx("select",{value:p,"aria-label":"Terminal font family",onChange:V=>_(OE(V.currentTarget.value)),children:nu.map(V=>m.jsx("option",{value:V.id,children:V.label},V.id))})]}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:f,onChange:V=>S(zE(V.currentTarget.checked))}),"Show scroll progress"]}),m.jsxs("label",{className:"settings-control",children:[m.jsx("span",{children:"Accent theme"}),m.jsx("select",{value:y,"aria-label":"Theme accent",onChange:V=>w(GE(V.currentTarget.value)),children:to.map(V=>m.jsx("option",{value:V.id,children:V.label},V.id))})]}),m.jsx("div",{className:"settings-theme-swatches","aria-hidden":"true",children:to.map(V=>m.jsx("span",{className:"settings-theme-swatch","data-active":y===V.id?"true":"false",style:{"--settings-theme-accent":V.accent}},V.id))})]}),m.jsxs("section",{id:"settings-shortcuts",ref:V=>{_e.current.shortcuts=V},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:Ne,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."}),D?m.jsx("p",{className:"settings-error",children:D}):null,m.jsx("ul",{className:"settings-shortcut-list","aria-label":"Workspace shortcuts",children:eo.map(V=>{const He=E===V.id;return m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsx("span",{className:"settings-shortcut-label",children:V.label}),m.jsx("span",{className:"settings-shortcut-group",children:V.group})]}),m.jsxs("div",{className:"settings-shortcut-actions",children:[m.jsx("button",{type:"button",className:"settings-shortcut-recorder","data-recording":He?"true":"false",onClick:()=>{N(V.id),ie(null)},children:He?"Press keys…":e0(x[V.id])}),m.jsx("button",{type:"button",className:"secondary-button settings-shortcut-reset",onClick:()=>tt(V.id),children:"Reset"})]})]},V.id)})})]}),m.jsxs("section",{id:"settings-notifications",ref:V=>{_e.current.notifications=V},className:"security-section settings-section",children:[m.jsx("h3",{children:"Notifications"}),ku()?m.jsxs(m.Fragment,{children:[m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:j&&ce==="granted",onChange:()=>{Te()},disabled:ce==="denied"}),"System notification when page is hidden"]}),ce==="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:B.enabled,onChange:V=>oe(kE(V.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:B.persistUntilDismissed?"Until closed":`${B.durationSeconds}s`}),m.jsx("input",{type:"range",min:Mf,max:Af,step:.5,value:B.durationSeconds,disabled:!B.enabled||B.persistUntilDismissed,"aria-label":"Completion toast duration",onChange:V=>Ce(V.currentTarget.value)})]}),m.jsxs("div",{className:"settings-stepper-row settings-duration-row",children:[m.jsx("input",{type:"number",min:Mf,max:Af,step:.5,value:B.durationSeconds,disabled:!B.enabled||B.persistUntilDismissed,"aria-label":"Completion toast duration value",onChange:V=>Ce(V.currentTarget.value)}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",disabled:!B.enabled||B.persistUntilDismissed,onClick:()=>oe(Uy(Xl)),children:"Reset"})]}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:B.persistUntilDismissed,disabled:!B.enabled,onChange:V=>oe(DE(V.currentTarget.checked))}),"Keep toast until dismissed"]}),m.jsxs("div",{className:"settings-assets-header",children:[m.jsx("span",{children:"Toast videos"}),m.jsxs("span",{children:[ef(Y)," max"]})]}),m.jsx("input",{ref:ne,type:"file",accept:"video/mp4,video/webm",className:"settings-asset-input","aria-label":"Upload toast video",onChange:V=>{xe(V.currentTarget.files)}}),m.jsx("button",{type:"button",className:"secondary-button settings-upload-button",disabled:pe,onClick:()=>ne.current?.click(),children:"Upload video"}),k?m.jsx("p",{className:"settings-error",children:k}):null,Q.length>0?m.jsx("ul",{className:"settings-asset-list","aria-label":"Toast videos",children:Q.map(V=>m.jsxs("li",{"data-enabled":me.has(V.id)?"true":"false",children:[m.jsxs("label",{className:"settings-asset-choice",children:[m.jsx("input",{type:"checkbox",checked:me.has(V.id),disabled:pe,"aria-label":`Use ${V.filename}`,onChange:He=>vt(V.id,He.currentTarget.checked)}),m.jsx("video",{src:V.url,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),m.jsxs("span",{className:"settings-asset-copy",children:[m.jsx("span",{children:V.filename}),m.jsx("small",{children:V.source==="built-in"?"Built-in":ef(V.size)})]})]}),V.source==="uploaded"?m.jsx("button",{type:"button",className:"secondary-button settings-asset-delete",disabled:pe,"aria-label":`Delete ${V.filename}`,onClick:()=>{ze(V.id)},children:"x"}):null]},V.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:pe||Q.length===0||!Ee,onClick:()=>{ct()},children:"Save selected videos"})]}),m.jsx("div",{id:"settings-security",ref:V=>{_e.current.security=V},className:"settings-section-group",children:m.jsx(TE,{api:o})}),m.jsx("div",{id:"settings-updates",ref:V=>{_e.current.updates=V},className:"settings-section-group",children:m.jsx(o2,{api:o})})]})]})]})})}function ef(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 Lc(e){return e instanceof Error?e.message:"Request failed."}function u2(e,t){if(e.length!==t.length)return!1;const n=new Set(t);return e.every(a=>n.has(a))}class Dl extends Error{constructor(t,n){super(n),this.status=t,this.name="UploadClientError"}status}function h2(e){const t=e.createXhr?.()??new XMLHttpRequest,n=new FormData,a=e.files.map((o,c)=>({fieldName:`file${c}`,relativePath:o.relativePath,size:o.file.size}));n.append("manifest",JSON.stringify({terminalId:e.terminalId,entries:a}));for(const[o,c]of e.files.entries())n.append(`file${o}`,c.file);return new Promise((o,c)=>{t.open("POST","/api/uploads"),t.withCredentials=!0,t.upload.onprogress=d=>{if(e.onProgress){if(d.lengthComputable&&d.total>0){e.onProgress({loaded:d.loaded,total:d.total,percent:Math.round(d.loaded/d.total*100)});return}e.onProgress({loaded:d.loaded,total:null,percent:null})}},t.onload=()=>{if(t.status>=200&&t.status<300){try{o(JSON.parse(t.responseText))}catch{c(new Dl(t.status,"Invalid upload response."))}return}c(new Dl(t.status,d2(t.responseText,t.statusText||`HTTP ${t.status}`)))},t.onerror=()=>c(new Dl(0,"Upload failed.")),t.onabort=()=>c(new Dl(0,"Upload aborted.")),t.ontimeout=()=>c(new Dl(0,"Upload timed out.")),t.send(n)})}function d2(e,t){try{const n=JSON.parse(e),a=typeof n.error=="string"?n.error:n.message;if(typeof a=="string"&&a.trim())return a}catch{}return t}const f2="modulepreload",p2=function(e){return"/"+e},Fy={},o0=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let _=function(f){return Promise.all(f.map(S=>Promise.resolve(S).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=d?.nonce||d?.getAttribute("nonce");o=_(n.map(f=>{if(f=p2(f),f in Fy)return;Fy[f]=!0;const S=f.endsWith(".css"),y=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const w=document.createElement("link");if(w.rel=S?"stylesheet":f2,S||(w.as="script"),w.crossOrigin="",w.href=f,p&&w.setAttribute("nonce",p),document.head.appendChild(w),S)return new Promise((x,C)=>{w.addEventListener("load",x),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${f}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return o.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})},_2=v.lazy(()=>o0(()=>import("./MarkdownPreview-DTYgRoOA.js"),[]));function m2({api:e,activeTerminalId:t,activeTerminalCwd:n,onOpenFile:a}){const[o,c]=v.useState(null),[d,p]=v.useState(""),[_,f]=v.useState({}),[S,y]=v.useState(()=>new Set),[w,x]=v.useState(null),[C,E]=v.useState({type:"empty"}),[N,D]=v.useState("idle"),[ie,R]=v.useState(null),H=v.useRef(null),j=v.useRef(null),W=v.useRef(!1),B=v.useRef(0),oe=v.useRef(null);oe.current===null&&t&&(oe.current=t);const ce=oe.current,ue=t?sf(t,n):null,Q=o?[o.rootPath,d].filter(Boolean).join("/"):"",G=w?.path??null;v.useEffect(()=>(W.current=!0,()=>{W.current=!1,B.current+=1,De()}),[]),v.useEffect(()=>{oe.current=t,j.current=null;const ee=t?sf(t,n):null;K(t,ee)},[e]),v.useEffect(()=>{if(!ce||t!==ce)return;const ee=sf(ce,n);ee!==j.current&&K(ce,ee)},[ce,t,n]);async function K(ee,Te=ue){const xe=Ce();if(j.current=Te,De(),c(null),p(""),f({}),y(new Set),x(null),E({type:"empty"}),R(null),!ee){D("idle");return}D("loading");try{const ze=await e.createFileRoot({terminalId:ee});if(!Me(xe))return;c({rootToken:ze.rootToken,rootPath:ze.rootPath});const qe=await e.listFiles({rootToken:ze.rootToken,path:""});if(!Me(xe))return;M(qe),D("idle")}catch(ze){if(await et(ze,xe))return;Me(xe)&&(R(Yn(ze)),D("idle"))}}async function J(ee=d,Te=o){if(!Te)return;const xe=Ce();D("loading"),R(null);try{const ze=await e.listFiles({rootToken:Te.rootToken,path:ee});if(!Me(xe))return;M(ze),D("idle")}catch(ze){if(await et(ze,xe))return;Me(xe)&&(R(Yn(ze)),D("idle"))}}async function se(){oe.current=t,await K(t,ue)}function M(ee){f(Te=>({...Te,[ee.path]:v2(ee.entries)}))}async function Y(ee){if(!(!tf(ee)||!o)){if(x(ee),R(null),ee.kind==="directory"){p(ee.path),Ee(),await pe(ee);return}if(p(kr(ee.path)),ee.editable){await k(ee);return}ee.previewKind!=="none"&&await ne(ee,ee.previewKind)}}async function X(ee){if(!(!tf(ee)||!o)){if(x(ee),R(null),ee.kind==="directory"){p(ee.path),Ee(),await pe(ee);return}if(p(kr(ee.path)),ee.editable){await I(ee);return}ee.previewKind!=="none"&&await ne(ee,ee.previewKind)}}async function pe(ee){if(S.has(ee.path)){y(Te=>{const xe=new Set(Te);return xe.delete(ee.path),xe});return}y(Te=>new Set(Te).add(ee.path)),await J(ee.path)}function ye(ee,Te){ee.key==="Enter"&&(ee.preventDefault(),X(Te))}async function k(ee){if(!o)return;const Te=Ce();D("loading"),De();try{const xe=await e.readFile({rootToken:o.rootToken,path:ee.path});if(!Me(Te))return;E({type:"text-preview",file:ee,read:xe}),D("idle")}catch(xe){if(await et(xe,Te))return;Me(Te)&&(R(Yn(xe)),D("idle"))}}async function I(ee){if(!o)return;const Te=Ce();D("loading");try{await a({rootToken:o.rootToken,path:ee.path}),Me(Te)&&D("idle")}catch(xe){if(await et(xe,Te))return;Me(Te)&&(R(Yn(xe)),D("idle"))}}async function ne(ee,Te){if(!o)return;const xe=Ce();D("loading"),De();try{const ze=await e.previewFile({rootToken:o.rootToken,path:ee.path});if(!Me(xe))return;const qe=URL.createObjectURL(ze);if(!Me(xe)){URL.revokeObjectURL(qe);return}H.current=qe,E({type:"preview",file:ee,previewKind:Te,url:qe}),D("idle")}catch(ze){if(await et(ze,xe))return;Me(xe)&&(R(Yn(ze)),D("idle"))}}async function he(ee){if(!o)return;const Te=ee==="file"?"New file":"New folder",xe=window.prompt(Te,""),ze=w?w.kind==="directory"?w.path:kr(w.path):d,qe=qy(xe,ze);if(qe){R(null);try{const vt=await e.createFileEntry({rootToken:o.rootToken,path:qe,kind:ee});x(vt.entry),await J(ze)}catch(vt){if(await et(vt))return;R(Yn(vt))}}}async function _e(){if(!o||!w)return;const ee=window.prompt("Move selected entry",w.path),Te=qy(ee,"");if(!Te||Te===w.path)return;const xe=kr(w.path),ze=kr(Te);R(null);try{const qe=await e.moveFileEntry({rootToken:o.rootToken,sourcePath:w.path,destinationPath:Te});x(qe.entry),p(qe.entry.kind==="directory"?qe.entry.path:kr(qe.entry.path)),Ee(),await J(xe),ze!==xe&&await J(ze)}catch(qe){if(await et(qe))return;R(Yn(qe))}}async function me(){if(!o||!w)return;const ee=w.path,Te=kr(ee);R(null);try{const xe=await e.previewDeleteFileEntry({rootToken:o.rootToken,path:w.path}),ze=xe.descendantCount>0?` and ${xe.descendantCount} nested item${xe.descendantCount===1?"":"s"}`:"";if(!window.confirm(`Delete ${xe.path}${ze}?`))return;await e.deleteFileEntry({rootToken:o.rootToken,path:w.path,previewToken:xe.previewToken}),x(null),p(Te),y(qe=>{const vt=new Set(qe);for(const ct of qe)(ct===ee||ct.startsWith(`${ee}/`))&&vt.delete(ct);return vt}),Ee(),await J(Te)}catch(xe){if(await et(xe))return;R(Yn(xe))}}function Ee(){B.current+=1,De(),E({type:"empty"})}function De(){H.current&&(URL.revokeObjectURL(H.current),H.current=null)}function Ce(){return B.current+=1,B.current}function Me(ee){return W.current&&ee===B.current}async function et(ee,Te){return y2(ee)?(Te!==void 0&&!Me(Te)||await K(t,ue),!0):!1}function tt(ee,Te){const xe=tf(ee),ze=ee.kind==="directory"&&S.has(ee.path),qe=_[ee.path]??[],vt={"--file-tree-depth":Te};return m.jsxs(ki.Fragment,{children:[m.jsxs("button",{type:"button",className:"file-entry-button","data-kind":ee.kind,"data-expanded":ze,"data-active":G===ee.path,disabled:!xe,style:vt,"aria-expanded":ee.kind==="directory"?ze:void 0,"aria-label":`${ee.kind==="directory"?"Open folder":"Open file"} ${ee.name}`,title:ee.kind==="directory"?"Expand or collapse folder":"Click to preview. Double-click or press Enter to open.",onClick:()=>{Y(ee)},onDoubleClick:()=>{X(ee)},onKeyDown:ct=>ye(ct,ee),children:[m.jsx("span",{className:"file-entry-disclosure","aria-hidden":"true",children:ee.kind==="directory"?ze?"▾":"▸":""}),m.jsx("span",{className:"file-entry-name",children:ee.name}),m.jsx("small",{children:g2(ee)})]}),ze?m.jsx("div",{className:"file-tree-children",role:"group",children:qe.map(ct=>tt(ct,Te+1))}):null]},ee.path)}const Ne=_[""]??[];return m.jsxs("section",{className:"file-explorer","aria-label":"Files","aria-busy":N==="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:()=>{he("file")},children:"+"}),m.jsx("button",{type:"button","aria-label":"New folder",title:"New folder",disabled:!o,onClick:()=>{he("directory")},children:"▣"})]})]}),ie?m.jsx("div",{className:"file-explorer-alert",role:"alert",children:ie}):null,m.jsxs("div",{className:"file-explorer-layout",children:[m.jsx("div",{className:"file-tree","aria-label":Q?`Files in ${Q}`:"Files",children:Ne.map(ee=>tt(ee,0))}),m.jsxs("section",{className:"file-detail","aria-label":"File detail",children:[m.jsxs("div",{className:"file-detail-header",children:[m.jsx("strong",{children:w?.name??"detail"}),m.jsxs("div",{className:"file-detail-actions",children:[m.jsx("button",{type:"button","aria-label":"Move selected entry",disabled:!w,onClick:()=>{_e()},children:"Move"}),m.jsx("button",{type:"button","aria-label":"Delete selected entry",disabled:!w,onClick:()=>{me()},children:"Delete"})]})]}),N==="loading"?m.jsx("div",{className:"file-detail-empty",children:"loading"}):null,C.type==="empty"&&N!=="loading"?m.jsx("div",{className:"file-detail-empty",children:"No file selected"}):null,C.type==="preview"?m.jsxs("div",{className:"file-preview-frame",children:[C.previewKind==="image"?m.jsx("img",{src:C.url,alt:C.file.name}):null,C.previewKind==="pdf"?m.jsx("iframe",{src:C.url,title:C.file.name}):null]}):null,C.type==="text-preview"&&C.read.language==="markdown"?m.jsx("div",{className:"file-markdown-preview","aria-label":`Preview for ${C.file.name}`,children:m.jsx(v.Suspense,{fallback:m.jsx("div",{className:"file-markdown-preview-loading",children:"loading preview"}),children:m.jsx(_2,{content:C.read.content})})}):null,C.type==="text-preview"&&C.read.language==="text"?m.jsx("pre",{className:"file-text-preview","aria-label":`Preview for ${C.file.name}`,children:C.read.content}):null]})]})]})}function tf(e){return e.kind==="directory"||e.editable||e.previewKind!=="none"}function g2(e){return e.kind==="directory"?"dir":e.editable?"edit":e.previewKind!=="none"?e.previewKind:"unsupported"}function sf(e,t){return`${e}\0${t??""}`}function v2(e){return[...e].sort((t,n)=>t.kind==="directory"&&n.kind!=="directory"?-1:t.kind!=="directory"&&n.kind==="directory"?1:t.name.localeCompare(n.name))}function kr(e){const t=e.split("/").filter(Boolean);return t.pop(),t.join("/")}function qy(e,t){if(e===null)return null;const n=e.trim().replace(/^\/+/,"").replace(/\/{2,}/g,"/").replace(/\/$/,"");return n?!t||n.includes("/")?n:`${t}/${n}`:null}function Yn(e){return e instanceof Error?e.message:"Request failed"}function y2(e){return e instanceof gn&&e.status===409&&e.message==="terminal_cwd_changed"}const S2=v.lazy(()=>o0(()=>import("./MarkdownPreview-DTYgRoOA.js"),[]));function Wy({api:e,editor:t,canClose:n,onClose:a}){const[o,c]=v.useState(t.read),[d,p]=v.useState(t.read.content),[_,f]=v.useState("idle"),[S,y]=v.useState(null),[w,x]=v.useState(!1),[C,E]=v.useState("edit"),N=v.useRef(t),D=v.useRef(t.read),ie=v.useRef(t.read.content),R=v.useRef(!1),H=v.useRef(!1),j=v.useRef(0),W=d!==o.content&&_!=="saving"&&!w;v.useEffect(()=>(H.current=!0,()=>{H.current=!1,j.current+=1}),[]),v.useEffect(()=>{j.current+=1,R.current=!1,N.current=t,D.current=t.read,ie.current=t.read.content,c(t.read),p(t.read.content),f("idle"),y(null),x(!1),E("edit")},[t.id,t.read]),v.useEffect(()=>{N.current=t},[t]),v.useEffect(()=>{D.current=o},[o]),v.useEffect(()=>{ie.current=d},[d]),v.useEffect(()=>{if(d===o.content||w)return;const Q=window.setInterval(()=>{!R.current&&ie.current!==D.current.content&&B()},1e3);return()=>window.clearInterval(Q)},[d===o.content,w,t.id]);async function B(){if(R.current)return;const Q=ie.current,G=D.current;if(Q===G.content)return;const K=N.current,J=j.current;R.current=!0,f("saving"),y(null),x(!1);try{const se=await e.writeFile({rootToken:K.rootToken,path:K.path,content:Q,expectedVersion:G.version});if(!H.current||J!==j.current)return;const M={...G,content:Q,version:se.version};D.current=M,c(M),f(ie.current===Q?"saved":"idle")}catch(se){if(!H.current||J!==j.current)return;if(se instanceof gn&&se.status===409){x(!0),f("idle");return}y(b2(se)),f("idle")}finally{J===j.current&&(R.current=!1)}}const oe=_==="saving"?"saving":_==="saved"?"saved":o.language,ce=o.language==="markdown",ue=ce&&C==="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:!W,onClick:()=>{B()},children:"Save"}),ce?m.jsx("button",{type:"button","aria-label":`${ue?"Edit":"Preview"} ${t.title}`,onClick:()=>E(Q=>Q==="preview"?"edit":"preview"),children:ue?"Edit":"Preview"}):null,n?m.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close editor ${t.title}`,onClick:a,children:"x"}):null]}),S?m.jsx("div",{className:"editor-pane-alert",role:"alert",children:S}):null,w?m.jsx("div",{className:"editor-pane-alert",role:"alert",children:"File changed on disk."}):null,ue?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(S2,{content:d})})}):m.jsx("textarea",{className:"editor-pane-textarea","aria-label":`Editor for ${t.title}`,spellCheck:!1,value:d,onChange:Q=>{const G=Q.target.value;ie.current=G,p(G),f("idle"),y(null),x(!1)}})]})}function b2(e){return e instanceof Error?e.message:"Request failed"}var w2=2,C2=1,x2=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(n.getPropertyValue("height")),o=Math.max(0,parseInt(n.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),d={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},p=d.top+d.bottom,_=d.right+d.left,f=a-p,S=o-_-t;return{cols:Math.max(w2,Math.floor(S/e.css.cell.width)),rows:Math.max(C2,Math.floor(f/e.css.cell.height))}}};var c0=Object.defineProperty,E2=Object.getOwnPropertyDescriptor,T2=(e,t)=>{for(var n in t)c0(e,n,{get:t[n],enumerable:!0})},Pt=(e,t,n,a)=>{for(var o=a>1?void 0:a?E2(t,n):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(o=(a?d(t,n,o):d(o))||o);return a&&o&&c0(t,n,o),o},ge=(e,t)=>(n,a)=>t(n,a,e),Yy="Terminal input",Wf={get:()=>Yy,set:e=>Yy=e},$y="Too much output to announce, navigate to rows manually to read",Yf={get:()=>$y,set:e=>$y=e};function k2(e){return e.replace(/\r?\n/g,"\r")}function D2(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function R2(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function M2(e,t,n,a){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");u0(o,t,n,a)}}function u0(e,t,n,a){e=k2(e),e=D2(e,n.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function h0(e,t,n){let a=n.getBoundingClientRect(),o=e.clientX-a.left-10,c=e.clientY-a.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${c}px`,t.style.zIndex="1000",t.focus()}function Vy(e,t,n,a,o){h0(e,t,n),o&&a.rightClickSelect(e),t.value=a.selectionText,t.select()}function Jn(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Du(e,t=0,n=e.length){let a="";for(let o=t;o<n;++o){let c=e[o];c>65535?(c-=65536,a+=String.fromCharCode((c>>10)+55296)+String.fromCharCode(c%1024+56320)):a+=String.fromCharCode(c)}return a}var A2=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let a=0,o=0;if(this._interim){let c=e.charCodeAt(o++);56320<=c&&c<=57343?t[a++]=(this._interim-55296)*1024+c-56320+65536:(t[a++]=this._interim,t[a++]=c),this._interim=0}for(let c=o;c<n;++c){let d=e.charCodeAt(c);if(55296<=d&&d<=56319){if(++c>=n)return this._interim=d,a;let p=e.charCodeAt(c);56320<=p&&p<=57343?t[a++]=(d-55296)*1024+p-56320+65536:(t[a++]=d,t[a++]=p);continue}d!==65279&&(t[a++]=d)}return a}},N2=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let a=0,o,c,d,p,_=0,f=0;if(this.interim[0]){let w=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let C=0,E;for(;(E=this.interim[++C]&63)&&C<4;)x<<=6,x|=E;let N=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,D=N-C;for(;f<D;){if(f>=n)return 0;if(E=e[f++],(E&192)!==128){f--,w=!0;break}else this.interim[C++]=E,x<<=6,x|=E&63}w||(N===2?x<128?f--:t[a++]=x:N===3?x<2048||x>=55296&&x<=57343||x===65279||(t[a++]=x):x<65536||x>1114111||(t[a++]=x)),this.interim.fill(0)}let S=n-4,y=f;for(;y<n;){for(;y<S&&!((o=e[y])&128)&&!((c=e[y+1])&128)&&!((d=e[y+2])&128)&&!((p=e[y+3])&128);)t[a++]=o,t[a++]=c,t[a++]=d,t[a++]=p,y+=4;if(o=e[y++],o<128)t[a++]=o;else if((o&224)===192){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(_=(o&31)<<6|c&63,_<128){y--;continue}t[a++]=_}else if((o&240)===224){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,a;if(d=e[y++],(d&192)!==128){y--;continue}if(_=(o&15)<<12|(c&63)<<6|d&63,_<2048||_>=55296&&_<=57343||_===65279)continue;t[a++]=_}else if((o&248)===240){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,a;if(d=e[y++],(d&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=d,a;if(p=e[y++],(p&192)!==128){y--;continue}if(_=(o&7)<<18|(c&63)<<12|(d&63)<<6|p&63,_<65536||_>1114111)continue;t[a++]=_}}return a}},d0="",tr=" ",mo=class f0{constructor(){this.fg=0,this.bg=0,this.extended=new lu}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 f0;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}},lu=class p0{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new p0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Cs=class _0 extends mo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new lu,this.combinedData=""}static fromCharData(t){let n=new _0;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Jn(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let a=t[1].charCodeAt(0);if(55296<=a&&a<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(a-55296)*1024+o-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Xy="di$target",$f="di$dependencies",nf=new Map;function B2(e){return e[$f]||[]}function yi(e){if(nf.has(e))return nf.get(e);let t=function(n,a,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");L2(t,n,o)};return t._id=e,nf.set(e,t),t}function L2(e,t,n){t[Xy]===t?t[$f].push({id:e,index:n}):(t[$f]=[{id:e,index:n}],t[Xy]=t)}var Hi=yi("BufferService"),m0=yi("CoreMouseService"),jr=yi("CoreService"),O2=yi("CharsetService"),p_=yi("InstantiationService"),g0=yi("LogService"),ji=yi("OptionsService"),v0=yi("OscLinkService"),z2=yi("UnicodeService"),go=yi("DecorationService"),Vf=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let a=[],o=this._optionsService.rawOptions.linkHandler,c=new Cs,d=n.getTrimmedLength(),p=-1,_=-1,f=!1;for(let S=0;S<d;S++)if(!(_===-1&&!n.hasContent(S))){if(n.loadCell(S,c),c.hasExtendedAttrs()&&c.extended.urlId)if(_===-1){_=S,p=c.extended.urlId;continue}else f=c.extended.urlId!==p;else _!==-1&&(f=!0);if(f||_!==-1&&S===d-1){let y=this._oscLinkService.getLinkData(p)?.uri;if(y){let w={start:{x:_+1,y:e},end:{x:S+(!f&&S===d-1?1:0),y:e}},x=!1;if(!o?.allowNonHttpProtocols)try{let C=new URL(y);["http:","https:"].includes(C.protocol)||(x=!0)}catch{x=!0}x||a.push({text:y,range:w,activate:(C,E)=>o?o.activate(C,E,w):H2(C,E),hover:(C,E)=>o?.hover?.(C,E,w),leave:(C,E)=>o?.leave?.(C,E,w)})}f=!1,c.hasExtendedAttrs()&&c.extended.urlId?(_=S,p=c.extended.urlId):(_=-1,p=-1)}}t(a)}};Vf=Pt([ge(0,Hi),ge(1,ji),ge(2,v0)],Vf);function H2(e,t){if(confirm(`Do you want to navigate to ${t}?
14
-
15
- WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Ru=yi("CharSizeService"),yn=yi("CoreBrowserService"),__=yi("MouseService"),Sn=yi("RenderService"),j2=yi("SelectionService"),y0=yi("CharacterJoinerService"),Oa=yi("ThemeService"),S0=yi("LinkProviderService"),U2=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Gy.isErrorNoTelemetry(e)?new Gy(e.message+`
16
-
17
- `+e.stack):new Error(e.message+`
18
-
19
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},P2=new U2;function Yc(e){K2(e)||P2.onUnexpectedError(e)}var Xf="Canceled";function K2(e){return e instanceof I2?!0:e instanceof Error&&e.name===Xf&&e.message===Xf}var I2=class extends Error{constructor(){super(Xf),this.name=this.message}};function F2(e){return new Error(`Illegal argument: ${e}`)}var Gy=class Gf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Gf)return t;let n=new Gf;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Zf=class b0 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,b0.prototype)}};function ns(e,t=0){return e[e.length-(1+t)]}var q2;(e=>{function t(c){return c<0}e.isLessThan=t;function n(c){return c<=0}e.isLessThanOrEqual=n;function a(c){return c>0}e.isGreaterThan=a;function o(c){return c===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(q2||={});function W2(e,t){let n=this,a=!1,o;return function(){return a||(a=!0,t||(o=e.apply(n,arguments))),o}}var w0;(e=>{function t(H){return H&&typeof H=="object"&&typeof H[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function a(){return n}e.empty=a;function*o(H){yield H}e.single=o;function c(H){return t(H)?H:o(H)}e.wrap=c;function d(H){return H||n}e.from=d;function*p(H){for(let j=H.length-1;j>=0;j--)yield H[j]}e.reverse=p;function _(H){return!H||H[Symbol.iterator]().next().done===!0}e.isEmpty=_;function f(H){return H[Symbol.iterator]().next().value}e.first=f;function S(H,j){let W=0;for(let B of H)if(j(B,W++))return!0;return!1}e.some=S;function y(H,j){for(let W of H)if(j(W))return W}e.find=y;function*w(H,j){for(let W of H)j(W)&&(yield W)}e.filter=w;function*x(H,j){let W=0;for(let B of H)yield j(B,W++)}e.map=x;function*C(H,j){let W=0;for(let B of H)yield*j(B,W++)}e.flatMap=C;function*E(...H){for(let j of H)yield*j}e.concat=E;function N(H,j,W){let B=W;for(let oe of H)B=j(B,oe);return B}e.reduce=N;function*D(H,j,W=H.length){for(j<0&&(j+=H.length),W<0?W+=H.length:W>H.length&&(W=H.length);j<W;j++)yield H[j]}e.slice=D;function ie(H,j=Number.POSITIVE_INFINITY){let W=[];if(j===0)return[W,H];let B=H[Symbol.iterator]();for(let oe=0;oe<j;oe++){let ce=B.next();if(ce.done)return[W,e.empty()];W.push(ce.value)}return[W,{[Symbol.iterator](){return B}}]}e.consume=ie;async function R(H){let j=[];for await(let W of H)j.push(W);return Promise.resolve(j)}e.asyncToArray=R})(w0||={});function zr(e){if(w0.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(a){t.push(a)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Y2(...e){return At(()=>zr(e))}function At(e){return{dispose:W2(()=>{e()})}}var C0=class x0{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{zr(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?x0.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)}};C0.DISABLE_DISPOSED_WARNING=!1;var sr=C0,Ie=class{constructor(){this._store=new sr,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ie.None=Object.freeze({dispose(){}});var Aa=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}},mn=typeof window=="object"?window:globalThis,Qf=class Jf{constructor(t){this.element=t,this.next=Jf.Undefined,this.prev=Jf.Undefined}};Qf.Undefined=new Qf(void 0);var Bt=Qf,Zy=class{constructor(){this._first=Bt.Undefined,this._last=Bt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Bt.Undefined}clear(){let e=this._first;for(;e!==Bt.Undefined;){let t=e.next;e.prev=Bt.Undefined,e.next=Bt.Undefined,e=t}this._first=Bt.Undefined,this._last=Bt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Bt(e);if(this._first===Bt.Undefined)this._first=n,this._last=n;else if(t){let o=this._last;this._last=n,n.prev=o,o.next=n}else{let o=this._first;this._first=n,n.next=o,o.prev=n}this._size+=1;let a=!1;return()=>{a||(a=!0,this._remove(n))}}shift(){if(this._first!==Bt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Bt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Bt.Undefined&&e.next!==Bt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Bt.Undefined&&e.next===Bt.Undefined?(this._first=Bt.Undefined,this._last=Bt.Undefined):e.next===Bt.Undefined?(this._last=this._last.prev,this._last.next=Bt.Undefined):e.prev===Bt.Undefined&&(this._first=this._first.next,this._first.prev=Bt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Bt.Undefined;)yield e.element,e=e.next}},$2=globalThis.performance&&typeof globalThis.performance.now=="function",V2=class E0{static create(t){return new E0(t)}constructor(t){this._now=$2&&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}},Di;(e=>{e.None=()=>Ie.None;function t(G,K){return y(G,()=>{},0,void 0,!0,void 0,K)}e.defer=t;function n(G){return(K,J=null,se)=>{let M=!1,Y;return Y=G(X=>{if(!M)return Y?Y.dispose():M=!0,K.call(J,X)},null,se),M&&Y.dispose(),Y}}e.once=n;function a(G,K,J){return f((se,M=null,Y)=>G(X=>se.call(M,K(X)),null,Y),J)}e.map=a;function o(G,K,J){return f((se,M=null,Y)=>G(X=>{K(X),se.call(M,X)},null,Y),J)}e.forEach=o;function c(G,K,J){return f((se,M=null,Y)=>G(X=>K(X)&&se.call(M,X),null,Y),J)}e.filter=c;function d(G){return G}e.signal=d;function p(...G){return(K,J=null,se)=>{let M=Y2(...G.map(Y=>Y(X=>K.call(J,X))));return S(M,se)}}e.any=p;function _(G,K,J,se){let M=J;return a(G,Y=>(M=K(M,Y),M),se)}e.reduce=_;function f(G,K){let J,se={onWillAddFirstListener(){J=G(M.fire,M)},onDidRemoveLastListener(){J?.dispose()}},M=new de(se);return K?.add(M),M.event}function S(G,K){return K instanceof Array?K.push(G):K&&K.add(G),G}function y(G,K,J=100,se=!1,M=!1,Y,X){let pe,ye,k,I=0,ne,he={leakWarningThreshold:Y,onWillAddFirstListener(){pe=G(me=>{I++,ye=K(ye,me),se&&!k&&(_e.fire(ye),ye=void 0),ne=()=>{let Ee=ye;ye=void 0,k=void 0,(!se||I>1)&&_e.fire(Ee),I=0},typeof J=="number"?(clearTimeout(k),k=setTimeout(ne,J)):k===void 0&&(k=0,queueMicrotask(ne))})},onWillRemoveListener(){M&&I>0&&ne?.()},onDidRemoveLastListener(){ne=void 0,pe.dispose()}},_e=new de(he);return X?.add(_e),_e.event}e.debounce=y;function w(G,K=0,J){return e.debounce(G,(se,M)=>se?(se.push(M),se):[M],K,void 0,!0,void 0,J)}e.accumulate=w;function x(G,K=(se,M)=>se===M,J){let se=!0,M;return c(G,Y=>{let X=se||!K(Y,M);return se=!1,M=Y,X},J)}e.latch=x;function C(G,K,J){return[e.filter(G,K,J),e.filter(G,se=>!K(se),J)]}e.split=C;function E(G,K=!1,J=[],se){let M=J.slice(),Y=G(ye=>{M?M.push(ye):pe.fire(ye)});se&&se.add(Y);let X=()=>{M?.forEach(ye=>pe.fire(ye)),M=null},pe=new de({onWillAddFirstListener(){Y||(Y=G(ye=>pe.fire(ye)),se&&se.add(Y))},onDidAddFirstListener(){M&&(K?setTimeout(X):X())},onDidRemoveLastListener(){Y&&Y.dispose(),Y=null}});return se&&se.add(pe),pe.event}e.buffer=E;function N(G,K){return(J,se,M)=>{let Y=K(new ie);return G(function(X){let pe=Y.evaluate(X);pe!==D&&J.call(se,pe)},void 0,M)}}e.chain=N;let D=Symbol("HaltChainable");class ie{constructor(){this.steps=[]}map(K){return this.steps.push(K),this}forEach(K){return this.steps.push(J=>(K(J),J)),this}filter(K){return this.steps.push(J=>K(J)?J:D),this}reduce(K,J){let se=J;return this.steps.push(M=>(se=K(se,M),se)),this}latch(K=(J,se)=>J===se){let J=!0,se;return this.steps.push(M=>{let Y=J||!K(M,se);return J=!1,se=M,Y?M:D}),this}evaluate(K){for(let J of this.steps)if(K=J(K),K===D)break;return K}}function R(G,K,J=se=>se){let se=(...pe)=>X.fire(J(...pe)),M=()=>G.on(K,se),Y=()=>G.removeListener(K,se),X=new de({onWillAddFirstListener:M,onDidRemoveLastListener:Y});return X.event}e.fromNodeEventEmitter=R;function H(G,K,J=se=>se){let se=(...pe)=>X.fire(J(...pe)),M=()=>G.addEventListener(K,se),Y=()=>G.removeEventListener(K,se),X=new de({onWillAddFirstListener:M,onDidRemoveLastListener:Y});return X.event}e.fromDOMEventEmitter=H;function j(G){return new Promise(K=>n(G)(K))}e.toPromise=j;function W(G){let K=new de;return G.then(J=>{K.fire(J)},()=>{K.fire(void 0)}).finally(()=>{K.dispose()}),K.event}e.fromPromise=W;function B(G,K){return G(J=>K.fire(J))}e.forward=B;function oe(G,K,J){return K(J),G(se=>K(se))}e.runAndSubscribe=oe;class ce{constructor(K,J){this._observable=K,this._counter=0,this._hasChanged=!1;let se={onWillAddFirstListener:()=>{K.addObserver(this)},onDidRemoveLastListener:()=>{K.removeObserver(this)}};this.emitter=new de(se),J&&J.add(this.emitter)}beginUpdate(K){this._counter++}handlePossibleChange(K){}handleChange(K,J){this._hasChanged=!0}endUpdate(K){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ue(G,K){return new ce(G,K).emitter.event}e.fromObservable=ue;function Q(G){return(K,J,se)=>{let M=0,Y=!1,X={beginUpdate(){M++},endUpdate(){M--,M===0&&(G.reportChanges(),Y&&(Y=!1,K.call(J)))},handlePossibleChange(){},handleChange(){Y=!0}};G.addObserver(X),G.reportChanges();let pe={dispose(){G.removeObserver(X)}};return se instanceof sr?se.add(pe):Array.isArray(se)&&se.push(pe),pe}}e.fromObservableLight=Q})(Di||={});var ep=class tp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${tp._idPool++}`,tp.all.add(this)}start(t){this._stopWatch=new V2,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}}};ep.all=new Set,ep._idPool=0;var X2=ep,G2=-1,T0=class k0{constructor(t,n,a=(k0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=a,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let a=this.threshold;if(a<=0||n<a)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;let[c,d]=this.getMostFrequentStack(),p=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(p),console.warn(c);let _=new J2(p,c);this._errorHandler(_)}return()=>{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[a,o]of this._stacks)(!t||n<o)&&(t=[a,o],n=o);return t}};T0._idPool=1;var Z2=T0,Q2=class D0{constructor(t){this.value=t}static create(){let t=new Error;return new D0(t.stack??"")}print(){console.warn(this.value.split(`
20
- `).slice(2).join(`
21
- `))}},J2=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},eT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},tT=0,rf=class{constructor(e){this.value=e,this.id=tT++}},iT=2,sT,de=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new Z2(e?.onListenerError??Yc,this._options?.leakWarningThreshold??G2):void 0,this._perfMon=this._options?._profName?new X2(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],_=new eT(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Yc)(_),Ie.None}if(this._disposed)return Ie.None;t&&(e=e.bind(t));let a=new rf(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=Q2.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof rf?(this._deliveryQueue??=new nT,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 n instanceof sr?n.add(c):Array.isArray(n)&&n.push(c),c},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let a=this._deliveryQueue.current===this;if(this._size*iT<=t.length){let o=0;for(let c=0;c<t.length;c++)t[c]?t[o++]=t[c]:a&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Yc;if(!n){e.value(t);return}try{e.value(t)}catch(a){n(a)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof rf)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}},nT=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ip=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new de,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new de,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let a=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(a,t),this._onDidChangeZoomLevel.fire(a)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let a=this.getWindowId(n);this.mapWindowIdToFullScreen.set(a,t),this._onDidChangeFullscreen.fire(a)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};ip.INSTANCE=new ip;var m_=ip;function rT(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}m_.INSTANCE.onDidChangeZoomLevel;function aT(e){return m_.INSTANCE.getZoomFactor(e)}m_.INSTANCE.onDidChangeFullscreen;var za=typeof navigator=="object"?navigator.userAgent:"",sp=za.indexOf("Firefox")>=0,lT=za.indexOf("AppleWebKit")>=0,g_=za.indexOf("Chrome")>=0,oT=!g_&&za.indexOf("Safari")>=0;za.indexOf("Electron/")>=0;za.indexOf("Android")>=0;var af=!1;if(typeof mn.matchMedia=="function"){let e=mn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=mn.matchMedia("(display-mode: fullscreen)");af=e.matches,rT(mn,e,({matches:n})=>{af&&t.matches||(af=n)})}var Ea="en",np=!1,rp=!1,$c=!1,R0=!1,Oc,Vc=Ea,Qy=Ea,cT,pn,Br=globalThis,as;typeof Br.vscode<"u"&&typeof Br.vscode.process<"u"?as=Br.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(as=process);var uT=typeof as?.versions?.electron=="string",hT=uT&&as?.type==="renderer";if(typeof as=="object"){np=as.platform==="win32",rp=as.platform==="darwin",$c=as.platform==="linux",$c&&as.env.SNAP&&as.env.SNAP_REVISION,as.env.CI||as.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Oc=Ea,Vc=Ea;let e=as.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Oc=t.userLocale,Qy=t.osLocale,Vc=t.resolvedLanguage||Ea,cT=t.languagePack?.translationsConfigFile}catch{}R0=!0}else typeof navigator=="object"&&!hT?(pn=navigator.userAgent,np=pn.indexOf("Windows")>=0,rp=pn.indexOf("Macintosh")>=0,(pn.indexOf("Macintosh")>=0||pn.indexOf("iPad")>=0||pn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,$c=pn.indexOf("Linux")>=0,pn?.indexOf("Mobi")>=0,Vc=globalThis._VSCODE_NLS_LANGUAGE||Ea,Oc=navigator.language.toLowerCase(),Qy=Oc):console.error("Unable to resolve platform.");var M0=np,Fs=rp,dT=$c,Jy=R0,qs=pn,$n=Vc,fT;(e=>{function t(){return $n}e.value=t;function n(){return $n.length===2?$n==="en":$n.length>=3?$n[0]==="e"&&$n[1]==="n"&&$n[2]==="-":!1}e.isDefaultVariant=n;function a(){return $n==="en"}e.isDefault=a})(fT||={});var pT=typeof Br.postMessage=="function"&&!Br.importScripts;(()=>{if(pT){let e=[];Br.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let a=0,o=e.length;a<o;a++){let c=e[a];if(c.id===n.data.vscodeScheduleAsyncWork){e.splice(a,1),c.callback();return}}});let t=0;return n=>{let a=++t;e.push({id:a,callback:n}),Br.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})();var _T=!!(qs&&qs.indexOf("Chrome")>=0);qs&&qs.indexOf("Firefox")>=0;!_T&&qs&&qs.indexOf("Safari")>=0;qs&&qs.indexOf("Edg/")>=0;qs&&qs.indexOf("Android")>=0;var ba=typeof navigator=="object"?navigator:{};Jy||document.queryCommandSupported&&document.queryCommandSupported("copy")||ba&&ba.clipboard&&ba.clipboard.writeText,Jy||ba&&ba.clipboard&&ba.clipboard.readText;var v_=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}},lf=new v_,eS=new v_,tS=new v_,mT=new Array(230),A0;(e=>{function t(p){return lf.keyCodeToStr(p)}e.toString=t;function n(p){return lf.strToKeyCode(p)}e.fromString=n;function a(p){return eS.keyCodeToStr(p)}e.toUserSettingsUS=a;function o(p){return tS.keyCodeToStr(p)}e.toUserSettingsGeneral=o;function c(p){return eS.strToKeyCode(p)||tS.strToKeyCode(p)}e.fromUserSettings=c;function d(p){if(p>=98&&p<=113)return null;switch(p){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return lf.keyCodeToStr(p)}e.toElectronAccelerator=d})(A0||={});var gT=class N0{constructor(t,n,a,o,c){this.ctrlKey=t,this.shiftKey=n,this.altKey=a,this.metaKey=o,this.keyCode=c}equals(t){return t instanceof N0&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",a=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${n}${a}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new vT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},vT=class{constructor(e){if(e.length===0)throw F2("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function yT(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return A0.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(sp)switch(t){case 59:return 85;case 60:if(dT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Fs)return 57;break}else if(lT&&(Fs&&t===93||!Fs&&t===92))return 57;return mT[t]||0}var ST=Fs?256:2048,bT=512,wT=1024,CT=Fs?2048:256,iS=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=yT(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|=ST),this.altKey&&(t|=bT),this.shiftKey&&(t|=wT),this.metaKey&&(t|=CT),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new gT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},sS=new WeakMap;function xT(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var ET=class{static getSameOriginWindowChain(e){let t=sS.get(e);if(!t){t=[],sS.set(e,t);let n=e,a;do a=xT(n),a?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=a;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,a=0,o=this.getSameOriginWindowChain(e);for(let c of o){let d=c.window.deref();if(n+=d?.scrollY??0,a+=d?.scrollX??0,d===t||!c.iframeElement)break;let p=c.iframeElement.getBoundingClientRect();n+=p.top,a+=p.left}return{top:n,left:a}}},zc=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=ET.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},nS=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let a=!1;if(g_){let o=navigator.userAgent.match(/Chrome\/(\d+)/);a=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,d=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")a?this.deltaY=o.wheelDeltaY/(120*d):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?sp&&!Fs?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")oT&&M0?this.deltaX=-(o.wheelDeltaX/120):a?this.deltaX=o.wheelDeltaX/(120*d):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?sp&&!Fs?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(a?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},B0=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),TT;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof kT?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Di.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:B0})})(TT||={});var kT=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?B0:(this._emitter||(this._emitter=new de),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},y_=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 Zf("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Zf("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},DT=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Zf("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=n.setInterval(()=>{e()},t);this.disposable=At(()=>{n.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},RT;(e=>{async function t(a){let o,c=await Promise.all(a.map(d=>d.then(p=>p,p=>{o||(o=p)})));if(typeof o<"u")throw o;return c}e.settled=t;function n(a){return new Promise(async(o,c)=>{try{await a(o,c)}catch(d){c(d)}})}e.withAsyncBody=n})(RT||={});var rS=class ys{static fromArray(t){return new ys(n=>{n.emitMany(t)})}static fromPromise(t){return new ys(async n=>{n.emitMany(await t)})}static fromPromises(t){return new ys(async n=>{await Promise.all(t.map(async a=>n.emitOne(await a)))})}static merge(t){return new ys(async n=>{await Promise.all(t.map(async a=>{for await(let o of a)n.emitOne(o)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new de,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 Di.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new ys(async a=>{for await(let o of t)a.emitOne(n(o))})}map(t){return ys.map(this,t)}static filter(t,n){return new ys(async a=>{for await(let o of t)n(o)&&a.emitOne(o)})}filter(t){return ys.filter(this,t)}static coalesce(t){return ys.filter(t,n=>!!n)}coalesce(){return ys.coalesce(this)}static async toPromise(t){let n=[];for await(let a of t)n.push(a);return n}toPromise(){return ys.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())}};rS.EMPTY=rS.fromArray([]);var{getWindow:Is,getWindowId:MT,onDidRegisterWindow:AT}=(function(){let e=new Map,t={window:mn,disposables:new sr};e.set(mn.vscodeWindowId,t);let n=new de,a=new de,o=new de;function c(d,p){return(typeof d=="number"?e.get(d):void 0)??(p?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:a.event,registerWindow(d){if(e.has(d.vscodeWindowId))return Ie.None;let p=new sr,_={window:d,disposables:p.add(new sr)};return e.set(d.vscodeWindowId,_),p.add(At(()=>{e.delete(d.vscodeWindowId),a.fire(d)})),p.add(Be(d,pi.BEFORE_UNLOAD,()=>{o.fire(d)})),n.fire(_),p},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:c,getWindow(d){let p=d;if(p?.ownerDocument?.defaultView)return p.ownerDocument.defaultView.window;let _=d;return _?.view?_.view.window:mn},getDocument(d){return Is(d).document}}})(),NT=class{constructor(e,t,n,a){this._node=e,this._type=t,this._handler=n,this._options=a||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Be(e,t,n,a){return new NT(e,t,n,a)}var aS=function(e,t,n,a){return Be(e,t,n,a)},S_,BT=class extends DT{constructor(e){super(),this.defaultTarget=e&&Is(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},lS=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){Yc(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,a=new Map,o=c=>{n.set(c,!1);let d=e.get(c)??[];for(t.set(c,d),e.set(c,[]),a.set(c,!0);d.length>0;)d.sort(lS.sort),d.shift().execute();a.set(c,!1)};S_=(c,d,p=0)=>{let _=MT(c),f=new lS(d,p),S=e.get(_);return S||(S=[],e.set(_,S)),S.push(f),n.get(_)||(n.set(_,!0),c.requestAnimationFrame(()=>o(_))),f}})();function LT(e){let t=e.getBoundingClientRect(),n=Is(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var pi={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"},OT=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=Vi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Vi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Vi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Vi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Vi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Vi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Vi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Vi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Vi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Vi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Vi(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=Vi(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=Vi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Vi(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 Vi(e){return typeof e=="number"?`${e}px`:e}function Zl(e){return new OT(e)}var L0=class{constructor(){this._hooks=new sr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,a,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=a,this._onStopCallback=o;let c=e;try{e.setPointerCapture(t),this._hooks.add(At(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=Is(e)}this._hooks.add(Be(c,pi.POINTER_MOVE,d=>{if(d.buttons!==n){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(Be(c,pi.POINTER_UP,d=>this.stopMonitoring(!0)))}};function zT(e,t,n){let a=null,o=null;if(typeof n.value=="function"?(a="value",o=n.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(a="get",o=n.get),!o)throw new Error("not supported");let c=`$memoize$${t}`;n[a]=function(...d){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,d)}),this[c]}}var Ks;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ks||={});var Ul=class Ai extends Ie{constructor(){super(),this.dispatched=!1,this.targets=new Zy,this.ignoreTargets=new Zy,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Di.runAndSubscribe(AT,({window:t,disposables:n})=>{n.add(Be(t.document,"touchstart",a=>this.onTouchStart(a),{passive:!1})),n.add(Be(t.document,"touchend",a=>this.onTouchEnd(t,a))),n.add(Be(t.document,"touchmove",a=>this.onTouchMove(a),{passive:!1}))},{window:mn,disposables:this._store}))}static addTarget(t){if(!Ai.isTouchDevice())return Ie.None;Ai.INSTANCE||(Ai.INSTANCE=new Ai);let n=Ai.INSTANCE.targets.push(t);return At(n)}static ignoreTarget(t){if(!Ai.isTouchDevice())return Ie.None;Ai.INSTANCE||(Ai.INSTANCE=new Ai);let n=Ai.INSTANCE.ignoreTargets.push(t);return At(n)}static isTouchDevice(){return"ontouchstart"in mn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let a=0,o=t.targetTouches.length;a<o;a++){let c=t.targetTouches.item(a);this.activeTouches[c.identifier]={id:c.identifier,initialTarget:c.target,initialTimeStamp:n,initialPageX:c.pageX,initialPageY:c.pageY,rollingTimestamps:[n],rollingPageX:[c.pageX],rollingPageY:[c.pageY]};let d=this.newGestureEvent(Ks.Start,c.target);d.pageX=c.pageX,d.pageY=c.pageY,this.dispatchEvent(d)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let a=Date.now(),o=Object.keys(this.activeTouches).length;for(let c=0,d=n.changedTouches.length;c<d;c++){let p=n.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(p.identifier))){console.warn("move of an UNKNOWN touch",p);continue}let _=this.activeTouches[p.identifier],f=Date.now()-_.initialTimeStamp;if(f<Ai.HOLD_DELAY&&Math.abs(_.initialPageX-ns(_.rollingPageX))<30&&Math.abs(_.initialPageY-ns(_.rollingPageY))<30){let S=this.newGestureEvent(Ks.Tap,_.initialTarget);S.pageX=ns(_.rollingPageX),S.pageY=ns(_.rollingPageY),this.dispatchEvent(S)}else if(f>=Ai.HOLD_DELAY&&Math.abs(_.initialPageX-ns(_.rollingPageX))<30&&Math.abs(_.initialPageY-ns(_.rollingPageY))<30){let S=this.newGestureEvent(Ks.Contextmenu,_.initialTarget);S.pageX=ns(_.rollingPageX),S.pageY=ns(_.rollingPageY),this.dispatchEvent(S)}else if(o===1){let S=ns(_.rollingPageX),y=ns(_.rollingPageY),w=ns(_.rollingTimestamps)-_.rollingTimestamps[0],x=S-_.rollingPageX[0],C=y-_.rollingPageY[0],E=[...this.targets].filter(N=>_.initialTarget instanceof Node&&N.contains(_.initialTarget));this.inertia(t,E,a,Math.abs(x)/w,x>0?1:-1,S,Math.abs(C)/w,C>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(Ks.End,_.initialTarget)),delete this.activeTouches[p.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let a=document.createEvent("CustomEvent");return a.initEvent(t,!1,!0),a.initialTarget=n,a.tapCount=0,a}dispatchEvent(t){if(t.type===Ks.Tap){let n=new Date().getTime(),a=0;n-this._lastSetTapCountTime>Ai.CLEAR_TAP_COUNT_TIME?a=1:a=2,this._lastSetTapCountTime=n,t.tapCount=a}else(t.type===Ks.Change||t.type===Ks.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let a of this.ignoreTargets)if(a.contains(t.initialTarget))return;let n=[];for(let a of this.targets)if(a.contains(t.initialTarget)){let o=0,c=t.initialTarget;for(;c&&c!==a;)o++,c=c.parentElement;n.push([o,a])}n.sort((a,o)=>a[0]-o[0]);for(let[a,o]of n)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,a,o,c,d,p,_,f){this.handle=S_(t,()=>{let S=Date.now(),y=S-a,w=0,x=0,C=!0;o+=Ai.SCROLL_FRICTION*y,p+=Ai.SCROLL_FRICTION*y,o>0&&(C=!1,w=c*o*y),p>0&&(C=!1,x=_*p*y);let E=this.newGestureEvent(Ks.Change);E.translationX=w,E.translationY=x,n.forEach(N=>N.dispatchEvent(E)),C||this.inertia(t,n,S,o,c,d+w,p,_,f+x)})}onTouchMove(t){let n=Date.now();for(let a=0,o=t.changedTouches.length;a<o;a++){let c=t.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("end of an UNKNOWN touch",c);continue}let d=this.activeTouches[c.identifier],p=this.newGestureEvent(Ks.Change,d.initialTarget);p.translationX=c.pageX-ns(d.rollingPageX),p.translationY=c.pageY-ns(d.rollingPageY),p.pageX=c.pageX,p.pageY=c.pageY,this.dispatchEvent(p),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(c.pageX),d.rollingPageY.push(c.pageY),d.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Ul.SCROLL_FRICTION=-.005,Ul.HOLD_DELAY=700,Ul.CLEAR_TAP_COUNT_TIME=400,Pt([zT],Ul,"isTouchDevice",1);var HT=Ul,b_=class extends Ie{onclick(e,t){this._register(Be(e,pi.CLICK,n=>t(new zc(Is(e),n))))}onmousedown(e,t){this._register(Be(e,pi.MOUSE_DOWN,n=>t(new zc(Is(e),n))))}onmouseover(e,t){this._register(Be(e,pi.MOUSE_OVER,n=>t(new zc(Is(e),n))))}onmouseleave(e,t){this._register(Be(e,pi.MOUSE_LEAVE,n=>t(new zc(Is(e),n))))}onkeydown(e,t){this._register(Be(e,pi.KEY_DOWN,n=>t(new iS(n))))}onkeyup(e,t){this._register(Be(e,pi.KEY_UP,n=>t(new iS(n))))}oninput(e,t){this._register(Be(e,pi.INPUT,t))}onblur(e,t){this._register(Be(e,pi.BLUR,t))}onfocus(e,t){this._register(Be(e,pi.FOCUS,t))}onchange(e,t){this._register(Be(e,pi.CHANGE,t))}ignoreGesture(e){return HT.ignoreTarget(e)}},oS=11,jT=class extends b_{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=oS+"px",this.domNode.style.height=oS+"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 L0),this._register(aS(this.bgDomNode,pi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(aS(this.domNode,pi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new BT),this._pointerdownScheduleRepeatTimer=this._register(new y_)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Is(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},UT=class ap{constructor(t,n,a,o,c,d,p){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,a=a|0,o=o|0,c=c|0,d=d|0,p=p|0),this.rawScrollLeft=o,this.rawScrollTop=p,n<0&&(n=0),o+n>a&&(o=a-n),o<0&&(o=0),c<0&&(c=0),p+c>d&&(p=d-c),p<0&&(p=0),this.width=n,this.scrollWidth=a,this.scrollLeft=o,this.height=c,this.scrollHeight=d,this.scrollTop=p}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new ap(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new ap(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let a=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,c=this.scrollLeft!==t.scrollLeft,d=this.height!==t.height,p=this.scrollHeight!==t.scrollHeight,_=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:a,scrollWidthChanged:o,scrollLeftChanged:c,heightChanged:d,scrollHeightChanged:p,scrollTopChanged:_}}},PT=class extends Ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new UT(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let a;t?a=new uS(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):a=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=a}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=uS.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},cS=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function of(e,t){let n=t-e;return function(a){return e+n*FT(a)}}function KT(e,t,n){return function(a){return a<n?e(a/n):t((a-n)/(1-n))}}var uS=class lp{constructor(t,n,a,o){this.from=t,this.to=n,this.duration=o,this.startTime=a,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,a){if(Math.abs(t-n)>2.5*a){let o,c;return t<n?(o=t+.75*a,c=n-.75*a):(o=t-.75*a,c=n+.75*a),KT(of(t,o),of(c,n),.33)}return of(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let a=this.scrollLeft(n),o=this.scrollTop(n);return new cS(a,o,!1)}return new cS(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,a){return lp.start(t,n,a)}static start(t,n,a){a=a+10;let o=Date.now()-10;return new lp(t,n,o,a)}};function IT(e){return Math.pow(e,3)}function FT(e){return 1-IT(1-e)}var qT=class extends Ie{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new y_)}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":"")))}},WT=140,O0=class extends b_{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 qT(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new L0),this._shouldRender=!0,this.domNode=Zl(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Be(this.domNode.domNode,pi.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new jT(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,a){this.slider=Zl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof a=="number"&&this.slider.setHeight(a),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Be(this.slider.domNode,pi.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),a=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);n<=o&&o<=a?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let o=LT(this.domNode.domNode);t=e.pageX-o.left,n=e.pageY-o.top}let a=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(a):this._scrollbarState.getDesiredScrollPositionFromOffset(a)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),a=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let c=this._sliderOrthogonalPointerPosition(o),d=Math.abs(c-n);if(M0&&d>WT){this._setDesiredScrollPositionNow(a.getScrollPosition());return}let p=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(a.getDesiredScrollPositionFromDelta(p))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},z0=class op{constructor(t,n,a,o,c,d){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(a),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=c,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new op(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,a,o,c){let d=Math.max(0,a-t),p=Math.max(0,d-2*n),_=o>0&&o>a;if(!_)return{computedAvailableSize:Math.round(d),computedIsNeeded:_,computedSliderSize:Math.round(p),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(a*p/o))),S=(p-f)/(o-a),y=c*S;return{computedAvailableSize:Math.round(d),computedIsNeeded:_,computedSliderSize:Math.round(f),computedSliderRatio:S,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=op._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,a=this._scrollPosition;return n<this._computedSliderPosition?a-=this._visibleSize:a+=this._visibleSize,a}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},YT=class extends O0{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new z0(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}},$T=class extends O0{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new z0(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}},VT=500,hS=50,XT=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},cp=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,a=1,o=this._rear;do{let c=o===this._front?t:Math.pow(2,-a);if(t-=c,n+=this._memory[o].score*c,o===this._front)break;o=(this._capacity+o-1)%this._capacity,a++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(g_){let n=Is(t.browserEvent),a=aT(n);this.accept(Date.now(),t.deltaX*a,t.deltaY*a)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,a){let o=null,c=new XT(t,n,a);this._front===-1&&this._rear===-1?(this._memory[0]=c,this._front=0,this._rear=0):(o=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=c),c.score=this._computeScore(c,o)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let a=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(a+=.25),n){let o=Math.abs(t.deltaX),c=Math.abs(t.deltaY),d=Math.abs(n.deltaX),p=Math.abs(n.deltaY),_=Math.max(Math.min(o,d),1),f=Math.max(Math.min(c,p),1),S=Math.max(o,d),y=Math.max(c,p);S%_===0&&y%f===0&&(a-=.5)}return Math.min(Math.max(a,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};cp.INSTANCE=new cp;var GT=cp,ZT=class extends b_{constructor(e,t,n){super(),this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new de),this.onWillScroll=this._onWillScroll.event,this._options=JT(t),this._scrollable=n,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let a={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new $T(this._scrollable,this._options,a)),this._horizontalScrollbar=this._register(new YT(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=Zl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Zl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Zl(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 y_),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=zr(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,Fs&&(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 nS(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=zr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new nS(n))};this._mouseWheelToDispose.push(Be(this._listenOnDomNode,pi.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=GT.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let d=!Fs&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),_={};if(o){let f=hS*o,S=p.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(_,S)}if(c){let f=hS*c,S=p.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(_,S)}_=this._scrollable.validateScrollPosition(_),(p.scrollLeft!==_.scrollLeft||p.scrollTop!==_.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(_):this._scrollable.setScrollPositionNow(_),n=!0)}let a=n;!a&&this._options.alwaysConsumeMouseWheel&&(a=!0),!a&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(a=!0),a&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,a=n?" left":"",o=t?" top":"",c=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${a}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${c}${o}${a}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),VT)}},QT=class extends ZT{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function JT(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,Fs&&(t.className+=" mac"),t}var up=class extends Ie{constructor(e,t,n,a,o,c,d,p){super(),this._bufferService=n,this._optionsService=d,this._renderService=p,this._onRequestScrollLines=this._register(new de),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let _=this._register(new PT({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>S_(a.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{_.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new QT(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},_)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Di.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(Di.runAndSubscribe(c.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${c.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${c.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${c.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
22
- `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};up=Pt([ge(2,Hi),ge(3,yn),ge(4,m0),ge(5,Oa),ge(6,ji),ge(7,Sn)],up);var hp=class extends Ie{constructor(e,t,n,a,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=a,this._renderService=o,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(c=>this._removeDecoration(c))),this._register(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 n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};hp=Pt([ge(1,Hi),ge(2,yn),ge(3,go),ge(4,Sn)],hp);var ek=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Us={full:0,left:0,center:0,right:0},Vn={full:0,left:0,center:0,right:0},Rl={full:0,left:0,center:0,right:0},ou=class extends Ie{constructor(e,t,n,a,o,c,d,p){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=a,this._renderService=o,this._optionsService=c,this._themeService=d,this._coreBrowserService=p,this._colorZoneStore=new ek,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 _=this._canvas.getContext("2d");if(_)this._ctx=_;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Vn.full=this._canvas.width,Vn.left=e,Vn.center=t,Vn.right=e,this._refreshDrawHeightConstants(),Rl.full=1,Rl.left=1,Rl.center=1+Vn.left,Rl.right=1+Vn.left+Vn.center}_refreshDrawHeightConstants(){Us.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);Us.left=t,Us.center=t,Us.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Us.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Us.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Us.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Us.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(Rl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Us[e.position||"full"]/2),Vn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Us[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}))}};ou=Pt([ge(2,Hi),ge(3,go),ge(4,Sn),ge(5,ji),ge(6,Oa),ge(7,yn)],ou);var ae;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
23
- `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(ae||={});var Xc;(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="Ÿ"))(Xc||={});var H0;(e=>e.ST=`${ae.ESC}\\`)(H0||={});var dp=class{constructor(e,t,n,a,o,c){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=a,this._coreService=o,this._renderService=c,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${ae.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,a=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=a+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let c=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=a+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};dp=Pt([ge(2,Hi),ge(3,ji),ge(4,jr),ge(5,Sn)],dp);var mi=0,gi=0,vi=0,Ut=0,dS={css:"#00000000",rgba:0},Jt;(e=>{function t(o,c,d,p){return p!==void 0?`#${Dr(o)}${Dr(c)}${Dr(d)}${Dr(p)}`:`#${Dr(o)}${Dr(c)}${Dr(d)}`}e.toCss=t;function n(o,c,d,p=255){return(o<<24|c<<16|d<<8|p)>>>0}e.toRgba=n;function a(o,c,d,p){return{css:e.toCss(o,c,d,p),rgba:e.toRgba(o,c,d,p)}}e.toColor=a})(Jt||={});var kt;(e=>{function t(_,f){if(Ut=(f.rgba&255)/255,Ut===1)return{css:f.css,rgba:f.rgba};let S=f.rgba>>24&255,y=f.rgba>>16&255,w=f.rgba>>8&255,x=_.rgba>>24&255,C=_.rgba>>16&255,E=_.rgba>>8&255;mi=x+Math.round((S-x)*Ut),gi=C+Math.round((y-C)*Ut),vi=E+Math.round((w-E)*Ut);let N=Jt.toCss(mi,gi,vi),D=Jt.toRgba(mi,gi,vi);return{css:N,rgba:D}}e.blend=t;function n(_){return(_.rgba&255)===255}e.isOpaque=n;function a(_,f,S){let y=Gc.ensureContrastRatio(_.rgba,f.rgba,S);if(y)return Jt.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=a;function o(_){let f=(_.rgba|255)>>>0;return[mi,gi,vi]=Gc.toChannels(f),{css:Jt.toCss(mi,gi,vi),rgba:f}}e.opaque=o;function c(_,f){return Ut=Math.round(f*255),[mi,gi,vi]=Gc.toChannels(_.rgba),{css:Jt.toCss(mi,gi,vi,Ut),rgba:Jt.toRgba(mi,gi,vi,Ut)}}e.opacity=c;function d(_,f){return Ut=_.rgba&255,c(_,Ut*f/255)}e.multiplyOpacity=d;function p(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=p})(kt||={});var Lt;(e=>{let t,n;try{let o=document.createElement("canvas");o.width=1,o.height=1;let c=o.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function a(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return mi=parseInt(o.slice(1,2).repeat(2),16),gi=parseInt(o.slice(2,3).repeat(2),16),vi=parseInt(o.slice(3,4).repeat(2),16),Jt.toColor(mi,gi,vi);case 5:return mi=parseInt(o.slice(1,2).repeat(2),16),gi=parseInt(o.slice(2,3).repeat(2),16),vi=parseInt(o.slice(3,4).repeat(2),16),Ut=parseInt(o.slice(4,5).repeat(2),16),Jt.toColor(mi,gi,vi,Ut);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 mi=parseInt(c[1]),gi=parseInt(c[2]),vi=parseInt(c[3]),Ut=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Jt.toColor(mi,gi,vi,Ut);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[mi,gi,vi,Ut]=t.getImageData(0,0,1,1).data,Ut!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Jt.toRgba(mi,gi,vi,Ut),css:o}}e.toColor=a})(Lt||={});var zi;(e=>{function t(a){return n(a>>16&255,a>>8&255,a&255)}e.relativeLuminance=t;function n(a,o,c){let d=a/255,p=o/255,_=c/255,f=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),S=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),y=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return f*.2126+S*.7152+y*.0722}e.relativeLuminance2=n})(zi||={});var Gc;(e=>{function t(d,p){if(Ut=(p&255)/255,Ut===1)return p;let _=p>>24&255,f=p>>16&255,S=p>>8&255,y=d>>24&255,w=d>>16&255,x=d>>8&255;return mi=y+Math.round((_-y)*Ut),gi=w+Math.round((f-w)*Ut),vi=x+Math.round((S-x)*Ut),Jt.toRgba(mi,gi,vi)}e.blend=t;function n(d,p,_){let f=zi.relativeLuminance(d>>8),S=zi.relativeLuminance(p>>8);if(fn(f,S)<_){if(S<f){let x=a(d,p,_),C=fn(f,zi.relativeLuminance(x>>8));if(C<_){let E=o(d,p,_),N=fn(f,zi.relativeLuminance(E>>8));return C>N?x:E}return x}let y=o(d,p,_),w=fn(f,zi.relativeLuminance(y>>8));if(w<_){let x=a(d,p,_),C=fn(f,zi.relativeLuminance(x>>8));return w>C?y:x}return y}}e.ensureContrastRatio=n;function a(d,p,_){let f=d>>24&255,S=d>>16&255,y=d>>8&255,w=p>>24&255,x=p>>16&255,C=p>>8&255,E=fn(zi.relativeLuminance2(w,x,C),zi.relativeLuminance2(f,S,y));for(;E<_&&(w>0||x>0||C>0);)w-=Math.max(0,Math.ceil(w*.1)),x-=Math.max(0,Math.ceil(x*.1)),C-=Math.max(0,Math.ceil(C*.1)),E=fn(zi.relativeLuminance2(w,x,C),zi.relativeLuminance2(f,S,y));return(w<<24|x<<16|C<<8|255)>>>0}e.reduceLuminance=a;function o(d,p,_){let f=d>>24&255,S=d>>16&255,y=d>>8&255,w=p>>24&255,x=p>>16&255,C=p>>8&255,E=fn(zi.relativeLuminance2(w,x,C),zi.relativeLuminance2(f,S,y));for(;E<_&&(w<255||x<255||C<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),E=fn(zi.relativeLuminance2(w,x,C),zi.relativeLuminance2(f,S,y));return(w<<24|x<<16|C<<8|255)>>>0}e.increaseLuminance=o;function c(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=c})(Gc||={});function Dr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function fn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var tk=class extends mo{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},cu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Cs}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],a=t.translateToString(!0),o=0,c=0,d=0,p=t.getFg(0),_=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==_){if(f-o>1){let S=this._getJoinedRanges(a,d,c,t,o);for(let y=0;y<S.length;y++)n.push(S[y])}o=f,d=c,p=this._workCell.fg,_=this._workCell.bg}c+=this._workCell.getChars().length||tr.length}if(this._bufferService.cols-o>1){let f=this._getJoinedRanges(a,d,c,t,o);for(let S=0;S<f.length;S++)n.push(f[S])}return n}_getJoinedRanges(e,t,n,a,o){let c=e.substring(t,n),d=[];try{d=this._characterJoiners[0].handler(c)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{let _=this._characterJoiners[p].handler(c);for(let f=0;f<_.length;f++)cu._mergeRanges(d,_[f])}catch(_){console.error(_)}return this._stringRangesToCellRanges(d,a,o),d}_stringRangesToCellRanges(e,t,n){let a=0,o=!1,c=0,d=e[a];if(d){for(let p=n;p<this._bufferService.cols;p++){let _=t.getWidth(p),f=t.getString(p).length||tr.length;if(_!==0){if(!o&&d[0]<=c&&(d[0]=p,o=!0),d[1]<=c){if(d[1]=p,d=e[++a],!d)break;d[0]<=c?(d[0]=p,o=!0):o=!1}c+=f}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let a=0;a<e.length;a++){let o=e[a];if(n){if(t[1]<=o[0])return e[a-1][1]=t[1],e;if(t[1]<=o[1])return e[a-1][1]=Math.max(t[1],o[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(t[1]<=o[0])return e.splice(a,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};cu=Pt([ge(0,Hi)],cu);function ik(e){return 57508<=e&&e<=57558}function sk(e){return 9472<=e&&e<=9631}function nk(e){return ik(e)||sk(e)}function rk(){return{css:{canvas:Hc(),cell:Hc()},device:{canvas:Hc(),cell:Hc(),char:{width:0,height:0,left:0,top:0}}}}function Hc(){return{width:0,height:0}}var fp=class{constructor(e,t,n,a,o,c,d){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=a,this._coreService=o,this._decorationService=c,this._themeService=d,this._workCell=new Cs,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,a,o,c,d,p,_,f,S){let y=[],w=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,C=e.getNoBgTrimmedLength();n&&C<c+1&&(C=c+1);let E,N=0,D="",ie=0,R=0,H=0,j=0,W=!1,B=0,oe=!1,ce=0,ue=0,Q=[],G=f!==-1&&S!==-1;for(let K=0;K<C;K++){e.loadCell(K,this._workCell);let J=this._workCell.getWidth();if(J===0)continue;let se=!1,M=K>=ue,Y=K,X=this._workCell;if(w.length>0&&K===w[0][0]&&M){let Ne=w.shift(),ee=this._isCellInSelection(Ne[0],t);for(ie=Ne[0]+1;ie<Ne[1];ie++)M&&=ee===this._isCellInSelection(ie,t);M&&=!n||c<Ne[0]||c>=Ne[1],M?(se=!0,X=new tk(this._workCell,e.translateToString(!0,Ne[0],Ne[1]),Ne[1]-Ne[0]),Y=Ne[1]-1,J=X.getWidth()):ue=Ne[1]}let pe=this._isCellInSelection(K,t),ye=n&&K===c,k=G&&K>=f&&K<=S,I=!1;this._decorationService.forEachDecorationAtCell(K,t,void 0,Ne=>{I=!0});let ne=X.getChars()||tr;if(ne===" "&&(X.isUnderline()||X.isOverline())&&(ne=" "),ce=J*p-_.get(ne,X.isBold(),X.isItalic()),!E)E=this._document.createElement("span");else if(N&&(pe&&oe||!pe&&!oe&&X.bg===R)&&(pe&&oe&&x.selectionForeground||X.fg===H)&&X.extended.ext===j&&k===W&&ce===B&&!ye&&!se&&!I&&M){X.isInvisible()?D+=tr:D+=ne,N++;continue}else N&&(E.textContent=D),E=this._document.createElement("span"),N=0,D="";if(R=X.bg,H=X.fg,j=X.extended.ext,W=k,B=ce,oe=pe,se&&c>=K&&c<=Y&&(c=K),!this._coreService.isCursorHidden&&ye&&this._coreService.isCursorInitialized){if(Q.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&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(X.isBold()&&Q.push("xterm-bold"),X.isItalic()&&Q.push("xterm-italic"),X.isDim()&&Q.push("xterm-dim"),X.isInvisible()?D=tr:D=X.getChars()||tr,X.isUnderline()&&(Q.push(`xterm-underline-${X.extended.underlineStyle}`),D===" "&&(D=" "),!X.isUnderlineColorDefault()))if(X.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${mo.toColorRGB(X.getUnderlineColor()).join(",")})`;else{let Ne=X.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&X.isBold()&&Ne<8&&(Ne+=8),E.style.textDecorationColor=x.ansi[Ne].css}X.isOverline()&&(Q.push("xterm-overline"),D===" "&&(D=" ")),X.isStrikethrough()&&Q.push("xterm-strikethrough"),k&&(E.style.textDecoration="underline");let he=X.getFgColor(),_e=X.getFgColorMode(),me=X.getBgColor(),Ee=X.getBgColorMode(),De=!!X.isInverse();if(De){let Ne=he;he=me,me=Ne;let ee=_e;_e=Ee,Ee=ee}let Ce,Me,et=!1;this._decorationService.forEachDecorationAtCell(K,t,void 0,Ne=>{Ne.options.layer!=="top"&&et||(Ne.backgroundColorRGB&&(Ee=50331648,me=Ne.backgroundColorRGB.rgba>>8&16777215,Ce=Ne.backgroundColorRGB),Ne.foregroundColorRGB&&(_e=50331648,he=Ne.foregroundColorRGB.rgba>>8&16777215,Me=Ne.foregroundColorRGB),et=Ne.options.layer==="top")}),!et&&pe&&(Ce=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,me=Ce.rgba>>8&16777215,Ee=50331648,et=!0,x.selectionForeground&&(_e=50331648,he=x.selectionForeground.rgba>>8&16777215,Me=x.selectionForeground)),et&&Q.push("xterm-decoration-top");let tt;switch(Ee){case 16777216:case 33554432:tt=x.ansi[me],Q.push(`xterm-bg-${me}`);break;case 50331648:tt=Jt.toColor(me>>16,me>>8&255,me&255),this._addStyle(E,`background-color:#${fS((me>>>0).toString(16),"0",6)}`);break;default:De?(tt=x.foreground,Q.push("xterm-bg-257")):tt=x.background}switch(Ce||X.isDim()&&(Ce=kt.multiplyOpacity(tt,.5)),_e){case 16777216:case 33554432:X.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(E,tt,x.ansi[he],X,Ce,void 0)||Q.push(`xterm-fg-${he}`);break;case 50331648:let Ne=Jt.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(E,tt,Ne,X,Ce,Me)||this._addStyle(E,`color:#${fS(he.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,tt,x.foreground,X,Ce,Me)||De&&Q.push("xterm-fg-257")}Q.length&&(E.className=Q.join(" "),Q.length=0),!ye&&!se&&!I&&M?N++:E.textContent=D,ce!==this.defaultSpacing&&(E.style.letterSpacing=`${ce}px`),y.push(E),K=Y}return E&&N&&(E.textContent=D),y}_applyMinimumContrast(e,t,n,a,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||nk(a.getCode()))return!1;let d=this._getContrastCache(a),p;if(!o&&!c&&(p=d.getColor(t.rgba,n.rgba)),p===void 0){let _=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);p=kt.ensureContrastRatio(o||t,c||n,_),d.setColor((o||t).rgba,(c||n).rgba,p??null)}return p?(this._addStyle(e,`color:${p.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,a=this._selectionEnd;return!n||!a?!1:this._columnSelectMode?n[0]<=a[0]?e>=n[0]&&t>=n[1]&&e<a[0]&&t<=a[1]:e<n[0]&&t>=n[1]&&e>=a[0]&&t<=a[1]:t>n[1]&&t<a[1]||n[1]===a[1]&&t===n[1]&&e>=n[0]&&e<a[0]||n[1]<a[1]&&t===a[1]&&e<a[0]||n[1]<a[1]&&t===n[1]&&e>=n[0]}};fp=Pt([ge(1,y0),ge(2,ji),ge(3,yn),ge(4,jr),ge(5,go),ge(6,Oa)],fp);function fS(e,t,n){for(;e.length<n;)e=t+e;return e}var ak=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let c=e.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[n,a,o,c],this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(o),this._container.appendChild(c),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,a){e===this._font&&t===this._fontSize&&n===this._weight&&a===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(e,t,n){let a=0;if(!t&&!n&&e.length===1&&(a=e.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];let d=this._measure(e,0);return d>0&&(this._flat[a]=d),d}let o=e;t&&(o+="B"),n&&(o+="I");let c=this._holey.get(o);if(c===void 0){let d=0;t&&(d|=1),n&&(d|=2),c=this._measure(e,d),c>0&&this._holey.set(o,c)}return c}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},lk=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,a=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let o=e.buffers.active.ydisp,c=t[1]-o,d=n[1]-o,p=Math.max(c,0),_=Math.min(d,e.rows-1);if(p>=e.rows||_<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=p,this.viewportCappedEndRow=_,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function ok(){return new lk}var cf="xterm-dom-renderer-owner-",vs="xterm-rows",jc="xterm-fg-",pS="xterm-bg-",Ml="xterm-focus",Uc="xterm-selection",ck=1,pp=class extends Ie{constructor(e,t,n,a,o,c,d,p,_,f,S,y,w,x){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=a,this._viewportElement=o,this._helperContainer=c,this._linkifier2=d,this._charSizeService=_,this._optionsService=f,this._bufferService=S,this._coreService=y,this._coreBrowserService=w,this._themeService=x,this._terminalClass=ck++,this._rowElements=[],this._selectionRenderModel=ok(),this.onRequestRedraw=this._register(new de).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(vs),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(Uc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=rk(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(C=>this._injectCss(C))),this._injectCss(this._themeService.colors),this._rowFactory=p.createInstance(fp,document),this._element.classList.add(cf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(C=>this._handleLinkHover(C))),this._register(this._linkifier2.onHideLinkUnderline(C=>this._handleLinkLeave(C))),this._register(At(()=>{this._element.classList.remove(cf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ak(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${vs} 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} .${vs} { 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} .${vs} .xterm-dim { color: ${kt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,a=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${a} { 50% { box-shadow: none; }}`,t+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${vs}.${Ml} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${vs}.${Ml} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${vs}.${Ml} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${vs} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${vs} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${vs} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${vs} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${vs} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Uc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Uc} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Uc} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,d]of e.ansi.entries())t+=`${this._terminalSelector} .${jc}${c} { color: ${d.css}; }${this._terminalSelector} .${jc}${c}.xterm-dim { color: ${kt.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${pS}${c} { background-color: ${d.css}; }`;t+=`${this._terminalSelector} .${jc}257 { color: ${kt.opaque(e.background).css}; }${this._terminalSelector} .${jc}257.xterm-dim { color: ${kt.multiplyOpacity(kt.opaque(e.background),.5).css}; }${this._terminalSelector} .${pS}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let a=this._document.createElement("div");this._rowContainer.appendChild(a),this._rowElements.push(a)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Ml),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ml),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let a=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,c=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,p=this._document.createDocumentFragment();if(n){let _=e[0]>t[0];p.appendChild(this._createSelectionElement(c,_?t[0]:e[0],_?e[0]:t[0],d-c+1))}else{let _=a===c?e[0]:0,f=c===o?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(c,_,f));let S=d-c-1;if(p.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,S)),c!==d){let y=o===d?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(d,0,y))}}this._selectionContainer.appendChild(p)}_createSelectionElement(e,t,n,a=1){let o=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-t);return c+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-c),o.style.height=`${a*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${c}px`,o.style.width=`${d}px`,o}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,a=n.ybase+n.y,o=Math.min(n.x,this._bufferService.cols-1),c=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=e;_<=t;_++){let f=_+n.ydisp,S=this._rowElements[_],y=n.lines.get(f);if(!S||!y)break;S.replaceChildren(...this._rowFactory.createRow(y,f,f===a,d,p,o,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${cf}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,a,o,c){n<0&&(e=0),a<0&&(t=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),a=Math.max(Math.min(a,d),0),o=Math.min(o,this._bufferService.cols);let p=this._bufferService.buffer,_=p.ybase+p.y,f=Math.min(p.x,o-1),S=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=n;x<=a;++x){let C=x+p.ydisp,E=this._rowElements[x],N=p.lines.get(C);if(!E||!N)break;E.replaceChildren(...this._rowFactory.createRow(N,C,C===_,y,w,f,S,this.dimensions.css.cell.width,this._widthCache,c?x===n?e:0:-1,c?(x===a?t:o)-1:-1))}}};pp=Pt([ge(7,p_),ge(8,Ru),ge(9,ji),ge(10,Hi),ge(11,jr),ge(12,yn),ge(13,Oa)],pp);var _p=class extends Ie{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new de),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new hk(this._optionsService))}catch{this._measureStrategy=this._register(new uk(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())}};_p=Pt([ge(2,ji)],_p);var j0=class extends Ie{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},uk=class extends j0{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},hk=class extends j0{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}},dk=class extends Ie{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new fk(this._window)),this._onDprChange=this._register(new de),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new de),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(Di.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Be(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Be(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},fk=class extends Ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Aa),this._onDprChange=this._register(new de),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=Be(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},pk=class extends Ie{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 w_(e,t,n){let a=n.getBoundingClientRect(),o=e.getComputedStyle(n),c=parseInt(o.getPropertyValue("padding-left")),d=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-a.left-c,t.clientY-a.top-d]}function _k(e,t,n,a,o,c,d,p,_){if(!c)return;let f=w_(e,t,n);if(f)return f[0]=Math.ceil((f[0]+(_?d/2:0))/d),f[1]=Math.ceil(f[1]/p),f[0]=Math.min(Math.max(f[0],1),a+(_?1:0)),f[1]=Math.min(Math.max(f[1],1),o),f}var mp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,a,o){return _k(window,e,t,n,a,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let n=w_(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};mp=Pt([ge(0,Sn),ge(1,Ru)],mp);var mk=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},U0={};T2(U0,{getSafariVersion:()=>vk,isChromeOS:()=>F0,isFirefox:()=>P0,isIpad:()=>yk,isIphone:()=>Sk,isLegacyEdge:()=>gk,isLinux:()=>C_,isMac:()=>uu,isNode:()=>Mu,isSafari:()=>K0,isWindows:()=>I0});var Mu=typeof process<"u"&&"title"in process,vo=Mu?"node":navigator.userAgent,yo=Mu?"node":navigator.platform,P0=vo.includes("Firefox"),gk=vo.includes("Edge"),K0=/^((?!chrome|android).)*safari/i.test(vo);function vk(){if(!K0)return 0;let e=vo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var uu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(yo),yk=yo==="iPad",Sk=yo==="iPhone",I0=["Windows","Win16","Win32","WinCE"].includes(yo),C_=yo.indexOf("Linux")>=0,F0=/\bCrOS\b/.test(vo),q0=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,a=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),o=e.timeRemaining(),n*1.5>o){a-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-t))}ms`),this._start();return}a=o}this.clear()}},bk=class extends q0{_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())}}},wk=class extends q0{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},hu=!Mu&&"requestIdleCallback"in window?wk:bk,Ck=class{constructor(){this._queue=new hu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},gp=class extends Ie{constructor(e,t,n,a,o,c,d,p,_){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=a,this._coreService=o,this._coreBrowserService=p,this._renderer=this._register(new Aa),this._pausedResizeTask=new Ck,this._observerDisposable=this._register(new Aa),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 de),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new de),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new de),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new de),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new mk((f,S)=>this._renderRows(f,S),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new xk(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(At(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(c.onDecorationRegistered(()=>this._fullRefresh())),this._register(c.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(_.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(a=>this._handleIntersectionChange(a[a.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=At(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let a=this._syncOutputHandler.flush();a&&(e=Math.min(e,a.start),t=Math.max(t,a.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};gp=Pt([ge(2,ji),ge(3,Ru),ge(4,jr),ge(5,go),ge(6,Hi),ge(7,yn),ge(8,Oa)],gp);var xk=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Ek(e,t,n,a){let o=n.buffer.x,c=n.buffer.y;if(!n.buffer.hasScrollback)return Dk(o,c,e,t,n,a)+Au(c,t,n,a)+Rk(o,c,e,t,n,a);let d;if(c===t)return d=o>e?"D":"C",so(Math.abs(o-e),io(d,a));d=c>t?"D":"C";let p=Math.abs(c-t),_=kk(c>t?e:o,n)+(p-1)*n.cols+1+Tk(c>t?o:e);return so(_,io(d,a))}function Tk(e,t){return e-1}function kk(e,t){return t.cols-e}function Dk(e,t,n,a,o,c){return Au(t,a,o,c).length===0?"":so(Y0(e,t,e,t-Hr(t,o),!1,o).length,io("D",c))}function Au(e,t,n,a){let o=e-Hr(e,n),c=t-Hr(t,n),d=Math.abs(o-c)-Mk(e,t,n);return so(d,io(W0(e,t),a))}function Rk(e,t,n,a,o,c){let d;Au(t,a,o,c).length>0?d=a-Hr(a,o):d=t;let p=a,_=Ak(e,t,n,a,o,c);return so(Y0(e,d,n,p,_==="C",o).length,io(_,c))}function Mk(e,t,n){let a=0,o=e-Hr(e,n),c=t-Hr(t,n);for(let d=0;d<Math.abs(o-c);d++){let p=W0(e,t)==="A"?-1:1;n.buffer.lines.get(o+p*d)?.isWrapped&&a++}return a}function Hr(e,t){let n=0,a=t.buffer.lines.get(e),o=a?.isWrapped;for(;o&&e>=0&&e<t.rows;)n++,a=t.buffer.lines.get(--e),o=a?.isWrapped;return n}function Ak(e,t,n,a,o,c){let d;return Au(n,a,o,c).length>0?d=a-Hr(a,o):d=t,e<n&&d<=a||e>=n&&d<a?"C":"D"}function W0(e,t){return e>t?"A":"B"}function Y0(e,t,n,a,o,c){let d=e,p=t,_="";for(;(d!==n||p!==a)&&p>=0&&p<c.buffer.lines.length;)d+=o?1:-1,o&&d>c.cols-1?(_+=c.buffer.translateBufferLineToString(p,!1,e,d),d=0,e=0,p++):!o&&d<0&&(_+=c.buffer.translateBufferLineToString(p,!1,0,e+1),d=c.cols-1,e=d,p--);return _+c.buffer.translateBufferLineToString(p,!1,e,d)}function io(e,t){let n=t?"O":"[";return ae.ESC+n+e}function so(e,t){e=Math.floor(e);let n="";for(let a=0;a<e;a++)n+=t;return n}var Nk=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 _S(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 uf=50,Bk=15,Lk=50,Ok=500,zk=" ",Hk=new RegExp(zk,"g"),vp=class extends Ie{constructor(e,t,n,a,o,c,d,p,_){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=a,this._coreService=o,this._mouseService=c,this._optionsService=d,this._renderService=p,this._coreBrowserService=_,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Cs,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new de),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new de),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new de),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new de),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new Nk(this._bufferService),this._activeSelectionMode=0,this._register(At(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,a=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],c=e[0]<t[0]?t[0]:e[0];for(let d=e[1];d<=t[1];d++){let p=n.translateBufferLineToString(d,!0,o,c);a.push(p)}}else{let o=e[1]===t[1]?t[0]:void 0;a.push(n.translateBufferLineToString(e[1],!0,e[0],o));for(let c=e[1]+1;c<=t[1]-1;c++){let d=n.lines.get(c),p=n.translateBufferLineToString(c,!0);d?.isWrapped?a[a.length-1]+=p:a.push(p)}if(e[1]!==t[1]){let c=n.lines.get(t[1]),d=n.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?a[a.length-1]+=d:a.push(d)}}return a.map(o=>o.replace(Hk," ")).join(I0?`\r
24
- `:`
25
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),C_&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!n||!a||!t?!1:this._areCoordsInSelection(t,n,a)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!n||!a?!1:this._areCoordsInSelection([e,t],n,a)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=_S(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let a=this._getMouseBufferCoords(e);return a?(this._selectWordAt(a,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=w_(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-uf),uf),t/=uf,t/Math.abs(t)+Math.round(t*(Bk-1)))}shouldForceSelection(e){return uu?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(),Lk)}_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&&!(uu&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let a=n.lines.get(this._model.selectionEnd[1]);a&&a.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Ok&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let a=Ek(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(a,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let a=0;t>=a;a++){let o=e.loadCell(a,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:o>1&&t!==a&&(n+=o-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,a=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,c=o.lines.get(e[1]);if(!c)return;let d=o.translateBufferLineToString(e[1],!1),p=this._convertViewportColToCharacterIndex(c,e[0]),_=p,f=e[0]-p,S=0,y=0,w=0,x=0;if(d.charAt(p)===" "){for(;p>0&&d.charAt(p-1)===" ";)p--;for(;_<d.length&&d.charAt(_+1)===" ";)_++}else{let N=e[0],D=e[0];c.getWidth(N)===0&&(S++,N--),c.getWidth(D)===2&&(y++,D++);let ie=c.getString(D).length;for(ie>1&&(x+=ie-1,_+=ie-1);N>0&&p>0&&!this._isCharWordSeparator(c.loadCell(N-1,this._workCell));){c.loadCell(N-1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===0?(S++,N--):R>1&&(w+=R-1,p-=R-1),p--,N--}for(;D<c.length&&_+1<d.length&&!this._isCharWordSeparator(c.loadCell(D+1,this._workCell));){c.loadCell(D+1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,D++):R>1&&(x+=R-1,_+=R-1),_++,D++}}_++;let C=p+f-S+w,E=Math.min(this._bufferService.cols,_-p+S+y-w-x);if(!(!t&&d.slice(p,_).trim()==="")){if(n&&C===0&&c.getCodePoint(0)!==32){let N=o.lines.get(e[1]-1);if(N&&c.isWrapped&&N.getCodePoint(this._bufferService.cols-1)!==32){let D=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(D){let ie=this._bufferService.cols-D.start;C-=ie,E+=ie}}}if(a&&C+E===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let N=o.lines.get(e[1]+1);if(N?.isWrapped&&N.getCodePoint(0)!==32){let D=this._getWordAt([0,e[1]+1],!1,!1,!0);D&&(E+=D.length)}}return{start:C,length:E}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=_S(n,this._bufferService.cols)}};vp=Pt([ge(3,Hi),ge(4,jr),ge(5,__),ge(6,ji),ge(7,Sn),ge(8,yn)],vp);var mS=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},gS=class{constructor(){this._color=new mS,this._css=new mS}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ri=Object.freeze((()=>{let e=[Lt.toColor("#2e3436"),Lt.toColor("#cc0000"),Lt.toColor("#4e9a06"),Lt.toColor("#c4a000"),Lt.toColor("#3465a4"),Lt.toColor("#75507b"),Lt.toColor("#06989a"),Lt.toColor("#d3d7cf"),Lt.toColor("#555753"),Lt.toColor("#ef2929"),Lt.toColor("#8ae234"),Lt.toColor("#fce94f"),Lt.toColor("#729fcf"),Lt.toColor("#ad7fa8"),Lt.toColor("#34e2e2"),Lt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let a=t[n/36%6|0],o=t[n/6%6|0],c=t[n%6];e.push({css:Jt.toCss(a,o,c),rgba:Jt.toRgba(a,o,c)})}for(let n=0;n<24;n++){let a=8+n*10;e.push({css:Jt.toCss(a,a,a),rgba:Jt.toRgba(a,a,a)})}return e})()),Rr=Lt.toColor("#ffffff"),Pl=Lt.toColor("#000000"),vS=Lt.toColor("#ffffff"),yS=Pl,Al={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},jk=Rr,yp=class extends Ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new gS,this._halfContrastCache=new gS,this._onChangeColors=this._register(new de),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Rr,background:Pl,cursor:vS,cursorAccent:yS,selectionForeground:void 0,selectionBackgroundTransparent:Al,selectionBackgroundOpaque:kt.blend(Pl,Al),selectionInactiveBackgroundTransparent:Al,selectionInactiveBackgroundOpaque:kt.blend(Pl,Al),scrollbarSliderBackground:kt.opacity(Rr,.2),scrollbarSliderHoverBackground:kt.opacity(Rr,.4),scrollbarSliderActiveBackground:kt.opacity(Rr,.5),overviewRulerBorder:Rr,ansi:ri.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=gt(e.foreground,Rr),t.background=gt(e.background,Pl),t.cursor=kt.blend(t.background,gt(e.cursor,vS)),t.cursorAccent=kt.blend(t.background,gt(e.cursorAccent,yS)),t.selectionBackgroundTransparent=gt(e.selectionBackground,Al),t.selectionBackgroundOpaque=kt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=gt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=kt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?gt(e.selectionForeground,dS):void 0,t.selectionForeground===dS&&(t.selectionForeground=void 0),kt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=kt.opacity(t.selectionBackgroundTransparent,.3)),kt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=kt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=gt(e.scrollbarSliderBackground,kt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=gt(e.scrollbarSliderHoverBackground,kt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=gt(e.scrollbarSliderActiveBackground,kt.opacity(t.foreground,.5)),t.overviewRulerBorder=gt(e.overviewRulerBorder,jk),t.ansi=ri.slice(),t.ansi[0]=gt(e.black,ri[0]),t.ansi[1]=gt(e.red,ri[1]),t.ansi[2]=gt(e.green,ri[2]),t.ansi[3]=gt(e.yellow,ri[3]),t.ansi[4]=gt(e.blue,ri[4]),t.ansi[5]=gt(e.magenta,ri[5]),t.ansi[6]=gt(e.cyan,ri[6]),t.ansi[7]=gt(e.white,ri[7]),t.ansi[8]=gt(e.brightBlack,ri[8]),t.ansi[9]=gt(e.brightRed,ri[9]),t.ansi[10]=gt(e.brightGreen,ri[10]),t.ansi[11]=gt(e.brightYellow,ri[11]),t.ansi[12]=gt(e.brightBlue,ri[12]),t.ansi[13]=gt(e.brightMagenta,ri[13]),t.ansi[14]=gt(e.brightCyan,ri[14]),t.ansi[15]=gt(e.brightWhite,ri[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let a=0;a<n;a++)t.ansi[a+16]=gt(e.extendedAnsi[a],ri[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()}}};yp=Pt([ge(0,ji)],yp);function gt(e,t){if(e!==void 0)try{return Lt.toColor(e)}catch{}return t}var Uk=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Pk=class{constructor(){this._services=new Uk,this._services.set(p_,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=B2(e).sort((c,d)=>c.index-d.index),a=[];for(let c of n){let d=this._services.get(c.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);a.push(d)}let o=n.length>0?n[0].index:t.length;if(t.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);return new e(...t,...a)}},Kk={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ik="xterm.js: ",Sp=class extends Ie{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Kk[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":Ik)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Sp=Pt([ge(0,ji)],Sp);var SS=class extends Ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new de),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new de),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new de),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let a=e;a<this._length-t;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let a=this._length-1;a>=e;a--)this._array[this._getCyclicIndex(a+n.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<n.length;a++)this._array[this._getCyclicIndex(e+a)]=n[a];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let a=this._length+n.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let o=t-1;o>=0;o--)this.set(e+o+n,this.get(e+o));let a=e+t+n-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<t;a++)this.set(e+a+n,this.get(e+a))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ke=3,Zt=Object.freeze(new mo),Pc=0,hf=2,Kl=class $0{constructor(t,n,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ke);let o=n||Cs.fromCharData([0,d0,1,0]);for(let c=0;c<t;++c)this.setCell(c,o);this.length=t}get(t){let n=this._data[t*Ke+0],a=n&2097151;return[this._data[t*Ke+1],n&2097152?this._combined[t]:a?Jn(a):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):a]}set(t,n){this._data[t*Ke+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ke+0]=t|2097152|n[2]<<22):this._data[t*Ke+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ke+0]>>22}hasWidth(t){return this._data[t*Ke+0]&12582912}getFg(t){return this._data[t*Ke+1]}getBg(t){return this._data[t*Ke+2]}hasContent(t){return this._data[t*Ke+0]&4194303}getCodePoint(t){let n=this._data[t*Ke+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ke+0]&2097152}getString(t){let n=this._data[t*Ke+0];return n&2097152?this._combined[t]:n&2097151?Jn(n&2097151):""}isProtected(t){return this._data[t*Ke+2]&536870912}loadCell(t,n){return Pc=t*Ke,n.content=this._data[Pc+0],n.fg=this._data[Pc+1],n.bg=this._data[Pc+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Ke+0]=n.content,this._data[t*Ke+1]=n.fg,this._data[t*Ke+2]=n.bg}setCellFromCodepoint(t,n,a,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Ke+0]=n|a<<22,this._data[t*Ke+1]=o.fg,this._data[t*Ke+2]=o.bg}addCodepointToCell(t,n,a){let o=this._data[t*Ke+0];o&2097152?this._combined[t]+=Jn(n):o&2097151?(this._combined[t]=Jn(o&2097151)+Jn(n),o&=-2097152,o|=2097152):o=n|1<<22,a&&(o&=-12582913,o|=a<<22),this._data[t*Ke+0]=o}insertCells(t,n,a){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),n<this.length-t){let o=new Cs;for(let c=this.length-t-n-1;c>=0;--c)this.setCell(t+n+c,this.loadCell(t+c,o));for(let c=0;c<n;++c)this.setCell(t+c,a)}else for(let o=t;o<this.length;++o)this.setCell(o,a);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,a)}deleteCells(t,n,a){if(t%=this.length,n<this.length-t){let o=new Cs;for(let c=0;c<this.length-t-n;++c)this.setCell(t+c,this.loadCell(t+n+c,o));for(let c=this.length-n;c<this.length;++c)this.setCell(c,a)}else for(let o=t;o<this.length;++o)this.setCell(o,a);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,a)}replaceCells(t,n,a,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,a),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,a);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,a),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,a);t<n&&t<this.length;)this.setCell(t++,a)}resize(t,n){if(t===this.length)return this._data.length*4*hf<this._data.buffer.byteLength;let a=t*Ke;if(t>this.length){if(this._data.buffer.byteLength>=a*4)this._data=new Uint32Array(this._data.buffer,0,a);else{let o=new Uint32Array(a);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,n)}else{this._data=this._data.subarray(0,a);let o=Object.keys(this._combined);for(let d=0;d<o.length;d++){let p=parseInt(o[d],10);p>=t&&delete this._combined[p]}let c=Object.keys(this._extendedAttrs);for(let d=0;d<c.length;d++){let p=parseInt(c[d],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,a*4*hf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*hf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let a=0;a<this.length;++a)this.isProtected(a)||this.setCell(a,t);return}this._combined={},this._extendedAttrs={};for(let a=0;a<this.length;++a)this.setCell(a,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new $0(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ke+0]&4194303)return t+(this._data[t*Ke+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ke+0]&4194303||this._data[t*Ke+2]&50331648)return t+(this._data[t*Ke+0]>>22);return 0}copyCellsFrom(t,n,a,o,c){let d=t._data;if(c)for(let _=o-1;_>=0;_--){for(let f=0;f<Ke;f++)this._data[(a+_)*Ke+f]=d[(n+_)*Ke+f];d[(n+_)*Ke+2]&268435456&&(this._extendedAttrs[a+_]=t._extendedAttrs[n+_])}else for(let _=0;_<o;_++){for(let f=0;f<Ke;f++)this._data[(a+_)*Ke+f]=d[(n+_)*Ke+f];d[(n+_)*Ke+2]&268435456&&(this._extendedAttrs[a+_]=t._extendedAttrs[n+_])}let p=Object.keys(t._combined);for(let _=0;_<p.length;_++){let f=parseInt(p[_],10);f>=n&&(this._combined[f-n+a]=t._combined[f])}}translateToString(t,n,a,o){n=n??0,a=a??this.length,t&&(a=Math.min(a,this.getTrimmedLength())),o&&(o.length=0);let c="";for(;n<a;){let d=this._data[n*Ke+0],p=d&2097151,_=d&2097152?this._combined[n]:p?Jn(p):tr;if(c+=_,o)for(let f=0;f<_.length;++f)o.push(n);n+=d>>22||1}return o&&o.push(n),c}};function Fk(e,t,n,a,o,c){let d=[];for(let p=0;p<e.length-1;p++){let _=p,f=e.get(++_);if(!f.isWrapped)continue;let S=[e.get(p)];for(;_<e.length&&f.isWrapped;)S.push(f),f=e.get(++_);if(!c&&a>=p&&a<_){p+=S.length-1;continue}let y=0,w=no(S,y,t),x=1,C=0;for(;x<S.length;){let N=no(S,x,t),D=N-C,ie=n-w,R=Math.min(D,ie);S[y].copyCellsFrom(S[x],C,w,R,!1),w+=R,w===n&&(y++,w=0),C+=R,C===N&&(x++,C=0),w===0&&y!==0&&S[y-1].getWidth(n-1)===2&&(S[y].copyCellsFrom(S[y-1],n-1,w++,1,!1),S[y-1].setCell(n-1,o))}S[y].replaceCells(w,n,o);let E=0;for(let N=S.length-1;N>0&&(N>y||S[N].getTrimmedLength()===0);N--)E++;E>0&&(d.push(p+S.length-E),d.push(E)),p+=S.length-1}return d}function qk(e,t){let n=[],a=0,o=t[a],c=0;for(let d=0;d<e.length;d++)if(o===d){let p=t[++a];e.onDeleteEmitter.fire({index:d-c,amount:p}),d+=p-1,c+=p,o=t[++a]}else n.push(d);return{layout:n,countRemoved:c}}function Wk(e,t){let n=[];for(let a=0;a<t.length;a++)n.push(e.get(t[a]));for(let a=0;a<n.length;a++)e.set(a,n[a]);e.length=t.length}function Yk(e,t,n){let a=[],o=e.map((_,f)=>no(e,f,t)).reduce((_,f)=>_+f),c=0,d=0,p=0;for(;p<o;){if(o-p<n){a.push(o-p);break}c+=n;let _=no(e,d,t);c>_&&(c-=_,d++);let f=e[d].getWidth(c-1)===2;f&&c--;let S=f?n-1:n;a.push(S),p+=S}return a}function no(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let a=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,o=e[t+1].getWidth(0)===2;return a&&o?n-1:n}var V0=class X0{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=X0._nextId++,this._onDispose=this.register(new de),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),zr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};V0._nextId=1;var $k=V0,oi={},Mr=oi.B;oi[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:"≥","{":"π","|":"≠","}":"£","~":"·"};oi.A={"#":"£"};oi.B=void 0;oi[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};oi.C=oi[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};oi.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};oi.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};oi.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};oi.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};oi.E=oi[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};oi.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};oi.H=oi[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};oi["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var bS=4294967295,wS=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Zt.clone(),this.savedCharset=Mr,this.markers=[],this._nullCell=Cs.fromCharData([0,d0,1,0]),this._whitespaceCell=Cs.fromCharData([0,tr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new hu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new SS(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 lu),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 lu),this._whitespaceCell}getBlankLine(e,t){return new Kl(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>bS?bS:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Zt);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 SS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Zt),a=0,o=this._getCorrectBufferLength(t);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)a+=+this.lines.get(d).resize(e,n);let c=0;if(this._rows<t)for(let d=this._rows;d<t;d++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Kl(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+c+1?(this.ybase--,c++,this.ydisp>0&&this.ydisp--):this.lines.push(new Kl(e,n)));else for(let d=this._rows;d>t;d--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let d=this.lines.length-o;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),c&&(this.y+=c),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let c=0;c<this.lines.length;c++)a+=+this.lines.get(c).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),a>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,a=Fk(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Zt),n);if(a.length>0){let o=qk(this.lines,a);Wk(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let a=this.getNullCell(Zt),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Kl(e,a))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,a=this.getNullCell(Zt),o=[],c=0;for(let d=this.lines.length-1;d>=0;d--){let p=this.lines.get(d);if(!p||!p.isWrapped&&p.getTrimmedLength()<=e)continue;let _=[p];for(;p.isWrapped&&d>0;)p=this.lines.get(--d),_.unshift(p);if(!n){let R=this.ybase+this.y;if(R>=d&&R<d+_.length)continue}let f=_[_.length-1].getTrimmedLength(),S=Yk(_,this._cols,e),y=S.length-_.length,w;this.ybase===0&&this.y!==this.lines.length-1?w=Math.max(0,this.y-this.lines.maxLength+y):w=Math.max(0,this.lines.length-this.lines.maxLength+y);let x=[];for(let R=0;R<y;R++){let H=this.getBlankLine(Zt,!0);x.push(H)}x.length>0&&(o.push({start:d+_.length+c,newLines:x}),c+=x.length),_.push(...x);let C=S.length-1,E=S[C];E===0&&(C--,E=S[C]);let N=_.length-y-1,D=f;for(;N>=0;){let R=Math.min(D,E);if(_[C]===void 0)break;if(_[C].copyCellsFrom(_[N],D-R,E-R,R,!0),E-=R,E===0&&(C--,E=S[C]),D-=R,D===0){N--;let H=Math.max(N,0);D=no(_,H,this._cols)}}for(let R=0;R<_.length;R++)S[R]<e&&_[R].setCell(S[R],a);let ie=y-w;for(;ie-- >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 d=[],p=[];for(let E=0;E<this.lines.length;E++)p.push(this.lines.get(E));let _=this.lines.length,f=_-1,S=0,y=o[S];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let w=0;for(let E=Math.min(this.lines.maxLength-1,_+c-1);E>=0;E--)if(y&&y.start>f+w){for(let N=y.newLines.length-1;N>=0;N--)this.lines.set(E--,y.newLines[N]);E++,d.push({index:f+1,amount:y.newLines.length}),w+=y.newLines.length,y=o[++S]}else this.lines.set(E,p[f--]);let x=0;for(let E=d.length-1;E>=0;E--)d[E].index+=x,this.lines.onInsertEmitter.fire(d[E]),x+=d[E].amount;let C=Math.max(0,_+c-this.lines.maxLength);C>0&&this.lines.onTrimEmitter.fire(C)}}translateBufferLineToString(e,t,n=0,a){let o=this.lines.get(e);return o?o.translateToString(t,n,a):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new $k(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Vk=class extends Ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new de),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 wS(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new wS(!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)}},G0=2,Z0=1,bp=class extends Ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new de),this.onResize=this._onResize.event,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,G0),this.rows=Math.max(e.rawOptions.rows||0,Z0),this.buffers=this._register(new Vk(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,a=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:a})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,a;a=this._cachedBlankLine,(!a||a.length!==this.cols||a.getFg(0)!==e.fg||a.getBg(0)!==e.bg)&&(a=n.getBlankLine(e,t),this._cachedBlankLine=a),a.isWrapped=t;let o=n.ybase+n.scrollTop,c=n.ybase+n.scrollBottom;if(n.scrollTop===0){let d=n.lines.isFull;c===n.lines.length-1?d?n.lines.recycle().copyFrom(a):n.lines.push(a.clone()):n.lines.splice(c+1,0,a.clone()),d?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let d=c-o+1;n.lines.shiftElements(o+1,d-1,-1),n.lines.set(c,a.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let a=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),a!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};bp=Pt([ge(0,ji)],bp);var wa={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:uu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Xk=["normal","bold","100","200","300","400","500","600","700","800","900"],Gk=class extends Ie{constructor(e){super(),this._onOptionChange=this._register(new de),this.onOptionChange=this._onOptionChange.event;let t={...wa};for(let n in e)if(n in t)try{let a=e[n];t[n]=this._sanitizeAndValidateOption(n,a)}catch(a){console.error(a)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(At(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in wa))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,a)=>{if(!(n in wa))throw new Error(`No option with key "${n}"`);a=this._sanitizeAndValidateOption(n,a),this.rawOptions[n]!==a&&(this.rawOptions[n]=a,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let a={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,a)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=wa[e]),!Zk(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=wa[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Xk.includes(t)?t:wa[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 Zk(e){return e==="block"||e==="underline"||e==="bar"}function Il(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let a in e)n[a]=t<=1?e[a]:e[a]&&Il(e[a],t-1);return n}var CS=Object.freeze({insertMode:!1}),xS=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),wp=class extends Ie{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new de),this.onData=this._onData.event,this._onUserInput=this._register(new de),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new de),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new de),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Il(CS),this.decPrivateModes=Il(xS)}reset(){this.modes=Il(CS),this.decPrivateModes=Il(xS)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(a=>a.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};wp=Pt([ge(0,Hi),ge(1,g0),ge(2,ji)],wp);var ES={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 df(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var ff=String.fromCharCode,TS={DEFAULT:e=>{let t=[df(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${ff(t[0])}${ff(t[1])}${ff(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${df(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${df(e,!0)};${e.x};${e.y}${t}`}},Cp=class extends Ie{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new de),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(ES))this.addProtocol(a,ES[a]);for(let a of Object.keys(TS))this.addEncoding(a,TS[a]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let a=t/n,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=a+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Cp=Pt([ge(0,Hi),ge(1,jr),ge(2,ji)],Cp);var pf=[[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]],Qk=[[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]],ai;function Jk(e,t){let n=0,a=t.length-1,o;if(e<t[0][0]||e>t[a][1])return!1;for(;a>=n;)if(o=n+a>>1,e>t[o][1])n=o+1;else if(e<t[o][0])a=o-1;else return!0;return!1}var eD=class{constructor(){if(this.version="6",!ai){ai=new Uint8Array(65536),ai.fill(1),ai[0]=0,ai.fill(0,1,32),ai.fill(0,127,160),ai.fill(2,4352,4448),ai[9001]=2,ai[9002]=2,ai.fill(2,11904,42192),ai[12351]=1,ai.fill(2,44032,55204),ai.fill(2,63744,64256),ai.fill(2,65040,65050),ai.fill(2,65072,65136),ai.fill(2,65280,65377),ai.fill(2,65504,65511);for(let e=0;e<pf.length;++e)ai.fill(0,pf[e][0],pf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ai[e]:Jk(e,Qk)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),a=n===0&&t!==0;if(a){let o=Ar.extractWidth(t);o===0?a=!1:o>n&&(n=o)}return Ar.createPropertyValue(0,n,a)}},Ar=class Zc{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new de,this.onChange=this._onChange.event;let t=new eD;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,a=!1){return(t&16777215)<<3|(n&3)<<1|(a?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,a=0,o=t.length;for(let c=0;c<o;++c){let d=t.charCodeAt(c);if(55296<=d&&d<=56319){if(++c>=o)return n+this.wcwidth(d);let f=t.charCodeAt(c);56320<=f&&f<=57343?d=(d-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let p=this.charProperties(d,a),_=Zc.extractWidth(p);Zc.extractShouldJoin(p)&&(_-=Zc.extractWidth(a)),n+=_,a=p}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},tD=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 kS(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Nl=2147483647,iD=256,Q0=class xp{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>iD)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new xp;if(!t.length)return n;for(let a=Array.isArray(t[0])?1:0;a<t.length;++a){let o=t[a];if(Array.isArray(o))for(let c=0;c<o.length;++c)n.addSubParam(o[c]);else n.addParam(o)}return n}clone(){let t=new xp(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let a=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-a>0&&t.push(Array.prototype.slice.call(this._subParams,a,o))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Nl?Nl: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>Nl?Nl:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,a=this._subParamsIdx[t]&255;return a-n>0?this._subParams.subarray(n,a):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let a=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-a>0&&(t[n]=this._subParams.slice(a,o))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let a=this._digitIsSub?this._subParams:this.params,o=a[n-1];a[n-1]=~o?Math.min(o*10+t,Nl):t}},Bl=[],sD=class{constructor(){this._state=0,this._active=Bl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Bl}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=Bl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Bl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Du(e,t,n));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let a=e[t++];if(a===59){this._state=2,this._start();break}if(a<48||57<a){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+a-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,a=this._active.length-1,o=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,n=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;a>=0&&(n=this._active[a].end(e),n!==!0);a--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,n;a--}for(;a>=0;a--)if(n=this._active[a].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,n}this._active=Bl,this._id=-1,this._state=0}}},rs=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Du(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},Ll=[],nD=class{constructor(){this._handlers=Object.create(null),this._active=Ll,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ll}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Ll,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ll,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Du(e,t,n));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,a=this._active.length-1,o=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,n=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;a>=0&&(n=this._active[a].unhook(e),n!==!0);a--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,n;a--}for(;a>=0;a--)if(n=this._active[a].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,n}this._active=Ll,this._ident=0}},Fl=new Q0;Fl.addParam(0);var DS=class{constructor(e){this._handler=e,this._data="",this._params=Fl,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Fl,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Du(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=Fl,this._data="",this._hitLimit=!1,n));return this._params=Fl,this._data="",this._hitLimit=!1,t}},rD=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,a){this.table[t<<8|e]=n<<4|a}addMany(e,t,n,a){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=n<<4|a}},bs=160,aD=(function(){let e=new rD(4095),t=Array.apply(null,Array(256)).map((p,_)=>_),n=(p,_)=>t.slice(p,_),a=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let c=n(0,14),d;e.setDefault(1,0),e.addMany(a,0,2,0);for(d in c)e.addMany([24,26,153,154],d,3,0),e.addMany(n(128,144),d,3,0),e.addMany(n(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(a,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(a,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(a,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(bs,0,2,0),e.add(bs,8,5,8),e.add(bs,6,0,6),e.add(bs,11,0,11),e.add(bs,13,13,13),e})(),lD=class extends Ie{constructor(e=aD){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 Q0,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,a)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(At(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new sD),this._dcsParser=this._register(new nD),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let c=e.intermediates.charCodeAt(o);if(32>c||c>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=c}}if(e.final.length!==1)throw new Error("final must be a single byte");let a=e.final.charCodeAt(0);if(t[0]>a||a>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=a,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let a=this._escHandlers[n];return a.push(t),{dispose:()=>{let o=a.indexOf(t);o!==-1&&a.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let a=this._csiHandlers[n];return a.push(t),{dispose:()=>{let o=a.indexOf(t);o!==-1&&a.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,a,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=a,this._parseStack.chunkPos=o}parse(e,t,n){let a=0,o=0,c=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,c=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let p=this._parseStack.handlers,_=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&_>-1){for(;_>=0&&(d=p[_](this._params),d!==!0);_--)if(d instanceof Promise)return this._parseStack.handlerPos=_,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&_>-1){for(;_>=0&&(d=p[_](),d!==!0);_--)if(d instanceof Promise)return this._parseStack.handlerPos=_,d}this._parseStack.handlers=[];break;case 6:if(a=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(a!==24&&a!==26,n),d)return d;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(a=e[this._parseStack.chunkPos],d=this._oscParser.end(a!==24&&a!==26,n),d)return d;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,c=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let p=c;p<t;++p){switch(a=e[p],o=this._transitions.table[this.currentState<<8|(a<160?a:bs)],o>>4){case 2:for(let w=p+1;;++w){if(w>=t||(a=e[w])<32||a>126&&a<bs){this._printHandler(e,p,w),p=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<bs){this._printHandler(e,p,w),p=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<bs){this._printHandler(e,p,w),p=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<bs){this._printHandler(e,p,w),p=w-1;break}}break;case 3:this._executeHandlers[a]?this._executeHandlers[a]():this._executeHandlerFb(a),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:p,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let _=this._csiHandlers[this._collect<<8|a],f=_?_.length-1:-1;for(;f>=0&&(d=_[f](this._params),d!==!0);f--)if(d instanceof Promise)return this._preserveStack(3,_,f,o,p),d;f<0&&this._csiHandlerFb(this._collect<<8|a,this._params),this.precedingJoinState=0;break;case 8:do switch(a){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(a-48)}while(++p<t&&(a=e[p])>47&&a<60);p--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let S=this._escHandlers[this._collect<<8|a],y=S?S.length-1:-1;for(;y>=0&&(d=S[y](),d!==!0);y--)if(d instanceof Promise)return this._preserveStack(4,S,y,o,p),d;y<0&&this._escHandlerFb(this._collect<<8|a),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|a,this._params);break;case 13:for(let w=p+1;;++w)if(w>=t||(a=e[w])===24||a===26||a===27||a>127&&a<bs){this._dcsParser.put(e,p,w),p=w-1;break}break;case 14:if(d=this._dcsParser.unhook(a!==24&&a!==26),d)return this._preserveStack(6,[],0,o,p),d;a===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let w=p+1;;w++)if(w>=t||(a=e[w])<32||a>127&&a<bs){this._oscParser.put(e,p,w),p=w-1;break}break;case 6:if(d=this._oscParser.end(a!==24&&a!==26),d)return this._preserveStack(5,[],0,o,p),d;a===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},oD=/^([\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})$/,cD=/^[\da-f]+$/;function RS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=oD.exec(t);if(n){let a=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/a*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/a*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/a*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),cD.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,a=[0,0,0];for(let o=0;o<3;++o){let c=parseInt(t.slice(n*o,n*o+n),16);a[o]=n===1?c<<4:n===2?c:n===3?c>>4:c>>8}return a}}function _f(e,t){let n=e.toString(16),a=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return a;case 12:return(a+a).slice(0,3);default:return a+a}}function uD(e,t=16){let[n,a,o]=e;return`rgb:${_f(n,t)}/${_f(a,t)}/${_f(o,t)}`}var hD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Xn=131072,MS=10;function AS(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var NS=5e3,BS=0,dD=class extends Ie{constructor(e,t,n,a,o,c,d,p,_=new lD){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=a,this._optionsService=o,this._oscLinkService=c,this._coreMouseService=d,this._unicodeService=p,this._parser=_,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new A2,this._utf8Decoder=new N2,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Zt.clone(),this._eraseAttrDataInternal=Zt.clone(),this._onRequestBell=this._register(new de),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new de),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new de),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new de),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new de),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new de),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new de),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new de),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new de),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new de),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new de),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new de),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 Ep(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,S)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:S.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,S,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:S,data:y})}),this._parser.setDcsHandlerFallback((f,S,y)=>{S==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:S,payload:y})}),this._parser.setPrintHandler((f,S,y)=>this.print(f,S,y)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(ae.BEL,()=>this.bell()),this._parser.setExecuteHandler(ae.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ae.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ae.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ae.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ae.BS,()=>this.backspace()),this._parser.setExecuteHandler(ae.HT,()=>this.tab()),this._parser.setExecuteHandler(ae.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ae.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Xc.IND,()=>this.index()),this._parser.setExecuteHandler(Xc.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Xc.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new rs(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new rs(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new rs(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new rs(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new rs(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new rs(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new rs(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new rs(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new rs(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new rs(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new rs(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new rs(f=>this.restoreCursorColor(f))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let f in oi)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new DS((f,S)=>this.requestStatusString(f,S)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,a){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=a}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),NS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${NS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,a=this._activeBuffer.x,o=this._activeBuffer.y,c=0,d=this._parseStack.paused;if(d){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;a=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Xn&&(c=this._parseStack.position+Xn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Xn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Xn))),d||this._dirtyRowTracker.clearRange(),e.length>Xn)for(let f=c;f<e.length;f+=Xn){let S=f+Xn<e.length?f+Xn:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(f,S),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,S),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,y))return this._preserveStack(a,o,y,f),this._logSlowResolvingAsync(n),n}else if(!d){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(a,o,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==a||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let p=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),_=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);_<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(_,this._bufferService.rows-1),end:Math.min(p,this._bufferService.rows-1)})}print(e,t,n){let a,o,c=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,p=this._bufferService.cols,_=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,S=this._curAttrData,y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.setCellFromCodepoint(this._activeBuffer.x-1,0,1,S);let w=this._parser.precedingJoinState;for(let x=t;x<n;++x){if(a=e[x],a<127&&c){let D=c[String.fromCharCode(a)];D&&(a=D.charCodeAt(0))}let C=this._unicodeService.charProperties(a,w);o=Ar.extractWidth(C);let E=Ar.extractShouldJoin(C),N=E?Ar.extractWidth(w):0;if(w=C,d&&this._onA11yChar.fire(Jn(a)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-N>p){if(_){let D=y,ie=this._activeBuffer.x-N;for(this._activeBuffer.x=N,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),N>0&&y instanceof Kl&&y.copyCellsFrom(D,ie,0,N,!1);ie<p;)D.setCellFromCodepoint(ie++,0,1,S)}else if(this._activeBuffer.x=p-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 ie=o-N;--ie>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,S);continue}if(f&&(y.insertCells(this._activeBuffer.x,o-N,this._activeBuffer.getNullCell(S)),y.getWidth(p-1)===2&&y.setCellFromCodepoint(p-1,0,1,S)),y.setCellFromCodepoint(this._activeBuffer.x++,a,o,S),o>0)for(;--o;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,S)}this._parser.precedingJoinState=w,this._activeBuffer.x<p&&n-t>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.setCellFromCodepoint(this._activeBuffer.x,0,1,S),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>AS(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new DS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new rs(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,a=!1,o=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);c.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),o),a&&(c.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,a=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-a+1;for(;t--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,a;for(a=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-a;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(a,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Zt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,a=Ar.extractWidth(t),o=this._activeBuffer.x-a,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),d=new Uint32Array(c.length*n),p=0;for(let f=0;f<c.length;){let S=c.codePointAt(f)||0;d[p++]=S,f+=S>65535?2:1}let _=p;for(let f=1;f<n;++f)d.copyWithin(_,0,p),_+=p;return this.print(d,0,_),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ae.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ae.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ae.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ae.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ae.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,Mr),this._charsetService.setgCharset(1,Mr),this._charsetService.setgCharset(2,Mr),this._charsetService.setgCharset(3,Mr);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(E=>(E[E.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",E[E.SET=1]="SET",E[E.RESET=2]="RESET",E[E.PERMANENTLY_SET=3]="PERMANENTLY_SET",E[E.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let a=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:c}=this._coreMouseService,d=this._coreService,{buffers:p,cols:_}=this._bufferService,{active:f,alt:S}=p,y=this._optionsService.rawOptions,w=(E,N)=>(d.triggerDataEvent(`${ae.ESC}[${t?"":"?"}${E};${N}$y`),!0),x=E=>E?1:2,C=e.params[0];return t?C===2?w(C,4):C===4?w(C,x(d.modes.insertMode)):C===12?w(C,3):C===20?w(C,x(y.convertEol)):w(C,0):C===1?w(C,x(a.applicationCursorKeys)):C===3?w(C,y.windowOptions.setWinLines?_===80?2:_===132?1:0:0):C===6?w(C,x(a.origin)):C===7?w(C,x(a.wraparound)):C===8?w(C,3):C===9?w(C,x(o==="X10")):C===12?w(C,x(y.cursorBlink)):C===25?w(C,x(!d.isCursorHidden)):C===45?w(C,x(a.reverseWraparound)):C===66?w(C,x(a.applicationKeypad)):C===67?w(C,4):C===1e3?w(C,x(o==="VT200")):C===1002?w(C,x(o==="DRAG")):C===1003?w(C,x(o==="ANY")):C===1004?w(C,x(a.sendFocus)):C===1005?w(C,4):C===1006?w(C,x(c==="SGR")):C===1015?w(C,4):C===1016?w(C,x(c==="SGR_PIXELS")):C===1048?w(C,1):C===47||C===1047||C===1049?w(C,x(f===S)):C===2004?w(C,x(a.bracketedPasteMode)):C===2026?w(C,x(a.synchronizedOutput)):w(C,0)}_updateAttrColor(e,t,n,a,o){return t===2?(e|=50331648,e&=-16777216,e|=mo.fromColorRGB([n,a,o])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let a=[0,0,-1,0,0,0],o=0,c=0;do{if(a[c+o]=e.params[t+c],e.hasSubParams(t+c)){let d=e.getSubParams(t+c),p=0;do a[1]===5&&(o=1),a[c+p+1+o]=d[p];while(++p<d.length&&p+c+1+o<a.length);break}if(a[1]===5&&c+o>=2||a[1]===2&&c+o>=5)break;a[1]&&(o=1)}while(++c+t<e.length&&c+o<a.length);for(let d=2;d<a.length;++d)a[d]===-1&&(a[d]=0);switch(a[0]){case 38:n.fg=this._updateAttrColor(n.fg,a[1],a[3],a[4],a[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,a[1],a[3],a[4],a[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,a[1],a[3],a[4],a[5])}return c}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Zt.fg,e.bg=Zt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,a=this._curAttrData;for(let o=0;o<t;o++)n=e.params[o],n>=30&&n<=37?(a.fg&=-50331904,a.fg|=16777216|n-30):n>=40&&n<=47?(a.bg&=-50331904,a.bg|=16777216|n-40):n>=90&&n<=97?(a.fg&=-50331904,a.fg|=16777216|n-90|8):n>=100&&n<=107?(a.bg&=-50331904,a.bg|=16777216|n-100|8):n===0?this._processSGR0(a):n===1?a.fg|=134217728:n===3?a.bg|=67108864:n===4?(a.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,a)):n===5?a.fg|=536870912:n===7?a.fg|=67108864:n===8?a.fg|=1073741824:n===9?a.fg|=2147483648:n===2?a.bg|=134217728:n===21?this._processUnderline(2,a):n===22?(a.fg&=-134217729,a.bg&=-134217729):n===23?a.bg&=-67108865:n===24?(a.fg&=-268435457,this._processUnderline(0,a)):n===25?a.fg&=-536870913:n===27?a.fg&=-67108865:n===28?a.fg&=-1073741825:n===29?a.fg&=2147483647:n===39?(a.fg&=-67108864,a.fg|=Zt.fg&16777215):n===49?(a.bg&=-67108864,a.bg|=Zt.bg&16777215):n===38||n===48||n===58?o+=this._extractColor(e,o,a):n===53?a.bg|=1073741824:n===55?a.bg&=-1073741825:n===59?(a.extended=a.extended.clone(),a.extended.underlineColor=-1,a.updateExtended()):n===100?(a.fg&=-67108864,a.fg|=Zt.fg&16777215,a.bg&=-67108864,a.bg|=Zt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ae.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ae.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ae.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Zt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!AS(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(`${ae.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>MS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>MS&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let a=n.shift(),o=n.shift();if(/^\d+$/.exec(a)){let c=parseInt(a);if(LS(c))if(o==="?")t.push({type:0,index:c});else{let d=RS(o);d&&t.push({type:1,index:c,color:d})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),a=e.slice(t+1);return a?this._createHyperlink(n,a):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),a,o=n.findIndex(c=>c.startsWith("id="));return o!==-1&&(a=n[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:a,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let a=0;a<n.length&&!(t>=this._specialColors.length);++a,++t)if(n[a]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=RS(n[a]);o&&this._onColor.fire([{type:1,index:this._specialColors[t],color:o}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let a=0;a<n.length;++a)if(/^\d+$/.exec(n[a])){let o=parseInt(n[a]);LS(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,Mr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(hD[e[0]],oi[e[1]]||Mr),!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=Zt.clone(),this._eraseAttrDataInternal=Zt.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 Cs;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,a=this._activeBuffer.lines.get(n);a&&(a.fill(e),a.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=d=>(this._coreService.triggerDataEvent(`${ae.ESC}${d}${ae.ESC}\\`),!0),a=this._bufferService.buffer,o=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${a.scrollTop+1};${a.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Ep=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)}};Ep=Pt([ge(0,Hi)],Ep);function LS(e){return 0<=e&&e<256}var fD=5e7,OS=12,pD=50,_D=class extends Ie{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new de),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>fD)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let a=this._writeBuffer[this._bufferOffset],o=this._action(a,t);if(o){let d=p=>performance.now()-n>=OS?setTimeout(()=>this._innerWrite(0,p)):this._innerWrite(n,p);o.catch(p=>(queueMicrotask(()=>{throw p}),Promise.resolve(!1))).then(d);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=a.length,performance.now()-n>=OS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>pD&&(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()}},Tp=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let p=t.addMarker(t.ybase+t.y),_={data:e,id:this._nextId++,lines:[p]};return p.onDispose(()=>this._removeMarkerFromLink(_,p)),this._dataByLinkId.set(_.id,_),_.id}let n=e,a=this._getEntryIdKey(n),o=this._entriesWithId.get(a);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let c=t.addMarker(t.ybase+t.y),d={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(d,c)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(a=>a.line!==t)){let a=this._bufferService.buffer.addMarker(t);n.lines.push(a),a.onDispose(()=>this._removeMarkerFromLink(n,a))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Tp=Pt([ge(0,Hi)],Tp);var zS=!1,mD=class extends Ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Aa),this._onBinary=this._register(new de),this.onBinary=this._onBinary.event,this._onData=this._register(new de),this.onData=this._onData.event,this._onLineFeed=this._register(new de),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new de),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new de),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new de),this._instantiationService=new Pk,this.optionsService=this._register(new Gk(e)),this._instantiationService.setService(ji,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(bp)),this._instantiationService.setService(Hi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Sp)),this._instantiationService.setService(g0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(wp)),this._instantiationService.setService(jr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Cp)),this._instantiationService.setService(m0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ar)),this._instantiationService.setService(z2,this.unicodeService),this._charsetService=this._instantiationService.createInstance(tD),this._instantiationService.setService(O2,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Tp),this._instantiationService.setService(v0,this._oscLinkService),this._inputHandler=this._register(new dD(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Di.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Di.forward(this._bufferService.onResize,this._onResize)),this._register(Di.forward(this.coreService.onData,this._onData)),this._register(Di.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 _D((t,n)=>this._inputHandler.parse(t,n))),this._register(Di.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new de),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&&!zS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),zS=!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,G0),t=Math.max(t,Z0),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(kS.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(kS(this._bufferService),!1))),this._windowsWrappingHeuristics.value=At(()=>{for(let t of e)t.dispose()})}}},gD={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function vD(e,t,n,a){let o={type:0,cancel:!1,key:void 0},c=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?o.key=ae.ESC+"OA":o.key=ae.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ae.ESC+"OD":o.key=ae.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ae.ESC+"OC":o.key=ae.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ae.ESC+"OB":o.key=ae.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ae.DEL,e.altKey&&(o.key=ae.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ae.ESC+"[Z";break}o.key=ae.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ae.ESC+ae.CR:ae.CR,o.cancel=!0;break;case 27:o.key=ae.ESC,e.altKey&&(o.key=ae.ESC+ae.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;c?o.key=ae.ESC+"[1;"+(c+1)+"D":t?o.key=ae.ESC+"OD":o.key=ae.ESC+"[D";break;case 39:if(e.metaKey)break;c?o.key=ae.ESC+"[1;"+(c+1)+"C":t?o.key=ae.ESC+"OC":o.key=ae.ESC+"[C";break;case 38:if(e.metaKey)break;c?o.key=ae.ESC+"[1;"+(c+1)+"A":t?o.key=ae.ESC+"OA":o.key=ae.ESC+"[A";break;case 40:if(e.metaKey)break;c?o.key=ae.ESC+"[1;"+(c+1)+"B":t?o.key=ae.ESC+"OB":o.key=ae.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ae.ESC+"[2~");break;case 46:c?o.key=ae.ESC+"[3;"+(c+1)+"~":o.key=ae.ESC+"[3~";break;case 36:c?o.key=ae.ESC+"[1;"+(c+1)+"H":t?o.key=ae.ESC+"OH":o.key=ae.ESC+"[H";break;case 35:c?o.key=ae.ESC+"[1;"+(c+1)+"F":t?o.key=ae.ESC+"OF":o.key=ae.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ae.ESC+"[5;"+(c+1)+"~":o.key=ae.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ae.ESC+"[6;"+(c+1)+"~":o.key=ae.ESC+"[6~";break;case 112:c?o.key=ae.ESC+"[1;"+(c+1)+"P":o.key=ae.ESC+"OP";break;case 113:c?o.key=ae.ESC+"[1;"+(c+1)+"Q":o.key=ae.ESC+"OQ";break;case 114:c?o.key=ae.ESC+"[1;"+(c+1)+"R":o.key=ae.ESC+"OR";break;case 115:c?o.key=ae.ESC+"[1;"+(c+1)+"S":o.key=ae.ESC+"OS";break;case 116:c?o.key=ae.ESC+"[15;"+(c+1)+"~":o.key=ae.ESC+"[15~";break;case 117:c?o.key=ae.ESC+"[17;"+(c+1)+"~":o.key=ae.ESC+"[17~";break;case 118:c?o.key=ae.ESC+"[18;"+(c+1)+"~":o.key=ae.ESC+"[18~";break;case 119:c?o.key=ae.ESC+"[19;"+(c+1)+"~":o.key=ae.ESC+"[19~";break;case 120:c?o.key=ae.ESC+"[20;"+(c+1)+"~":o.key=ae.ESC+"[20~";break;case 121:c?o.key=ae.ESC+"[21;"+(c+1)+"~":o.key=ae.ESC+"[21~";break;case 122:c?o.key=ae.ESC+"[23;"+(c+1)+"~":o.key=ae.ESC+"[23~";break;case 123:c?o.key=ae.ESC+"[24;"+(c+1)+"~":o.key=ae.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=ae.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ae.DEL:e.keyCode===219?o.key=ae.ESC:e.keyCode===220?o.key=ae.FS:e.keyCode===221&&(o.key=ae.GS);else if((!n||a)&&e.altKey&&!e.metaKey){let d=gD[e.keyCode]?.[e.shiftKey?1:0];if(d)o.key=ae.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,_=String.fromCharCode(p);e.shiftKey&&(_=_.toUpperCase()),o.key=ae.ESC+_}else if(e.keyCode===32)o.key=ae.ESC+(e.ctrlKey?ae.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),o.key=ae.ESC+p,o.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=ae.US),e.key==="@"&&(o.key=ae.NUL));break}return o}var Wt=0,yD=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new hu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new hu,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((o,c)=>this._getKey(o)-this._getKey(c)),t=0,n=0,a=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<a.length;o++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(a[o]=e[t],t++):a[o]=this._array[n++];this._array=a,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Wt=this._search(t),Wt===-1)||this._getKey(this._array[Wt])!==t)return!1;do if(this._array[Wt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Wt),!0;while(++Wt<this._array.length&&this._getKey(this._array[Wt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,c)=>o-c),t=0,n=new Array(this._array.length-e.length),a=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:n[a++]=this._array[o];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Wt=this._search(e),!(Wt<0||Wt>=this._array.length)&&this._getKey(this._array[Wt])===e))do yield this._array[Wt];while(++Wt<this._array.length&&this._getKey(this._array[Wt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Wt=this._search(e),!(Wt<0||Wt>=this._array.length)&&this._getKey(this._array[Wt])===e))do t(this._array[Wt]);while(++Wt<this._array.length&&this._getKey(this._array[Wt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let a=t+n>>1,o=this._getKey(this._array[a]);if(o>e)n=a-1;else if(o<e)t=a+1;else{for(;a>0&&this._getKey(this._array[a-1])===e;)a--;return a}}return t}},mf=0,HS=0,SD=class extends Ie{constructor(){super(),this._decorations=new yD(e=>e?.marker.line),this._onDecorationRegistered=this._register(new de),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new de),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 bD(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),a=t.onDispose(()=>{a.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let a=0,o=0;for(let c of this._decorations.getKeyIterator(t))a=c.options.x??0,o=a+(c.options.width??1),e>=a&&e<o&&(!n||(c.options.layer??"bottom")===n)&&(yield c)}forEachDecorationAtCell(e,t,n,a){this._decorations.forEachByKey(t,o=>{mf=o.options.x??0,HS=mf+(o.options.width??1),e>=mf&&e<HS&&(!n||(o.options.layer??"bottom")===n)&&a(o)})}},bD=class extends sr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new de),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new de),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=Lt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Lt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},wD=1e3,CD=class{constructor(e,t=wD){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let a=performance.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=a-this._lastRefreshMs,c=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},c)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},jS=20,du=class extends Ie{constructor(e,t,n,a){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=a,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let c=0;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);if(this._topBoundaryFocusListener=c=>this._handleBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._handleBoundaryFocus(c,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new CD(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(c=>this._handleResize(c.rows))),this._register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(c=>this._handleChar(c))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
26
- `))),this._register(this._terminal.onA11yTab(c=>this._handleTab(c))),this._register(this._terminal.onKey(c=>this._handleKey(c.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Be(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(At(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<jS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
27
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===jS+1&&(this._liveRegion.textContent+=Yf.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,a=n.lines.length.toString();for(let o=e;o<=t;o++){let c=n.lines.get(n.ydisp+o),d=[],p=c?.translateToString(!0,void 0,void 0,d)||"",_=(n.ydisp+o+1).toString(),f=this._rowElements[o];f&&(p.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=p,this._rowColumns.set(f,d)),f.setAttribute("aria-posinset",_),f.setAttribute("aria-setsize",a),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,a=this._rowElements[t===0?1:this._rowElements.length-2],o=n.getAttribute("aria-posinset"),c=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===c||e.relatedTarget!==a)return;let d,p;if(t===0?(d=n,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(d=this._rowElements.shift(),p=n,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{let _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let a=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(a)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:a,offset:a.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let o=({node:p,offset:_})=>{let f=p instanceof Text?p.parentNode:p,S=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(S))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(f);if(!y)return console.warn("columns is null. Race condition?"),null;let w=_<y.length?y[_]:y.slice(-1)[0]+1;return w>=this._terminal.cols&&(++S,w=0),{row:S,column:w}},c=o(t),d=o(n);if(!(!c||!d)){if(c.row>d.row||c.row===d.row&&c.column>=d.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(d.row-c.row)*this._terminal.cols-c.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let a=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${a/t})`}};du=Pt([ge(1,p_),ge(2,yn),ge(3,Sn)],du);var kp=class extends Ie{constructor(e,t,n,a,o){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=a,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new de),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new de),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(At(()=>{zr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Be(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Be(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Be(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Be(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let a=0;a<n.length;a++){let o=n[a];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(a=>{a?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[a,o]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(a)&&(n=this._checkLinkProviderResult(a,e,n)):o.provideLinks(e.y,c=>{if(this._isMouseOut)return;let d=c?.map(p=>({link:p}));this._activeProviderReplies?.set(a,d),n=this._checkLinkProviderResult(a,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let a=0;a<t.size;a++){let o=t.get(a);if(o)for(let c=0;c<o.length;c++){let d=o[c],p=d.link.range.start.y<e?0:d.link.range.start.x,_=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let f=p;f<=_;f++){if(n.has(f)){o.splice(c--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let a=this._activeProviderReplies.get(e),o=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(o=!0);if(!o&&a){let c=a.find(d=>this._linkAtPosition(d.link,t));c&&(n=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let c=0;c<this._activeProviderReplies.size;c++){let d=this._activeProviderReplies.get(c)?.find(p=>this._linkAtPosition(p.link,t));if(d){n=!0,this._handleNewLink(d);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&xD(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,zr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let a=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(a,o),this._lastMouseEvent)){let c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._askForLink(c,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,a=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-a-1,n.end.x,n.end.y-a-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,a=e.range.end.y*this._bufferService.cols+e.range.end.x,o=t.y*this._bufferService.cols+t.x;return n<=o&&o<=a}_positionFromMouseEvent(e,t,n){let a=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,a,o){return{x1:e,y1:t,x2:n,y2:a,cols:this._bufferService.cols,fg:o}}};kp=Pt([ge(1,__),ge(2,Sn),ge(3,Hi),ge(4,S0)],kp);function xD(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 ED=class extends mD{constructor(e={}){super(e),this._linkifier=this._register(new Aa),this.browser=U0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Aa),this._onCursorMove=this._register(new de),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new de),this.onKey=this._onKey.event,this._onRender=this._register(new de),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new de),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new de),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new de),this.onBell=this._onBell.event,this._onFocus=this._register(new de),this._onBlur=this._register(new de),this._onA11yCharEmitter=this._register(new de),this._onA11yTabEmitter=this._register(new de),this._onWillOpen=this._register(new de),this._setup(),this._decorationService=this._instantiationService.createInstance(SD),this._instantiationService.setService(go,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(pk),this._instantiationService.setService(S0,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Vf)),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(Di.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Di.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Di.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Di.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 n,a="";switch(t.index){case 256:n="foreground",a="10";break;case 257:n="background",a="11";break;case 258:n="cursor",a="12";break;default:n="ansi",a="4;"+t.index}switch(t.type){case 0:let o=kt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ae.ESC}]${a};${uD(o)}${H0.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=Jt.toColor(...t.color));else{let c=n;this._themeService.modifyColors(d=>d[c]=Jt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(du,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ae.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(ae.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),a=this._renderService.dimensions.css.cell.height,o=t.getWidth(n),c=this._renderService.dimensions.css.cell.width*o,d=this.buffer.y*this._renderService.dimensions.css.cell.height,p=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=p+"px",this.textarea.style.top=d+"px",this.textarea.style.width=c+"px",this.textarea.style.height=a+"px",this.textarea.style.lineHeight=a+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Be(this.element,"copy",t=>{this.hasSelection()&&R2(t,this._selectionService)}));let e=t=>M2(t,this.textarea,this.coreService,this.optionsService);this._register(Be(this.textarea,"paste",e)),this._register(Be(this.element,"paste",e)),P0?this._register(Be(this.element,"mousedown",t=>{t.button===2&&Vy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Be(this.element,"contextmenu",t=>{Vy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),C_&&this._register(Be(this.element,"auxclick",t=>{t.button===1&&h0(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Be(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Be(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Be(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Be(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Be(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Be(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Be(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Be(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Wf.get()),F0||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(dk,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(yn,this._coreBrowserService),this._register(Be(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Be(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(_p,this._document,this._helperContainer),this._instantiationService.setService(Ru,this._charSizeService),this._themeService=this._instantiationService.createInstance(yp),this._instantiationService.setService(Oa,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(cu),this._instantiationService.setService(y0,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(gp,this.rows,this.screenElement)),this._instantiationService.setService(Sn,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(dp,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(mp),this._instantiationService.setService(__,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(kp,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(up,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(vp,this.element,this.screenElement,a)),this._instantiationService.setService(j2,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(Di.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(hp,this.screenElement)),this._register(Be(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(du,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ou,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ou,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(pp,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(c){let d=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!d)return!1;let p,_;switch(c.overrideType||c.type){case"mousemove":_=32,c.buttons===void 0?(p=3,c.button!==void 0&&(p=c.button<3?c.button:3)):p=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":_=0,p=c.button<3?c.button:3;break;case"mousedown":_=1,p=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let f=c.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;_=f<0?0:1,p=4;break;default:return!1}return _===void 0||p===void 0||p>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:p,action:_,ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey})}let a={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:c=>(n(c),c.buttons||(this._document.removeEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.removeEventListener("mousemove",a.mousedrag)),this.cancel(c)),wheel:c=>(n(c),this.cancel(c,!0)),mousedrag:c=>{c.buttons&&n(c)},mousemove:c=>{c.buttons||n(c)}};this._register(this.coreMouseService.onProtocolChange(c=>{c?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(c)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),c&8?a.mousemove||(t.addEventListener("mousemove",o.mousemove),a.mousemove=o.mousemove):(t.removeEventListener("mousemove",a.mousemove),a.mousemove=null),c&16?a.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),a.wheel=o.wheel):(t.removeEventListener("wheel",a.wheel),a.wheel=null),c&2?a.mouseup||(a.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",a.mouseup),a.mouseup=null),c&4?a.mousedrag||(a.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",a.mousedrag),a.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Be(t,"mousedown",c=>{if(c.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(c)))return n(c),a.mouseup&&this._document.addEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.addEventListener("mousemove",a.mousedrag),this.cancel(c)})),this._register(Be(t,"wheel",c=>{if(!a.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(c)===!1)return!1;if(!this.buffer.hasScrollback){if(c.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(c,!0);let d=ae.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(c,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){u0(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=vD(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let a=this.rows-1;return this.scrollLines(n.type===2?-a:a),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===ae.ETX||n.key===ae.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(TD(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(Zt));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(ae.ESC+"[I"):this.coreService.triggerDataEvent(ae.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ae.ESC}[4;${n};${t}t`);break;case 1:let a=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ae.ESC}[6;${o};${a}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function TD(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var kD=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},DD=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 Cs)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},US=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 DD(t)}getNullCell(){return new Cs}},RD=class extends Ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new de),this.onBufferChange=this._onBufferChange.event,this._normal=new US(this._core.buffers.normal,"normal"),this._alternate=new US(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)}},MD=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,a)=>t(n,a.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},AD=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}},ND=["cols","rows"],Ps=0,BD=class extends Ie{constructor(e){super(),this._core=this._register(new ED(e)),this._addonManager=this._register(new kD),this._publicOptions={...this._core.options};let t=a=>this._core.options[a],n=(a,o)=>{this._checkReadonlyOptions(a),this._core.options[a]=o};for(let a in this._core.options){let o={get:t.bind(this,a),set:n.bind(this,a)};Object.defineProperty(this._publicOptions,a,o)}}_checkReadonlyOptions(e){if(ND.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 MD(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new AD(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 RD(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
28
- `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Wf.get()},set promptLabel(e){Wf.set(e)},get tooMuchOutput(){return Yf.get()},set tooMuchOutput(e){Yf.set(e)}}}_verifyIntegers(...e){for(Ps of e)if(Ps===1/0||isNaN(Ps)||Ps%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ps of e)if(Ps&&(Ps===1/0||isNaN(Ps)||Ps%1!==0||Ps<0))throw new Error("This API only accepts positive integers")}};class LD{pending=null;accept(t){let n="";for(const a of t)n+=this.acceptChar(a);return n}acceptChar(t){return t===""?this.acceptBackspace():iw.has(t)?this.acceptConsonant(t):sw.has(t)?this.acceptVowel(t):jD(t)&&this.canReplacePendingWith(t)?(this.pending=KS(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(nw.has(t))return this.pending.final=t,"";const o=this.flushPending();return this.pending={initial:t},o}const n=HD.get(`${this.pending.final}${t}`);if(n)return this.pending.final=n,"";const a=this.flushPending();return this.pending={initial:t},a}acceptVowel(t){if(!this.pending)return t;if(!this.pending.vowel)return this.pending.vowel=t,"";if(!this.pending.final){const c=zD.get(`${this.pending.vowel}${t}`);return c?(this.pending.vowel=c,""):this.flushPending()+t}const n=PS.get(this.pending.final);if(n){this.pending.final=n[0];const c=this.flushPending();return this.pending={initial:n[1],vowel:t},c}const a=this.pending.final,o=IS({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=PS.get(this.pending.final);return t?this.pending.final=t[0]:delete this.pending.final,""}return this.pending.vowel?(delete this.pending.vowel,""):(this.pending=null,"")}canReplacePendingWith(t){if(!this.pending?.initial)return!1;const n=KS(t);return n.initial===this.pending.initial&&(!this.pending.vowel||n.vowel===this.pending.vowel)&&(!this.pending.final||n.final===this.pending.final)}flushPending(){if(!this.pending)return"";const t=IS(this.pending);return this.pending=null,t}}const fu=44032,pu=21,Ta=28,OD=19*pu*Ta,J0=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],ew=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],tw=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],iw=x_(J0),sw=x_(ew),nw=x_(tw),zD=new Map([["ㅗㅏ","ㅘ"],["ㅗㅐ","ㅙ"],["ㅗㅣ","ㅚ"],["ㅜㅓ","ㅝ"],["ㅜㅔ","ㅞ"],["ㅜㅣ","ㅟ"],["ㅡㅣ","ㅢ"]]),rw=[["ㄱㅅ","ㄳ"],["ㄴㅈ","ㄵ"],["ㄴㅎ","ㄶ"],["ㄹㄱ","ㄺ"],["ㄹㅁ","ㄻ"],["ㄹㅂ","ㄼ"],["ㄹㅅ","ㄽ"],["ㄹㅌ","ㄾ"],["ㄹㅍ","ㄿ"],["ㄹㅎ","ㅀ"],["ㅂㅅ","ㅄ"]],HD=new Map(rw),PS=new Map(rw.map(([e,t])=>[t,[e[0],e[1]]]));function x_(e){return new Map(e.map((t,n)=>[t,n]))}function jD(e){const t=e.codePointAt(0);return t!==void 0&&t>=fu&&t<fu+OD}function KS(e){const t=e.codePointAt(0)-fu,n=Math.floor(t/(pu*Ta)),a=Math.floor(t%(pu*Ta)/Ta),o=t%Ta,c={initial:J0[n],vowel:ew[a]};return o===0?c:{...c,final:tw[o]}}function IS(e){if(!e.vowel)return e.initial;const t=iw.get(e.initial),n=sw.get(e.vowel),a=e.final?nw.get(e.final):0;return t===void 0||n===void 0||a===void 0?`${e.initial}${e.vowel}${e.final??""}`:String.fromCodePoint(fu+(t*pu+n)*Ta+a)}const UD=[{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 PD({ctrlActive:e,onCtrl:t,onStandaloneKey:n,onPreserveFocus:a,onHide:o}){function c(d){d.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"}),UD.map(d=>m.jsx("button",{type:"button",className:"mobile-terminal-key","aria-label":d.ariaLabel,onClick:()=>n(d.key),children:d.label},d.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 KD={escape:"\x1B",tab:" ",arrowUp:"\x1B[A",arrowDown:"\x1B[B",arrowRight:"\x1B[C",arrowLeft:"\x1B[D"};function ID(e){return KD[e]}function FD(e){return/^[a-z]$/i.test(e)?String.fromCharCode(e.toUpperCase().charCodeAt(0)-64):null}const So=new Map,ro=new Map,qD=Object.freeze({open:!1,text:""});function WD(e){let t=ro.get(e);return t||(t=new Set,ro.set(e,t)),t}function aw(e){const t=ro.get(e);if(t)for(const n of Array.from(t))n()}function E_(e){return So.get(e)??qD}function YD(e,t){const n=WD(e);return n.add(t),()=>{n.delete(t)}}function $D(e,t){const n=E_(e);n.open!==t&&(So.set(e,{...n,open:t}),aw(e))}function VD(e,t){const n=E_(e);n.text!==t&&(So.set(e,{...n,text:t}),aw(e))}function XD(e){So.delete(e),ro.delete(e)}function GD(){So.clear(),ro.clear()}const ZD=20;function QD({terminalId:e,onSubmit:t,disabled:n=!1}){const a=v.useMemo(()=>w=>YD(e,w),[e]),o=v.useMemo(()=>()=>E_(e),[e]),c=v.useSyncExternalStore(a,o,o),{open:d,text:p}=c,_=v.useRef(null);v.useEffect(()=>{d&&_.current?.focus()},[d]);function f(w){$D(e,w)}function S(w){VD(e,w)}function y(){if(n||!p)return;const w=p.replace(/\r\n/g,`
29
- `).replace(/\n/g,"\r");w&&t(w),window.setTimeout(()=>t("\r"),ZD),S(""),_.current?.focus()}return d?m.jsxs("div",{className:"compose-drawer compose-drawer--open",children:[m.jsxs("button",{type:"button",className:"compose-drawer-header","aria-label":"Collapse compose drawer",title:"Click to collapse — Esc also closes when focus is in the textarea",onClick:()=>f(!1),children:[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:_,className:"compose-drawer-input","aria-label":"Compose input",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",value:p,onChange:w=>S(w.target.value),onKeyDown:w=>{if(w.key==="Enter"&&(w.metaKey||w.ctrlKey)){w.preventDefault(),y();return}w.key==="Escape"&&(w.preventDefault(),f(!1))},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",onClick:()=>{S(""),_.current?.focus()},disabled:!p,children:"Clear"}),m.jsx("button",{type:"button",className:"compose-drawer-send",onClick:y,disabled:n||!p,children:"Send"})]})]}):m.jsx("div",{className:"compose-drawer compose-drawer--closed",children:m.jsxs("button",{type:"button",className:"compose-drawer-handle","aria-label":"Open compose drawer",title:"Compose long input — type without per-keystroke latency, send with Cmd/Ctrl+Enter",onClick:()=>f(!0),children:[m.jsx("span",{"aria-hidden":"true",children:"▴"}),m.jsx("span",{children:"compose"}),p?m.jsx("span",{className:"compose-drawer-handle-dot","aria-label":"draft saved"}):null]})})}function JD(e){e.attachCustomKeyEventHandler(o=>{if(eR(o)){const c=FS(e);return c?(o.preventDefault(),o.stopPropagation(),qS(c),!1):!0}return tR(o)?(o.preventDefault(),o.stopPropagation(),iR(e),!1):!0});const t=e.element;if(!t)return{dispose(){e.attachCustomKeyEventHandler(()=>!0)}};const n=o=>{const c=FS(e);if(c){if(o.clipboardData){o.clipboardData.setData("text/plain",c),o.preventDefault();return}o.preventDefault(),qS(c)}},a=o=>{const c=o.clipboardData?.getData("text/plain");if(c===void 0)return;const d=lw(c);d!==c&&(o.preventDefault(),o.stopImmediatePropagation(),e.paste(d))};return t.addEventListener("copy",n,!0),t.addEventListener("paste",a,!0),{dispose(){t.removeEventListener("copy",n,!0),t.removeEventListener("paste",a,!0),e.attachCustomKeyEventHandler(()=>!0)}}}function eR(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 tR(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 iR(e){if(navigator.clipboard?.readText)try{const t=await navigator.clipboard.readText();if(!t)return;e.paste(lw(t))}catch{}}function FS(e){return e.hasSelection()?e.getSelection():""}function lw(e){return e.replace(/(?:\r\n|\r|\n)+$/,"")}async function qS(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}sR(e)}function sR(e){const t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=document.createElement("textarea");n.value=e,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.style.opacity="0",document.body.appendChild(n),n.focus({preventScroll:!0}),n.select();try{typeof document.execCommand=="function"&&document.execCommand("copy")}finally{n.remove(),t?.focus({preventScroll:!0})}}const nR=[4,10,11,12];function rR(e,t){const n=[e.parser.registerCsiHandler({final:"c"},a=>WS(a)),e.parser.registerCsiHandler({prefix:">",final:"c"},a=>WS(a)),e.parser.registerCsiHandler({final:"n"},a=>aR(a)),e.parser.registerCsiHandler({prefix:"?",final:"n"},a=>lR(a)),e.parser.registerCsiHandler({final:"t"},a=>oR(a)),e.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...nR.map(a=>e.parser.registerOscHandler(a,o=>cR(o)))];return{dispose(){for(const a of n)a.dispose()}}}function WS(e){return Nu(e)===0}function aR(e){const t=Nu(e);return t===5||t===6}function lR(e){return Nu(e)===6}function oR(e){const t=Nu(e);return t===14||t===16||t===18}function cR(e){return e.split(";").some(t=>t==="?")}function Nu(e){const t=e[0];return typeof t=="number"?t:0}const ao=new Map,uR=2*1024*1024,hR=1500,dR=25e3;function fR(e,t){let n=ao.get(e);n||(n=pR(e),ao.set(e,n),cw(n)),n.listeners.add(t);const a=c=>gR(n,c),o=()=>{n.listeners.delete(t)};return{status:n.status,snapshot:n.snapshot,output:n.output.slice(),history:n.history,send:a,detach:o}}function ow(e){const t=ao.get(e);t&&(vR(t),ao.delete(e))}function YS(){for(const e of Array.from(ao.keys()))ow(e)}function pR(e){return{url:e,socket:null,status:"connecting",snapshot:null,output:[],history:null,outputBytes:0,pendingOut:[],listeners:new Set,reconnectTimer:null,reconnectEnabled:!0,heartbeat:null,isAlive:!1,exited:!1}}function cw(e){if(!e.reconnectEnabled)return;Ol(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){Ol(e,"connected");for(const n of e.pendingOut)t.send(JSON.stringify(n));e.pendingOut.length=0,e.isAlive=!0,_R(e)}}),t.addEventListener("message",n=>{if(e.socket!==t)return;const a=typeof n.data=="string"?n.data:"";if(!a)return;let o=null;try{o=JSON.parse(a)}catch{return}if(!(!o||typeof o.type!="string")){if(o.type==="pong"){e.isAlive=!0;return}mR(e,o),uw(e,{type:"message",message:o})}}),t.addEventListener("close",n=>{if(e.socket===t){if(e.socket=null,T_(e),n.code===1008){e.reconnectEnabled=!1,Ol(e,"unauthorized");return}if(e.exited||!e.reconnectEnabled){Ol(e,"closed");return}Ol(e,"reconnecting"),e.reconnectTimer=window.setTimeout(()=>{e.reconnectTimer=null,cw(e)},hR)}}),t.addEventListener("error",()=>{})}function _R(e){T_(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)}))}},dR)}function T_(e){e.heartbeat!==null&&(window.clearInterval(e.heartbeat),e.heartbeat=null)}function mR(e,t){if(t.type==="snapshot"){e.snapshot=t.terminal,e.output=t.output.slice(),e.history=t.history??null,e.outputBytes=e.output.reduce((n,a)=>n+a.length,0),e.exited=t.terminal.status==="exited",$S(e);return}if(t.type==="output"){e.output.push(t.data),e.outputBytes+=t.data.length,$S(e);return}if(t.type==="terminal_updated"){e.snapshot=t.terminal,t.terminal.status==="exited"&&(e.exited=!0);return}if(t.type==="exit"){e.exited=!0,e.snapshot&&e.snapshot.id===t.terminalId&&(e.snapshot={...e.snapshot,status:"exited",exitCode:t.exitCode});return}}function $S(e){for(;e.outputBytes>uR&&e.output.length>1;){const t=e.output.shift();e.outputBytes-=t.length}}function Ol(e,t){e.status!==t&&(e.status=t,uw(e,{type:"status",status:t}))}function uw(e,t){for(const n of Array.from(e.listeners))n(t)}function gR(e,t){const n=e.socket;return n&&n.readyState===WebSocket.OPEN?(n.send(JSON.stringify(t)),!0):(t.type==="input"&&e.pendingOut.push(t),!1)}function vR(e){e.reconnectEnabled=!1,e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),T_(e);const t=e.socket;e.socket=null,t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),e.listeners.clear()}const yR=[0,50,150,350],SR=[300,1200,2500],bR=1e3,wR=1e5,Dp="\x1B[?1049l\x1B[?1047l\x1B[?47l",CR=new Set(["47","1047","1049"]),xR=80,ER=6;function VS({terminal:e,serverApi:t,active:n,visible:a=!0,canClose:o,refreshCwdOnEnter:c=!1,tabId:d,onSelect:p,onClose:_,onExit:f,onSnapshot:S,onAuthClose:y}){const w=v.useSyncExternalStore(Xb,Hf,()=>Nr),x=v.useSyncExternalStore(Gb,jf,()=>Ra),C=v.useSyncExternalStore(Zb,Pf,()=>!0),E=v.useSyncExternalStore(r0,rr,()=>ru),N=v.useRef(null),D=v.useRef(null),ie=v.useRef(null),R=v.useRef(null),H=v.useRef({onExit:f,onSnapshot:S}),j=v.useRef(t.createWebSocketUrl),W=v.useRef(y),B=v.useRef(null),oe=v.useRef(new Map),ce=v.useRef([]),ue=v.useRef([]),Q=v.useRef([]),G=v.useRef(0),K=v.useRef(!1),J=v.useRef(null),se=v.useRef(0),M=v.useRef(null),Y=v.useRef(null),X=v.useRef(!1),pe=v.useRef(!1),ye=v.useRef(!1),k=v.useRef(null),I=v.useRef(null),ne=v.useRef(!1),he=v.useRef(!1),_e=v.useRef(!1),me=v.useRef(!1),Ee=v.useRef(!1),De=v.useRef(!1),Ce=v.useRef(!1),Me=v.useRef(n),et=v.useRef(a),tt=v.useRef(c),Ne=v.useRef(w),ee=v.useRef(x),[,Te]=v.useState("connecting"),[xe,ze]=v.useState(!1),[qe,vt]=v.useState(null),[ct,V]=v.useState(!1),[He,it]=v.useState(null),[rt,Es]=v.useState(!1),[ls,ci]=v.useState(!1),[ui,Bi]=v.useState(!1),[Si,ei]=v.useState(null),[Ws,Li]=v.useState(!1),[ti,bi]=v.useState(!1);v.useLayoutEffect(()=>{Me.current=n},[n]),v.useLayoutEffect(()=>{et.current=a},[a]),v.useLayoutEffect(()=>{tt.current=c},[c]),v.useLayoutEffect(()=>{Ne.current=w},[w]),v.useLayoutEffect(()=>{ee.current=x},[x]),v.useEffect(()=>{a&&n&&e.status==="running"&&(at(),zt())},[n,a,e.status]),v.useEffect(()=>{H.current={onExit:f,onSnapshot:S}},[f,S]),v.useEffect(()=>{j.current=t.createWebSocketUrl,W.current=y},[t,y]),v.useEffect(()=>{let z=!1;return ei(null),e.status!=="running"?()=>{z=!0}:(t.getTerminalTranscriptSource(e.id).then(fe=>{z||ei(fe.source)}).catch(fe=>{!z&&!gf(fe)&&ei(null)}),()=>{z=!0})},[t,e.currentCommand,e.id,e.status]),v.useEffect(()=>{Li(!1)},[e.id,Si?.provider,Si?.sessionId]),v.useEffect(()=>{const z=D.current;z&&(z.options.disableStdin=e.status==="exited"),e.status==="exited"&&Te("closed")},[e.status]),v.useEffect(()=>{const z=D.current;z&&(z.options.fontSize=w,Jd(w,ee.current).then(()=>{Ne.current===w&&at()}))},[w]),v.useEffect(()=>{const z=D.current;z&&(z.options.fontFamily=zf(x),Jd(Ne.current,x).then(()=>{ee.current===x&&at()}))},[x]),v.useEffect(()=>{const z=D.current;z&&(z.options.theme=XS(E))},[E]),v.useEffect(()=>{const z=N.current;if(!z)return;let fe=!1,Pe=null,Fe=null,Je=null,xt=null,di=null,Ct=null,Rs=null;B.current=null,Ee.current=!1,De.current=!1,hi(),Ys();const cr=Ne.current,Pr=ee.current,Ki=new BD({cursorBlink:!0,convertEol:!1,disableStdin:e.status==="exited",fontFamily:zf(Pr),fontSize:cr,fontWeight:400,fontWeightBold:700,macOptionClickForcesSelection:!0,scrollback:wR,theme:{...XS(rr())}}),ur=new x2;return Ki.loadAddon(ur),xt=rR(Ki),D.current=Ki,ie.current=ur,Jd(cr,Pr).then(()=>{if(fe)return;Ki.open(z),Ee.current=!0,Pe=JD(Ki),et.current&&Me.current&&e.status==="running"&&zt(),at(),di=OR(z,Ki,()=>Ne.current*1.2,ii,It=>{dt(It)},Ot,cs),Ct=NR(z,Ki,ii,It=>{dt(It)},Ot,cs);const Ou=new LD;Fe=Ki.onData(It=>{if(Ce.current){const ja=FD(It);if(ja){Gi(!1),Le(ja);return}}const Kr=Ou.accept(It);Kr&&Le(Kr)}),Je=Ki.onScroll(It=>{if(he.current||me.current||_e.current){wt();return}Pi(),er(Ki)&&yt({scrollToBottom:!0}),ii(),It<=3&&dt()}),Rs=new ResizeObserver(()=>{Kt()}),Rs.observe(z),De.current&&(Ts(),De.current=!1,at()),Nt()}),()=>{fe=!0,Ee.current=!1,De.current=!1,hi(),Rt(),Ui(),_e.current=!1,di?.(),Ct?.(),Rs?.disconnect(),Pe?.dispose(),Fe?.dispose(),Je?.dispose(),xt?.dispose(),Ki.dispose(),D.current=null,ie.current=null}},[e.id]),v.useEffect(()=>{const z=j.current(e.id),fe=fR(z,Yt);return R.current=fe.send,Te(fe.status),fe.status==="connected"&&at(),fe.snapshot&&(H.current.onSnapshot(fe.snapshot,{notifyCompletion:!1}),D.current&&(at(),$s(fe.output,fe.history),at())),()=>{fe.detach(),R.current=null}},[e.id]);function Yt(z){if(z.type==="status"){Te(z.status),z.status==="unauthorized"&&W.current?.(),z.status==="connected"&&at();return}Xe(z.message)}function Ys(z=[],fe=null){ue.current=[],Q.current=GS(z),G.current=0,K.current=!1,J.current=null,_e.current=!1,se.current+=1,M.current=fe,Y.current=null,X.current=!1,pe.current=!1,ye.current=!1,De.current=!1,k.current=null,ne.current=!1,ze(!1),vt(null),V(!1),it(null),Es(!1),ci(!1)}function $s(z=[],fe=null){Ys(z,fe),or()}function or(){if(!D.current||!Ee.current){De.current=!0;return}De.current=!1,Ts()}async function Ts(){const z=D.current;if(!z)return;const fe=Kc(z,ne.current),Pe=fe?Q.current.length:G.current;await ks(z,{liveOutputLimit:Pe,scrollToBottom:fe}),D.current===z&&wt()}function ks(z,fe={}){return new Promise(Pe=>{_e.current=!0,K.current=!1;const Fe=se.current+1;se.current=Fe;const Je=Math.max(0,Math.min(fe.liveOutputLimit??Q.current.length,Q.current.length)),xt=()=>{if(D.current!==z||se.current!==Fe){Pe();return}try{G.current=Je,fe.scrollToBottom&&Vs(z)}finally{_e.current=!1;const Ct=wi();Ct&&yt(Ct),Pe()}},di=()=>{if(D.current!==z||se.current!==Fe){Pe();return}z.clear();const Ct=GS([...ue.current,...Q.current.slice(0,Je)]);if(Ct.length===0){xt();return}for(let Rs=0;Rs<Ct.length;Rs+=1){const cr=Ct[Rs];Rs===Ct.length-1?z.write(cr,xt):z.write(cr)}};if(z.buffer.active.type==="alternate"){z.write(Dp,di);return}di()})}async function dt(z=0){const fe=D.current;if(ye.current||!fe)return;const Pe=M.current;ye.current=!0,ze(!0);const Fe=fe.buffer.active.viewportY;try{let Je=!!(Pe&&!Pe.hasMore);if(!Je)try{const xt=await t.getTerminalHistory(e.id,{beforeLine:Pe?.startLine??0,limit:bR});if(M.current={startLine:xt.startLine,endLine:xt.endLine,hasMore:xt.hasMore},xt.output.length>0){await Dt(fe,xt.output,Fe,z);return}Je=!xt.hasMore}catch(xt){Je=gf(xt)}Je&&await ft(fe,Fe,z)}catch{}finally{ye.current=!1,ze(!1)}}async function ft(z,fe,Pe){if(!(X.current||pe.current))try{const Fe=Y.current,Je=await t.getTerminalTranscriptHistory(e.id,{...Fe?{cursor:Fe}:{},limit:80});if(ei(Je.source),Y.current=Je.cursor,pe.current=!Je.hasMore||!Je.cursor,Je.output.length===0)return;await Dt(z,Je.output,fe,Pe)}catch(Fe){gf(Fe)&&(X.current=!0)}}async function Dt(z,fe,Pe,Fe){ue.current=[...fe,...ue.current];const Je=MR(fe);await ks(z,{liveOutputLimit:G.current,scrollToBottom:!1}),D.current===z&&(Ds(z,Math.max(0,Pe+Je+Math.min(0,Fe))),ne.current=!er(z),ii())}v.useEffect(()=>{const z=window.visualViewport;function fe(){document.visibilityState==="visible"&&at()}function Pe(){at()}function Fe(){Nt()}return document.addEventListener("visibilitychange",fe),window.addEventListener("pageshow",Pe),window.addEventListener("resize",Fe),z?.addEventListener("resize",Fe),z?.addEventListener("scroll",Fe),()=>{document.removeEventListener("visibilitychange",fe),window.removeEventListener("pageshow",Pe),window.removeEventListener("resize",Fe),z?.removeEventListener("resize",Fe),z?.removeEventListener("scroll",Fe)}},[e.id]);function Xe(z){if(z.type==="snapshot"&&z.terminal.id===e.id){if(H.current.onSnapshot(z.terminal,{notifyCompletion:!1}),!D.current)return;at(),$s(z.output,z.history??null),at();return}if(z.type==="terminal_updated"&&z.terminal.id===e.id){H.current.onSnapshot(z.terminal,{notifyCompletion:!0});return}if(z.type==="output"&&z.terminalId===e.id){const Pe=hw(z.data);if(!Pe)return;Q.current.push(Pe),D.current&&Ee.current?yt({scrollToBottom:!0}):De.current=!0;return}const fe=D.current;if(fe){if(z.type==="exit"&&z.terminalId===e.id){H.current.onExit(z.exitCode),Te("closed");return}z.type==="error"&&fe.writeln(`\r
30
- [nterminal] ${z.message}`)}}function Kt(z=25){if(document.visibilityState==="hidden"||!et.current||oe.current.has(z))return;const fe=window.setTimeout(()=>{oe.current.delete(z),Re()},z);oe.current.set(z,fe)}function Nt(){for(const z of yR)Kt(z)}function at(){B.current=null,Nt()}function hi(){for(const z of oe.current.values())window.clearTimeout(z);oe.current.clear()}function Rt(){for(const z of ce.current)window.clearTimeout(z);ce.current=[]}function ii(){if(wt(),!k.current){V(!1);return}V(!0),Ui(),I.current=window.setTimeout(()=>{I.current=null,V(!1)},1200)}function wt(){const z=D.current,fe=z?AR(z):null;if(k.current=fe,vt(fe),ci(!!(z&&fe)),Es(!!(z&&fe&&!er(z))),fe||!z||!Ri()){it(null);return}it({alternate:z.buffer.active.type==="alternate"})}function Ri(){const z=M.current;return ue.current.length>0||!!z?.hasMore}function Ui(){I.current!==null&&(window.clearTimeout(I.current),I.current=null)}function Pi(){const z=D.current;z&&(ne.current=!er(z),wt())}function si(z){J.current=vf(J.current,z)}function os(z){const fe=J.current;return J.current=null,vf(fe,z)}function wi(){const z=J.current;return J.current=null,z}function yt(z={}){const fe=D.current;if(!fe||!Ee.current){De.current=!0;return}if(_e.current){si(z);return}if(K.current){si(z);return}const Pe=os(z);if(!Pe.force&&!Kc(fe,ne.current)){wt();return}K.current=!0;const Fe=se.current,Je=()=>{if(D.current!==fe||se.current!==Fe){K.current=!1;return}if(!Pe.force&&!Kc(fe,ne.current)){K.current=!1,wt();return}const xt=G.current,di=Q.current[xt];if(di===void 0){K.current=!1,Pe.scrollToBottom&&Vs(fe),wt();const Ct=wi();Ct&&yt(vf(Pe,Ct));return}G.current=xt+1,fe.write(di,Je)};Je()}function Ot(){me.current=!0}function cs(){Pi(),me.current=!1;const z=D.current;z&&er(z)&&yt({scrollToBottom:!0})}function Vs(z){bn(()=>ZS(z))&&(ne.current=!1)}function Ds(z,fe){bn(()=>(z.scrollToLine(fe),!0))}function bn(z){he.current=!0;try{return z()}finally{he.current=!1}}function L(){const z=D.current;if(!z)return;const fe=()=>{ZS(z),ne.current=!1,wt(),yt({force:!0,scrollToBottom:!0}),zt()};if(z.buffer.active.type==="alternate"){z.write(Dp,fe);return}fe()}function q(z){const fe=D.current,Pe=N.current;if(!fe||!Pe)return;const Fe=Pe.getBoundingClientRect();if(Fe.height<=0)return;const Je=Math.max(0,Math.min(1,(z-Fe.top)/Fe.height)),xt=Math.round(fe.buffer.active.baseY*Je);Ot();try{fe.scrollToLine(xt)}finally{cs()}ne.current=!er(fe),wt(),ii(),xt<=3&&dt()}function le(z){z.preventDefault(),z.stopPropagation(),z.currentTarget.setPointerCapture?.(z.pointerId),q(z.clientY)}function ve(z){(z.buttons&1)!==0&&(z.preventDefault(),z.stopPropagation(),q(z.clientY))}function Re(){const z=D.current,fe=ie.current;if(!(!z||!fe)&&!(document.visibilityState==="hidden"||!et.current||N.current?.isConnected===!1))try{const Pe=Kc(z,ne.current);fe.fit(),Pe&&Vs(z),z.refresh(0,Math.max(0,z.rows-1)),wt();const Fe={cols:z.cols,rows:z.rows},Je=B.current;if(Je&&Je.cols===Fe.cols&&Je.rows===Fe.rows)return;Ge({type:"resize",terminalId:e.id,cols:Fe.cols,rows:Fe.rows})&&(B.current=Fe)}catch{}}function Ge(z){const fe=R.current;return fe?fe(z):!1}function Le(z){yt({force:!0,scrollToBottom:!0}),Ge({type:"input",terminalId:e.id,data:z})&&DR(z)&&lt()}function lt(){!tt.current||!Me.current||(Rt(),ce.current=SR.map(z=>{const fe=window.setTimeout(()=>{ce.current=ce.current.filter(Pe=>Pe!==fe),tt.current&&Me.current&&Ge({type:"refresh_cwd",terminalId:e.id})},z);return fe}))}function zt(){D.current?.focus()}function Ls(){Bi(z=>{const fe=!z;return Ce.current=fe,fe}),zt()}function Gi(z){Ce.current=z,Bi(z)}function wn(z){Ce.current&&Gi(!1),Le(ID(z)),zt()}return m.jsxs("section",{className:"terminal-pane","data-active":n,onMouseDown:()=>{n||p()},children:[m.jsx(TR,{terminal:e,canClose:o,tabId:d,transcriptSource:Si,onOpenTranscript:()=>Li(!0),onClose:_}),m.jsx("div",{className:"xterm-container",ref:N}),xe?m.jsx("div",{className:"terminal-history-loader",role:"status","aria-label":"Loading older terminal output",children:m.jsx("span",{"aria-hidden":"true"})}):null,C&&qe?m.jsxs("div",{className:"terminal-scroll-progress","data-active":ct,"aria-hidden":"true",children:[qe.current,"/",qe.total]}):C&&He?m.jsxs("div",{className:"terminal-scroll-progress","data-active":!1,"data-pending":"true","data-buffer":He.alternate?"alternate":"normal","aria-hidden":"true",children:[He.alternate?"alt ":"","0/?"]}):null,rt?m.jsx("button",{type:"button",className:"terminal-scroll-bottom-button","aria-label":"Scroll terminal to bottom",title:"Scroll to bottom",onPointerDown:z=>z.stopPropagation(),onMouseDown:z=>z.stopPropagation(),onClick:z=>{z.stopPropagation(),L()},children:"↓"}):null,ls?m.jsx("button",{type:"button",className:"terminal-scroll-handle","aria-label":"Drag terminal scroll handle",title:"Drag to scroll",onPointerDown:le,onPointerMove:ve,children:m.jsx("span",{"aria-hidden":"true"})}):null,n&&e.status==="running"?ti?m.jsx(PD,{ctrlActive:ui,onCtrl:Ls,onStandaloneKey:wn,onPreserveFocus:zt,onHide:()=>bi(!1)}):m.jsx("button",{type:"button",className:"mobile-terminal-key-toggle","aria-label":"Show terminal control keys",title:"Show Ctrl / Esc / Tab / arrows",onMouseDown:z=>{z.stopPropagation(),zt()},onPointerDown:z=>{z.stopPropagation(),zt()},onClick:()=>bi(!0),children:"⌨"}):null,m.jsx(QD,{terminalId:e.id,onSubmit:Le,disabled:e.status!=="running"}),Ws&&Si?m.jsx(kR,{terminal:e,serverApi:t,source:Si,onClose:()=>Li(!1)}):null]})}function XS(e){return{background:"#0a0d10",foreground:"#e2e8ee",cursor:ZE(e),selectionBackground:QE(e)}}function TR({terminal:e,canClose:t,tabId:n,transcriptSource:a,onOpenTranscript:o,onClose:c}){const d=Hb({id:`pane-${e.id}`,disabled:!n,...n?{data:{kind:"pane",sourceTabId:n,terminalId:e.id}}:{}}),p={cursor:n?"grab":"default",opacity:d.isDragging?.5:void 0};return m.jsxs("header",{ref:d.setNodeRef,className:"terminal-pane-header",style:p,"data-dragging":d.isDragging,...d.attributes,...d.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.jsx("button",{type:"button",className:"terminal-pane-transcript","data-provider":a.provider,title:`${_u(a.provider)} JSONL history available`,"aria-label":`Open ${_u(a.provider)} JSONL transcript`,onPointerDown:_=>_.stopPropagation(),onMouseDown:_=>_.stopPropagation(),onClick:_=>{_.stopPropagation(),o()},children:"JSONL"}):null,m.jsx("span",{className:`terminal-pane-state terminal-pane-state-${e.status}`,children:e.status}),t?m.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close pane ${e.title}`,title:"Close pane",onPointerDown:_=>_.stopPropagation(),onMouseDown:_=>_.stopPropagation(),onClick:_=>{_.stopPropagation(),c()},children:"x"}):null]})}function kR({terminal:e,serverApi:t,source:n,onClose:a}){const o=v.useRef(null),c=v.useRef(0),d=v.useRef(!1),p=v.useRef(!1),_=v.useRef(null),[f,S]=v.useState([]),[y,w]=v.useState(null),[x,C]=v.useState(!1),[E,N]=v.useState(!0),[D,ie]=v.useState(!1),[R,H]=v.useState(null);v.useEffect(()=>{c.current+=1;const ue=c.current;return d.current=!1,p.current=!0,_.current=null,S([]),w(null),C(!1),H(null),j(null,"initial",ue),()=>{c.current===ue&&(c.current+=1)}},[t,n.provider,n.sessionId,e.id]),v.useLayoutEffect(()=>{const ue=o.current;if(!ue)return;if(p.current){p.current=!1,ue.scrollTop=ue.scrollHeight;return}const Q=_.current;Q!==null&&(_.current=null,ue.scrollTop+=ue.scrollHeight-Q)},[f]);async function j(ue,Q,G=c.current){if(!d.current){d.current=!0,Q==="initial"?N(!0):(ie(!0),_.current=o.current?.scrollHeight??null),H(null);try{await W(ue,Q,G)}catch(K){if(c.current!==G)return;H(K instanceof Error?K.message:"Failed to load transcript history.")}finally{c.current===G&&(d.current=!1,N(!1),ie(!1))}}}async function W(ue,Q,G){let K=ue,J=0;for(;c.current===G;){const se=await t.getTerminalTranscriptHistory(e.id,{...K?{cursor:K}:{},limit:xR});if(c.current!==G)return;const M=RR(se.output,n.provider);if(w(se.cursor),C(!!(se.hasMore&&se.cursor)),M){S(Y=>Q==="older"?[M,...Y]:[M]);return}if(!se.hasMore||!se.cursor||J>=ER)return;K=se.cursor,J+=1}}function B(){const ue=o.current;!ue||ue.scrollTop>72||!x||!y||d.current||j(y,"older")}const oe=_u(n.provider),ce=f.join("");return m.jsx("div",{className:"security-overlay transcript-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"transcript-dialog-title",onClick:a,children:m.jsxs("div",{className:"security-panel transcript-dialog",onClick:ue=>ue.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:[oe," JSONL"]}),m.jsx("span",{title:n.sessionId,children:n.sessionId})]}),m.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:a,children:"×"})]}),m.jsxs("div",{ref:o,className:"transcript-dialog-scroll","aria-label":"JSONL transcript output",onScroll:B,children:[D?m.jsx("div",{className:"transcript-dialog-status",children:"Loading older entries..."}):null,!E&&x?m.jsx("div",{className:"transcript-dialog-hint",children:"Scroll up for older entries"}):null,ce?m.jsx("pre",{children:ce}):null,E?m.jsx("div",{className:"transcript-dialog-status",children:"Loading transcript..."}):null,!E&&!ce&&!R?m.jsx("div",{className:"transcript-dialog-status",children:"No transcript entries found."}):null,R?m.jsx("div",{className:"transcript-dialog-error",children:R}):null]})]})})}function DR(e){return e.includes("\r")||e.includes(`
31
- `)}function gf(e){return e instanceof gn&&e.status===404}function _u(e){return e==="codex"?"Codex":"Claude"}function RR(e,t){const n=`[nterminal] ${_u(t)} transcript archive ends here. Live terminal screen continues below.`,a=e.join("").replace(/\r\n/g,`
32
- `).replace(/\r/g,`
33
- `).replace(n,"").replace(/\n{3,}/g,`
34
-
35
- `).trimEnd();return a?`${a}
36
- `:""}function MR(e){let t=0;for(const n of e){if(!n)continue;const a=n.match(/\r\n|\r|\n/g);t+=a?.length??1}return Math.max(1,t)}function GS(e){const t=[];for(const n of e){const a=hw(n);a&&t.push(a)}return t}function hw(e){return e.replace(/\x1b\[\?([0-9;:]*)([hl])/g,(t,n,a)=>{const o=n.split(";").filter(Boolean).filter(c=>!CR.has(c.split(":")[0]??""));return o.length>0?`\x1B[?${o.join(";")}${a}`:""})}function vf(e,t={}){const n={};return(e?.force||t.force)&&(n.force=!0),(e?.scrollToBottom||t.scrollToBottom)&&(n.scrollToBottom=!0),n}function AR(e){const t=e.buffer.active,n=t.baseY+e.rows;return n<=e.rows?null:{current:Math.max(1,Math.min(n,t.viewportY+1)),total:n}}function er(e){return e.buffer.active.viewportY>=Math.max(0,e.buffer.active.baseY-1)}function Kc(e,t){return!t||er(e)}function ZS(e){return er(e)?!1:(e.scrollToLine(Math.max(0,e.buffer.active.baseY)),!0)}function NR(e,t,n,a,o,c){const d=p=>{const _=LR(p);_!==0&&(p.cancelable&&p.preventDefault(),p.stopPropagation(),BR(t,_,n,a,o,c))};return e.addEventListener("wheel",d,{capture:!0,passive:!1}),()=>{e.removeEventListener("wheel",d,{capture:!0})}}function BR(e,t,n,a,o,c){const d=()=>{o();try{e.scrollLines(t)}finally{c()}n(),t<0&&e.buffer.active.viewportY<=3&&a(t)};if(e.buffer.active.type==="alternate"){e.write(Dp,d);return}d()}function LR(e){const n=e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?e.deltaY/24:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*24:e.deltaY;if(n===0)return 0;const a=n<0?Math.floor(n):Math.ceil(n);return Math.max(-30,Math.min(30,a))}function OR(e,t,n,a,o,c,d){let p=null,_=0;const f={passive:!1};function S(x){p=yf(x),_=0}function y(x){const C=yf(x);if(C===null){p=null,_=0;return}if(p===null){p=C;return}const E=C.clientY-p.clientY;if(p=C,x.cancelable&&x.preventDefault(),E===0)return;if(zR(t)&&HR(t,C,-E)){_=0;return}_-=E/n();const N=_<0?Math.ceil(_):Math.floor(_);if(N!==0){_-=N,c();try{t.scrollLines(N)}finally{d()}a(),N<0&&t.buffer.active.viewportY<=3&&o(N)}}function w(x){if(x.touches.length>0){p=yf(x);return}p=null,_=0}return e.addEventListener("touchstart",S,f),e.addEventListener("touchmove",y,f),e.addEventListener("touchend",w),e.addEventListener("touchcancel",w),()=>{e.removeEventListener("touchstart",S,f),e.removeEventListener("touchmove",y,f),e.removeEventListener("touchend",w),e.removeEventListener("touchcancel",w)}}function yf(e){if(e.touches.length!==1)return null;const t=e.touches[0];return t?{clientX:t.clientX,clientY:t.clientY}:null}function zR(e){return e.buffer.active.type==="alternate"||e.modes.mouseTrackingMode!=="none"}function HR(e,t,n){const a=e.element;return a?(a.dispatchEvent(jR(t,n)),!0):!1}function jR(e,t){const n=typeof WheelEvent=="function"?WheelEvent.DOM_DELTA_PIXEL:0,a={bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:t,deltaMode:n};if(typeof WheelEvent=="function")return new WheelEvent("wheel",a);const o=new Event("wheel",a);return Object.defineProperties(o,{clientX:{value:e.clientX},clientY:{value:e.clientY},deltaX:{value:0},deltaY:{value:t},deltaMode:{value:0}}),o}function Rp({node:e,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c=!0,refreshCwdOnEnter:d=!1,tabId:p,dropZoneActive:_=!1,draggingTerminalId:f=null,mobileFocusLeafKey:S=null,path:y=[],totalPanes:w,onSelect:x,onClose:C,onResize:E,onExit:N,onSnapshot:D,onCloseEditor:ie,onAuthClose:R}){const H=w??Mp(e);if(y.length===0&&S){const oe=Ap(e),ce=oe.some(ue=>ue.key===S)?S:oe[0]?.key;if(oe.length>1&&ce)return m.jsx("div",{className:"mobile-focused-split",children:oe.map(ue=>{const Q=ue.key===ce;if(ue.type==="editor"){const K=n[ue.editorId];return m.jsx("div",{className:"mobile-focused-pane","data-active":Q,"aria-hidden":!Q,children:K?m.jsx(Wy,{api:a,editor:K,canClose:H>1,onClose:()=>ie(ue.editorId)}):m.jsx("div",{className:"missing-pane",children:"Editor unavailable"})},ue.key)}const G=t[ue.terminalId];return G?m.jsx("div",{className:"mobile-focused-pane","data-active":Q,"aria-hidden":!Q,children:m.jsx(VS,{terminal:G,serverApi:a,active:Q,visible:c&&Q,canClose:H>1,refreshCwdOnEnter:d&&Q,tabId:p,onSelect:()=>x(ue.terminalId),onClose:()=>C(ue.terminalId),onExit:K=>N(ue.terminalId,K),onSnapshot:D,...R?{onAuthClose:R}:{}})},ue.key):m.jsx("div",{className:"mobile-focused-pane","data-active":Q,"aria-hidden":!Q,children:m.jsx("div",{className:"missing-pane",children:"Terminal unavailable"})},ue.key)})})}if(e.type==="pane"){const oe=t[e.terminalId];if(!oe)return m.jsx("div",{className:"missing-pane",children:"Terminal unavailable"});const ce=m.jsx(VS,{terminal:oe,serverApi:a,active:e.terminalId===o,visible:c,canClose:H>1,refreshCwdOnEnter:d&&e.terminalId===o,tabId:p,onSelect:()=>x(e.terminalId),onClose:()=>C(e.terminalId),onExit:Q=>N(e.terminalId,Q),onSnapshot:D,...R?{onAuthClose:R}:{}});return _&&f!==e.terminalId?m.jsxs("div",{className:"pane-drop-host",children:[ce,m.jsx(Ic,{terminalId:e.terminalId,side:"top"}),m.jsx(Ic,{terminalId:e.terminalId,side:"right"}),m.jsx(Ic,{terminalId:e.terminalId,side:"bottom"}),m.jsx(Ic,{terminalId:e.terminalId,side:"left"})]}):ce}if(e.type==="editor"){const oe=n[e.editorId];return oe?m.jsx(Wy,{api:a,editor:oe,canClose:H>1,onClose:()=>ie(e.editorId)}):m.jsx("div",{className:"missing-pane",children:"Editor unavailable"})}const j=`${e.ratio*100}%`,W=`${(1-e.ratio)*100}%`,B=e.direction==="vertical"?{gridTemplateColumns:`${j} 1px ${W}`}:{gridTemplateRows:`${j} 1px ${W}`};return m.jsxs("div",{className:"split-pane","data-direction":e.direction,style:B,children:[m.jsx("div",{className:"split-cell",children:m.jsx(Rp,{node:e.first,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:d,tabId:p,dropZoneActive:_,draggingTerminalId:f,mobileFocusLeafKey:S,path:[...y,0],totalPanes:H,onSelect:x,onClose:C,onResize:E,onExit:N,onSnapshot:D,onCloseEditor:ie,...R?{onAuthClose:R}:{}})}),m.jsx(UR,{direction:e.direction,path:y,onResize:E}),m.jsx("div",{className:"split-cell",children:m.jsx(Rp,{node:e.second,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:d,tabId:p,dropZoneActive:_,draggingTerminalId:f,mobileFocusLeafKey:S,path:[...y,1],totalPanes:H,onSelect:x,onClose:C,onResize:E,onExit:N,onSnapshot:D,onCloseEditor:ie,...R?{onAuthClose:R}:{}})})]})}function Ic({terminalId:e,side:t}){const{setNodeRef:n,isOver:a}=jb({id:`pane-${e}-${t}`,data:{kind:"pane-zone",terminalId:e,side:t}});return m.jsx("div",{ref:n,className:`pane-drop-zone pane-drop-zone--${t}`,"data-over":a,"aria-hidden":"true"})}function UR({direction:e,path:t,onResize:n}){function a(o){o.preventDefault(),o.stopPropagation();const c=o.currentTarget;c.setPointerCapture?.(o.pointerId),c.classList.add("is-dragging"),document.body.style.cursor=e==="vertical"?"col-resize":"row-resize";const d=c.parentElement;if(!d)return;const p=d.getBoundingClientRect();function _(S){const y=e==="vertical"?(S.clientX-p.left)/p.width:(S.clientY-p.top)/p.height;n(t,Math.min(.9,Math.max(.1,y)))}function f(){window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",f),c.classList.remove("is-dragging"),document.body.style.cursor=""}window.addEventListener("pointermove",_),window.addEventListener("pointerup",f)}return 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 Mp(e){return e.type==="pane"||e.type==="editor"?1:Mp(e.first)+Mp(e.second)}function Ap(e){return e.type==="pane"?[{key:PR(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:KR(e.editorId),type:"editor",editorId:e.editorId}]:[...Ap(e.first),...Ap(e.second)]}function PR(e){return`terminal:${e}`}function KR(e){return`editor:${e}`}const k_="workspace-default",IR="NTerminal";function FR(){return{workspaces:[],activeWorkspaceId:null,terminals:{}}}function qR(e,t){switch(t.type){case"workspace.hydrated":return Np(t.terminals,t.savedTabs,t.savedWorkspaces,t.savedActiveWorkspaceId);case"workspace.created":return WR(e,{id:t.workspaceId,title:t.title});case"workspace.closed":return $R(e,t.workspaceId);case"workspace.selected":return dw(e,t.workspaceId);case"workspace.renamed":return YR(e,t.workspaceId,t.title);case"terminal.created":return fw(e,t.terminal);case"terminal.split":return VR(e,t.terminal,t.direction);case"terminal.updated":return aM(e,t.terminal);case"terminal.exited":return lM(e,t.terminalId,t.exitCode);case"terminal.closed":return _w(e,t.terminalId);case"terminal.detached":return oM(e,t.terminalId);case"editor.split":return XR(e,t.editorId,t.title,t.direction);case"editor.closed":return cM(e,t.editorId);case"pane.selected":return iM(e,t.terminalId);case"pane.resized":return sM(e,t.path,t.ratio);case"tab.selected":return ZR(e,t.tabId);case"tab.renamed":return tM(e,t.tabId,t.title);case"tab.reordered":return pw(e,t.sourceTabId,t.targetIndex);case"tab.dropped_into_pane":return QR(e,t.sourceTabId,t.sourceTerminalId,t.targetTerminalId,t.side);case"terminal.extracted_to_tab":return JR(e,t.sourceTabId,t.sourceTerminalId,t.targetIndex);case"activePane.closed":return GR(e);default:return e}}function WR(e,t){if(e.workspaces.some(a=>a.id===t.id))return dw(e,t.id);const n={id:t.id,title:t.title,tabs:[],activeTabId:null};return{...e,workspaces:[...e.workspaces,n],activeWorkspaceId:n.id}}function dw(e,t){return e.workspaces.some(n=>n.id===t)?{...e,activeWorkspaceId:t}:e}function YR(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(d=>d.id!==t||d.title===a?d:(o=!0,{...d,title:a}));return o?{...e,workspaces:c}:e}function $R(e,t){if(e.workspaces.length<=1||!e.workspaces.some(p=>p.id===t))return e;const n=e.workspaces.find(p=>p.id===t),a=new Set(n?rM(n):[]),o={...e.terminals};for(const p of a)delete o[p];const c=e.workspaces.filter(p=>p.id!==t),d=e.activeWorkspaceId===t?c[0]?.id??null:e.activeWorkspaceId;return{workspaces:c,activeWorkspaceId:d,terminals:o}}function fw(e,t){const n=gw(e),a=Ur(n)??Lu(),o=vw(t);return{...n,activeWorkspaceId:a.id,terminals:{...n.terminals,[t.id]:t},workspaces:n.workspaces.map(c=>c.id===a.id?{...c,tabs:[...c.tabs,o],activeTabId:o.id}:c)}}function VR(e,t,n){const a=Ur(e),o=a?Bu(a):void 0;if(!a||!o)return fw(e,t);const c=o.activeTerminalId,d=lo(o.root,c,{type:"split",direction:n,ratio:.5,first:{type:"pane",terminalId:c},second:{type:"pane",terminalId:t.id}});return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(p=>p.id===a.id?{...p,tabs:p.tabs.map(_=>_.id===o.id?{..._,root:d,activeTerminalId:t.id}:_)}:p)}}function XR(e,t,n,a){const o=Ur(e),c=o?Bu(o):void 0;if(!o||!c)return e;const d=c.activeTerminalId,p=lo(c.root,d,{type:"split",direction:a,ratio:.5,first:{type:"pane",terminalId:d},second:{type:"editor",editorId:t,title:n}});return{...e,workspaces:e.workspaces.map(_=>_.id===o.id?{..._,tabs:_.tabs.map(f=>f.id===c.id?{...f,root:p,activeTerminalId:d}:f)}:_)}}function GR(e){const t=Ur(e),n=t?Bu(t):void 0;return n?_w(e,n.activeTerminalId):e}function ZR(e,t){const n=Ur(e);return!n||!n.tabs.some(a=>a.id===t)?e:{...e,workspaces:e.workspaces.map(a=>a.id===n.id?{...a,activeTabId:t}:a)}}function pw(e,t,n){const a=e.workspaces.map(o=>{const c=o.tabs.findIndex(S=>S.id===t);if(c<0)return o;const d=o.tabs.slice(),[p]=d.splice(c,1);if(!p)return o;const _=Math.max(0,Math.min(d.length,n)),f=d.slice();return f.splice(_,0,p),eM(o.tabs,f)?o:{...o,tabs:f}});return a.every((o,c)=>o===e.workspaces[c])?e:{...e,workspaces:a}}function QR(e,t,n,a,o){if(n===a||!e.terminals[n]||!e.terminals[a])return e;let c=e.workspaces.map(_=>{const f=_.tabs.findIndex(C=>C.id===t);if(f<0)return _;const S=_.tabs[f];if(!S)return _;const y=oo(S.root,n);if(!y){const C=_.tabs.filter((E,N)=>N!==f);return{..._,tabs:C}}const w={...S,root:y,activeTerminalId:xs(y)[0]??S.activeTerminalId},x=_.tabs.slice();return x[f]=w,{..._,tabs:x}});const d=o==="left"||o==="right"?"vertical":"horizontal",p=o==="left"||o==="top";return c=c.map(_=>{const f=_.tabs.findIndex(E=>xs(E.root).includes(a));if(f<0)return _;const S=_.tabs[f];if(!S)return _;const y={type:"pane",terminalId:n},w={type:"split",direction:d,ratio:.5,first:p?y:{type:"pane",terminalId:a},second:p?{type:"pane",terminalId:a}:y},x=lo(S.root,a,w),C=_.tabs.slice();return C[f]={...S,root:x,activeTerminalId:n},{..._,tabs:C,activeTabId:S.id}}),gw({...e,workspaces:c})}function JR(e,t,n,a){let o=-1,c=-1;for(let N=0;N<e.workspaces.length;N+=1){const D=e.workspaces[N].tabs.findIndex(ie=>ie.id===t);if(D>=0){o=N,c=D;break}}if(o<0)return e;const d=e.workspaces[o],p=d.tabs[c],_=xs(p.root);if(!_.includes(n))return e;if(_.length===1)return pw(e,t,a);const f=oo(p.root,n);if(!f)return e;const S={...p,root:f,activeTerminalId:xs(f)[0]??p.activeTerminalId},y=e.terminals[n],w={id:`tab-${Date.now().toString(36)}-${n.slice(0,8)}`,title:y?.title??"",activeTerminalId:n,root:{type:"pane",terminalId:n}},x=d.tabs.slice();x[c]=S;const C=Math.max(0,Math.min(x.length,a));x.splice(C,0,w);const E=e.workspaces.slice();return E[o]={...d,tabs:x,activeTabId:w.id},{...e,workspaces:E}}function eM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.id!==t[n]?.id)return!1;return!0}function tM(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(d=>{let p=!1;const _=d.tabs.map(f=>f.id!==t||f.title===a?f:(o=!0,p=!0,{...f,title:a}));return p?{...d,tabs:_}:d});return o?{...e,workspaces:c}:e}function iM(e,t){const n=e.workspaces.find(o=>o.tabs.some(c=>co(c.root,t))),a=n?.tabs.find(o=>co(o.root,t));return!n||!a?e:{...e,activeWorkspaceId:n.id,workspaces:e.workspaces.map(o=>o.id===n.id?{...o,activeTabId:a.id,tabs:o.tabs.map(c=>c.id===a.id?{...c,activeTerminalId:t}:c)}:o)}}function sM(e,t,n){const a=Ur(e),o=a?Bu(a):void 0;if(!a||!o)return e;const c=Hp(o.root,t,yw(n));return c===o.root?e:{...e,workspaces:e.workspaces.map(d=>d.id===a.id?{...d,tabs:d.tabs.map(p=>p.id===o.id?{...p,root:c}:p)}:d)}}function Np(e,t,n,a){const o=Object.fromEntries(e.map(S=>[S.id,S])),c=new Set(e.map(S=>S.id)),d=new Set;let p=uM(t,n,c,d);p.length===0&&(p=[Lu()]);const _=typeof a=="string"&&p.some(S=>S.id===a)?a:p[0]?.id??null,f=_??p[0]?.id??k_;for(const S of e){if(d.has(S.id))continue;const y=vw(S);p=hM(p,f,y),d.add(S.id)}return{workspaces:p.map(bo),activeWorkspaceId:_,terminals:o}}function D_(e){return xs(e.root)}function nM(e){return jp(e.root)}function rM(e){return e.tabs.flatMap(t=>xs(t.root))}function Sf(e){const t=e.workspaces.map(n=>{const a=n.tabs.flatMap(o=>{const c=Op(o.root);return c?[{...o,root:c}]:[]});return bo({...n,tabs:a})});return{activeWorkspaceId:t.some(n=>n.id===e.activeWorkspaceId)?e.activeWorkspaceId:t[0]?.id??null,workspaces:t}}function aM(e,t){return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(n=>({...n,tabs:n.tabs.map(a=>co(a.root,t.id)?{...a,title:a.title||t.title}:a)}))}}function lM(e,t,n){const a=e.terminals[t];return a?{...e,terminals:{...e.terminals,[t]:{...a,status:"exited",exitCode:n}}}:e}function _w(e,t){const n={...e.terminals};return delete n[t],mw(e,t,n)}function oM(e,t){return e.terminals[t]?mw(e,t,{...e.terminals}):e}function mw(e,t,n){const a=e.workspaces.map(c=>{const d=[];for(const p of c.tabs){const _=oo(p.root,t);if(!_)continue;const f=xs(_),S=f.includes(p.activeTerminalId)?p.activeTerminalId:f[0];S&&d.push({...p,root:_,activeTerminalId:S})}return bo({...c,tabs:d})}),o=a.some(c=>c.id===e.activeWorkspaceId);return{workspaces:a,activeWorkspaceId:o?e.activeWorkspaceId:a[0]?.id??null,terminals:n}}function cM(e,t){const n=e.workspaces.map(o=>{const c=[];for(const d of o.tabs){const p=Bp(d.root,t);if(!p)continue;const _=xs(p),f=_.includes(d.activeTerminalId)?d.activeTerminalId:_[0];f&&c.push({...d,root:p,activeTerminalId:f})}return bo({...o,tabs:c})}),a=n.some(o=>o.id===e.activeWorkspaceId);return{...e,workspaces:n,activeWorkspaceId:a?e.activeWorkspaceId:n[0]?.id??null}}function uM(e,t,n,a){if(t&&t.length>0){const o=[];for(const c of t)dM(c)&&o.push(QS(c,n,a));if(o.length>0)return o}return[QS({...Lu(),tabs:e??[]},n,a)]}function QS(e,t,n){const a=[];for(const o of e.tabs){if(!fM(o))continue;const c=Lp(o.root,t);if(!c)continue;const d=xs(c);for(const _ of d)n.add(_);const p=d.includes(o.activeTerminalId)?o.activeTerminalId:d[0];p&&a.push({...o,root:c,activeTerminalId:p})}return bo({...e,tabs:a})}function gw(e){return Ur(e)?e:{...e,workspaces:[Lu()],activeWorkspaceId:k_}}function Ur(e){return e.workspaces.find(t=>t.id===e.activeWorkspaceId)??e.workspaces[0]}function Bu(e){return e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]}function Lu(){return{id:k_,title:IR,tabs:[],activeTabId:null}}function bo(e){const t=e.tabs.some(n=>n.id===e.activeTabId);return{...e,activeTabId:t?e.activeTabId:e.tabs[0]?.id??null}}function hM(e,t,n){return e.map(a=>a.id===t?{...a,tabs:[...a.tabs,n],activeTabId:a.activeTabId??n.id}:a)}function vw(e){return{id:`tab-${e.id}`,title:e.title||e.id,root:{type:"pane",terminalId:e.id},activeTerminalId:e.id}}function lo(e,t,n){return e.type==="pane"?e.terminalId===t?n:e:e.type==="editor"?e:{...e,first:lo(e.first,t,n),second:lo(e.second,t,n)}}function oo(e,t){if(e.type==="pane")return e.terminalId===t?null:e;if(e.type==="editor")return e;const n=oo(e.first,t),a=oo(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function Bp(e,t){if(e.type==="editor")return e.editorId===t?null:e;if(e.type==="pane")return e;const n=Bp(e.first,t),a=Bp(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function Lp(e,t){if(e.type==="pane")return t.has(e.terminalId)?e:null;if(e.type==="editor")return null;const n=Lp(e.first,t),a=Lp(e.second,t);return n&&a?{...e,ratio:yw(e.ratio),first:n,second:a}:n??a}function Op(e){if(e.type==="editor")return null;if(e.type==="pane")return e;const t=Op(e.first),n=Op(e.second);return t&&n?{...e,first:t,second:n}:t??n}function dM(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 fM(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&typeof t.activeTerminalId=="string"&&zp(t.root)}function zp(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")&&zp(t.first)&&zp(t.second):!1}function Hp(e,t,n){if(e.type==="pane"||e.type==="editor")return e;if(t.length===0)return e.ratio===n?e:{...e,ratio:n};const[a,...o]=t;if(a===0){const c=Hp(e.first,o,n);return c===e.first?e:{...e,first:c}}if(a===1){const c=Hp(e.second,o,n);return c===e.second?e:{...e,second:c}}return e}function yw(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}function co(e,t){return e.type==="pane"?e.terminalId===t:e.type==="editor"?!1:co(e.first,t)||co(e.second,t)}function xs(e){return e.type==="pane"?[e.terminalId]:e.type==="editor"?[]:[...xs(e.first),...xs(e.second)]}function jp(e){return e.type==="pane"||e.type==="editor"?1:jp(e.first)+jp(e.second)}const Na=new Map,mu=new Map,gu=new Map;function wo(e){return e??"__local__"}function pM(e){return{agentId:e,state:FR(),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=wo(e);let n=Na.get(t);return n||(n=pM(e),Na.set(t,n)),n}function Sw(e,t){const n=wo(e);let a=mu.get(n);return a||(a=new Set,mu.set(n,a)),a.add(t),()=>{a.delete(t)}}function _M(e){const t=wo(e),n=mu.get(t);if(n)for(const a of Array.from(n))a()}function Ha(e,t){Na.set(wo(e),t),_M(e)}const Up=new Set;function mM(e){return Up.add(e),()=>{Up.delete(e)}}function zl(e,t){const n=Qt(e),a=wo(e);t.type==="workspace.hydrated"&&gu.delete(a);const o=qR(n.state,t);let c=n.unreadCompletions,d=null;if(t.type==="terminal.updated"){const f=n.state.terminals[t.terminal.id],S=f?.activity==="busy",y=t.terminal.activity==="busy",w=t.terminal.activity==="idle",x=wM(a);if(t.notifyCompletion===!0&&y&&x.add(t.terminal.id),t.notifyCompletion===!0&&S&&w&&x.has(t.terminal.id)){const C=gM(o,t.terminal.id);C&&(d={terminalId:t.terminal.id,tabId:C.tab.id,commandName:f?.currentCommand??null},C.workspace.activeTabId!==C.tab.id&&(c.has(C.tab.id)||(c=new Set(c),c.add(C.tab.id))))}(w||t.terminal.status==="exited")&&x.delete(t.terminal.id)}t.type==="tab.selected"&&c.has(t.tabId)&&(c=new Set(c),c.delete(t.tabId));const p=o!==n.state,_=c!==n.unreadCompletions;if((p||_)&&Ha(e,{...n,state:o,unreadCompletions:c}),_&&bw(),d)for(const f of Array.from(Up))f({agentId:e,...d})}function gM(e,t){for(const n of e.workspaces)for(const a of n.tabs)if(xs(a.root).includes(t))return{workspace:n,tab:a};return null}const Pp=new Set;function vM(e){return Pp.add(e),()=>{Pp.delete(e)}}function yM(){let e=0;for(const t of Na.values())e+=t.unreadCompletions.size;return e}function bw(){for(const e of Array.from(Pp))e()}function SM(e,t){const n=Qt(e);if(!n.unreadCompletions.has(t))return;const a=new Set(n.unreadCompletions);a.delete(t),Ha(e,{...n,unreadCompletions:a}),bw()}function JS(e,t){const n=Qt(e);t!==n.state&&Ha(e,{...n,state:t})}function eb(e,t){const n=Qt(e),a=t(n.editors);a!==n.editors&&Ha(e,{...n,editors:a})}function Ca(e,t,n){const a=Qt(e);a.loaded===t&&a.error===n||Ha(e,{...a,loaded:t,error:n})}function Fc(e,t,n){const a=Qt(e);a.layoutRevision===t&&a.lastPersistedLayoutJson===n||Ha(e,{...a,layoutRevision:t,lastPersistedLayoutJson:n})}function bM(e){const t=Qt(e);return t.mutable.editorIdCounter+=1,t.mutable.editorIdCounter}function tb(){for(const e of Na.values()){const t=e.mutable.saveCoord.saveTimer;t!==null&&window.clearTimeout(t),e.unreadCompletions.size>0}Na.clear(),mu.clear(),gu.clear()}function wM(e){let t=gu.get(e);return t||(t=new Set,gu.set(e,t)),t}function CM(e,t){let n=!1,a=!1,o=null,c=!1;for(const d of D_(e)){const p=t[d];if(p){if(p.status==="exited"){c=!0,n=!0;continue}p.activity==="busy"?(a=!0,n=!0,!o&&p.currentCommand&&(o=p.currentCommand)):p.activity==="idle"&&(n=!0)}}return n?c?{state:"exited",commandName:null}:a?{state:"busy",commandName:o}:{state:"idle",commandName:null}:null}function xM(e){return e?e.state==="busy"?e.commandName?`running: ${e.commandName}`:"running":e.state==="exited"?"exited":"idle":""}function EM({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,onSelectTab:c,onCreateTab:d,onToggleWorkspaces:p,onCloseTerminals:_,onReattachTerminal:f,onDeleteTerminal:S,onSplitVertical:y,onSplitHorizontal:w,onRenameTab:x,activePaneAvailable:C}){const[E,N]=v.useState(null),[D,ie]=v.useState(null),R=v.useRef(null);v.useEffect(()=>{R.current?.focus(),R.current?.select()},[E?.tabId]);function H(B,oe){N({tabId:B,title:oe})}function j(){if(!E)return;const B=E.title.trim();B&&x(E.tabId,B),N(null)}function W(){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 - ${FE()}`,onClick:y,disabled:!C,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 - ${qE()}`,onClick:w,disabled:!C,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:p,children:m.jsxs("span",{className:"hamburger-lines","aria-hidden":"true",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]})}),m.jsxs("div",{className:"terminal-tab-list",children:[e.map((B,oe)=>{const ce=D_(B),ue=nM(B),Q=n[B.activeTerminalId],G=B.title||Q?.title||B.activeTerminalId,K=B.id===t,J=E?.tabId===B.id,se=CM(B,n),M=a?.has(B.id)??!1;return m.jsxs(ki.Fragment,{children:[m.jsx(ib,{index:oe}),m.jsx(TM,{tab:B,active:K,editing:J,title:G,paneCount:ue,terminalIds:ce,canClose:e.length>1,editValue:J?E.title:null,editInputRef:J?R:null,activity:se,unread:M,onSelect:()=>c(B.id),onBeginRename:()=>H(B.id,G),onCloseAll:()=>_(ce),onCommitRename:j,onCancelRename:()=>N(null),onRenameChange:Y=>N({tabId:B.id,title:Y})})]},B.id)}),m.jsx(ib,{index:e.length}),m.jsx("button",{type:"button",className:"tab-add-button","aria-label":"New tab",title:"New tab",onClick:d,children:"+"}),(o?.length??0)>0?m.jsx("div",{className:"terminal-detached-pills","aria-label":"Detached terminals",children:(o??[]).map(B=>m.jsx(kM,{terminal:B,onReattach:()=>f?.(B.id),onDelete:()=>ie(B)},B.id))}):null]}),C?W():null]}),D?m.jsx(DM,{terminal:D,onCancel:()=>ie(null),onConfirm:()=>{S?.(D.id),ie(null)}}):null]})}function TM({tab:e,active:t,editing:n,title:a,paneCount:o,canClose:c,editValue:d,editInputRef:p,activity:_,unread:f,onSelect:S,onBeginRename:y,onCloseAll:w,onCommitRename:x,onCancelRename:C,onRenameChange:E}){const{attributes:N,listeners:D,setNodeRef:ie,transform:R,isDragging:H}=Hb({id:`tab-${e.id}`,data:{kind:"tab",tabId:e.id,terminalId:e.activeTerminalId},disabled:n}),j={transform:Cf.Translate.toString(R),opacity:H?.4:void 0,zIndex:H?2:void 0};return m.jsxs("div",{ref:ie,className:"terminal-tab","data-active":t,"data-dragging":H,"data-unread":f?"true":void 0,style:j,...N,...D,children:[_?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":_.state,"aria-hidden":"true",title:xM(_)}):null,n&&p&&d!==null?m.jsxs("form",{className:"terminal-tab-editor",onSubmit:W=>{W.preventDefault(),x()},children:[m.jsx("input",{ref:p,"aria-label":`Rename ${a}`,value:d,onBlur:x,onChange:W=>E(W.target.value),onKeyDown:W=>{if(W.key==="Enter"){W.preventDefault(),x();return}W.key==="Escape"&&(W.preventDefault(),C())}}),m.jsx("small",{children:o})]}):m.jsxs("button",{type:"button",className:"terminal-tab-select","aria-label":`Select ${a}`,title:a,onClick:S,onDoubleClick:W=>{W.preventDefault(),y()},children:[m.jsx("span",{children:a}),m.jsxs("small",{children:[o," pane",o===1?"":"s"]})]}),c&&!n?m.jsx("button",{type:"button",className:"icon-button","aria-label":`Close ${a}`,title:`Close ${a}`,onPointerDown:W=>W.stopPropagation(),onClick:W=>{W.stopPropagation(),w()},children:"x"}):null]})}function ib({index:e}){const{setNodeRef:t,isOver:n}=jb({id:`tab-position-${e}`,data:{kind:"tab-position",index:e}});return m.jsx("div",{ref:t,className:"terminal-tab-drop-slot","data-over":n,"aria-hidden":"true"})}function kM({terminal:e,onReattach:t,onDelete:n}){const a=e.title||e.cwd||e.id.slice(0,8),o=`${e.title||"Terminal"}
37
- ${e.cwd}
38
- (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(),n()},children:"×"})]})}function DM({terminal:e,onCancel:t,onConfirm:n}){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:n,children:"Delete"})]})]})})}function RM({toast:e,onDismiss:t}){if(!e)return null;const n=e.status==="failed"||e.status==="partial"?"alert":"status",a="response"in e?e.response:void 0;return m.jsxs("aside",{className:`upload-toast upload-toast-${e.status}`,role:n,"aria-live":n==="alert"?"assertive":"polite",children:[m.jsxs("header",{className:"upload-toast-header",children:[m.jsx("strong",{children:BM(e)}),m.jsx("button",{type:"button","aria-label":"Dismiss upload status",onClick:t,children:"x"})]}),m.jsxs("div",{className:"upload-toast-body",children:[e.status==="queued"?m.jsx("p",{children:e.message??"Preparing upload..."}):null,e.status==="uploading"?m.jsx(MM,{toast:e}):null,a&&"message"in e&&e.message?m.jsx("p",{className:"upload-toast-muted",children:e.message}):null,a?m.jsx(AM,{response:a}):null,e.status==="failed"&&!a&&e.message?m.jsx("p",{children:e.message}):null]})]})}function MM({toast:e}){const t=e.percent===null?LM(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 AM({response:e}){const t=e.results.filter(o=>o.status==="failed"),n=e.results.filter(o=>o.status==="uploaded"),a=[...t,...n].slice(0,5);return m.jsxs(m.Fragment,{children:[m.jsx("p",{className:"upload-toast-destination",children:e.destinationCwd}),a.length>0?m.jsx("ul",{className:"upload-result-list",children:a.map((o,c)=>m.jsx(NM,{result:o},`${o.relativePath}-${c}`))}):null,e.results.length>a.length?m.jsxs("p",{className:"upload-toast-muted",children:["+",e.results.length-a.length," more"]}):null]})}function NM({result:e}){const t=e.savedRelativePath??e.relativePath;return m.jsxs("li",{"data-status":e.status,children:[m.jsx("span",{className:"upload-result-path",children:t}),e.status==="failed"&&e.error?m.jsx("span",{className:"upload-result-error",children:e.error}):null]})}function BM(e){if(e.status==="queued")return"Preparing upload";if(e.status==="uploading")return`Uploading ${e.fileCount} file${e.fileCount===1?"":"s"}`;if(e.status==="success"){const t=e.response?.uploaded??e.fileCount;return`Uploaded ${t} file${t===1?"":"s"}`}if(e.status==="partial"){const t=e.response?.uploaded??0,n=(e.response?.uploaded??0)+(e.response?.failed??0)||e.fileCount;return`Uploaded ${t} of ${n} files`}return"Upload failed"}function LM(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`}function OM({toast:e,onActivate:t,onDismiss:n}){if(!e)return null;const a=e,o=a.commandName?`${a.commandName} finished`:"Command finished";function c(p){p.stopPropagation(),n()}function d(p){p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),t(a))}return m.jsxs("aside",{className:"completion-toast",role:"status","aria-live":"polite",tabIndex:0,onClick:()=>t(a),onKeyDown:d,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 zM=Wl(0,0,1,1),_n=1e-6;function HM(e){return ww(e).map(t=>t.terminalId)}function ww(e){return ql(e,zM).sort(KM).map((t,n)=>({...t,index:n+1}))}function jM(e,t,n){const a=ww(e),o=a.find(d=>d.terminalId===t);return o?a.filter(d=>d.terminalId!==t).map(d=>PM(o,d,n)).filter(d=>d!==null).sort(IM)[0]?.entry.terminalId??null:null}function UM(e,t){return!Number.isInteger(t)||t<1?null:HM(e)[t-1]??null}function ql(e,t){if(e.type==="pane")return[{terminalId:e.terminalId,bounds:t}];if(e.type==="editor")return[];const n=FM(e.ratio);if(e.direction==="vertical"){const o=t.left+(t.right-t.left)*n;return[...ql(e.first,Wl(t.left,t.top,o,t.bottom)),...ql(e.second,Wl(o,t.top,t.right,t.bottom))]}const a=t.top+(t.bottom-t.top)*n;return[...ql(e.first,Wl(t.left,t.top,t.right,a)),...ql(e.second,Wl(t.left,a,t.right,t.bottom))]}function PM(e,t,n){const a=e.bounds,o=t.bounds,c=sb(a.left,a.right,o.left,o.right),d=sb(a.top,a.bottom,o.top,o.bottom);switch(n){case"left":return o.centerX>=a.centerX-_n||d<=_n?null:{entry:t,primaryDistance:Math.max(0,a.left-o.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:d};case"right":return o.centerX<=a.centerX+_n||d<=_n?null:{entry:t,primaryDistance:Math.max(0,o.left-a.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:d};case"up":return o.centerY>=a.centerY-_n||c<=_n?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+_n||c<=_n?null:{entry:t,primaryDistance:Math.max(0,o.top-a.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};default:return null}}function KM(e,t){return ka(e.bounds.top,t.bounds.top)||ka(e.bounds.left,t.bounds.left)}function IM(e,t){return ka(e.primaryDistance,t.primaryDistance)||ka(e.perpendicularDistance,t.perpendicularDistance)||ka(t.overlap,e.overlap)||ka(e.entry.index,t.entry.index)}function ka(e,t){const n=e-t;return Math.abs(n)<=_n?0:n}function sb(e,t,n,a){return Math.max(0,Math.min(t,a)-Math.max(e,n))}function Wl(e,t,n,a){return{left:e,top:t,right:n,bottom:a,centerX:e+(n-e)/2,centerY:t+(a-t)/2}}function FM(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}class qM extends Error{constructor(t){super(t),this.name="UploadDropError"}}function nb(e){return e?Array.from(e.types??[]).includes("Files")||Tw(e.items).some(n=>n.kind==="file")?!0:kw(e.files).length>0:!1}async function WM(e){const t=Tw(e.items).filter(n=>n.kind==="file");return t.length>0?YM(t):$M(e.files)}async function YM(e){const t=[];for(const n of e){const a=ZM(n);if(a){await Cw(a,"",t);continue}const o=n.getAsFile();if(o){t.push({relativePath:xw(o),file:o});continue}throw new qM("Folder upload is not supported by this browser.")}return t}function $M(e){return kw(e).map(t=>({relativePath:xw(t),file:t}))}async function Cw(e,t,n){const a=JM(t,e.name);if(e.isFile){const d=await VM(e);n.push({relativePath:a,file:d});return}if(!e.isDirectory)return;const o=e.createReader(),c=await XM(o);for(const d of c)await Cw(d,a,n)}function VM(e){return new Promise((t,n)=>{e.file(t,a=>n(a))})}async function XM(e){const t=[];for(;;){const n=await GM(e);if(n.length===0)return t;t.push(...n)}}function GM(e){return new Promise((t,n)=>{e.readEntries(t,a=>n(a))})}function xw(e){const t=e.webkitRelativePath;return Ew(typeof t=="string"&&t?t:e.name)}function ZM(e){const t=e.webkitGetAsEntry?.();return QM(t)?t:null}function QM(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 JM(e,t){return Ew(e?`${e}/${t}`:t)}function Ew(e){return e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).join("/")}function Tw(e){return e?Array.from(e):[]}function kw(e){return e?Array.from(e):[]}const rb="nterminal.terminalLayout.v1",ab="nterminal.terminalWorkspaces.v2",Dw="nterminal.sidebarCollapsed.v1",eA=75,lb=Kb.map(e=>e.url),tA=Kb[0].url;function iA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a,sessionExpiresAt:o=null,onLogout:c=async()=>{},onSessionInvalid:d}){const p=v.useMemo(()=>e??bu(),[e]),_=v.useMemo(()=>t??wu(null),[t]),f=v.useMemo(()=>_A(n),[n]),S=v.useMemo(()=>L=>Sw(n,L),[n]),y=v.useMemo(()=>()=>Qt(n),[n]),w=v.useSyncExternalStore(S,y,y),x=w.state,C=w.editors,E=!w.loaded,N=w.error,[D,ie]=v.useState(!1),[R,H]=v.useState(()=>SA()),[j,W]=v.useState("servers"),[B,oe]=v.useState(!1),ce=v.useSyncExternalStore(e2,Ky,Ky);v.useSyncExternalStore(Qb,Py,Py);const[ue,Q]=v.useState(()=>[null]),[G,K]=v.useState(()=>[n]),[J,se]=v.useState(()=>new Set),[M,Y]=v.useState({}),[X,pe]=v.useState(null),ye=v.useRef(null);v.useRef(!1);const k=v.useRef(0),[I,ne]=v.useState(null),he=cx(wy(Nb,{activationConstraint:{distance:8}}),wy(Bb,{activationConstraint:{delay:250,tolerance:5}}));v.useEffect(()=>t2(p),[p]);function _e(L){const q=L.active.data.current;if(q){if(q.kind==="tab"&&typeof q.tabId=="string"&&typeof q.terminalId=="string"){ne({tabId:q.tabId,terminalId:q.terminalId});return}q.kind==="pane"&&typeof q.sourceTabId=="string"&&typeof q.terminalId=="string"&&ne({tabId:q.sourceTabId,terminalId:q.terminalId})}}function me(L){ne(null);const q=L.active.data.current,le=L.over?.data.current;if(!(!q||!le||typeof q.terminalId!="string")){if(q.kind==="tab"&&typeof q.tabId=="string"){if(le.kind==="tab-position"&&typeof le.index=="number"){Xe({type:"tab.reordered",sourceTabId:q.tabId,targetIndex:le.index});return}le.kind==="pane-zone"&&typeof le.terminalId=="string"&&(le.side==="top"||le.side==="right"||le.side==="bottom"||le.side==="left")&&Xe({type:"tab.dropped_into_pane",sourceTabId:q.tabId,sourceTerminalId:q.terminalId,targetTerminalId:le.terminalId,side:le.side});return}if(q.kind==="pane"&&typeof q.sourceTabId=="string"){if(le.kind==="tab-position"&&typeof le.index=="number"){Xe({type:"terminal.extracted_to_tab",sourceTabId:q.sourceTabId,sourceTerminalId:q.terminalId,targetIndex:le.index});return}le.kind==="pane-zone"&&typeof le.terminalId=="string"&&(le.side==="top"||le.side==="right"||le.side==="bottom"||le.side==="left")&&Xe({type:"tab.dropped_into_pane",sourceTabId:q.sourceTabId,sourceTerminalId:q.terminalId,targetTerminalId:le.terminalId,side:le.side})}}}function Ee(){ne(null)}const De=x.workspaces.find(L=>L.id===x.activeWorkspaceId)??x.workspaces[0],Ce=De?.tabs.find(L=>L.id===De.activeTabId)??De?.tabs[0],Me=Ce?.activeTerminalId??null,et=Me?x.terminals[Me]:void 0,tt=dA("(max-width: 760px)"),Ne=v.useMemo(()=>Ce?vu(Ce.root):[],[Ce]),ee=De&&Ce?Qc(n,De.id,Ce.id):null,Te=Ce?Rw(Ne,Ce.activeTerminalId,ee?M[ee]:void 0):null,xe=tt&&Ne.length>1,ze=v.useMemo(()=>{const L=new Set;for(const q of x.workspaces)for(const le of q.tabs)for(const ve of D_(le))L.add(ve);return Object.values(x.terminals).filter(q=>!L.has(q.id))},[x.terminals,x.workspaces]),[qe,vt]=v.useState(null),[ct,V]=v.useState(null),[He,it]=v.useState([]),[rt,Es]=v.useState(()=>Lr()),ls=v.useRef(0),ci=v.useRef(n),ui=v.useRef(lb),Bi=v.useRef(rt),Si=v.useRef(()=>{});Si.current=ii;const ei=v.useCallback(async()=>{try{const L=await p.listNotificationAssets();it(L.assets.filter(q=>q.enabled).map(q=>q.url))}catch{it([])}},[p]);v.useEffect(()=>{K(L=>L.some(q=>Gn(q,n))?L:[...L,n])},[n]),v.useEffect(()=>{let L=!1;return p.listAgents().then(q=>{if(!L){const le=[null,...q.agents.map(ve=>ve.id)];le.some(ve=>Gn(ve,n))||le.push(n),Q(le)}}).catch(()=>{}),()=>{L=!0}},[n,p]),v.useEffect(()=>{Q(L=>L.some(q=>Gn(q,n))?L:[...L,n])},[n]),v.useEffect(()=>{ci.current=n},[n]),v.useEffect(()=>{ei()},[ei]),v.useEffect(()=>qb(()=>Es(Lr())),[]),v.useEffect(()=>{const L=q=>{Si.current(q)};return window.addEventListener("keydown",L,!0),()=>window.removeEventListener("keydown",L,!0)},[]),v.useEffect(()=>{ui.current=He.length>0?He:lb},[He]),v.useEffect(()=>{Bi.current=rt},[rt]),v.useEffect(()=>{if(!w.loaded||!De||!Ce)return;const L=Qc(n,De.id,Ce.id);se(q=>{if(q.has(L))return q;const le=new Set(q);return le.add(L),le})},[n,w.loaded,De?.id,Ce?.id]),v.useEffect(()=>()=>{yt()},[]),v.useEffect(()=>mM(L=>{const q=Qt(L.agentId).state,le=q.workspaces.flatMap(Le=>Le.tabs).find(Le=>Le.id===L.tabId),ve=q.terminals[L.terminalId],Re=le?.title?.trim()||ve?.title||L.commandName||"terminal",Ge=document.visibilityState==="visible"&&Gn(L.agentId,ci.current)&&L.tabId===pA(q);if(Ge||BE({tabTitle:Re,commandName:L.commandName,terminalId:L.terminalId}),!Ge&&document.visibilityState==="visible"&&Bi.current.enabled){const Le=ls.current+1;ls.current=Le;const lt=ui.current;V({id:Le,agentId:L.agentId,terminalId:L.terminalId,tabId:L.tabId,tabTitle:Re,commandName:L.commandName,assetSrc:lt[Math.floor(Math.random()*lt.length)]??tA})}}),[]),v.useEffect(()=>{if(!ct||rt.persistUntilDismissed)return;const L=window.setTimeout(()=>{V(q=>q?.id===ct.id?null:q)},rt.durationSeconds*1e3);return()=>window.clearTimeout(L)},[ct,rt]),v.useEffect(()=>{ye.current?.focus(),ye.current?.select()},[X?.workspaceId]),v.useEffect(()=>{bA(R),R&&pe(null)},[R]),v.useEffect(()=>{let L=!1;async function q(){if(!Qt(n).loaded){Ca(n,!1,null);try{const ve=mA(f),[Re,Ge]=await Promise.all([_.listTerminals(),_.getTerminalLayout()]),Le=Re.terminals.length>0?Re.terminals:[(await _.createTerminal({cols:80,rows:24})).terminal];if(!L){const lt=Ge.layout?Nw(Ge.layout):null,zt=lt??ve??{},Ls=Np(Le,zt.savedTabs,zt.savedWorkspaces,zt.savedActiveWorkspaceId),Gi=Sf(Ls);JS(n,Ls),Fc(n,Ge.revision,JSON.stringify(Gi)),Ca(n,!0,null),!lt&&ve&&Ot(Gi,{baseRevision:Ge.revision})}}catch(ve){!L&&!Dt(ve)&&Ca(n,!0,qc(ve))}}}return q(),()=>{L=!0}},[n,_]);async function Ws(){await ft(async()=>{const L=await _.createTerminal({cols:80,rows:24});Xe({type:"terminal.created",terminal:L.terminal})})}async function Li(L){await ft(async()=>{const q=Me?{parentTerminalId:Me,cols:80,rows:24}:{cols:80,rows:24},le=await _.createTerminal(q);Xe({type:"terminal.split",terminal:le.terminal,direction:L})})}async function ti(L){if(!Me)throw new Error("No active pane is available.");const q=await _.readFile(L),le=`editor-${Date.now().toString(36)}-${bM(n)}`,ve=yA(q.path);eb(n,Re=>({...Re,[le]:{id:le,title:ve,rootToken:L.rootToken,path:q.path,read:q}})),ee&&Y(Re=>({...Re,[ee]:Mw(le)})),Xe({type:"editor.split",editorId:le,title:ve,direction:"vertical"})}function bi(L){eb(n,q=>{const le={...q};return delete le[L],le}),Xe({type:"editor.closed",editorId:L})}function Yt(L){Ys([L])}function Ys(L){for(const q of L)Xe({type:"terminal.detached",terminalId:q})}async function $s(L){await ft(async()=>{await ks(L),ow(_.createWebSocketUrl(L)),XD(L),Xe({type:"terminal.closed",terminalId:L})})}async function or(L,q){const le=q.trim();if(!le)return;let ve=null;for(const Re of x.workspaces){const Ge=Re.tabs.find(Le=>Le.id===L);if(Ge){ve=Ge.activeTerminalId;break}}if(Xe({type:"tab.renamed",tabId:L,title:le}),!!ve)try{const Re=await _.renameTerminal(ve,le);Kt({type:"terminal.updated",terminal:Re.terminal})}catch(Re){Ca(n,!0,qc(Re))}}function Ts(L){const q=x.terminals[L];q&&Xe({type:"terminal.created",terminal:q})}async function ks(L){try{await _.closeTerminal(L)}catch(q){if(q instanceof gn&&q.status===404)return;throw q}}async function dt(){await ft(async()=>{await c()})}async function ft(L){Ca(n,!0,null);try{await L()}catch(q){if(Dt(q))return;Ca(n,!0,qc(q))}}function Dt(L){return L instanceof gn&&L.status===401&&!_.isAgent&&d?(d(),!0):!1}function Xe(L){zl(n,L);const q=Qt(n),le=q.state;if(!q.loaded||le.workspaces.length===0)return;const ve=Sf(le);JSON.stringify(ve)!==q.lastPersistedLayoutJson&&wi(ve)}function Kt(L){zl(n,L)}function Nt(L,q,le,ve){const Re=Qc(L,q,le);Y(Ge=>({...Ge,[Re]:ve}))}function at(L){ee&&Y(q=>({...q,[ee]:L}))}function hi(L,q){const le=yu(L);q?Nt(n,q.workspaceId,q.tabId,le):at(le),Xe({type:"pane.selected",terminalId:L})}function Rt(L){at(L.key),L.type==="terminal"&&Xe({type:"pane.selected",terminalId:L.terminalId})}function ii(L){if(B||L.isComposing||L.key==="Process"||oA(L.target))return;const q=nA(L);if(!q)return;if(L.preventDefault(),L.stopPropagation(),q.type==="server.previous"||q.type==="server.next"){wt(q.type==="server.next"?1:-1);return}const le=Qt(n).state,ve=le.workspaces.find(Le=>Le.id===le.activeWorkspaceId)??le.workspaces[0],Re=ve?.tabs.find(Le=>Le.id===ve.activeTabId)??ve?.tabs[0];if(q.type==="split"){if(!Re)return;Li(q.direction);return}if(!ve||!Re)return;if(q.type==="tab.previous"||q.type==="tab.next"){const Le=lA(ve.tabs,Re.id,q.type==="tab.next"?1:-1);Le&&Xe({type:"tab.selected",tabId:Le.id});return}if(q.type==="tab.index"){const Le=ve.tabs[q.index-1];Le&&Xe({type:"tab.selected",tabId:Le.id});return}const Ge=rA(Re.root,Re.activeTerminalId,q);Ge&&hi(Ge,{workspaceId:ve.id,tabId:Re.id})}function wt(L){if(!a||ue.length===0)return;const q=ue.findIndex(Ge=>Gn(Ge,n)),ve=((q===-1?0:q)+L+ue.length)%ue.length,Re=ue[ve]??null;Gn(Re,n)||a(Re)}function Ri(L){nb(L.dataTransfer)&&(L.preventDefault(),L.dataTransfer.dropEffect="copy")}function Ui(L){if(!nb(L.dataTransfer))return;L.preventDefault();const q=gA(Qt(n).state),le=k.current+1;if(k.current=le,!q){vt({id:le,status:"failed",fileCount:0,message:"No active running terminal is available for upload."});return}vt({id:le,status:"queued",fileCount:0,message:"Preparing upload..."}),Pi(le,q.id,L.dataTransfer)}async function Pi(L,q,le){try{const ve=await WM(le);if(ve.length===0)throw new Error("No files were found in the drop.");si(L,{id:L,status:"uploading",fileCount:ve.length,loaded:0,total:null,percent:null});const Re=await h2({terminalId:q,files:ve,onProgress:zt=>{si(L,{id:L,status:"uploading",fileCount:ve.length,loaded:zt.loaded,total:zt.total,percent:zt.percent})}}),Ge=Re.failed>0?Re.uploaded>0?"partial":"failed":"success",Le=Re.failed>0?vA(Re):void 0,lt={id:L,status:Ge,fileCount:ve.length,response:Re};Le&&(lt.message=Le),si(L,lt)}catch(ve){si(L,{id:L,status:"failed",fileCount:0,message:qc(ve)})}}function si(L,q){vt(le=>le?.id===L?q:le)}function os(L){const le=Qt(L.agentId).state.workspaces.find(ve=>ve.tabs.some(Re=>Re.id===L.tabId));le&&Nt(L.agentId,le.id,L.tabId,yu(L.terminalId)),zl(L.agentId,{type:"pane.selected",terminalId:L.terminalId}),SM(L.agentId,L.tabId),Gn(L.agentId,n)||a?.(L.agentId),V(null)}function wi(L){const q=Qt(n).mutable.saveCoord;q.pendingLayoutSave=L,Hl(L,f),q.saveTimer!==null&&window.clearTimeout(q.saveTimer),q.saveTimer=window.setTimeout(()=>{q.saveTimer=null;const le=q.pendingLayoutSave;q.pendingLayoutSave=null,le&&Ot(le)},eA)}function yt(){const L=Qt(n).mutable.saveCoord;L.saveTimer!==null&&(window.clearTimeout(L.saveTimer),L.saveTimer=null);const q=L.pendingLayoutSave;L.pendingLayoutSave=null,q&&(Hl(q,f),Ot(q))}function Ot(L,q={}){const le=Qt(n).mutable.saveCoord;le.nextPersistLayout=L,q.baseRevision!==void 0&&(le.queuedBaseRevision=q.baseRevision),!le.nextPersistQueued&&(le.nextPersistQueued=!0,le.persistChain=le.persistChain.then(async()=>{le.nextPersistQueued=!1;const ve=le.nextPersistLayout,Re=le.queuedBaseRevision;le.nextPersistLayout=null,le.queuedBaseRevision=void 0,ve&&await cs(ve,Re!==void 0?{baseRevision:Re}:{})}))}async function cs(L,q={}){const le=Qt(n),ve=q.baseRevision??le.layoutRevision,Re={layout:L,...typeof ve=="number"?{baseRevision:ve}:{}};try{const Ge=await _.saveTerminalLayout(Re),Le=Ge.layout??L;Fc(n,Ge.revision,JSON.stringify(Le)),Hl(Le,f);return}catch(Ge){if(Ge instanceof gn&&Ge.status===409)try{const Le=await _.getTerminalLayout();if(Le.layout){const lt=Qt(n).state,zt=Np(Object.values(lt.terminals),void 0,Le.layout.workspaces,Le.layout.activeWorkspaceId),Ls=Sf(zt);JS(n,zt),Fc(n,Le.revision,JSON.stringify(Ls)),Hl(Ls,f)}else Fc(n,Le.revision,le.lastPersistedLayoutJson);return}catch{}Hl(L,f)}}const Vs=wA(o),Ds=!R||D,bn=Ds?j:"servers";return m.jsx(cE,{sensors:he,onDragStart:_e,onDragEnd:me,onDragCancel:Ee,children:m.jsxs("main",{className:"terminal-shell","data-collapsed":R,"data-sidebar-open":D,onDragOver:Ri,onDrop:Ui,children:[m.jsx("button",{type:"button",className:"workspace-backdrop","aria-label":"Close workspaces",onClick:()=>ie(!1)}),m.jsxs("aside",{className:"workspace-sidebar",children:[m.jsxs("header",{className:"workspace-brand",children:[Ds?m.jsx(gb,{height:20}):m.jsx(mb,{size:24}),m.jsx("button",{type:"button",className:"sidebar-collapse-button","aria-label":R?"Expand sidebar":"Collapse sidebar",title:R?"Expand sidebar":"Collapse sidebar",onClick:()=>H(L=>!L),children:R?">":"<"}),m.jsx("button",{type:"button",className:"sidebar-drawer-close-button","aria-label":"Close workspaces",title:"Close workspaces",onClick:()=>ie(!1),children:"x"})]}),m.jsxs("div",{className:"workspace-sidebar-content",children:[Ds?m.jsxs("div",{className:"workspace-sidebar-tabs",role:"tablist","aria-label":"Sidebar mode",children:[m.jsx("button",{type:"button",role:"tab","aria-selected":j==="servers",onClick:()=>{W("servers"),pe(null)},children:"Servers"}),m.jsx("button",{type:"button",role:"tab","aria-selected":j==="files",onClick:()=>{W("files"),pe(null)},children:"Files"})]}):null,bn==="servers"&&Ds?m.jsx("nav",{className:"workspace-nav","aria-label":"Servers",children:m.jsx(Qd,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d})}):null,Ds?null:m.jsx("nav",{className:"workspace-nav workspace-nav--collapsed","aria-label":"Servers",children:m.jsx(Qd,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d,compact:!0})}),bn==="files"?m.jsxs(m.Fragment,{children:[Ds?m.jsx("nav",{className:"workspace-nav workspace-nav--compact","aria-label":"Servers",children:m.jsx(Qd,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d})}):null,m.jsx(m2,{api:_,activeTerminalId:Me,activeTerminalCwd:et?.cwd??null,onOpenFile:ti})]}):null]}),Ds?m.jsxs("div",{className:"workspace-sidebar-footer",children:[m.jsx("span",{children:Vs}),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(ob,{name:"settings"}),ce.hasUpdates?m.jsx("span",{className:"update-pulse-dot","aria-hidden":"true"}):null]}),m.jsx("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"logout",title:"Logout",onClick:()=>{dt()},children:m.jsx(ob,{name:"logout"})})]})]}):null]}),B?m.jsx(c2,{api:p,onClose:()=>oe(!1),updateAvailable:ce.hasUpdates,onNotificationAssetsChanged:()=>{ei()}}):null,m.jsxs("section",{className:"terminal-main","aria-label":"Terminal workspace","data-mobile-pane-switcher":xe?"true":void 0,children:[m.jsx(EM,{tabs:De?.tabs??[],activeTabId:De?.activeTabId??null,terminals:x.terminals,unreadCompletionTabIds:w.unreadCompletions,detachedTerminals:ze,onSelectTab:L=>Xe({type:"tab.selected",tabId:L}),onCreateTab:()=>{Ws()},onToggleWorkspaces:()=>ie(L=>!L),onCloseTerminals:L=>Ys(L),onReattachTerminal:L=>Ts(L),onDeleteTerminal:L=>{$s(L)},onSplitVertical:()=>{Li("vertical")},onSplitHorizontal:()=>{Li("horizontal")},onRenameTab:(L,q)=>{or(L,q)},activePaneAvailable:!!Me}),xe?m.jsx(uA,{targets:Ne,activeLeafKey:Te,terminals:x.terminals,editors:C,onSelect:Rt}):null,N?m.jsx("div",{className:"workspace-error",children:N}):null,m.jsxs("section",{className:"workspace-body","aria-busy":E,children:[E?m.jsx("div",{className:"workspace-placeholder",children:"Opening shell..."}):null,!E&&!Ce?m.jsx(cA,{onCreate:()=>{Ws()}}):null,G.map(L=>{const q=Gn(L,n);return m.jsx(sA,{agentId:L,active:q,activeServerApi:q?_:void 0,visitedTabKeys:J,refreshCwdOnEnter:q&&bn==="files",draggingTab:q?I:null,mobileSplitFocus:tt,mobileFocusedLeafByTabKey:M,onSelect:le=>{q&&hi(le)},onClose:le=>{q&&Yt(le)},onCloseEditor:le=>{q&&bi(le)},onResize:(le,ve)=>{q&&Xe({type:"pane.resized",path:le,ratio:ve})},onExit:(le,ve)=>{q?Kt({type:"terminal.exited",terminalId:le,exitCode:ve}):zl(L,{type:"terminal.exited",terminalId:le,exitCode:ve})},onSnapshot:(le,ve)=>{const Re={type:"terminal.updated",terminal:le,notifyCompletion:ve?.notifyCompletion===!0};q?Kt(Re):zl(L,Re)},...L===null&&d?{onAuthClose:d}:{}},Aw(L))})]}),m.jsx(OM,{toast:ct,onActivate:os,onDismiss:()=>V(null)}),m.jsx(RM,{toast:qe,onDismiss:()=>vt(null)})]})]})})}function sA({agentId:e,active:t,activeServerApi:n,visitedTabKeys:a,refreshCwdOnEnter:o,draggingTab:c,mobileSplitFocus:d,mobileFocusedLeafByTabKey:p,onSelect:_,onClose:f,onCloseEditor:S,onResize:y,onExit:w,onSnapshot:x,onAuthClose:C}){const E=v.useMemo(()=>ce=>Sw(e,ce),[e]),N=v.useMemo(()=>()=>Qt(e),[e]),D=v.useSyncExternalStore(E,N,N),ie=v.useMemo(()=>wu(e),[e]),R=n??ie,H=D.state,j=H.workspaces.find(ce=>ce.id===H.activeWorkspaceId)??H.workspaces[0],W=j?.id??null,oe=(j?.tabs.find(ce=>ce.id===j.activeTabId)??j?.tabs[0])?.id??null;return!D.loaded||H.workspaces.length===0?null:m.jsx("div",{className:"workspace-server-surface","data-active":t,"aria-hidden":!t,children:H.workspaces.flatMap(ce=>ce.tabs.map(ue=>{const Q=t&&ce.id===W&&ue.id===oe,G=Qc(e,ce.id,ue.id),K=vu(ue.root),J=d&&K.length>1?Rw(K,ue.activeTerminalId,p[G]):null;return!Q&&!a.has(G)?null:m.jsx("div",{className:"workspace-tab-surface","data-active":Q,"aria-hidden":!Q,children:m.jsx(Rp,{node:ue.root,terminals:H.terminals,editors:D.editors,api:R,activeTerminalId:ue.activeTerminalId,visible:Q,refreshCwdOnEnter:Q&&o,tabId:ue.id,dropZoneActive:Q&&c!==null,draggingTerminalId:Q?c?.terminalId??null:null,mobileFocusLeafKey:J,onSelect:_,onClose:f,onCloseEditor:S,onResize:y,onExit:w,onSnapshot:x,...C?{onAuthClose:C}:{}})},`${ce.id}:${ue.id}`)}))})}function nA(e){const t=IE(e);if(t)switch(t.id){case"server.previous":case"server.next":case"tab.previous":case"tab.next":return{type:t.id};case"tab.index":case"pane.index":return t.index===null?null:{type:t.id,index:t.index};case"split.right":return{type:"split",direction:"vertical"};case"split.down":return{type:"split",direction:"horizontal"};default:return null}if(e.ctrlKey&&e.altKey&&!e.metaKey&&!e.shiftKey){const n=aA(e.key);return n?{type:"pane.direction",direction:n}:null}return null}function rA(e,t,n){switch(n.type){case"pane.direction":return jM(e,t,n.direction);case"pane.index":return UM(e,n.index);default:return null}}function aA(e){switch(e){case"ArrowLeft":return"left";case"ArrowRight":return"right";case"ArrowUp":return"up";case"ArrowDown":return"down";default:return null}}function lA(e,t,n){if(e.length===0)return null;const a=e.findIndex(c=>c.id===t);return e[((a===-1?0:a)+n+e.length)%e.length]??null}function vu(e){return e.type==="pane"?[{key:yu(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:Mw(e.editorId),type:"editor",editorId:e.editorId,title:e.title}]:[...vu(e.first),...vu(e.second)]}function Rw(e,t,n){if(n&&e.some(o=>o.key===n))return n;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 Mw(e){return`editor:${e}`}function oA(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 cA({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 uA({targets:e,activeLeafKey:t,terminals:n,editors:a,onSelect:o}){if(e.length<=1)return null;const c=t?e.findIndex(S=>S.key===t):-1,d=c>=0?c:0,p=e[d]??e[0],_=hA(p,n,a);function f(S){const y=(d+S+e.length)%e.length,w=e[y];w&&o(w)}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:()=>f(-1),children:"<"}),m.jsxs("span",{title:_,children:["Pane ",d+1,"/",e.length," | ",_]}),m.jsx("button",{type:"button","aria-label":"Next pane",onClick:()=>f(1),children:">"})]})}function hA(e,t,n){if(e.type==="editor")return n[e.editorId]?.title||e.title||e.editorId;const a=t[e.terminalId];return a?.title||a?.cwd||e.terminalId}function dA(e){const[t,n]=v.useState(()=>fA(e));return v.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function"){n(!1);return}const a=window.matchMedia(e),o=()=>n(a.matches);return o(),typeof a.addEventListener=="function"?(a.addEventListener("change",o),()=>a.removeEventListener("change",o)):(a.addListener(o),()=>a.removeListener(o))},[e]),t}function fA(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function Gn(e,t){return e===t}function pA(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 Aw(e){return e??"__local__"}function Qc(e,t,n){return`${Aw(e)}:${t}:${n}`}function _A(e){return e?{workspaceKey:`${ab}:${e}`,layoutKey:`${rb}:${e}`}:{workspaceKey:ab,layoutKey:rb}}function mA(e){const t=localStorage.getItem(e.workspaceKey);if(t)try{const a=JSON.parse(t),o=Ub(a);if(o)return Nw(o)}catch{}const n=localStorage.getItem(e.layoutKey);if(!n)return null;try{const a=JSON.parse(n);return!Array.isArray(a)||!a.every(yE)?null:{savedTabs:a}}catch{return null}}function Nw(e){const t=Ub(e);return t?{savedWorkspaces:t.workspaces,savedActiveWorkspaceId:t.activeWorkspaceId}:null}function Hl(e,t){if(e.workspaces.length>0){localStorage.setItem(t.workspaceKey,JSON.stringify(e)),localStorage.removeItem(t.layoutKey);return}localStorage.removeItem(t.workspaceKey)}function gA(e){const t=e.workspaces.find(o=>o.id===e.activeWorkspaceId)??e.workspaces[0],n=t?.tabs.find(o=>o.id===t.activeTabId)??t?.tabs[0],a=n?e.terminals[n.activeTerminalId]:void 0;return a?.status==="running"?a:null}function vA(e){return e.results.find(t=>t.status==="failed"&&t.error)?.error}function yA(e){return e.split("/").filter(Boolean).pop()??e}function SA(){try{return localStorage.getItem(Dw)==="true"}catch{return!1}}function bA(e){try{localStorage.setItem(Dw,e?"true":"false")}catch{}}function wA(e){if(!e)return"session · local";const t=Date.parse(e);if(!Number.isFinite(t))return"session · local";const n=t-Date.now();if(n<=0)return"session · expired";const a=Math.max(1,Math.floor(n/6e4));return a<60?`session · ${a}m left`:`session · ${Math.floor(a/60)}h left`}function ob({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 qc(e){return e instanceof Error?e.message:"Request failed"}function CA({api:e,onDone:t}){const[n,a]=v.useState(null),[o,c]=v.useState(null),[d,p]=v.useState(""),[_,f]=v.useState(!1),[S,y]=v.useState(null),[w,x]=v.useState(null);v.useEffect(()=>{let E=!1;return e.setupTotp().then(N=>{E||(a(N.qrDataUrl),c(N.secret))}).catch(N=>{E||x(N instanceof Error?N.message:"Failed to generate QR code")}),()=>{E=!0}},[e]);async function C(E){if(E.preventDefault(),!!o){f(!0),y(null);try{await e.activateTotp({secret:o,otp:d}),t()}catch(N){y(N instanceof Error?N.message:"Verification failed")}finally{f(!1)}}}return w?m.jsx("p",{className:"form-error",children:w}):!n||!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:n,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:C,children:[m.jsxs("label",{children:["Verification code",m.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:d,onChange:E=>p(E.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),S?m.jsx("p",{className:"form-error",children:S}):null,m.jsx("button",{type:"submit",disabled:_||d.length!==6,children:"Activate 2FA"})]})]})}function xA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a}){const o=v.useMemo(()=>e??bu(),[e]),c=v.useMemo(()=>t??wu(null),[t]),[d,p]=v.useState(null),[_,f]=v.useState(null);v.useEffect(()=>{let C=!1;return o.getSession().then(E=>{C||(p(E),f(null))}).catch(E=>{C||(f(uo(E)),p(null))}),()=>{C=!0}},[o]);const S=DA(d);async function y(){const C=await o.getSession();p(C),f(null)}async function w(){YS(),tb(),GD(),f(null),p(null);try{await y()}catch(C){f(uo(C))}}if(S==="workspace")return m.jsx(iA,{api:o,serverApi:c,activeAgentId:n,onSelectServer:a,sessionExpiresAt:d?.expiresAt??null,onSessionInvalid:()=>{w()},onLogout:async()=>{YS(),tb();const C=await o.logout();p(C)}});const x={loading:"Terminal",setup_password:"Set password",setup_totp:"Set up 2FA",login:"Unlock terminal",reauth:"Verify it’s you",workspace:"Terminal"};return 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(mb,{size:26}),m.jsxs("div",{children:[m.jsx(gb,{height:17}),m.jsx("p",{className:"auth-host",children:"local terminal"})]})]}),m.jsx("h1",{children:x[S]})]}),_?m.jsx("p",{className:"form-error",children:_}):null,S==="loading"?m.jsx("p",{className:"muted",children:"Checking session..."}):null,S==="loading"&&_?m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{w()},children:"Retry"}):null,S==="setup_password"?m.jsx(EA,{api:o,onSession:C=>{p(C)}}):null,S==="setup_totp"?m.jsx(CA,{api:o,onDone:()=>{y()}}):null,S==="login"?m.jsx(TA,{api:o,session:d,onSession:p,onRefresh:y}):null,S==="reauth"?m.jsx(kA,{api:o,session:d,onSession:p,onFullLogin:()=>p(C=>C&&{...C,deviceTrusted:!1})}):null]})]})}function EA({api:e,onSession:t}){const[n,a]=v.useState(""),[o,c]=v.useState(""),[d,p]=v.useState(!1),[_,f]=v.useState(null);async function S(y){y.preventDefault(),p(!0),f(null);try{if(n!==o){f("Passwords do not match");return}t(await e.setupPassword({password:n}))}catch(w){f(uo(w))}finally{p(!1)}}return m.jsxs("form",{className:"auth-form",onSubmit:S,children:[m.jsxs("label",{children:["Password",m.jsx("input",{autoFocus:!0,value:n,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})]}),_?m.jsx("p",{className:"form-error",children:_}):null,m.jsx("button",{type:"submit",disabled:d||n.length<8||o.length<8,children:"Set password"})]})}function TA({api:e,session:t,onSession:n,onRefresh:a}){const[o,c]=v.useState(""),[d,p]=v.useState(""),[_,f]=v.useState(!1),[S,y]=v.useState(!1),[w,x]=v.useState(null),C=t?.totpEnabled??!1,E=t?.currentIpWhitelisted??!1;async function N(D){D.preventDefault(),y(!0),x(null);try{n(await e.login({password:o,...C?{otp:d}:{},rememberNetwork:_}))}catch(ie){x(uo(ie))}finally{y(!1)}}return m.jsxs("form",{className:"auth-form",onSubmit:N,children:[m.jsxs("label",{children:["Password",m.jsx("input",{autoFocus:!0,type:"password",value:o,onChange:D=>c(D.currentTarget.value),required:!0})]}),C?m.jsxs("label",{children:["Authenticator code",m.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:d,onChange:D=>p(D.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}):null,E?null:m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:_,onChange:D=>f(D.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),w?m.jsx("p",{className:"form-error",children:w}):null,m.jsxs("div",{className:"button-row",children:[m.jsx("button",{type:"submit",disabled:S||o.length===0||C&&d.length!==6,children:"Unlock"}),m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a()},disabled:S,children:"Refresh"})]})]})}function kA({api:e,session:t,onSession:n,onFullLogin:a}){const o=t?.currentIpWhitelisted??!1,[c,d]=v.useState(""),[p,_]=v.useState(!1),[f,S]=v.useState(!1),[y,w]=v.useState(null),x=ki.useRef(!1),C=ki.useCallback(async(N,D)=>{S(!0),w(null);try{n(await e.reauth({...N?{otp:N}:{},rememberNetwork:D}))}catch(ie){w(uo(ie))}finally{S(!1)}},[e,n]);v.useEffect(()=>{o&&!x.current&&(x.current=!0,C(void 0,!1))},[o,C]);async function E(N){N.preventDefault(),await C(c,p)}return o&&!y?m.jsx("p",{className:"muted",children:"Reconnecting from a trusted network…"}):m.jsxs("form",{className:"auth-form",onSubmit:E,children:[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:N=>d(N.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:p,onChange:N=>_(N.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),y?m.jsx("p",{className:"form-error",children:y}):null,m.jsxs("div",{className:"button-row",children:[m.jsx("button",{type:"submit",disabled:f||c.length!==6,children:"Continue"}),m.jsx("button",{type:"button",className:"secondary-button",onClick:a,disabled:f,children:"Use password instead"})]})]})}function DA(e){return e?e.passwordSet?e.authenticated&&!e.totpEnabled?"setup_totp":e.authenticated?"workspace":e.deviceTrusted&&e.totpEnabled?"reauth":"login":"setup_password":"loading"}function uo(e){return e instanceof Error?e.message:"Request failed"}const cb="NTerminal",Kp="nterminal.activeAgentId";function RA(){const[e,t]=v.useState(()=>MA()),n=v.useMemo(()=>bu(),[]),a=v.useMemo(()=>wu(e),[e]);v.useEffect(()=>{const c=()=>{const d=yM();document.title=d>0?`(${d}) ${cb}`:cb};return c(),vM(c)},[]);function o(c){AA(c),t(c)}return m.jsx(xA,{api:n,activeAgentId:e,serverApi:a,onSelectServer:o})}function MA(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Kp);return e&&e.trim()?e:null}catch{return null}}function AA(e){if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(Kp,e);return}window.localStorage.removeItem(Kp)}catch{}}const ub=["gesturestart","gesturechange","gestureend"],NA=[".workspace-list",".terminal-tab-list",".mobile-terminal-key-bar",".upload-toast-body",".file-tree",".file-detail",".file-editor",".file-markdown-preview",".editor-markdown-preview"].join(",");function BA(e=window){if(!OA(e))return()=>{};const t={passive:!1},n=e.document;function a(c){c.cancelable&&c.preventDefault()}function o(c){if(c.defaultPrevented)return;const d=c.touches;!d||d.length===0||(d.length>1||!LA(c.target))&&a(c)}for(const c of ub)n.addEventListener(c,a,t);return n.addEventListener("touchmove",o,t),n.addEventListener("dblclick",a,t),()=>{for(const c of ub)n.removeEventListener(c,a,t);n.removeEventListener("touchmove",o,t),n.removeEventListener("dblclick",a,t)}}function LA(e){return e instanceof Element&&e.closest(NA)!==null}function OA(e){return e.navigator.maxTouchPoints>0?!0:typeof e.matchMedia=="function"&&e.matchMedia("(pointer: coarse)").matches}const hb="--nterminal-viewport-height",db="--nterminal-keyboard-inset-bottom",fb="data-nterminal-keyboard-visible",zA=120;function HA(e=window){const t=e.document.documentElement,n=e.visualViewport;function a(){const o=jA(e);o!==null&&t.style.setProperty(hb,`${o}px`),t.style.setProperty(db,`${Bw(e)}px`),t.setAttribute(fb,String(UA(e)))}return a(),n?.addEventListener("resize",a),n?.addEventListener("scroll",a),e.addEventListener("resize",a),e.addEventListener("orientationchange",a),e.addEventListener("pageshow",a),e.document.addEventListener("visibilitychange",a),()=>{n?.removeEventListener("resize",a),n?.removeEventListener("scroll",a),e.removeEventListener("resize",a),e.removeEventListener("orientationchange",a),e.removeEventListener("pageshow",a),e.document.removeEventListener("visibilitychange",a),t.style.removeProperty(hb),t.style.removeProperty(db),t.removeAttribute(fb)}}function jA(e){const t=e.visualViewport?.height;return Su(t)?t:Su(e.innerHeight)?e.innerHeight:null}function Su(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function UA(e){return Bw(e)>zA}function Bw(e){const t=e.visualViewport?.height;if(!Su(t)||!Su(e.innerHeight))return 0;const n=typeof e.visualViewport?.offsetTop=="number"?e.visualViewport.offsetTop:0;return Math.max(0,Math.round(e.innerHeight-t-n))}HA();BA();u_();VC.createRoot(document.getElementById("root")).render(m.jsx(ki.StrictMode,{children:m.jsx(RA,{})}));export{UC as g,m as j};