paneful 0.9.12 → 0.9.13
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.
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(t){function e(E,R){var D=E.length;E.push(R);e:for(;0<D;){var j=D-1>>>1,G=E[j];if(0<s(G,R))E[j]=R,E[D]=G,D=j;else break e}}function i(E){return E.length===0?null:E[0]}function r(E){if(E.length===0)return null;var R=E[0],D=E.pop();if(D!==R){E[0]=D;e:for(var j=0,G=E.length,q=G>>>1;j<q;){var
|
|
25
|
+
*/(function(t){function e(E,R){var D=E.length;E.push(R);e:for(;0<D;){var j=D-1>>>1,G=E[j];if(0<s(G,R))E[j]=R,E[D]=G,D=j;else break e}}function i(E){return E.length===0?null:E[0]}function r(E){if(E.length===0)return null;var R=E[0],D=E.pop();if(D!==R){E[0]=D;e:for(var j=0,G=E.length,q=G>>>1;j<q;){var fe=2*(j+1)-1,Q=E[fe],le=fe+1,Z=E[le];if(0>s(Q,D))le<G&&0>s(Z,Q)?(E[j]=Z,E[le]=D,j=le):(E[j]=Q,E[fe]=D,j=fe);else if(le<G&&0>s(Z,D))E[j]=Z,E[le]=D,j=le;else break e}}return R}function s(E,R){var D=E.sortIndex-R.sortIndex;return D!==0?D:E.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var n=performance;t.unstable_now=function(){return n.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var h=[],l=[],c=1,u=null,d=3,f=!1,p=!1,m=!1,x=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(E){for(var R=i(l);R!==null;){if(R.callback===null)r(l);else if(R.startTime<=E)r(l),R.sortIndex=R.expirationTime,e(h,R);else break;R=i(l)}}function y(E){if(m=!1,S(E),!p)if(i(h)!==null)p=!0,M(L);else{var R=i(l);R!==null&&T(y,R.startTime-E)}}function L(E,R){p=!1,m&&(m=!1,_(B),B=-1),f=!0;var D=d;try{for(S(R),u=i(h);u!==null&&(!(u.expirationTime>R)||E&&!V());){var j=u.callback;if(typeof j=="function"){u.callback=null,d=u.priorityLevel;var G=j(u.expirationTime<=R);R=t.unstable_now(),typeof G=="function"?u.callback=G:u===i(h)&&r(h),S(R)}else r(h);u=i(h)}if(u!==null)var q=!0;else{var fe=i(l);fe!==null&&T(y,fe.startTime-R),q=!1}return q}finally{u=null,d=D,f=!1}}var P=!1,N=null,B=-1,U=5,W=-1;function V(){return!(t.unstable_now()-W<U)}function C(){if(N!==null){var E=t.unstable_now();W=E;var R=!0;try{R=N(!0,E)}finally{R?w():(P=!1,N=null)}}else P=!1}var w;if(typeof g=="function")w=function(){g(C)};else if(typeof MessageChannel<"u"){var b=new MessageChannel,k=b.port2;b.port1.onmessage=C,w=function(){k.postMessage(null)}}else w=function(){x(C,0)};function M(E){N=E,P||(P=!0,w())}function T(E,R){B=x(function(){E(t.unstable_now())},R)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(E){E.callback=null},t.unstable_continueExecution=function(){p||f||(p=!0,M(L))},t.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<E?Math.floor(1e3/E):5},t.unstable_getCurrentPriorityLevel=function(){return d},t.unstable_getFirstCallbackNode=function(){return i(h)},t.unstable_next=function(E){switch(d){case 1:case 2:case 3:var R=3;break;default:R=d}var D=d;d=R;try{return E()}finally{d=D}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(E,R){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var D=d;d=E;try{return R()}finally{d=D}},t.unstable_scheduleCallback=function(E,R,D){var j=t.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?j+D:j):D=j,E){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=D+G,E={id:c++,callback:R,priorityLevel:E,startTime:D,expirationTime:G,sortIndex:-1},D>j?(E.sortIndex=D,e(l,E),i(h)===null&&E===i(l)&&(m?(_(B),B=-1):m=!0,T(y,D-j))):(E.sortIndex=G,e(h,E),p||f||(p=!0,M(L))),E},t.unstable_shouldYield=V,t.unstable_wrapCallback=function(E){var R=d;return function(){var D=d;d=R;try{return E.apply(this,arguments)}finally{d=D}}}})(vg);gg.exports=vg;var D1=gg.exports;/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
`+Fl+t}var jl=!1;function Wl(t,e){if(!t||jl)return"";jl=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(l){var r=l}Reflect.construct(t,[],e)}else{try{e.call()}catch(l){r=l}t.call(e.prototype)}else{try{throw Error()}catch(l){r=l}t()}}catch(l){if(l&&r&&typeof l.stack=="string"){for(var s=l.stack.split(`
|
|
35
35
|
`),n=r.stack.split(`
|
|
36
36
|
`),o=s.length-1,a=n.length-1;1<=o&&0<=a&&s[o]!==n[a];)a--;for(;1<=o&&0<=a;o--,a--)if(s[o]!==n[a]){if(o!==1||a!==1)do if(o--,a--,0>a||s[o]!==n[a]){var h=`
|
|
37
|
-
`+s[o].replace(" at new "," at ");return t.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",t.displayName)),h}while(1<=o&&0<=a);break}}}finally{jl=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?bn(t):""}function I1(t){switch(t.tag){case 5:return bn(t.type);case 16:return bn("Lazy");case 13:return bn("Suspense");case 19:return bn("SuspenseList");case 0:case 2:case 15:return t=Wl(t.type,!1),t;case 11:return t=Wl(t.type.render,!1),t;case 1:return t=Wl(t.type,!0),t;default:return""}}function qh(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ms:return"Fragment";case vs:return"Portal";case Uh:return"Profiler";case Vu:return"StrictMode";case Kh:return"Suspense";case Vh:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Sg:return(t.displayName||"Context")+".Consumer";case yg:return(t._context.displayName||"Context")+".Provider";case qu:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Gu:return e=t.displayName||null,e!==null?e:qh(t.type)||"Memo";case lr:e=t._payload,t=t._init;try{return qh(t(e))}catch{}}return null}function z1(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return qh(e);case 8:return e===Vu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Er(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function xg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function F1(t){var e=xg(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var s=i.get,n=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,n.call(this,o)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Po(t){t._valueTracker||(t._valueTracker=F1(t))}function Cg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var i=e.getValue(),r="";return t&&(r=xg(t)?t.checked?"true":"false":t.value),t=r,t!==i?(e.setValue(t),!0):!1}function Pa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Gh(t,e){var i=e.checked;return Le({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function cf(t,e){var i=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;i=Er(e.value!=null?e.value:i),t._wrapperState={initialChecked:r,initialValue:i,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function bg(t,e){e=e.checked,e!=null&&Ku(t,"checked",e,!1)}function Yh(t,e){bg(t,e);var i=Er(e.value),r=e.type;if(i!=null)r==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Xh(t,e.type,i):e.hasOwnProperty("defaultValue")&&Xh(t,e.type,Er(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function uf(t,e,i){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,i||e===t.value||(t.value=e),t.defaultValue=e}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function Xh(t,e,i){(e!=="number"||Pa(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var kn=Array.isArray;function Bs(t,e,i,r){if(t=t.options,e){e={};for(var s=0;s<i.length;s++)e["$"+i[s]]=!0;for(i=0;i<t.length;i++)s=e.hasOwnProperty("$"+t[i].value),t[i].selected!==s&&(t[i].selected=s),s&&r&&(t[i].defaultSelected=!0)}else{for(i=""+Er(i),e=null,s=0;s<t.length;s++){if(t[s].value===i){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function Qh(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(I(91));return Le({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function df(t,e){var i=e.value;if(i==null){if(i=e.children,e=e.defaultValue,i!=null){if(e!=null)throw Error(I(92));if(kn(i)){if(1<i.length)throw Error(I(93));i=i[0]}e=i}e==null&&(e=""),i=e}t._wrapperState={initialValue:Er(i)}}function kg(t,e){var i=Er(e.value),r=Er(e.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),e.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),r!=null&&(t.defaultValue=""+r)}function ff(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Eg(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Zh(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Eg(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Do,Lg=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,i,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,i,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Do=Do||document.createElement("div"),Do.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Do.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Gn(t,e){if(e){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=e;return}}t.textContent=e}var An={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},j1=["Webkit","ms","Moz","O"];Object.keys(An).forEach(function(t){j1.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),An[e]=An[t]})});function Mg(t,e,i){return e==null||typeof e=="boolean"||e===""?"":i||typeof e!="number"||e===0||An.hasOwnProperty(t)&&An[t]?(""+e).trim():e+"px"}function Rg(t,e){t=t.style;for(var i in e)if(e.hasOwnProperty(i)){var r=i.indexOf("--")===0,s=Mg(i,e[i],r);i==="float"&&(i="cssFloat"),r?t.setProperty(i,s):t[i]=s}}var W1=Le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Jh(t,e){if(e){if(W1[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(I(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(I(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(I(61))}if(e.style!=null&&typeof e.style!="object")throw Error(I(62))}}function ec(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 tc=null;function Yu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ic=null,As=null,Ns=null;function _f(t){if(t=yo(t)){if(typeof ic!="function")throw Error(I(280));var e=t.stateNode;e&&(e=gl(e),ic(t.stateNode,t.type,e))}}function Tg(t){As?Ns?Ns.push(t):Ns=[t]:As=t}function Pg(){if(As){var t=As,e=Ns;if(Ns=As=null,_f(t),e)for(t=0;t<e.length;t++)_f(e[t])}}function Dg(t,e){return t(e)}function Bg(){}var Hl=!1;function Ag(t,e,i){if(Hl)return t(e,i);Hl=!0;try{return Dg(t,e,i)}finally{Hl=!1,(As!==null||Ns!==null)&&(Bg(),Pg())}}function Yn(t,e){var i=t.stateNode;if(i===null)return null;var r=gl(i);if(r===null)return null;i=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(I(231,e,typeof i));return i}var rc=!1;if(qi)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){rc=!0}}),window.addEventListener("test",nn,nn),window.removeEventListener("test",nn,nn)}catch{rc=!1}function H1(t,e,i,r,s,n,o,a,h){var l=Array.prototype.slice.call(arguments,3);try{e.apply(i,l)}catch(c){this.onError(c)}}var Nn=!1,Da=null,Ba=!1,sc=null,U1={onError:function(t){Nn=!0,Da=t}};function K1(t,e,i,r,s,n,o,a,h){Nn=!1,Da=null,H1.apply(U1,arguments)}function V1(t,e,i,r,s,n,o,a,h){if(K1.apply(this,arguments),Nn){if(Nn){var l=Da;Nn=!1,Da=null}else throw Error(I(198));Ba||(Ba=!0,sc=l)}}function as(t){var e=t,i=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(i=e.return),t=e.return;while(t)}return e.tag===3?i:null}function Ng(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function pf(t){if(as(t)!==t)throw Error(I(188))}function q1(t){var e=t.alternate;if(!e){if(e=as(t),e===null)throw Error(I(188));return e!==t?null:t}for(var i=t,r=e;;){var s=i.return;if(s===null)break;var n=s.alternate;if(n===null){if(r=s.return,r!==null){i=r;continue}break}if(s.child===n.child){for(n=s.child;n;){if(n===i)return pf(s),t;if(n===r)return pf(s),e;n=n.sibling}throw Error(I(188))}if(i.return!==r.return)i=s,r=n;else{for(var o=!1,a=s.child;a;){if(a===i){o=!0,i=s,r=n;break}if(a===r){o=!0,r=s,i=n;break}a=a.sibling}if(!o){for(a=n.child;a;){if(a===i){o=!0,i=n,r=s;break}if(a===r){o=!0,r=n,i=s;break}a=a.sibling}if(!o)throw Error(I(189))}}if(i.alternate!==r)throw Error(I(190))}if(i.tag!==3)throw Error(I(188));return i.stateNode.current===i?t:e}function $g(t){return t=q1(t),t!==null?Og(t):null}function Og(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Og(t);if(e!==null)return e;t=t.sibling}return null}var Ig=jt.unstable_scheduleCallback,gf=jt.unstable_cancelCallback,G1=jt.unstable_shouldYield,Y1=jt.unstable_requestPaint,Ne=jt.unstable_now,X1=jt.unstable_getCurrentPriorityLevel,Xu=jt.unstable_ImmediatePriority,zg=jt.unstable_UserBlockingPriority,Aa=jt.unstable_NormalPriority,Q1=jt.unstable_LowPriority,Fg=jt.unstable_IdlePriority,dl=null,Mi=null;function Z1(t){if(Mi&&typeof Mi.onCommitFiberRoot=="function")try{Mi.onCommitFiberRoot(dl,t,void 0,(t.current.flags&128)===128)}catch{}}var pi=Math.clz32?Math.clz32:ty,J1=Math.log,ey=Math.LN2;function ty(t){return t>>>=0,t===0?32:31-(J1(t)/ey|0)|0}var Bo=64,Ao=4194304;function En(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Na(t,e){var i=t.pendingLanes;if(i===0)return 0;var r=0,s=t.suspendedLanes,n=t.pingedLanes,o=i&268435455;if(o!==0){var a=o&~s;a!==0?r=En(a):(n&=o,n!==0&&(r=En(n)))}else o=i&~s,o!==0?r=En(o):n!==0&&(r=En(n));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,n=e&-e,s>=n||s===16&&(n&4194240)!==0))return e;if(r&4&&(r|=i&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)i=31-pi(e),s=1<<i,r|=t[i],e&=~s;return r}function iy(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ry(t,e){for(var i=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,n=t.pendingLanes;0<n;){var o=31-pi(n),a=1<<o,h=s[o];h===-1?(!(a&i)||a&r)&&(s[o]=iy(a,e)):h<=e&&(t.expiredLanes|=a),n&=~a}}function nc(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function jg(){var t=Bo;return Bo<<=1,!(Bo&4194240)&&(Bo=64),t}function Ul(t){for(var e=[],i=0;31>i;i++)e.push(t);return e}function vo(t,e,i){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-pi(e),t[e]=i}function sy(t,e){var i=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<i;){var s=31-pi(i),n=1<<s;e[s]=0,r[s]=-1,t[s]=-1,i&=~n}}function Qu(t,e){var i=t.entangledLanes|=e;for(t=t.entanglements;i;){var r=31-pi(i),s=1<<r;s&e|t[r]&e&&(t[r]|=e),i&=~s}}var he=0;function Wg(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Hg,Zu,Ug,Kg,Vg,oc=!1,No=[],vr=null,mr=null,yr=null,Xn=new Map,Qn=new Map,ur=[],ny="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function vf(t,e){switch(t){case"focusin":case"focusout":vr=null;break;case"dragenter":case"dragleave":mr=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":Xn.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qn.delete(e.pointerId)}}function on(t,e,i,r,s,n){return t===null||t.nativeEvent!==n?(t={blockedOn:e,domEventName:i,eventSystemFlags:r,nativeEvent:n,targetContainers:[s]},e!==null&&(e=yo(e),e!==null&&Zu(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function oy(t,e,i,r,s){switch(e){case"focusin":return vr=on(vr,t,e,i,r,s),!0;case"dragenter":return mr=on(mr,t,e,i,r,s),!0;case"mouseover":return yr=on(yr,t,e,i,r,s),!0;case"pointerover":var n=s.pointerId;return Xn.set(n,on(Xn.get(n)||null,t,e,i,r,s)),!0;case"gotpointercapture":return n=s.pointerId,Qn.set(n,on(Qn.get(n)||null,t,e,i,r,s)),!0}return!1}function qg(t){var e=Fr(t.target);if(e!==null){var i=as(e);if(i!==null){if(e=i.tag,e===13){if(e=Ng(i),e!==null){t.blockedOn=e,Vg(t.priority,function(){Ug(i)});return}}else if(e===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function aa(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var i=ac(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var r=new i.constructor(i.type,i);tc=r,i.target.dispatchEvent(r),tc=null}else return e=yo(i),e!==null&&Zu(e),t.blockedOn=i,!1;e.shift()}return!0}function mf(t,e,i){aa(t)&&i.delete(e)}function ay(){oc=!1,vr!==null&&aa(vr)&&(vr=null),mr!==null&&aa(mr)&&(mr=null),yr!==null&&aa(yr)&&(yr=null),Xn.forEach(mf),Qn.forEach(mf)}function an(t,e){t.blockedOn===e&&(t.blockedOn=null,oc||(oc=!0,jt.unstable_scheduleCallback(jt.unstable_NormalPriority,ay)))}function Zn(t){function e(s){return an(s,t)}if(0<No.length){an(No[0],t);for(var i=1;i<No.length;i++){var r=No[i];r.blockedOn===t&&(r.blockedOn=null)}}for(vr!==null&&an(vr,t),mr!==null&&an(mr,t),yr!==null&&an(yr,t),Xn.forEach(e),Qn.forEach(e),i=0;i<ur.length;i++)r=ur[i],r.blockedOn===t&&(r.blockedOn=null);for(;0<ur.length&&(i=ur[0],i.blockedOn===null);)qg(i),i.blockedOn===null&&ur.shift()}var $s=Qi.ReactCurrentBatchConfig,$a=!0;function ly(t,e,i,r){var s=he,n=$s.transition;$s.transition=null;try{he=1,Ju(t,e,i,r)}finally{he=s,$s.transition=n}}function hy(t,e,i,r){var s=he,n=$s.transition;$s.transition=null;try{he=4,Ju(t,e,i,r)}finally{he=s,$s.transition=n}}function Ju(t,e,i,r){if($a){var s=ac(t,e,i,r);if(s===null)eh(t,e,r,Oa,i),vf(t,r);else if(oy(s,t,e,i,r))r.stopPropagation();else if(vf(t,r),e&4&&-1<ny.indexOf(t)){for(;s!==null;){var n=yo(s);if(n!==null&&Hg(n),n=ac(t,e,i,r),n===null&&eh(t,e,r,Oa,i),n===s)break;s=n}s!==null&&r.stopPropagation()}else eh(t,e,r,null,i)}}var Oa=null;function ac(t,e,i,r){if(Oa=null,t=Yu(r),t=Fr(t),t!==null)if(e=as(t),e===null)t=null;else if(i=e.tag,i===13){if(t=Ng(e),t!==null)return t;t=null}else if(i===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Oa=t,null}function Gg(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(X1()){case Xu:return 1;case zg:return 4;case Aa:case Q1:return 16;case Fg:return 536870912;default:return 16}default:return 16}}var fr=null,ed=null,la=null;function Yg(){if(la)return la;var t,e=ed,i=e.length,r,s="value"in fr?fr.value:fr.textContent,n=s.length;for(t=0;t<i&&e[t]===s[t];t++);var o=i-t;for(r=1;r<=o&&e[i-r]===s[n-r];r++);return la=s.slice(t,1<r?1-r:void 0)}function ha(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function $o(){return!0}function yf(){return!1}function Ht(t){function e(i,r,s,n,o){this._reactName=i,this._targetInst=s,this.type=r,this.nativeEvent=n,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(i=t[a],this[a]=i?i(n):n[a]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?$o:yf,this.isPropagationStopped=yf,this}return Le(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=$o)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=$o)},persist:function(){},isPersistent:$o}),e}var Qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},td=Ht(Qs),mo=Le({},Qs,{view:0,detail:0}),cy=Ht(mo),Kl,Vl,ln,fl=Le({},mo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:id,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ln&&(ln&&t.type==="mousemove"?(Kl=t.screenX-ln.screenX,Vl=t.screenY-ln.screenY):Vl=Kl=0,ln=t),Kl)},movementY:function(t){return"movementY"in t?t.movementY:Vl}}),Sf=Ht(fl),uy=Le({},fl,{dataTransfer:0}),dy=Ht(uy),fy=Le({},mo,{relatedTarget:0}),ql=Ht(fy),_y=Le({},Qs,{animationName:0,elapsedTime:0,pseudoElement:0}),py=Ht(_y),gy=Le({},Qs,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),vy=Ht(gy),my=Le({},Qs,{data:0}),wf=Ht(my),yy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sy={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"},wy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xy(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=wy[t])?!!e[t]:!1}function id(){return xy}var Cy=Le({},mo,{key:function(t){if(t.key){var e=yy[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=ha(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Sy[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:id,charCode:function(t){return t.type==="keypress"?ha(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ha(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),by=Ht(Cy),ky=Le({},fl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xf=Ht(ky),Ey=Le({},mo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:id}),Ly=Ht(Ey),My=Le({},Qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ry=Ht(My),Ty=Le({},fl,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Py=Ht(Ty),Dy=[9,13,27,32],rd=qi&&"CompositionEvent"in window,$n=null;qi&&"documentMode"in document&&($n=document.documentMode);var By=qi&&"TextEvent"in window&&!$n,Xg=qi&&(!rd||$n&&8<$n&&11>=$n),Cf=" ",bf=!1;function Qg(t,e){switch(t){case"keyup":return Dy.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ys=!1;function Ay(t,e){switch(t){case"compositionend":return Zg(e);case"keypress":return e.which!==32?null:(bf=!0,Cf);case"textInput":return t=e.data,t===Cf&&bf?null:t;default:return null}}function Ny(t,e){if(ys)return t==="compositionend"||!rd&&Qg(t,e)?(t=Yg(),la=ed=fr=null,ys=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Xg&&e.locale!=="ko"?null:e.data;default:return null}}var $y={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 kf(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!$y[t.type]:e==="textarea"}function Jg(t,e,i,r){Tg(r),e=Ia(e,"onChange"),0<e.length&&(i=new td("onChange","change",null,i,r),t.push({event:i,listeners:e}))}var On=null,Jn=null;function Oy(t){cv(t,0)}function _l(t){var e=xs(t);if(Cg(e))return t}function Iy(t,e){if(t==="change")return e}var ev=!1;if(qi){var Gl;if(qi){var Yl="oninput"in document;if(!Yl){var Ef=document.createElement("div");Ef.setAttribute("oninput","return;"),Yl=typeof Ef.oninput=="function"}Gl=Yl}else Gl=!1;ev=Gl&&(!document.documentMode||9<document.documentMode)}function Lf(){On&&(On.detachEvent("onpropertychange",tv),Jn=On=null)}function tv(t){if(t.propertyName==="value"&&_l(Jn)){var e=[];Jg(e,Jn,t,Yu(t)),Ag(Oy,e)}}function zy(t,e,i){t==="focusin"?(Lf(),On=e,Jn=i,On.attachEvent("onpropertychange",tv)):t==="focusout"&&Lf()}function Fy(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return _l(Jn)}function jy(t,e){if(t==="click")return _l(e)}function Wy(t,e){if(t==="input"||t==="change")return _l(e)}function Hy(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var vi=typeof Object.is=="function"?Object.is:Hy;function eo(t,e){if(vi(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length)return!1;for(r=0;r<i.length;r++){var s=i[r];if(!Hh.call(e,s)||!vi(t[s],e[s]))return!1}return!0}function Mf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Rf(t,e){var i=Mf(t);t=0;for(var r;i;){if(i.nodeType===3){if(r=t+i.textContent.length,t<=e&&r>=e)return{node:i,offset:e-t};t=r}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Mf(i)}}function iv(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?iv(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function rv(){for(var t=window,e=Pa();e instanceof t.HTMLIFrameElement;){try{var i=typeof e.contentWindow.location.href=="string"}catch{i=!1}if(i)t=e.contentWindow;else break;e=Pa(t.document)}return e}function sd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Uy(t){var e=rv(),i=t.focusedElem,r=t.selectionRange;if(e!==i&&i&&i.ownerDocument&&iv(i.ownerDocument.documentElement,i)){if(r!==null&&sd(i)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in i)i.selectionStart=e,i.selectionEnd=Math.min(t,i.value.length);else if(t=(e=i.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=i.textContent.length,n=Math.min(r.start,s);r=r.end===void 0?n:Math.min(r.end,s),!t.extend&&n>r&&(s=r,r=n,n=s),s=Rf(i,n);var o=Rf(i,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),n>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=i;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<e.length;i++)t=e[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Ky=qi&&"documentMode"in document&&11>=document.documentMode,Ss=null,lc=null,In=null,hc=!1;function Tf(t,e,i){var r=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;hc||Ss==null||Ss!==Pa(r)||(r=Ss,"selectionStart"in r&&sd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),In&&eo(In,r)||(In=r,r=Ia(lc,"onSelect"),0<r.length&&(e=new td("onSelect","select",null,e,i),t.push({event:e,listeners:r}),e.target=Ss)))}function Oo(t,e){var i={};return i[t.toLowerCase()]=e.toLowerCase(),i["Webkit"+t]="webkit"+e,i["Moz"+t]="moz"+e,i}var ws={animationend:Oo("Animation","AnimationEnd"),animationiteration:Oo("Animation","AnimationIteration"),animationstart:Oo("Animation","AnimationStart"),transitionend:Oo("Transition","TransitionEnd")},Xl={},sv={};qi&&(sv=document.createElement("div").style,"AnimationEvent"in window||(delete ws.animationend.animation,delete ws.animationiteration.animation,delete ws.animationstart.animation),"TransitionEvent"in window||delete ws.transitionend.transition);function pl(t){if(Xl[t])return Xl[t];if(!ws[t])return t;var e=ws[t],i;for(i in e)if(e.hasOwnProperty(i)&&i in sv)return Xl[t]=e[i];return t}var nv=pl("animationend"),ov=pl("animationiteration"),av=pl("animationstart"),lv=pl("transitionend"),hv=new Map,Pf="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Rr(t,e){hv.set(t,e),os(e,[t])}for(var Ql=0;Ql<Pf.length;Ql++){var Zl=Pf[Ql],Vy=Zl.toLowerCase(),qy=Zl[0].toUpperCase()+Zl.slice(1);Rr(Vy,"on"+qy)}Rr(nv,"onAnimationEnd");Rr(ov,"onAnimationIteration");Rr(av,"onAnimationStart");Rr("dblclick","onDoubleClick");Rr("focusin","onFocus");Rr("focusout","onBlur");Rr(lv,"onTransitionEnd");js("onMouseEnter",["mouseout","mouseover"]);js("onMouseLeave",["mouseout","mouseover"]);js("onPointerEnter",["pointerout","pointerover"]);js("onPointerLeave",["pointerout","pointerover"]);os("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));os("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));os("onBeforeInput",["compositionend","keypress","textInput","paste"]);os("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));os("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));os("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ln="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(" "),Gy=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ln));function Df(t,e,i){var r=t.type||"unknown-event";t.currentTarget=i,V1(r,e,void 0,t),t.currentTarget=null}function cv(t,e){e=(e&4)!==0;for(var i=0;i<t.length;i++){var r=t[i],s=r.event;r=r.listeners;e:{var n=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],h=a.instance,l=a.currentTarget;if(a=a.listener,h!==n&&s.isPropagationStopped())break e;Df(s,a,l),n=h}else for(o=0;o<r.length;o++){if(a=r[o],h=a.instance,l=a.currentTarget,a=a.listener,h!==n&&s.isPropagationStopped())break e;Df(s,a,l),n=h}}}if(Ba)throw t=sc,Ba=!1,sc=null,t}function ge(t,e){var i=e[_c];i===void 0&&(i=e[_c]=new Set);var r=t+"__bubble";i.has(r)||(uv(e,t,2,!1),i.add(r))}function Jl(t,e,i){var r=0;e&&(r|=4),uv(i,t,r,e)}var Io="_reactListening"+Math.random().toString(36).slice(2);function to(t){if(!t[Io]){t[Io]=!0,mg.forEach(function(i){i!=="selectionchange"&&(Gy.has(i)||Jl(i,!1,t),Jl(i,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Io]||(e[Io]=!0,Jl("selectionchange",!1,e))}}function uv(t,e,i,r){switch(Gg(e)){case 1:var s=ly;break;case 4:s=hy;break;default:s=Ju}i=s.bind(null,e,i,t),s=void 0,!rc||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,i,{capture:!0,passive:s}):t.addEventListener(e,i,!0):s!==void 0?t.addEventListener(e,i,{passive:s}):t.addEventListener(e,i,!1)}function eh(t,e,i,r,s){var n=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var h=o.tag;if((h===3||h===4)&&(h=o.stateNode.containerInfo,h===s||h.nodeType===8&&h.parentNode===s))return;o=o.return}for(;a!==null;){if(o=Fr(a),o===null)return;if(h=o.tag,h===5||h===6){r=n=o;continue e}a=a.parentNode}}r=r.return}Ag(function(){var l=n,c=Yu(i),u=[];e:{var d=hv.get(t);if(d!==void 0){var f=td,p=t;switch(t){case"keypress":if(ha(i)===0)break e;case"keydown":case"keyup":f=by;break;case"focusin":p="focus",f=ql;break;case"focusout":p="blur",f=ql;break;case"beforeblur":case"afterblur":f=ql;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=Sf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=dy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=Ly;break;case nv:case ov:case av:f=py;break;case lv:f=Ry;break;case"scroll":f=cy;break;case"wheel":f=Py;break;case"copy":case"cut":case"paste":f=vy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=xf}var m=(e&4)!==0,x=!m&&t==="scroll",_=m?d!==null?d+"Capture":null:d;m=[];for(var g=l,S;g!==null;){S=g;var y=S.stateNode;if(S.tag===5&&y!==null&&(S=y,_!==null&&(y=Yn(g,_),y!=null&&m.push(io(g,y,S)))),x)break;g=g.return}0<m.length&&(d=new f(d,p,null,i,c),u.push({event:d,listeners:m}))}}if(!(e&7)){e:{if(d=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",d&&i!==tc&&(p=i.relatedTarget||i.fromElement)&&(Fr(p)||p[Gi]))break e;if((f||d)&&(d=c.window===c?c:(d=c.ownerDocument)?d.defaultView||d.parentWindow:window,f?(p=i.relatedTarget||i.toElement,f=l,p=p?Fr(p):null,p!==null&&(x=as(p),p!==x||p.tag!==5&&p.tag!==6)&&(p=null)):(f=null,p=l),f!==p)){if(m=Sf,y="onMouseLeave",_="onMouseEnter",g="mouse",(t==="pointerout"||t==="pointerover")&&(m=xf,y="onPointerLeave",_="onPointerEnter",g="pointer"),x=f==null?d:xs(f),S=p==null?d:xs(p),d=new m(y,g+"leave",f,i,c),d.target=x,d.relatedTarget=S,y=null,Fr(c)===l&&(m=new m(_,g+"enter",p,i,c),m.target=S,m.relatedTarget=x,y=m),x=y,f&&p)t:{for(m=f,_=p,g=0,S=m;S;S=us(S))g++;for(S=0,y=_;y;y=us(y))S++;for(;0<g-S;)m=us(m),g--;for(;0<S-g;)_=us(_),S--;for(;g--;){if(m===_||_!==null&&m===_.alternate)break t;m=us(m),_=us(_)}m=null}else m=null;f!==null&&Bf(u,d,f,m,!1),p!==null&&x!==null&&Bf(u,x,p,m,!0)}}e:{if(d=l?xs(l):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var L=Iy;else if(kf(d))if(ev)L=Wy;else{L=Fy;var P=zy}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(L=jy);if(L&&(L=L(t,l))){Jg(u,L,i,c);break e}P&&P(t,d,l),t==="focusout"&&(P=d._wrapperState)&&P.controlled&&d.type==="number"&&Xh(d,"number",d.value)}switch(P=l?xs(l):window,t){case"focusin":(kf(P)||P.contentEditable==="true")&&(Ss=P,lc=l,In=null);break;case"focusout":In=lc=Ss=null;break;case"mousedown":hc=!0;break;case"contextmenu":case"mouseup":case"dragend":hc=!1,Tf(u,i,c);break;case"selectionchange":if(Ky)break;case"keydown":case"keyup":Tf(u,i,c)}var N;if(rd)e:{switch(t){case"compositionstart":var B="onCompositionStart";break e;case"compositionend":B="onCompositionEnd";break e;case"compositionupdate":B="onCompositionUpdate";break e}B=void 0}else ys?Qg(t,i)&&(B="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(B="onCompositionStart");B&&(Xg&&i.locale!=="ko"&&(ys||B!=="onCompositionStart"?B==="onCompositionEnd"&&ys&&(N=Yg()):(fr=c,ed="value"in fr?fr.value:fr.textContent,ys=!0)),P=Ia(l,B),0<P.length&&(B=new wf(B,t,null,i,c),u.push({event:B,listeners:P}),N?B.data=N:(N=Zg(i),N!==null&&(B.data=N)))),(N=By?Ay(t,i):Ny(t,i))&&(l=Ia(l,"onBeforeInput"),0<l.length&&(c=new wf("onBeforeInput","beforeinput",null,i,c),u.push({event:c,listeners:l}),c.data=N))}cv(u,e)})}function io(t,e,i){return{instance:t,listener:e,currentTarget:i}}function Ia(t,e){for(var i=e+"Capture",r=[];t!==null;){var s=t,n=s.stateNode;s.tag===5&&n!==null&&(s=n,n=Yn(t,i),n!=null&&r.unshift(io(t,n,s)),n=Yn(t,e),n!=null&&r.push(io(t,n,s))),t=t.return}return r}function us(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Bf(t,e,i,r,s){for(var n=e._reactName,o=[];i!==null&&i!==r;){var a=i,h=a.alternate,l=a.stateNode;if(h!==null&&h===r)break;a.tag===5&&l!==null&&(a=l,s?(h=Yn(i,n),h!=null&&o.unshift(io(i,h,a))):s||(h=Yn(i,n),h!=null&&o.push(io(i,h,a)))),i=i.return}o.length!==0&&t.push({event:e,listeners:o})}var Yy=/\r\n?/g,Xy=/\u0000|\uFFFD/g;function Af(t){return(typeof t=="string"?t:""+t).replace(Yy,`
|
|
38
|
-
`).replace(Xy,"")}function zo(t,e,i){if(e=Af(e),Af(t)!==e&&i)throw Error(I(425))}function za(){}var cc=null,uc=null;function dc(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var fc=typeof setTimeout=="function"?setTimeout:void 0,Qy=typeof clearTimeout=="function"?clearTimeout:void 0,Nf=typeof Promise=="function"?Promise:void 0,Zy=typeof queueMicrotask=="function"?queueMicrotask:typeof Nf<"u"?function(t){return Nf.resolve(null).then(t).catch(Jy)}:fc;function Jy(t){setTimeout(function(){throw t})}function th(t,e){var i=e,r=0;do{var s=i.nextSibling;if(t.removeChild(i),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(r===0){t.removeChild(s),Zn(e);return}r--}else i!=="$"&&i!=="$?"&&i!=="$!"||r++;i=s}while(i);Zn(e)}function Sr(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function $f(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(e===0)return t;e--}else i==="/$"&&e++}t=t.previousSibling}return null}var Zs=Math.random().toString(36).slice(2),Ei="__reactFiber$"+Zs,ro="__reactProps$"+Zs,Gi="__reactContainer$"+Zs,_c="__reactEvents$"+Zs,eS="__reactListeners$"+Zs,tS="__reactHandles$"+Zs;function Fr(t){var e=t[Ei];if(e)return e;for(var i=t.parentNode;i;){if(e=i[Gi]||i[Ei]){if(i=e.alternate,e.child!==null||i!==null&&i.child!==null)for(t=$f(t);t!==null;){if(i=t[Ei])return i;t=$f(t)}return e}t=i,i=t.parentNode}return null}function yo(t){return t=t[Ei]||t[Gi],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function xs(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(I(33))}function gl(t){return t[ro]||null}var pc=[],Cs=-1;function Tr(t){return{current:t}}function Se(t){0>Cs||(t.current=pc[Cs],pc[Cs]=null,Cs--)}function _e(t,e){Cs++,pc[Cs]=t.current,t.current=e}var Lr={},mt=Tr(Lr),Dt=Tr(!1),Zr=Lr;function Ws(t,e){var i=t.type.contextTypes;if(!i)return Lr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},n;for(n in i)s[n]=e[n];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Bt(t){return t=t.childContextTypes,t!=null}function Fa(){Se(Dt),Se(mt)}function Of(t,e,i){if(mt.current!==Lr)throw Error(I(168));_e(mt,e),_e(Dt,i)}function dv(t,e,i){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return i;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(I(108,z1(t)||"Unknown",s));return Le({},i,r)}function ja(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Lr,Zr=mt.current,_e(mt,t),_e(Dt,Dt.current),!0}function If(t,e,i){var r=t.stateNode;if(!r)throw Error(I(169));i?(t=dv(t,e,Zr),r.__reactInternalMemoizedMergedChildContext=t,Se(Dt),Se(mt),_e(mt,t)):Se(Dt),_e(Dt,i)}var ji=null,vl=!1,ih=!1;function fv(t){ji===null?ji=[t]:ji.push(t)}function iS(t){vl=!0,fv(t)}function Pr(){if(!ih&&ji!==null){ih=!0;var t=0,e=he;try{var i=ji;for(he=1;t<i.length;t++){var r=i[t];do r=r(!0);while(r!==null)}ji=null,vl=!1}catch(s){throw ji!==null&&(ji=ji.slice(t+1)),Ig(Xu,Pr),s}finally{he=e,ih=!1}}return null}var bs=[],ks=0,Wa=null,Ha=0,Zt=[],Jt=0,Jr=null,Wi=1,Hi="";function $r(t,e){bs[ks++]=Ha,bs[ks++]=Wa,Wa=t,Ha=e}function _v(t,e,i){Zt[Jt++]=Wi,Zt[Jt++]=Hi,Zt[Jt++]=Jr,Jr=t;var r=Wi;t=Hi;var s=32-pi(r)-1;r&=~(1<<s),i+=1;var n=32-pi(e)+s;if(30<n){var o=s-s%5;n=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Wi=1<<32-pi(e)+s|i<<s|r,Hi=n+t}else Wi=1<<n|i<<s|r,Hi=t}function nd(t){t.return!==null&&($r(t,1),_v(t,1,0))}function od(t){for(;t===Wa;)Wa=bs[--ks],bs[ks]=null,Ha=bs[--ks],bs[ks]=null;for(;t===Jr;)Jr=Zt[--Jt],Zt[Jt]=null,Hi=Zt[--Jt],Zt[Jt]=null,Wi=Zt[--Jt],Zt[Jt]=null}var Ft=null,zt=null,we=!1,_i=null;function pv(t,e){var i=ti(5,null,null,0);i.elementType="DELETED",i.stateNode=e,i.return=t,e=t.deletions,e===null?(t.deletions=[i],t.flags|=16):e.push(i)}function zf(t,e){switch(t.tag){case 5:var i=t.type;return e=e.nodeType!==1||i.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Ft=t,zt=Sr(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Ft=t,zt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(i=Jr!==null?{id:Wi,overflow:Hi}:null,t.memoizedState={dehydrated:e,treeContext:i,retryLane:1073741824},i=ti(18,null,null,0),i.stateNode=e,i.return=t,t.child=i,Ft=t,zt=null,!0):!1;default:return!1}}function gc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function vc(t){if(we){var e=zt;if(e){var i=e;if(!zf(t,e)){if(gc(t))throw Error(I(418));e=Sr(i.nextSibling);var r=Ft;e&&zf(t,e)?pv(r,i):(t.flags=t.flags&-4097|2,we=!1,Ft=t)}}else{if(gc(t))throw Error(I(418));t.flags=t.flags&-4097|2,we=!1,Ft=t}}}function Ff(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Ft=t}function Fo(t){if(t!==Ft)return!1;if(!we)return Ff(t),we=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!dc(t.type,t.memoizedProps)),e&&(e=zt)){if(gc(t))throw gv(),Error(I(418));for(;e;)pv(t,e),e=Sr(e.nextSibling)}if(Ff(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(I(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(e===0){zt=Sr(t.nextSibling);break e}e--}else i!=="$"&&i!=="$!"&&i!=="$?"||e++}t=t.nextSibling}zt=null}}else zt=Ft?Sr(t.stateNode.nextSibling):null;return!0}function gv(){for(var t=zt;t;)t=Sr(t.nextSibling)}function Hs(){zt=Ft=null,we=!1}function ad(t){_i===null?_i=[t]:_i.push(t)}var rS=Qi.ReactCurrentBatchConfig;function hn(t,e,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(I(309));var r=i.stateNode}if(!r)throw Error(I(147,t));var s=r,n=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===n?e.ref:(e=function(o){var a=s.refs;o===null?delete a[n]:a[n]=o},e._stringRef=n,e)}if(typeof t!="string")throw Error(I(284));if(!i._owner)throw Error(I(290,t))}return t}function jo(t,e){throw t=Object.prototype.toString.call(e),Error(I(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function jf(t){var e=t._init;return e(t._payload)}function vv(t){function e(_,g){if(t){var S=_.deletions;S===null?(_.deletions=[g],_.flags|=16):S.push(g)}}function i(_,g){if(!t)return null;for(;g!==null;)e(_,g),g=g.sibling;return null}function r(_,g){for(_=new Map;g!==null;)g.key!==null?_.set(g.key,g):_.set(g.index,g),g=g.sibling;return _}function s(_,g){return _=br(_,g),_.index=0,_.sibling=null,_}function n(_,g,S){return _.index=S,t?(S=_.alternate,S!==null?(S=S.index,S<g?(_.flags|=2,g):S):(_.flags|=2,g)):(_.flags|=1048576,g)}function o(_){return t&&_.alternate===null&&(_.flags|=2),_}function a(_,g,S,y){return g===null||g.tag!==6?(g=hh(S,_.mode,y),g.return=_,g):(g=s(g,S),g.return=_,g)}function h(_,g,S,y){var L=S.type;return L===ms?c(_,g,S.props.children,y,S.key):g!==null&&(g.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===lr&&jf(L)===g.type)?(y=s(g,S.props),y.ref=hn(_,g,S),y.return=_,y):(y=ga(S.type,S.key,S.props,null,_.mode,y),y.ref=hn(_,g,S),y.return=_,y)}function l(_,g,S,y){return g===null||g.tag!==4||g.stateNode.containerInfo!==S.containerInfo||g.stateNode.implementation!==S.implementation?(g=ch(S,_.mode,y),g.return=_,g):(g=s(g,S.children||[]),g.return=_,g)}function c(_,g,S,y,L){return g===null||g.tag!==7?(g=Vr(S,_.mode,y,L),g.return=_,g):(g=s(g,S),g.return=_,g)}function u(_,g,S){if(typeof g=="string"&&g!==""||typeof g=="number")return g=hh(""+g,_.mode,S),g.return=_,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case To:return S=ga(g.type,g.key,g.props,null,_.mode,S),S.ref=hn(_,null,g),S.return=_,S;case vs:return g=ch(g,_.mode,S),g.return=_,g;case lr:var y=g._init;return u(_,y(g._payload),S)}if(kn(g)||sn(g))return g=Vr(g,_.mode,S,null),g.return=_,g;jo(_,g)}return null}function d(_,g,S,y){var L=g!==null?g.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return L!==null?null:a(_,g,""+S,y);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case To:return S.key===L?h(_,g,S,y):null;case vs:return S.key===L?l(_,g,S,y):null;case lr:return L=S._init,d(_,g,L(S._payload),y)}if(kn(S)||sn(S))return L!==null?null:c(_,g,S,y,null);jo(_,S)}return null}function f(_,g,S,y,L){if(typeof y=="string"&&y!==""||typeof y=="number")return _=_.get(S)||null,a(g,_,""+y,L);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case To:return _=_.get(y.key===null?S:y.key)||null,h(g,_,y,L);case vs:return _=_.get(y.key===null?S:y.key)||null,l(g,_,y,L);case lr:var P=y._init;return f(_,g,S,P(y._payload),L)}if(kn(y)||sn(y))return _=_.get(S)||null,c(g,_,y,L,null);jo(g,y)}return null}function p(_,g,S,y){for(var L=null,P=null,N=g,B=g=0,U=null;N!==null&&B<S.length;B++){N.index>B?(U=N,N=null):U=N.sibling;var W=d(_,N,S[B],y);if(W===null){N===null&&(N=U);break}t&&N&&W.alternate===null&&e(_,N),g=n(W,g,B),P===null?L=W:P.sibling=W,P=W,N=U}if(B===S.length)return i(_,N),we&&$r(_,B),L;if(N===null){for(;B<S.length;B++)N=u(_,S[B],y),N!==null&&(g=n(N,g,B),P===null?L=N:P.sibling=N,P=N);return we&&$r(_,B),L}for(N=r(_,N);B<S.length;B++)U=f(N,_,B,S[B],y),U!==null&&(t&&U.alternate!==null&&N.delete(U.key===null?B:U.key),g=n(U,g,B),P===null?L=U:P.sibling=U,P=U);return t&&N.forEach(function(V){return e(_,V)}),we&&$r(_,B),L}function m(_,g,S,y){var L=sn(S);if(typeof L!="function")throw Error(I(150));if(S=L.call(S),S==null)throw Error(I(151));for(var P=L=null,N=g,B=g=0,U=null,W=S.next();N!==null&&!W.done;B++,W=S.next()){N.index>B?(U=N,N=null):U=N.sibling;var V=d(_,N,W.value,y);if(V===null){N===null&&(N=U);break}t&&N&&V.alternate===null&&e(_,N),g=n(V,g,B),P===null?L=V:P.sibling=V,P=V,N=U}if(W.done)return i(_,N),we&&$r(_,B),L;if(N===null){for(;!W.done;B++,W=S.next())W=u(_,W.value,y),W!==null&&(g=n(W,g,B),P===null?L=W:P.sibling=W,P=W);return we&&$r(_,B),L}for(N=r(_,N);!W.done;B++,W=S.next())W=f(N,_,B,W.value,y),W!==null&&(t&&W.alternate!==null&&N.delete(W.key===null?B:W.key),g=n(W,g,B),P===null?L=W:P.sibling=W,P=W);return t&&N.forEach(function(C){return e(_,C)}),we&&$r(_,B),L}function x(_,g,S,y){if(typeof S=="object"&&S!==null&&S.type===ms&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case To:e:{for(var L=S.key,P=g;P!==null;){if(P.key===L){if(L=S.type,L===ms){if(P.tag===7){i(_,P.sibling),g=s(P,S.props.children),g.return=_,_=g;break e}}else if(P.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===lr&&jf(L)===P.type){i(_,P.sibling),g=s(P,S.props),g.ref=hn(_,P,S),g.return=_,_=g;break e}i(_,P);break}else e(_,P);P=P.sibling}S.type===ms?(g=Vr(S.props.children,_.mode,y,S.key),g.return=_,_=g):(y=ga(S.type,S.key,S.props,null,_.mode,y),y.ref=hn(_,g,S),y.return=_,_=y)}return o(_);case vs:e:{for(P=S.key;g!==null;){if(g.key===P)if(g.tag===4&&g.stateNode.containerInfo===S.containerInfo&&g.stateNode.implementation===S.implementation){i(_,g.sibling),g=s(g,S.children||[]),g.return=_,_=g;break e}else{i(_,g);break}else e(_,g);g=g.sibling}g=ch(S,_.mode,y),g.return=_,_=g}return o(_);case lr:return P=S._init,x(_,g,P(S._payload),y)}if(kn(S))return p(_,g,S,y);if(sn(S))return m(_,g,S,y);jo(_,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,g!==null&&g.tag===6?(i(_,g.sibling),g=s(g,S),g.return=_,_=g):(i(_,g),g=hh(S,_.mode,y),g.return=_,_=g),o(_)):i(_,g)}return x}var Us=vv(!0),mv=vv(!1),Ua=Tr(null),Ka=null,Es=null,ld=null;function hd(){ld=Es=Ka=null}function cd(t){var e=Ua.current;Se(Ua),t._currentValue=e}function mc(t,e,i){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===i)break;t=t.return}}function Os(t,e){Ka=t,ld=Es=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Pt=!0),t.firstContext=null)}function si(t){var e=t._currentValue;if(ld!==t)if(t={context:t,memoizedValue:e,next:null},Es===null){if(Ka===null)throw Error(I(308));Es=t,Ka.dependencies={lanes:0,firstContext:t}}else Es=Es.next=t;return e}var jr=null;function ud(t){jr===null?jr=[t]:jr.push(t)}function yv(t,e,i,r){var s=e.interleaved;return s===null?(i.next=i,ud(e)):(i.next=s.next,s.next=i),e.interleaved=i,Yi(t,r)}function Yi(t,e){t.lanes|=e;var i=t.alternate;for(i!==null&&(i.lanes|=e),i=t,t=t.return;t!==null;)t.childLanes|=e,i=t.alternate,i!==null&&(i.childLanes|=e),i=t,t=t.return;return i.tag===3?i.stateNode:null}var hr=!1;function dd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Sv(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Vi(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function wr(t,e,i){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,se&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Yi(t,i)}return s=r.interleaved,s===null?(e.next=e,ud(r)):(e.next=s.next,s.next=e),r.interleaved=e,Yi(t,i)}function ca(t,e,i){if(e=e.updateQueue,e!==null&&(e=e.shared,(i&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,i|=r,e.lanes=i,Qu(t,i)}}function Wf(t,e){var i=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,i===r)){var s=null,n=null;if(i=i.firstBaseUpdate,i!==null){do{var o={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};n===null?s=n=o:n=n.next=o,i=i.next}while(i!==null);n===null?s=n=e:n=n.next=e}else s=n=e;i={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:r.shared,effects:r.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=e:t.next=e,i.lastBaseUpdate=e}function Va(t,e,i,r){var s=t.updateQueue;hr=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var h=a,l=h.next;h.next=null,o===null?n=l:o.next=l,o=h;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=l:a.next=l,c.lastBaseUpdate=h))}if(n!==null){var u=s.baseState;o=0,c=l=h=null,a=n;do{var d=a.lane,f=a.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=t,m=a;switch(d=e,f=i,m.tag){case 1:if(p=m.payload,typeof p=="function"){u=p.call(f,u,d);break e}u=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,d=typeof p=="function"?p.call(f,u,d):p,d==null)break e;u=Le({},u,d);break e;case 2:hr=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,d=s.effects,d===null?s.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(l=c=f,h=u):c=c.next=f,o|=d;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;d=a,a=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(c===null&&(h=u),s.baseState=h,s.firstBaseUpdate=l,s.lastBaseUpdate=c,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else n===null&&(s.shared.lanes=0);ts|=o,t.lanes=o,t.memoizedState=u}}function Hf(t,e,i){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=i,typeof s!="function")throw Error(I(191,s));s.call(r)}}}var So={},Ri=Tr(So),so=Tr(So),no=Tr(So);function Wr(t){if(t===So)throw Error(I(174));return t}function fd(t,e){switch(_e(no,e),_e(so,t),_e(Ri,So),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Zh(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Zh(e,t)}Se(Ri),_e(Ri,e)}function Ks(){Se(Ri),Se(so),Se(no)}function wv(t){Wr(no.current);var e=Wr(Ri.current),i=Zh(e,t.type);e!==i&&(_e(so,t),_e(Ri,i))}function _d(t){so.current===t&&(Se(Ri),Se(so))}var ke=Tr(0);function qa(t){for(var e=t;e!==null;){if(e.tag===13){var i=e.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var rh=[];function pd(){for(var t=0;t<rh.length;t++)rh[t]._workInProgressVersionPrimary=null;rh.length=0}var ua=Qi.ReactCurrentDispatcher,sh=Qi.ReactCurrentBatchConfig,es=0,Ee=null,He=null,Ge=null,Ga=!1,zn=!1,oo=0,sS=0;function ft(){throw Error(I(321))}function gd(t,e){if(e===null)return!1;for(var i=0;i<e.length&&i<t.length;i++)if(!vi(t[i],e[i]))return!1;return!0}function vd(t,e,i,r,s,n){if(es=n,Ee=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ua.current=t===null||t.memoizedState===null?lS:hS,t=i(r,s),zn){n=0;do{if(zn=!1,oo=0,25<=n)throw Error(I(301));n+=1,Ge=He=null,e.updateQueue=null,ua.current=cS,t=i(r,s)}while(zn)}if(ua.current=Ya,e=He!==null&&He.next!==null,es=0,Ge=He=Ee=null,Ga=!1,e)throw Error(I(300));return t}function md(){var t=oo!==0;return oo=0,t}function bi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ge===null?Ee.memoizedState=Ge=t:Ge=Ge.next=t,Ge}function ni(){if(He===null){var t=Ee.alternate;t=t!==null?t.memoizedState:null}else t=He.next;var e=Ge===null?Ee.memoizedState:Ge.next;if(e!==null)Ge=e,He=t;else{if(t===null)throw Error(I(310));He=t,t={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},Ge===null?Ee.memoizedState=Ge=t:Ge=Ge.next=t}return Ge}function ao(t,e){return typeof e=="function"?e(t):e}function nh(t){var e=ni(),i=e.queue;if(i===null)throw Error(I(311));i.lastRenderedReducer=t;var r=He,s=r.baseQueue,n=i.pending;if(n!==null){if(s!==null){var o=s.next;s.next=n.next,n.next=o}r.baseQueue=s=n,i.pending=null}if(s!==null){n=s.next,r=r.baseState;var a=o=null,h=null,l=n;do{var c=l.lane;if((es&c)===c)h!==null&&(h=h.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),r=l.hasEagerState?l.eagerState:t(r,l.action);else{var u={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};h===null?(a=h=u,o=r):h=h.next=u,Ee.lanes|=c,ts|=c}l=l.next}while(l!==null&&l!==n);h===null?o=r:h.next=a,vi(r,e.memoizedState)||(Pt=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=h,i.lastRenderedState=r}if(t=i.interleaved,t!==null){s=t;do n=s.lane,Ee.lanes|=n,ts|=n,s=s.next;while(s!==t)}else s===null&&(i.lanes=0);return[e.memoizedState,i.dispatch]}function oh(t){var e=ni(),i=e.queue;if(i===null)throw Error(I(311));i.lastRenderedReducer=t;var r=i.dispatch,s=i.pending,n=e.memoizedState;if(s!==null){i.pending=null;var o=s=s.next;do n=t(n,o.action),o=o.next;while(o!==s);vi(n,e.memoizedState)||(Pt=!0),e.memoizedState=n,e.baseQueue===null&&(e.baseState=n),i.lastRenderedState=n}return[n,r]}function xv(){}function Cv(t,e){var i=Ee,r=ni(),s=e(),n=!vi(r.memoizedState,s);if(n&&(r.memoizedState=s,Pt=!0),r=r.queue,yd(Ev.bind(null,i,r,t),[t]),r.getSnapshot!==e||n||Ge!==null&&Ge.memoizedState.tag&1){if(i.flags|=2048,lo(9,kv.bind(null,i,r,s,e),void 0,null),tt===null)throw Error(I(349));es&30||bv(i,e,s)}return s}function bv(t,e,i){t.flags|=16384,t={getSnapshot:e,value:i},e=Ee.updateQueue,e===null?(e={lastEffect:null,stores:null},Ee.updateQueue=e,e.stores=[t]):(i=e.stores,i===null?e.stores=[t]:i.push(t))}function kv(t,e,i,r){e.value=i,e.getSnapshot=r,Lv(e)&&Mv(t)}function Ev(t,e,i){return i(function(){Lv(e)&&Mv(t)})}function Lv(t){var e=t.getSnapshot;t=t.value;try{var i=e();return!vi(t,i)}catch{return!0}}function Mv(t){var e=Yi(t,1);e!==null&&gi(e,t,1,-1)}function Uf(t){var e=bi();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ao,lastRenderedState:t},e.queue=t,t=t.dispatch=aS.bind(null,Ee,t),[e.memoizedState,t]}function lo(t,e,i,r){return t={tag:t,create:e,destroy:i,deps:r,next:null},e=Ee.updateQueue,e===null?(e={lastEffect:null,stores:null},Ee.updateQueue=e,e.lastEffect=t.next=t):(i=e.lastEffect,i===null?e.lastEffect=t.next=t:(r=i.next,i.next=t,t.next=r,e.lastEffect=t)),t}function Rv(){return ni().memoizedState}function da(t,e,i,r){var s=bi();Ee.flags|=t,s.memoizedState=lo(1|e,i,void 0,r===void 0?null:r)}function ml(t,e,i,r){var s=ni();r=r===void 0?null:r;var n=void 0;if(He!==null){var o=He.memoizedState;if(n=o.destroy,r!==null&&gd(r,o.deps)){s.memoizedState=lo(e,i,n,r);return}}Ee.flags|=t,s.memoizedState=lo(1|e,i,n,r)}function Kf(t,e){return da(8390656,8,t,e)}function yd(t,e){return ml(2048,8,t,e)}function Tv(t,e){return ml(4,2,t,e)}function Pv(t,e){return ml(4,4,t,e)}function Dv(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Bv(t,e,i){return i=i!=null?i.concat([t]):null,ml(4,4,Dv.bind(null,e,t),i)}function Sd(){}function Av(t,e){var i=ni();e=e===void 0?null:e;var r=i.memoizedState;return r!==null&&e!==null&&gd(e,r[1])?r[0]:(i.memoizedState=[t,e],t)}function Nv(t,e){var i=ni();e=e===void 0?null:e;var r=i.memoizedState;return r!==null&&e!==null&&gd(e,r[1])?r[0]:(t=t(),i.memoizedState=[t,e],t)}function $v(t,e,i){return es&21?(vi(i,e)||(i=jg(),Ee.lanes|=i,ts|=i,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Pt=!0),t.memoizedState=i)}function nS(t,e){var i=he;he=i!==0&&4>i?i:4,t(!0);var r=sh.transition;sh.transition={};try{t(!1),e()}finally{he=i,sh.transition=r}}function Ov(){return ni().memoizedState}function oS(t,e,i){var r=Cr(t);if(i={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null},Iv(t))zv(e,i);else if(i=yv(t,e,i,r),i!==null){var s=Ct();gi(i,t,r,s),Fv(i,e,r)}}function aS(t,e,i){var r=Cr(t),s={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null};if(Iv(t))zv(e,s);else{var n=t.alternate;if(t.lanes===0&&(n===null||n.lanes===0)&&(n=e.lastRenderedReducer,n!==null))try{var o=e.lastRenderedState,a=n(o,i);if(s.hasEagerState=!0,s.eagerState=a,vi(a,o)){var h=e.interleaved;h===null?(s.next=s,ud(e)):(s.next=h.next,h.next=s),e.interleaved=s;return}}catch{}finally{}i=yv(t,e,s,r),i!==null&&(s=Ct(),gi(i,t,r,s),Fv(i,e,r))}}function Iv(t){var e=t.alternate;return t===Ee||e!==null&&e===Ee}function zv(t,e){zn=Ga=!0;var i=t.pending;i===null?e.next=e:(e.next=i.next,i.next=e),t.pending=e}function Fv(t,e,i){if(i&4194240){var r=e.lanes;r&=t.pendingLanes,i|=r,e.lanes=i,Qu(t,i)}}var Ya={readContext:si,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useInsertionEffect:ft,useLayoutEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useMutableSource:ft,useSyncExternalStore:ft,useId:ft,unstable_isNewReconciler:!1},lS={readContext:si,useCallback:function(t,e){return bi().memoizedState=[t,e===void 0?null:e],t},useContext:si,useEffect:Kf,useImperativeHandle:function(t,e,i){return i=i!=null?i.concat([t]):null,da(4194308,4,Dv.bind(null,e,t),i)},useLayoutEffect:function(t,e){return da(4194308,4,t,e)},useInsertionEffect:function(t,e){return da(4,2,t,e)},useMemo:function(t,e){var i=bi();return e=e===void 0?null:e,t=t(),i.memoizedState=[t,e],t},useReducer:function(t,e,i){var r=bi();return e=i!==void 0?i(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=oS.bind(null,Ee,t),[r.memoizedState,t]},useRef:function(t){var e=bi();return t={current:t},e.memoizedState=t},useState:Uf,useDebugValue:Sd,useDeferredValue:function(t){return bi().memoizedState=t},useTransition:function(){var t=Uf(!1),e=t[0];return t=nS.bind(null,t[1]),bi().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,i){var r=Ee,s=bi();if(we){if(i===void 0)throw Error(I(407));i=i()}else{if(i=e(),tt===null)throw Error(I(349));es&30||bv(r,e,i)}s.memoizedState=i;var n={value:i,getSnapshot:e};return s.queue=n,Kf(Ev.bind(null,r,n,t),[t]),r.flags|=2048,lo(9,kv.bind(null,r,n,i,e),void 0,null),i},useId:function(){var t=bi(),e=tt.identifierPrefix;if(we){var i=Hi,r=Wi;i=(r&~(1<<32-pi(r)-1)).toString(32)+i,e=":"+e+"R"+i,i=oo++,0<i&&(e+="H"+i.toString(32)),e+=":"}else i=sS++,e=":"+e+"r"+i.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},hS={readContext:si,useCallback:Av,useContext:si,useEffect:yd,useImperativeHandle:Bv,useInsertionEffect:Tv,useLayoutEffect:Pv,useMemo:Nv,useReducer:nh,useRef:Rv,useState:function(){return nh(ao)},useDebugValue:Sd,useDeferredValue:function(t){var e=ni();return $v(e,He.memoizedState,t)},useTransition:function(){var t=nh(ao)[0],e=ni().memoizedState;return[t,e]},useMutableSource:xv,useSyncExternalStore:Cv,useId:Ov,unstable_isNewReconciler:!1},cS={readContext:si,useCallback:Av,useContext:si,useEffect:yd,useImperativeHandle:Bv,useInsertionEffect:Tv,useLayoutEffect:Pv,useMemo:Nv,useReducer:oh,useRef:Rv,useState:function(){return oh(ao)},useDebugValue:Sd,useDeferredValue:function(t){var e=ni();return He===null?e.memoizedState=t:$v(e,He.memoizedState,t)},useTransition:function(){var t=oh(ao)[0],e=ni().memoizedState;return[t,e]},useMutableSource:xv,useSyncExternalStore:Cv,useId:Ov,unstable_isNewReconciler:!1};function di(t,e){if(t&&t.defaultProps){e=Le({},e),t=t.defaultProps;for(var i in t)e[i]===void 0&&(e[i]=t[i]);return e}return e}function yc(t,e,i,r){e=t.memoizedState,i=i(r,e),i=i==null?e:Le({},e,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var yl={isMounted:function(t){return(t=t._reactInternals)?as(t)===t:!1},enqueueSetState:function(t,e,i){t=t._reactInternals;var r=Ct(),s=Cr(t),n=Vi(r,s);n.payload=e,i!=null&&(n.callback=i),e=wr(t,n,s),e!==null&&(gi(e,t,s,r),ca(e,t,s))},enqueueReplaceState:function(t,e,i){t=t._reactInternals;var r=Ct(),s=Cr(t),n=Vi(r,s);n.tag=1,n.payload=e,i!=null&&(n.callback=i),e=wr(t,n,s),e!==null&&(gi(e,t,s,r),ca(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var i=Ct(),r=Cr(t),s=Vi(i,r);s.tag=2,e!=null&&(s.callback=e),e=wr(t,s,r),e!==null&&(gi(e,t,r,i),ca(e,t,r))}};function Vf(t,e,i,r,s,n,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,n,o):e.prototype&&e.prototype.isPureReactComponent?!eo(i,r)||!eo(s,n):!0}function jv(t,e,i){var r=!1,s=Lr,n=e.contextType;return typeof n=="object"&&n!==null?n=si(n):(s=Bt(e)?Zr:mt.current,r=e.contextTypes,n=(r=r!=null)?Ws(t,s):Lr),e=new e(i,n),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=yl,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=n),e}function qf(t,e,i,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(i,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(i,r),e.state!==t&&yl.enqueueReplaceState(e,e.state,null)}function Sc(t,e,i,r){var s=t.stateNode;s.props=i,s.state=t.memoizedState,s.refs={},dd(t);var n=e.contextType;typeof n=="object"&&n!==null?s.context=si(n):(n=Bt(e)?Zr:mt.current,s.context=Ws(t,n)),s.state=t.memoizedState,n=e.getDerivedStateFromProps,typeof n=="function"&&(yc(t,e,n,i),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&yl.enqueueReplaceState(s,s.state,null),Va(t,i,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function Vs(t,e){try{var i="",r=e;do i+=I1(r),r=r.return;while(r);var s=i}catch(n){s=`
|
|
37
|
+
`+s[o].replace(" at new "," at ");return t.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",t.displayName)),h}while(1<=o&&0<=a);break}}}finally{jl=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?bn(t):""}function I1(t){switch(t.tag){case 5:return bn(t.type);case 16:return bn("Lazy");case 13:return bn("Suspense");case 19:return bn("SuspenseList");case 0:case 2:case 15:return t=Wl(t.type,!1),t;case 11:return t=Wl(t.type.render,!1),t;case 1:return t=Wl(t.type,!0),t;default:return""}}function qh(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ms:return"Fragment";case vs:return"Portal";case Uh:return"Profiler";case Vu:return"StrictMode";case Kh:return"Suspense";case Vh:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Sg:return(t.displayName||"Context")+".Consumer";case yg:return(t._context.displayName||"Context")+".Provider";case qu:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Gu:return e=t.displayName||null,e!==null?e:qh(t.type)||"Memo";case lr:e=t._payload,t=t._init;try{return qh(t(e))}catch{}}return null}function z1(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return qh(e);case 8:return e===Vu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Er(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function xg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function F1(t){var e=xg(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var s=i.get,n=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,n.call(this,o)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Po(t){t._valueTracker||(t._valueTracker=F1(t))}function Cg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var i=e.getValue(),r="";return t&&(r=xg(t)?t.checked?"true":"false":t.value),t=r,t!==i?(e.setValue(t),!0):!1}function Pa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Gh(t,e){var i=e.checked;return Le({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function cf(t,e){var i=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;i=Er(e.value!=null?e.value:i),t._wrapperState={initialChecked:r,initialValue:i,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function bg(t,e){e=e.checked,e!=null&&Ku(t,"checked",e,!1)}function Yh(t,e){bg(t,e);var i=Er(e.value),r=e.type;if(i!=null)r==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Xh(t,e.type,i):e.hasOwnProperty("defaultValue")&&Xh(t,e.type,Er(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function uf(t,e,i){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,i||e===t.value||(t.value=e),t.defaultValue=e}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function Xh(t,e,i){(e!=="number"||Pa(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var kn=Array.isArray;function Bs(t,e,i,r){if(t=t.options,e){e={};for(var s=0;s<i.length;s++)e["$"+i[s]]=!0;for(i=0;i<t.length;i++)s=e.hasOwnProperty("$"+t[i].value),t[i].selected!==s&&(t[i].selected=s),s&&r&&(t[i].defaultSelected=!0)}else{for(i=""+Er(i),e=null,s=0;s<t.length;s++){if(t[s].value===i){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function Qh(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(I(91));return Le({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function df(t,e){var i=e.value;if(i==null){if(i=e.children,e=e.defaultValue,i!=null){if(e!=null)throw Error(I(92));if(kn(i)){if(1<i.length)throw Error(I(93));i=i[0]}e=i}e==null&&(e=""),i=e}t._wrapperState={initialValue:Er(i)}}function kg(t,e){var i=Er(e.value),r=Er(e.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),e.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),r!=null&&(t.defaultValue=""+r)}function ff(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Eg(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Zh(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Eg(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Do,Lg=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,i,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,i,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Do=Do||document.createElement("div"),Do.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Do.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Gn(t,e){if(e){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=e;return}}t.textContent=e}var An={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},j1=["Webkit","ms","Moz","O"];Object.keys(An).forEach(function(t){j1.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),An[e]=An[t]})});function Mg(t,e,i){return e==null||typeof e=="boolean"||e===""?"":i||typeof e!="number"||e===0||An.hasOwnProperty(t)&&An[t]?(""+e).trim():e+"px"}function Rg(t,e){t=t.style;for(var i in e)if(e.hasOwnProperty(i)){var r=i.indexOf("--")===0,s=Mg(i,e[i],r);i==="float"&&(i="cssFloat"),r?t.setProperty(i,s):t[i]=s}}var W1=Le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Jh(t,e){if(e){if(W1[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(I(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(I(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(I(61))}if(e.style!=null&&typeof e.style!="object")throw Error(I(62))}}function ec(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 tc=null;function Yu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var ic=null,As=null,Ns=null;function _f(t){if(t=yo(t)){if(typeof ic!="function")throw Error(I(280));var e=t.stateNode;e&&(e=gl(e),ic(t.stateNode,t.type,e))}}function Tg(t){As?Ns?Ns.push(t):Ns=[t]:As=t}function Pg(){if(As){var t=As,e=Ns;if(Ns=As=null,_f(t),e)for(t=0;t<e.length;t++)_f(e[t])}}function Dg(t,e){return t(e)}function Bg(){}var Hl=!1;function Ag(t,e,i){if(Hl)return t(e,i);Hl=!0;try{return Dg(t,e,i)}finally{Hl=!1,(As!==null||Ns!==null)&&(Bg(),Pg())}}function Yn(t,e){var i=t.stateNode;if(i===null)return null;var r=gl(i);if(r===null)return null;i=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(I(231,e,typeof i));return i}var rc=!1;if(qi)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){rc=!0}}),window.addEventListener("test",nn,nn),window.removeEventListener("test",nn,nn)}catch{rc=!1}function H1(t,e,i,r,s,n,o,a,h){var l=Array.prototype.slice.call(arguments,3);try{e.apply(i,l)}catch(c){this.onError(c)}}var Nn=!1,Da=null,Ba=!1,sc=null,U1={onError:function(t){Nn=!0,Da=t}};function K1(t,e,i,r,s,n,o,a,h){Nn=!1,Da=null,H1.apply(U1,arguments)}function V1(t,e,i,r,s,n,o,a,h){if(K1.apply(this,arguments),Nn){if(Nn){var l=Da;Nn=!1,Da=null}else throw Error(I(198));Ba||(Ba=!0,sc=l)}}function as(t){var e=t,i=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(i=e.return),t=e.return;while(t)}return e.tag===3?i:null}function Ng(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function pf(t){if(as(t)!==t)throw Error(I(188))}function q1(t){var e=t.alternate;if(!e){if(e=as(t),e===null)throw Error(I(188));return e!==t?null:t}for(var i=t,r=e;;){var s=i.return;if(s===null)break;var n=s.alternate;if(n===null){if(r=s.return,r!==null){i=r;continue}break}if(s.child===n.child){for(n=s.child;n;){if(n===i)return pf(s),t;if(n===r)return pf(s),e;n=n.sibling}throw Error(I(188))}if(i.return!==r.return)i=s,r=n;else{for(var o=!1,a=s.child;a;){if(a===i){o=!0,i=s,r=n;break}if(a===r){o=!0,r=s,i=n;break}a=a.sibling}if(!o){for(a=n.child;a;){if(a===i){o=!0,i=n,r=s;break}if(a===r){o=!0,r=n,i=s;break}a=a.sibling}if(!o)throw Error(I(189))}}if(i.alternate!==r)throw Error(I(190))}if(i.tag!==3)throw Error(I(188));return i.stateNode.current===i?t:e}function $g(t){return t=q1(t),t!==null?Og(t):null}function Og(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Og(t);if(e!==null)return e;t=t.sibling}return null}var Ig=jt.unstable_scheduleCallback,gf=jt.unstable_cancelCallback,G1=jt.unstable_shouldYield,Y1=jt.unstable_requestPaint,Ne=jt.unstable_now,X1=jt.unstable_getCurrentPriorityLevel,Xu=jt.unstable_ImmediatePriority,zg=jt.unstable_UserBlockingPriority,Aa=jt.unstable_NormalPriority,Q1=jt.unstable_LowPriority,Fg=jt.unstable_IdlePriority,dl=null,Mi=null;function Z1(t){if(Mi&&typeof Mi.onCommitFiberRoot=="function")try{Mi.onCommitFiberRoot(dl,t,void 0,(t.current.flags&128)===128)}catch{}}var pi=Math.clz32?Math.clz32:ty,J1=Math.log,ey=Math.LN2;function ty(t){return t>>>=0,t===0?32:31-(J1(t)/ey|0)|0}var Bo=64,Ao=4194304;function En(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Na(t,e){var i=t.pendingLanes;if(i===0)return 0;var r=0,s=t.suspendedLanes,n=t.pingedLanes,o=i&268435455;if(o!==0){var a=o&~s;a!==0?r=En(a):(n&=o,n!==0&&(r=En(n)))}else o=i&~s,o!==0?r=En(o):n!==0&&(r=En(n));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,n=e&-e,s>=n||s===16&&(n&4194240)!==0))return e;if(r&4&&(r|=i&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)i=31-pi(e),s=1<<i,r|=t[i],e&=~s;return r}function iy(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ry(t,e){for(var i=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,n=t.pendingLanes;0<n;){var o=31-pi(n),a=1<<o,h=s[o];h===-1?(!(a&i)||a&r)&&(s[o]=iy(a,e)):h<=e&&(t.expiredLanes|=a),n&=~a}}function nc(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function jg(){var t=Bo;return Bo<<=1,!(Bo&4194240)&&(Bo=64),t}function Ul(t){for(var e=[],i=0;31>i;i++)e.push(t);return e}function vo(t,e,i){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-pi(e),t[e]=i}function sy(t,e){var i=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<i;){var s=31-pi(i),n=1<<s;e[s]=0,r[s]=-1,t[s]=-1,i&=~n}}function Qu(t,e){var i=t.entangledLanes|=e;for(t=t.entanglements;i;){var r=31-pi(i),s=1<<r;s&e|t[r]&e&&(t[r]|=e),i&=~s}}var he=0;function Wg(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Hg,Zu,Ug,Kg,Vg,oc=!1,No=[],vr=null,mr=null,yr=null,Xn=new Map,Qn=new Map,ur=[],ny="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function vf(t,e){switch(t){case"focusin":case"focusout":vr=null;break;case"dragenter":case"dragleave":mr=null;break;case"mouseover":case"mouseout":yr=null;break;case"pointerover":case"pointerout":Xn.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qn.delete(e.pointerId)}}function on(t,e,i,r,s,n){return t===null||t.nativeEvent!==n?(t={blockedOn:e,domEventName:i,eventSystemFlags:r,nativeEvent:n,targetContainers:[s]},e!==null&&(e=yo(e),e!==null&&Zu(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function oy(t,e,i,r,s){switch(e){case"focusin":return vr=on(vr,t,e,i,r,s),!0;case"dragenter":return mr=on(mr,t,e,i,r,s),!0;case"mouseover":return yr=on(yr,t,e,i,r,s),!0;case"pointerover":var n=s.pointerId;return Xn.set(n,on(Xn.get(n)||null,t,e,i,r,s)),!0;case"gotpointercapture":return n=s.pointerId,Qn.set(n,on(Qn.get(n)||null,t,e,i,r,s)),!0}return!1}function qg(t){var e=Fr(t.target);if(e!==null){var i=as(e);if(i!==null){if(e=i.tag,e===13){if(e=Ng(i),e!==null){t.blockedOn=e,Vg(t.priority,function(){Ug(i)});return}}else if(e===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function aa(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var i=ac(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var r=new i.constructor(i.type,i);tc=r,i.target.dispatchEvent(r),tc=null}else return e=yo(i),e!==null&&Zu(e),t.blockedOn=i,!1;e.shift()}return!0}function mf(t,e,i){aa(t)&&i.delete(e)}function ay(){oc=!1,vr!==null&&aa(vr)&&(vr=null),mr!==null&&aa(mr)&&(mr=null),yr!==null&&aa(yr)&&(yr=null),Xn.forEach(mf),Qn.forEach(mf)}function an(t,e){t.blockedOn===e&&(t.blockedOn=null,oc||(oc=!0,jt.unstable_scheduleCallback(jt.unstable_NormalPriority,ay)))}function Zn(t){function e(s){return an(s,t)}if(0<No.length){an(No[0],t);for(var i=1;i<No.length;i++){var r=No[i];r.blockedOn===t&&(r.blockedOn=null)}}for(vr!==null&&an(vr,t),mr!==null&&an(mr,t),yr!==null&&an(yr,t),Xn.forEach(e),Qn.forEach(e),i=0;i<ur.length;i++)r=ur[i],r.blockedOn===t&&(r.blockedOn=null);for(;0<ur.length&&(i=ur[0],i.blockedOn===null);)qg(i),i.blockedOn===null&&ur.shift()}var $s=Qi.ReactCurrentBatchConfig,$a=!0;function ly(t,e,i,r){var s=he,n=$s.transition;$s.transition=null;try{he=1,Ju(t,e,i,r)}finally{he=s,$s.transition=n}}function hy(t,e,i,r){var s=he,n=$s.transition;$s.transition=null;try{he=4,Ju(t,e,i,r)}finally{he=s,$s.transition=n}}function Ju(t,e,i,r){if($a){var s=ac(t,e,i,r);if(s===null)eh(t,e,r,Oa,i),vf(t,r);else if(oy(s,t,e,i,r))r.stopPropagation();else if(vf(t,r),e&4&&-1<ny.indexOf(t)){for(;s!==null;){var n=yo(s);if(n!==null&&Hg(n),n=ac(t,e,i,r),n===null&&eh(t,e,r,Oa,i),n===s)break;s=n}s!==null&&r.stopPropagation()}else eh(t,e,r,null,i)}}var Oa=null;function ac(t,e,i,r){if(Oa=null,t=Yu(r),t=Fr(t),t!==null)if(e=as(t),e===null)t=null;else if(i=e.tag,i===13){if(t=Ng(e),t!==null)return t;t=null}else if(i===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Oa=t,null}function Gg(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(X1()){case Xu:return 1;case zg:return 4;case Aa:case Q1:return 16;case Fg:return 536870912;default:return 16}default:return 16}}var fr=null,ed=null,la=null;function Yg(){if(la)return la;var t,e=ed,i=e.length,r,s="value"in fr?fr.value:fr.textContent,n=s.length;for(t=0;t<i&&e[t]===s[t];t++);var o=i-t;for(r=1;r<=o&&e[i-r]===s[n-r];r++);return la=s.slice(t,1<r?1-r:void 0)}function ha(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function $o(){return!0}function yf(){return!1}function Ht(t){function e(i,r,s,n,o){this._reactName=i,this._targetInst=s,this.type=r,this.nativeEvent=n,this.target=o,this.currentTarget=null;for(var a in t)t.hasOwnProperty(a)&&(i=t[a],this[a]=i?i(n):n[a]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?$o:yf,this.isPropagationStopped=yf,this}return Le(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=$o)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=$o)},persist:function(){},isPersistent:$o}),e}var Qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},td=Ht(Qs),mo=Le({},Qs,{view:0,detail:0}),cy=Ht(mo),Kl,Vl,ln,fl=Le({},mo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:id,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ln&&(ln&&t.type==="mousemove"?(Kl=t.screenX-ln.screenX,Vl=t.screenY-ln.screenY):Vl=Kl=0,ln=t),Kl)},movementY:function(t){return"movementY"in t?t.movementY:Vl}}),Sf=Ht(fl),uy=Le({},fl,{dataTransfer:0}),dy=Ht(uy),fy=Le({},mo,{relatedTarget:0}),ql=Ht(fy),_y=Le({},Qs,{animationName:0,elapsedTime:0,pseudoElement:0}),py=Ht(_y),gy=Le({},Qs,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),vy=Ht(gy),my=Le({},Qs,{data:0}),wf=Ht(my),yy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sy={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"},wy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xy(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=wy[t])?!!e[t]:!1}function id(){return xy}var Cy=Le({},mo,{key:function(t){if(t.key){var e=yy[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=ha(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Sy[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:id,charCode:function(t){return t.type==="keypress"?ha(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ha(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),by=Ht(Cy),ky=Le({},fl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),xf=Ht(ky),Ey=Le({},mo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:id}),Ly=Ht(Ey),My=Le({},Qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ry=Ht(My),Ty=Le({},fl,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Py=Ht(Ty),Dy=[9,13,27,32],rd=qi&&"CompositionEvent"in window,$n=null;qi&&"documentMode"in document&&($n=document.documentMode);var By=qi&&"TextEvent"in window&&!$n,Xg=qi&&(!rd||$n&&8<$n&&11>=$n),Cf=" ",bf=!1;function Qg(t,e){switch(t){case"keyup":return Dy.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ys=!1;function Ay(t,e){switch(t){case"compositionend":return Zg(e);case"keypress":return e.which!==32?null:(bf=!0,Cf);case"textInput":return t=e.data,t===Cf&&bf?null:t;default:return null}}function Ny(t,e){if(ys)return t==="compositionend"||!rd&&Qg(t,e)?(t=Yg(),la=ed=fr=null,ys=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Xg&&e.locale!=="ko"?null:e.data;default:return null}}var $y={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 kf(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!$y[t.type]:e==="textarea"}function Jg(t,e,i,r){Tg(r),e=Ia(e,"onChange"),0<e.length&&(i=new td("onChange","change",null,i,r),t.push({event:i,listeners:e}))}var On=null,Jn=null;function Oy(t){cv(t,0)}function _l(t){var e=xs(t);if(Cg(e))return t}function Iy(t,e){if(t==="change")return e}var ev=!1;if(qi){var Gl;if(qi){var Yl="oninput"in document;if(!Yl){var Ef=document.createElement("div");Ef.setAttribute("oninput","return;"),Yl=typeof Ef.oninput=="function"}Gl=Yl}else Gl=!1;ev=Gl&&(!document.documentMode||9<document.documentMode)}function Lf(){On&&(On.detachEvent("onpropertychange",tv),Jn=On=null)}function tv(t){if(t.propertyName==="value"&&_l(Jn)){var e=[];Jg(e,Jn,t,Yu(t)),Ag(Oy,e)}}function zy(t,e,i){t==="focusin"?(Lf(),On=e,Jn=i,On.attachEvent("onpropertychange",tv)):t==="focusout"&&Lf()}function Fy(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return _l(Jn)}function jy(t,e){if(t==="click")return _l(e)}function Wy(t,e){if(t==="input"||t==="change")return _l(e)}function Hy(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var vi=typeof Object.is=="function"?Object.is:Hy;function eo(t,e){if(vi(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length)return!1;for(r=0;r<i.length;r++){var s=i[r];if(!Hh.call(e,s)||!vi(t[s],e[s]))return!1}return!0}function Mf(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Rf(t,e){var i=Mf(t);t=0;for(var r;i;){if(i.nodeType===3){if(r=t+i.textContent.length,t<=e&&r>=e)return{node:i,offset:e-t};t=r}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Mf(i)}}function iv(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?iv(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function rv(){for(var t=window,e=Pa();e instanceof t.HTMLIFrameElement;){try{var i=typeof e.contentWindow.location.href=="string"}catch{i=!1}if(i)t=e.contentWindow;else break;e=Pa(t.document)}return e}function sd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Uy(t){var e=rv(),i=t.focusedElem,r=t.selectionRange;if(e!==i&&i&&i.ownerDocument&&iv(i.ownerDocument.documentElement,i)){if(r!==null&&sd(i)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in i)i.selectionStart=e,i.selectionEnd=Math.min(t,i.value.length);else if(t=(e=i.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=i.textContent.length,n=Math.min(r.start,s);r=r.end===void 0?n:Math.min(r.end,s),!t.extend&&n>r&&(s=r,r=n,n=s),s=Rf(i,n);var o=Rf(i,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),n>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=i;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<e.length;i++)t=e[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Ky=qi&&"documentMode"in document&&11>=document.documentMode,Ss=null,lc=null,In=null,hc=!1;function Tf(t,e,i){var r=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;hc||Ss==null||Ss!==Pa(r)||(r=Ss,"selectionStart"in r&&sd(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),In&&eo(In,r)||(In=r,r=Ia(lc,"onSelect"),0<r.length&&(e=new td("onSelect","select",null,e,i),t.push({event:e,listeners:r}),e.target=Ss)))}function Oo(t,e){var i={};return i[t.toLowerCase()]=e.toLowerCase(),i["Webkit"+t]="webkit"+e,i["Moz"+t]="moz"+e,i}var ws={animationend:Oo("Animation","AnimationEnd"),animationiteration:Oo("Animation","AnimationIteration"),animationstart:Oo("Animation","AnimationStart"),transitionend:Oo("Transition","TransitionEnd")},Xl={},sv={};qi&&(sv=document.createElement("div").style,"AnimationEvent"in window||(delete ws.animationend.animation,delete ws.animationiteration.animation,delete ws.animationstart.animation),"TransitionEvent"in window||delete ws.transitionend.transition);function pl(t){if(Xl[t])return Xl[t];if(!ws[t])return t;var e=ws[t],i;for(i in e)if(e.hasOwnProperty(i)&&i in sv)return Xl[t]=e[i];return t}var nv=pl("animationend"),ov=pl("animationiteration"),av=pl("animationstart"),lv=pl("transitionend"),hv=new Map,Pf="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Rr(t,e){hv.set(t,e),os(e,[t])}for(var Ql=0;Ql<Pf.length;Ql++){var Zl=Pf[Ql],Vy=Zl.toLowerCase(),qy=Zl[0].toUpperCase()+Zl.slice(1);Rr(Vy,"on"+qy)}Rr(nv,"onAnimationEnd");Rr(ov,"onAnimationIteration");Rr(av,"onAnimationStart");Rr("dblclick","onDoubleClick");Rr("focusin","onFocus");Rr("focusout","onBlur");Rr(lv,"onTransitionEnd");js("onMouseEnter",["mouseout","mouseover"]);js("onMouseLeave",["mouseout","mouseover"]);js("onPointerEnter",["pointerout","pointerover"]);js("onPointerLeave",["pointerout","pointerover"]);os("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));os("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));os("onBeforeInput",["compositionend","keypress","textInput","paste"]);os("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));os("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));os("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ln="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(" "),Gy=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ln));function Df(t,e,i){var r=t.type||"unknown-event";t.currentTarget=i,V1(r,e,void 0,t),t.currentTarget=null}function cv(t,e){e=(e&4)!==0;for(var i=0;i<t.length;i++){var r=t[i],s=r.event;r=r.listeners;e:{var n=void 0;if(e)for(var o=r.length-1;0<=o;o--){var a=r[o],h=a.instance,l=a.currentTarget;if(a=a.listener,h!==n&&s.isPropagationStopped())break e;Df(s,a,l),n=h}else for(o=0;o<r.length;o++){if(a=r[o],h=a.instance,l=a.currentTarget,a=a.listener,h!==n&&s.isPropagationStopped())break e;Df(s,a,l),n=h}}}if(Ba)throw t=sc,Ba=!1,sc=null,t}function ve(t,e){var i=e[_c];i===void 0&&(i=e[_c]=new Set);var r=t+"__bubble";i.has(r)||(uv(e,t,2,!1),i.add(r))}function Jl(t,e,i){var r=0;e&&(r|=4),uv(i,t,r,e)}var Io="_reactListening"+Math.random().toString(36).slice(2);function to(t){if(!t[Io]){t[Io]=!0,mg.forEach(function(i){i!=="selectionchange"&&(Gy.has(i)||Jl(i,!1,t),Jl(i,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Io]||(e[Io]=!0,Jl("selectionchange",!1,e))}}function uv(t,e,i,r){switch(Gg(e)){case 1:var s=ly;break;case 4:s=hy;break;default:s=Ju}i=s.bind(null,e,i,t),s=void 0,!rc||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,i,{capture:!0,passive:s}):t.addEventListener(e,i,!0):s!==void 0?t.addEventListener(e,i,{passive:s}):t.addEventListener(e,i,!1)}function eh(t,e,i,r,s){var n=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s||a.nodeType===8&&a.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var h=o.tag;if((h===3||h===4)&&(h=o.stateNode.containerInfo,h===s||h.nodeType===8&&h.parentNode===s))return;o=o.return}for(;a!==null;){if(o=Fr(a),o===null)return;if(h=o.tag,h===5||h===6){r=n=o;continue e}a=a.parentNode}}r=r.return}Ag(function(){var l=n,c=Yu(i),u=[];e:{var d=hv.get(t);if(d!==void 0){var f=td,p=t;switch(t){case"keypress":if(ha(i)===0)break e;case"keydown":case"keyup":f=by;break;case"focusin":p="focus",f=ql;break;case"focusout":p="blur",f=ql;break;case"beforeblur":case"afterblur":f=ql;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=Sf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=dy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=Ly;break;case nv:case ov:case av:f=py;break;case lv:f=Ry;break;case"scroll":f=cy;break;case"wheel":f=Py;break;case"copy":case"cut":case"paste":f=vy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=xf}var m=(e&4)!==0,x=!m&&t==="scroll",_=m?d!==null?d+"Capture":null:d;m=[];for(var g=l,S;g!==null;){S=g;var y=S.stateNode;if(S.tag===5&&y!==null&&(S=y,_!==null&&(y=Yn(g,_),y!=null&&m.push(io(g,y,S)))),x)break;g=g.return}0<m.length&&(d=new f(d,p,null,i,c),u.push({event:d,listeners:m}))}}if(!(e&7)){e:{if(d=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",d&&i!==tc&&(p=i.relatedTarget||i.fromElement)&&(Fr(p)||p[Gi]))break e;if((f||d)&&(d=c.window===c?c:(d=c.ownerDocument)?d.defaultView||d.parentWindow:window,f?(p=i.relatedTarget||i.toElement,f=l,p=p?Fr(p):null,p!==null&&(x=as(p),p!==x||p.tag!==5&&p.tag!==6)&&(p=null)):(f=null,p=l),f!==p)){if(m=Sf,y="onMouseLeave",_="onMouseEnter",g="mouse",(t==="pointerout"||t==="pointerover")&&(m=xf,y="onPointerLeave",_="onPointerEnter",g="pointer"),x=f==null?d:xs(f),S=p==null?d:xs(p),d=new m(y,g+"leave",f,i,c),d.target=x,d.relatedTarget=S,y=null,Fr(c)===l&&(m=new m(_,g+"enter",p,i,c),m.target=S,m.relatedTarget=x,y=m),x=y,f&&p)t:{for(m=f,_=p,g=0,S=m;S;S=us(S))g++;for(S=0,y=_;y;y=us(y))S++;for(;0<g-S;)m=us(m),g--;for(;0<S-g;)_=us(_),S--;for(;g--;){if(m===_||_!==null&&m===_.alternate)break t;m=us(m),_=us(_)}m=null}else m=null;f!==null&&Bf(u,d,f,m,!1),p!==null&&x!==null&&Bf(u,x,p,m,!0)}}e:{if(d=l?xs(l):window,f=d.nodeName&&d.nodeName.toLowerCase(),f==="select"||f==="input"&&d.type==="file")var L=Iy;else if(kf(d))if(ev)L=Wy;else{L=Fy;var P=zy}else(f=d.nodeName)&&f.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(L=jy);if(L&&(L=L(t,l))){Jg(u,L,i,c);break e}P&&P(t,d,l),t==="focusout"&&(P=d._wrapperState)&&P.controlled&&d.type==="number"&&Xh(d,"number",d.value)}switch(P=l?xs(l):window,t){case"focusin":(kf(P)||P.contentEditable==="true")&&(Ss=P,lc=l,In=null);break;case"focusout":In=lc=Ss=null;break;case"mousedown":hc=!0;break;case"contextmenu":case"mouseup":case"dragend":hc=!1,Tf(u,i,c);break;case"selectionchange":if(Ky)break;case"keydown":case"keyup":Tf(u,i,c)}var N;if(rd)e:{switch(t){case"compositionstart":var B="onCompositionStart";break e;case"compositionend":B="onCompositionEnd";break e;case"compositionupdate":B="onCompositionUpdate";break e}B=void 0}else ys?Qg(t,i)&&(B="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(B="onCompositionStart");B&&(Xg&&i.locale!=="ko"&&(ys||B!=="onCompositionStart"?B==="onCompositionEnd"&&ys&&(N=Yg()):(fr=c,ed="value"in fr?fr.value:fr.textContent,ys=!0)),P=Ia(l,B),0<P.length&&(B=new wf(B,t,null,i,c),u.push({event:B,listeners:P}),N?B.data=N:(N=Zg(i),N!==null&&(B.data=N)))),(N=By?Ay(t,i):Ny(t,i))&&(l=Ia(l,"onBeforeInput"),0<l.length&&(c=new wf("onBeforeInput","beforeinput",null,i,c),u.push({event:c,listeners:l}),c.data=N))}cv(u,e)})}function io(t,e,i){return{instance:t,listener:e,currentTarget:i}}function Ia(t,e){for(var i=e+"Capture",r=[];t!==null;){var s=t,n=s.stateNode;s.tag===5&&n!==null&&(s=n,n=Yn(t,i),n!=null&&r.unshift(io(t,n,s)),n=Yn(t,e),n!=null&&r.push(io(t,n,s))),t=t.return}return r}function us(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Bf(t,e,i,r,s){for(var n=e._reactName,o=[];i!==null&&i!==r;){var a=i,h=a.alternate,l=a.stateNode;if(h!==null&&h===r)break;a.tag===5&&l!==null&&(a=l,s?(h=Yn(i,n),h!=null&&o.unshift(io(i,h,a))):s||(h=Yn(i,n),h!=null&&o.push(io(i,h,a)))),i=i.return}o.length!==0&&t.push({event:e,listeners:o})}var Yy=/\r\n?/g,Xy=/\u0000|\uFFFD/g;function Af(t){return(typeof t=="string"?t:""+t).replace(Yy,`
|
|
38
|
+
`).replace(Xy,"")}function zo(t,e,i){if(e=Af(e),Af(t)!==e&&i)throw Error(I(425))}function za(){}var cc=null,uc=null;function dc(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var fc=typeof setTimeout=="function"?setTimeout:void 0,Qy=typeof clearTimeout=="function"?clearTimeout:void 0,Nf=typeof Promise=="function"?Promise:void 0,Zy=typeof queueMicrotask=="function"?queueMicrotask:typeof Nf<"u"?function(t){return Nf.resolve(null).then(t).catch(Jy)}:fc;function Jy(t){setTimeout(function(){throw t})}function th(t,e){var i=e,r=0;do{var s=i.nextSibling;if(t.removeChild(i),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(r===0){t.removeChild(s),Zn(e);return}r--}else i!=="$"&&i!=="$?"&&i!=="$!"||r++;i=s}while(i);Zn(e)}function Sr(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function $f(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(e===0)return t;e--}else i==="/$"&&e++}t=t.previousSibling}return null}var Zs=Math.random().toString(36).slice(2),Ei="__reactFiber$"+Zs,ro="__reactProps$"+Zs,Gi="__reactContainer$"+Zs,_c="__reactEvents$"+Zs,eS="__reactListeners$"+Zs,tS="__reactHandles$"+Zs;function Fr(t){var e=t[Ei];if(e)return e;for(var i=t.parentNode;i;){if(e=i[Gi]||i[Ei]){if(i=e.alternate,e.child!==null||i!==null&&i.child!==null)for(t=$f(t);t!==null;){if(i=t[Ei])return i;t=$f(t)}return e}t=i,i=t.parentNode}return null}function yo(t){return t=t[Ei]||t[Gi],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function xs(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(I(33))}function gl(t){return t[ro]||null}var pc=[],Cs=-1;function Tr(t){return{current:t}}function Se(t){0>Cs||(t.current=pc[Cs],pc[Cs]=null,Cs--)}function pe(t,e){Cs++,pc[Cs]=t.current,t.current=e}var Lr={},mt=Tr(Lr),Dt=Tr(!1),Zr=Lr;function Ws(t,e){var i=t.type.contextTypes;if(!i)return Lr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},n;for(n in i)s[n]=e[n];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Bt(t){return t=t.childContextTypes,t!=null}function Fa(){Se(Dt),Se(mt)}function Of(t,e,i){if(mt.current!==Lr)throw Error(I(168));pe(mt,e),pe(Dt,i)}function dv(t,e,i){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return i;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(I(108,z1(t)||"Unknown",s));return Le({},i,r)}function ja(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Lr,Zr=mt.current,pe(mt,t),pe(Dt,Dt.current),!0}function If(t,e,i){var r=t.stateNode;if(!r)throw Error(I(169));i?(t=dv(t,e,Zr),r.__reactInternalMemoizedMergedChildContext=t,Se(Dt),Se(mt),pe(mt,t)):Se(Dt),pe(Dt,i)}var ji=null,vl=!1,ih=!1;function fv(t){ji===null?ji=[t]:ji.push(t)}function iS(t){vl=!0,fv(t)}function Pr(){if(!ih&&ji!==null){ih=!0;var t=0,e=he;try{var i=ji;for(he=1;t<i.length;t++){var r=i[t];do r=r(!0);while(r!==null)}ji=null,vl=!1}catch(s){throw ji!==null&&(ji=ji.slice(t+1)),Ig(Xu,Pr),s}finally{he=e,ih=!1}}return null}var bs=[],ks=0,Wa=null,Ha=0,Zt=[],Jt=0,Jr=null,Wi=1,Hi="";function $r(t,e){bs[ks++]=Ha,bs[ks++]=Wa,Wa=t,Ha=e}function _v(t,e,i){Zt[Jt++]=Wi,Zt[Jt++]=Hi,Zt[Jt++]=Jr,Jr=t;var r=Wi;t=Hi;var s=32-pi(r)-1;r&=~(1<<s),i+=1;var n=32-pi(e)+s;if(30<n){var o=s-s%5;n=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Wi=1<<32-pi(e)+s|i<<s|r,Hi=n+t}else Wi=1<<n|i<<s|r,Hi=t}function nd(t){t.return!==null&&($r(t,1),_v(t,1,0))}function od(t){for(;t===Wa;)Wa=bs[--ks],bs[ks]=null,Ha=bs[--ks],bs[ks]=null;for(;t===Jr;)Jr=Zt[--Jt],Zt[Jt]=null,Hi=Zt[--Jt],Zt[Jt]=null,Wi=Zt[--Jt],Zt[Jt]=null}var Ft=null,zt=null,we=!1,_i=null;function pv(t,e){var i=ti(5,null,null,0);i.elementType="DELETED",i.stateNode=e,i.return=t,e=t.deletions,e===null?(t.deletions=[i],t.flags|=16):e.push(i)}function zf(t,e){switch(t.tag){case 5:var i=t.type;return e=e.nodeType!==1||i.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Ft=t,zt=Sr(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Ft=t,zt=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(i=Jr!==null?{id:Wi,overflow:Hi}:null,t.memoizedState={dehydrated:e,treeContext:i,retryLane:1073741824},i=ti(18,null,null,0),i.stateNode=e,i.return=t,t.child=i,Ft=t,zt=null,!0):!1;default:return!1}}function gc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function vc(t){if(we){var e=zt;if(e){var i=e;if(!zf(t,e)){if(gc(t))throw Error(I(418));e=Sr(i.nextSibling);var r=Ft;e&&zf(t,e)?pv(r,i):(t.flags=t.flags&-4097|2,we=!1,Ft=t)}}else{if(gc(t))throw Error(I(418));t.flags=t.flags&-4097|2,we=!1,Ft=t}}}function Ff(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Ft=t}function Fo(t){if(t!==Ft)return!1;if(!we)return Ff(t),we=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!dc(t.type,t.memoizedProps)),e&&(e=zt)){if(gc(t))throw gv(),Error(I(418));for(;e;)pv(t,e),e=Sr(e.nextSibling)}if(Ff(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(I(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(e===0){zt=Sr(t.nextSibling);break e}e--}else i!=="$"&&i!=="$!"&&i!=="$?"||e++}t=t.nextSibling}zt=null}}else zt=Ft?Sr(t.stateNode.nextSibling):null;return!0}function gv(){for(var t=zt;t;)t=Sr(t.nextSibling)}function Hs(){zt=Ft=null,we=!1}function ad(t){_i===null?_i=[t]:_i.push(t)}var rS=Qi.ReactCurrentBatchConfig;function hn(t,e,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(I(309));var r=i.stateNode}if(!r)throw Error(I(147,t));var s=r,n=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===n?e.ref:(e=function(o){var a=s.refs;o===null?delete a[n]:a[n]=o},e._stringRef=n,e)}if(typeof t!="string")throw Error(I(284));if(!i._owner)throw Error(I(290,t))}return t}function jo(t,e){throw t=Object.prototype.toString.call(e),Error(I(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function jf(t){var e=t._init;return e(t._payload)}function vv(t){function e(_,g){if(t){var S=_.deletions;S===null?(_.deletions=[g],_.flags|=16):S.push(g)}}function i(_,g){if(!t)return null;for(;g!==null;)e(_,g),g=g.sibling;return null}function r(_,g){for(_=new Map;g!==null;)g.key!==null?_.set(g.key,g):_.set(g.index,g),g=g.sibling;return _}function s(_,g){return _=br(_,g),_.index=0,_.sibling=null,_}function n(_,g,S){return _.index=S,t?(S=_.alternate,S!==null?(S=S.index,S<g?(_.flags|=2,g):S):(_.flags|=2,g)):(_.flags|=1048576,g)}function o(_){return t&&_.alternate===null&&(_.flags|=2),_}function a(_,g,S,y){return g===null||g.tag!==6?(g=hh(S,_.mode,y),g.return=_,g):(g=s(g,S),g.return=_,g)}function h(_,g,S,y){var L=S.type;return L===ms?c(_,g,S.props.children,y,S.key):g!==null&&(g.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===lr&&jf(L)===g.type)?(y=s(g,S.props),y.ref=hn(_,g,S),y.return=_,y):(y=ga(S.type,S.key,S.props,null,_.mode,y),y.ref=hn(_,g,S),y.return=_,y)}function l(_,g,S,y){return g===null||g.tag!==4||g.stateNode.containerInfo!==S.containerInfo||g.stateNode.implementation!==S.implementation?(g=ch(S,_.mode,y),g.return=_,g):(g=s(g,S.children||[]),g.return=_,g)}function c(_,g,S,y,L){return g===null||g.tag!==7?(g=Vr(S,_.mode,y,L),g.return=_,g):(g=s(g,S),g.return=_,g)}function u(_,g,S){if(typeof g=="string"&&g!==""||typeof g=="number")return g=hh(""+g,_.mode,S),g.return=_,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case To:return S=ga(g.type,g.key,g.props,null,_.mode,S),S.ref=hn(_,null,g),S.return=_,S;case vs:return g=ch(g,_.mode,S),g.return=_,g;case lr:var y=g._init;return u(_,y(g._payload),S)}if(kn(g)||sn(g))return g=Vr(g,_.mode,S,null),g.return=_,g;jo(_,g)}return null}function d(_,g,S,y){var L=g!==null?g.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return L!==null?null:a(_,g,""+S,y);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case To:return S.key===L?h(_,g,S,y):null;case vs:return S.key===L?l(_,g,S,y):null;case lr:return L=S._init,d(_,g,L(S._payload),y)}if(kn(S)||sn(S))return L!==null?null:c(_,g,S,y,null);jo(_,S)}return null}function f(_,g,S,y,L){if(typeof y=="string"&&y!==""||typeof y=="number")return _=_.get(S)||null,a(g,_,""+y,L);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case To:return _=_.get(y.key===null?S:y.key)||null,h(g,_,y,L);case vs:return _=_.get(y.key===null?S:y.key)||null,l(g,_,y,L);case lr:var P=y._init;return f(_,g,S,P(y._payload),L)}if(kn(y)||sn(y))return _=_.get(S)||null,c(g,_,y,L,null);jo(g,y)}return null}function p(_,g,S,y){for(var L=null,P=null,N=g,B=g=0,U=null;N!==null&&B<S.length;B++){N.index>B?(U=N,N=null):U=N.sibling;var W=d(_,N,S[B],y);if(W===null){N===null&&(N=U);break}t&&N&&W.alternate===null&&e(_,N),g=n(W,g,B),P===null?L=W:P.sibling=W,P=W,N=U}if(B===S.length)return i(_,N),we&&$r(_,B),L;if(N===null){for(;B<S.length;B++)N=u(_,S[B],y),N!==null&&(g=n(N,g,B),P===null?L=N:P.sibling=N,P=N);return we&&$r(_,B),L}for(N=r(_,N);B<S.length;B++)U=f(N,_,B,S[B],y),U!==null&&(t&&U.alternate!==null&&N.delete(U.key===null?B:U.key),g=n(U,g,B),P===null?L=U:P.sibling=U,P=U);return t&&N.forEach(function(V){return e(_,V)}),we&&$r(_,B),L}function m(_,g,S,y){var L=sn(S);if(typeof L!="function")throw Error(I(150));if(S=L.call(S),S==null)throw Error(I(151));for(var P=L=null,N=g,B=g=0,U=null,W=S.next();N!==null&&!W.done;B++,W=S.next()){N.index>B?(U=N,N=null):U=N.sibling;var V=d(_,N,W.value,y);if(V===null){N===null&&(N=U);break}t&&N&&V.alternate===null&&e(_,N),g=n(V,g,B),P===null?L=V:P.sibling=V,P=V,N=U}if(W.done)return i(_,N),we&&$r(_,B),L;if(N===null){for(;!W.done;B++,W=S.next())W=u(_,W.value,y),W!==null&&(g=n(W,g,B),P===null?L=W:P.sibling=W,P=W);return we&&$r(_,B),L}for(N=r(_,N);!W.done;B++,W=S.next())W=f(N,_,B,W.value,y),W!==null&&(t&&W.alternate!==null&&N.delete(W.key===null?B:W.key),g=n(W,g,B),P===null?L=W:P.sibling=W,P=W);return t&&N.forEach(function(C){return e(_,C)}),we&&$r(_,B),L}function x(_,g,S,y){if(typeof S=="object"&&S!==null&&S.type===ms&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case To:e:{for(var L=S.key,P=g;P!==null;){if(P.key===L){if(L=S.type,L===ms){if(P.tag===7){i(_,P.sibling),g=s(P,S.props.children),g.return=_,_=g;break e}}else if(P.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===lr&&jf(L)===P.type){i(_,P.sibling),g=s(P,S.props),g.ref=hn(_,P,S),g.return=_,_=g;break e}i(_,P);break}else e(_,P);P=P.sibling}S.type===ms?(g=Vr(S.props.children,_.mode,y,S.key),g.return=_,_=g):(y=ga(S.type,S.key,S.props,null,_.mode,y),y.ref=hn(_,g,S),y.return=_,_=y)}return o(_);case vs:e:{for(P=S.key;g!==null;){if(g.key===P)if(g.tag===4&&g.stateNode.containerInfo===S.containerInfo&&g.stateNode.implementation===S.implementation){i(_,g.sibling),g=s(g,S.children||[]),g.return=_,_=g;break e}else{i(_,g);break}else e(_,g);g=g.sibling}g=ch(S,_.mode,y),g.return=_,_=g}return o(_);case lr:return P=S._init,x(_,g,P(S._payload),y)}if(kn(S))return p(_,g,S,y);if(sn(S))return m(_,g,S,y);jo(_,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,g!==null&&g.tag===6?(i(_,g.sibling),g=s(g,S),g.return=_,_=g):(i(_,g),g=hh(S,_.mode,y),g.return=_,_=g),o(_)):i(_,g)}return x}var Us=vv(!0),mv=vv(!1),Ua=Tr(null),Ka=null,Es=null,ld=null;function hd(){ld=Es=Ka=null}function cd(t){var e=Ua.current;Se(Ua),t._currentValue=e}function mc(t,e,i){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===i)break;t=t.return}}function Os(t,e){Ka=t,ld=Es=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Pt=!0),t.firstContext=null)}function si(t){var e=t._currentValue;if(ld!==t)if(t={context:t,memoizedValue:e,next:null},Es===null){if(Ka===null)throw Error(I(308));Es=t,Ka.dependencies={lanes:0,firstContext:t}}else Es=Es.next=t;return e}var jr=null;function ud(t){jr===null?jr=[t]:jr.push(t)}function yv(t,e,i,r){var s=e.interleaved;return s===null?(i.next=i,ud(e)):(i.next=s.next,s.next=i),e.interleaved=i,Yi(t,r)}function Yi(t,e){t.lanes|=e;var i=t.alternate;for(i!==null&&(i.lanes|=e),i=t,t=t.return;t!==null;)t.childLanes|=e,i=t.alternate,i!==null&&(i.childLanes|=e),i=t,t=t.return;return i.tag===3?i.stateNode:null}var hr=!1;function dd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Sv(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Vi(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function wr(t,e,i){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,se&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Yi(t,i)}return s=r.interleaved,s===null?(e.next=e,ud(r)):(e.next=s.next,s.next=e),r.interleaved=e,Yi(t,i)}function ca(t,e,i){if(e=e.updateQueue,e!==null&&(e=e.shared,(i&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,i|=r,e.lanes=i,Qu(t,i)}}function Wf(t,e){var i=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,i===r)){var s=null,n=null;if(i=i.firstBaseUpdate,i!==null){do{var o={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};n===null?s=n=o:n=n.next=o,i=i.next}while(i!==null);n===null?s=n=e:n=n.next=e}else s=n=e;i={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:n,shared:r.shared,effects:r.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=e:t.next=e,i.lastBaseUpdate=e}function Va(t,e,i,r){var s=t.updateQueue;hr=!1;var n=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var h=a,l=h.next;h.next=null,o===null?n=l:o.next=l,o=h;var c=t.alternate;c!==null&&(c=c.updateQueue,a=c.lastBaseUpdate,a!==o&&(a===null?c.firstBaseUpdate=l:a.next=l,c.lastBaseUpdate=h))}if(n!==null){var u=s.baseState;o=0,c=l=h=null,a=n;do{var d=a.lane,f=a.eventTime;if((r&d)===d){c!==null&&(c=c.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=t,m=a;switch(d=e,f=i,m.tag){case 1:if(p=m.payload,typeof p=="function"){u=p.call(f,u,d);break e}u=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,d=typeof p=="function"?p.call(f,u,d):p,d==null)break e;u=Le({},u,d);break e;case 2:hr=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,d=s.effects,d===null?s.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},c===null?(l=c=f,h=u):c=c.next=f,o|=d;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;d=a,a=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(c===null&&(h=u),s.baseState=h,s.firstBaseUpdate=l,s.lastBaseUpdate=c,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else n===null&&(s.shared.lanes=0);ts|=o,t.lanes=o,t.memoizedState=u}}function Hf(t,e,i){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=i,typeof s!="function")throw Error(I(191,s));s.call(r)}}}var So={},Ri=Tr(So),so=Tr(So),no=Tr(So);function Wr(t){if(t===So)throw Error(I(174));return t}function fd(t,e){switch(pe(no,e),pe(so,t),pe(Ri,So),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Zh(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Zh(e,t)}Se(Ri),pe(Ri,e)}function Ks(){Se(Ri),Se(so),Se(no)}function wv(t){Wr(no.current);var e=Wr(Ri.current),i=Zh(e,t.type);e!==i&&(pe(so,t),pe(Ri,i))}function _d(t){so.current===t&&(Se(Ri),Se(so))}var ke=Tr(0);function qa(t){for(var e=t;e!==null;){if(e.tag===13){var i=e.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var rh=[];function pd(){for(var t=0;t<rh.length;t++)rh[t]._workInProgressVersionPrimary=null;rh.length=0}var ua=Qi.ReactCurrentDispatcher,sh=Qi.ReactCurrentBatchConfig,es=0,Ee=null,He=null,Ge=null,Ga=!1,zn=!1,oo=0,sS=0;function ft(){throw Error(I(321))}function gd(t,e){if(e===null)return!1;for(var i=0;i<e.length&&i<t.length;i++)if(!vi(t[i],e[i]))return!1;return!0}function vd(t,e,i,r,s,n){if(es=n,Ee=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ua.current=t===null||t.memoizedState===null?lS:hS,t=i(r,s),zn){n=0;do{if(zn=!1,oo=0,25<=n)throw Error(I(301));n+=1,Ge=He=null,e.updateQueue=null,ua.current=cS,t=i(r,s)}while(zn)}if(ua.current=Ya,e=He!==null&&He.next!==null,es=0,Ge=He=Ee=null,Ga=!1,e)throw Error(I(300));return t}function md(){var t=oo!==0;return oo=0,t}function bi(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ge===null?Ee.memoizedState=Ge=t:Ge=Ge.next=t,Ge}function ni(){if(He===null){var t=Ee.alternate;t=t!==null?t.memoizedState:null}else t=He.next;var e=Ge===null?Ee.memoizedState:Ge.next;if(e!==null)Ge=e,He=t;else{if(t===null)throw Error(I(310));He=t,t={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},Ge===null?Ee.memoizedState=Ge=t:Ge=Ge.next=t}return Ge}function ao(t,e){return typeof e=="function"?e(t):e}function nh(t){var e=ni(),i=e.queue;if(i===null)throw Error(I(311));i.lastRenderedReducer=t;var r=He,s=r.baseQueue,n=i.pending;if(n!==null){if(s!==null){var o=s.next;s.next=n.next,n.next=o}r.baseQueue=s=n,i.pending=null}if(s!==null){n=s.next,r=r.baseState;var a=o=null,h=null,l=n;do{var c=l.lane;if((es&c)===c)h!==null&&(h=h.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),r=l.hasEagerState?l.eagerState:t(r,l.action);else{var u={lane:c,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};h===null?(a=h=u,o=r):h=h.next=u,Ee.lanes|=c,ts|=c}l=l.next}while(l!==null&&l!==n);h===null?o=r:h.next=a,vi(r,e.memoizedState)||(Pt=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=h,i.lastRenderedState=r}if(t=i.interleaved,t!==null){s=t;do n=s.lane,Ee.lanes|=n,ts|=n,s=s.next;while(s!==t)}else s===null&&(i.lanes=0);return[e.memoizedState,i.dispatch]}function oh(t){var e=ni(),i=e.queue;if(i===null)throw Error(I(311));i.lastRenderedReducer=t;var r=i.dispatch,s=i.pending,n=e.memoizedState;if(s!==null){i.pending=null;var o=s=s.next;do n=t(n,o.action),o=o.next;while(o!==s);vi(n,e.memoizedState)||(Pt=!0),e.memoizedState=n,e.baseQueue===null&&(e.baseState=n),i.lastRenderedState=n}return[n,r]}function xv(){}function Cv(t,e){var i=Ee,r=ni(),s=e(),n=!vi(r.memoizedState,s);if(n&&(r.memoizedState=s,Pt=!0),r=r.queue,yd(Ev.bind(null,i,r,t),[t]),r.getSnapshot!==e||n||Ge!==null&&Ge.memoizedState.tag&1){if(i.flags|=2048,lo(9,kv.bind(null,i,r,s,e),void 0,null),tt===null)throw Error(I(349));es&30||bv(i,e,s)}return s}function bv(t,e,i){t.flags|=16384,t={getSnapshot:e,value:i},e=Ee.updateQueue,e===null?(e={lastEffect:null,stores:null},Ee.updateQueue=e,e.stores=[t]):(i=e.stores,i===null?e.stores=[t]:i.push(t))}function kv(t,e,i,r){e.value=i,e.getSnapshot=r,Lv(e)&&Mv(t)}function Ev(t,e,i){return i(function(){Lv(e)&&Mv(t)})}function Lv(t){var e=t.getSnapshot;t=t.value;try{var i=e();return!vi(t,i)}catch{return!0}}function Mv(t){var e=Yi(t,1);e!==null&&gi(e,t,1,-1)}function Uf(t){var e=bi();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ao,lastRenderedState:t},e.queue=t,t=t.dispatch=aS.bind(null,Ee,t),[e.memoizedState,t]}function lo(t,e,i,r){return t={tag:t,create:e,destroy:i,deps:r,next:null},e=Ee.updateQueue,e===null?(e={lastEffect:null,stores:null},Ee.updateQueue=e,e.lastEffect=t.next=t):(i=e.lastEffect,i===null?e.lastEffect=t.next=t:(r=i.next,i.next=t,t.next=r,e.lastEffect=t)),t}function Rv(){return ni().memoizedState}function da(t,e,i,r){var s=bi();Ee.flags|=t,s.memoizedState=lo(1|e,i,void 0,r===void 0?null:r)}function ml(t,e,i,r){var s=ni();r=r===void 0?null:r;var n=void 0;if(He!==null){var o=He.memoizedState;if(n=o.destroy,r!==null&&gd(r,o.deps)){s.memoizedState=lo(e,i,n,r);return}}Ee.flags|=t,s.memoizedState=lo(1|e,i,n,r)}function Kf(t,e){return da(8390656,8,t,e)}function yd(t,e){return ml(2048,8,t,e)}function Tv(t,e){return ml(4,2,t,e)}function Pv(t,e){return ml(4,4,t,e)}function Dv(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Bv(t,e,i){return i=i!=null?i.concat([t]):null,ml(4,4,Dv.bind(null,e,t),i)}function Sd(){}function Av(t,e){var i=ni();e=e===void 0?null:e;var r=i.memoizedState;return r!==null&&e!==null&&gd(e,r[1])?r[0]:(i.memoizedState=[t,e],t)}function Nv(t,e){var i=ni();e=e===void 0?null:e;var r=i.memoizedState;return r!==null&&e!==null&&gd(e,r[1])?r[0]:(t=t(),i.memoizedState=[t,e],t)}function $v(t,e,i){return es&21?(vi(i,e)||(i=jg(),Ee.lanes|=i,ts|=i,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Pt=!0),t.memoizedState=i)}function nS(t,e){var i=he;he=i!==0&&4>i?i:4,t(!0);var r=sh.transition;sh.transition={};try{t(!1),e()}finally{he=i,sh.transition=r}}function Ov(){return ni().memoizedState}function oS(t,e,i){var r=Cr(t);if(i={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null},Iv(t))zv(e,i);else if(i=yv(t,e,i,r),i!==null){var s=Ct();gi(i,t,r,s),Fv(i,e,r)}}function aS(t,e,i){var r=Cr(t),s={lane:r,action:i,hasEagerState:!1,eagerState:null,next:null};if(Iv(t))zv(e,s);else{var n=t.alternate;if(t.lanes===0&&(n===null||n.lanes===0)&&(n=e.lastRenderedReducer,n!==null))try{var o=e.lastRenderedState,a=n(o,i);if(s.hasEagerState=!0,s.eagerState=a,vi(a,o)){var h=e.interleaved;h===null?(s.next=s,ud(e)):(s.next=h.next,h.next=s),e.interleaved=s;return}}catch{}finally{}i=yv(t,e,s,r),i!==null&&(s=Ct(),gi(i,t,r,s),Fv(i,e,r))}}function Iv(t){var e=t.alternate;return t===Ee||e!==null&&e===Ee}function zv(t,e){zn=Ga=!0;var i=t.pending;i===null?e.next=e:(e.next=i.next,i.next=e),t.pending=e}function Fv(t,e,i){if(i&4194240){var r=e.lanes;r&=t.pendingLanes,i|=r,e.lanes=i,Qu(t,i)}}var Ya={readContext:si,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useInsertionEffect:ft,useLayoutEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useMutableSource:ft,useSyncExternalStore:ft,useId:ft,unstable_isNewReconciler:!1},lS={readContext:si,useCallback:function(t,e){return bi().memoizedState=[t,e===void 0?null:e],t},useContext:si,useEffect:Kf,useImperativeHandle:function(t,e,i){return i=i!=null?i.concat([t]):null,da(4194308,4,Dv.bind(null,e,t),i)},useLayoutEffect:function(t,e){return da(4194308,4,t,e)},useInsertionEffect:function(t,e){return da(4,2,t,e)},useMemo:function(t,e){var i=bi();return e=e===void 0?null:e,t=t(),i.memoizedState=[t,e],t},useReducer:function(t,e,i){var r=bi();return e=i!==void 0?i(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=oS.bind(null,Ee,t),[r.memoizedState,t]},useRef:function(t){var e=bi();return t={current:t},e.memoizedState=t},useState:Uf,useDebugValue:Sd,useDeferredValue:function(t){return bi().memoizedState=t},useTransition:function(){var t=Uf(!1),e=t[0];return t=nS.bind(null,t[1]),bi().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,i){var r=Ee,s=bi();if(we){if(i===void 0)throw Error(I(407));i=i()}else{if(i=e(),tt===null)throw Error(I(349));es&30||bv(r,e,i)}s.memoizedState=i;var n={value:i,getSnapshot:e};return s.queue=n,Kf(Ev.bind(null,r,n,t),[t]),r.flags|=2048,lo(9,kv.bind(null,r,n,i,e),void 0,null),i},useId:function(){var t=bi(),e=tt.identifierPrefix;if(we){var i=Hi,r=Wi;i=(r&~(1<<32-pi(r)-1)).toString(32)+i,e=":"+e+"R"+i,i=oo++,0<i&&(e+="H"+i.toString(32)),e+=":"}else i=sS++,e=":"+e+"r"+i.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},hS={readContext:si,useCallback:Av,useContext:si,useEffect:yd,useImperativeHandle:Bv,useInsertionEffect:Tv,useLayoutEffect:Pv,useMemo:Nv,useReducer:nh,useRef:Rv,useState:function(){return nh(ao)},useDebugValue:Sd,useDeferredValue:function(t){var e=ni();return $v(e,He.memoizedState,t)},useTransition:function(){var t=nh(ao)[0],e=ni().memoizedState;return[t,e]},useMutableSource:xv,useSyncExternalStore:Cv,useId:Ov,unstable_isNewReconciler:!1},cS={readContext:si,useCallback:Av,useContext:si,useEffect:yd,useImperativeHandle:Bv,useInsertionEffect:Tv,useLayoutEffect:Pv,useMemo:Nv,useReducer:oh,useRef:Rv,useState:function(){return oh(ao)},useDebugValue:Sd,useDeferredValue:function(t){var e=ni();return He===null?e.memoizedState=t:$v(e,He.memoizedState,t)},useTransition:function(){var t=oh(ao)[0],e=ni().memoizedState;return[t,e]},useMutableSource:xv,useSyncExternalStore:Cv,useId:Ov,unstable_isNewReconciler:!1};function di(t,e){if(t&&t.defaultProps){e=Le({},e),t=t.defaultProps;for(var i in t)e[i]===void 0&&(e[i]=t[i]);return e}return e}function yc(t,e,i,r){e=t.memoizedState,i=i(r,e),i=i==null?e:Le({},e,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var yl={isMounted:function(t){return(t=t._reactInternals)?as(t)===t:!1},enqueueSetState:function(t,e,i){t=t._reactInternals;var r=Ct(),s=Cr(t),n=Vi(r,s);n.payload=e,i!=null&&(n.callback=i),e=wr(t,n,s),e!==null&&(gi(e,t,s,r),ca(e,t,s))},enqueueReplaceState:function(t,e,i){t=t._reactInternals;var r=Ct(),s=Cr(t),n=Vi(r,s);n.tag=1,n.payload=e,i!=null&&(n.callback=i),e=wr(t,n,s),e!==null&&(gi(e,t,s,r),ca(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var i=Ct(),r=Cr(t),s=Vi(i,r);s.tag=2,e!=null&&(s.callback=e),e=wr(t,s,r),e!==null&&(gi(e,t,r,i),ca(e,t,r))}};function Vf(t,e,i,r,s,n,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,n,o):e.prototype&&e.prototype.isPureReactComponent?!eo(i,r)||!eo(s,n):!0}function jv(t,e,i){var r=!1,s=Lr,n=e.contextType;return typeof n=="object"&&n!==null?n=si(n):(s=Bt(e)?Zr:mt.current,r=e.contextTypes,n=(r=r!=null)?Ws(t,s):Lr),e=new e(i,n),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=yl,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=n),e}function qf(t,e,i,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(i,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(i,r),e.state!==t&&yl.enqueueReplaceState(e,e.state,null)}function Sc(t,e,i,r){var s=t.stateNode;s.props=i,s.state=t.memoizedState,s.refs={},dd(t);var n=e.contextType;typeof n=="object"&&n!==null?s.context=si(n):(n=Bt(e)?Zr:mt.current,s.context=Ws(t,n)),s.state=t.memoizedState,n=e.getDerivedStateFromProps,typeof n=="function"&&(yc(t,e,n,i),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&yl.enqueueReplaceState(s,s.state,null),Va(t,i,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function Vs(t,e){try{var i="",r=e;do i+=I1(r),r=r.return;while(r);var s=i}catch(n){s=`
|
|
39
39
|
Error generating stack: `+n.message+`
|
|
40
|
-
`+n.stack}return{value:t,source:e,stack:s,digest:null}}function ah(t,e,i){return{value:t,source:null,stack:i??null,digest:e??null}}function wc(t,e){try{console.error(e.value)}catch(i){setTimeout(function(){throw i})}}var uS=typeof WeakMap=="function"?WeakMap:Map;function Wv(t,e,i){i=Vi(-1,i),i.tag=3,i.payload={element:null};var r=e.value;return i.callback=function(){Qa||(Qa=!0,Pc=r),wc(t,e)},i}function Hv(t,e,i){i=Vi(-1,i),i.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;i.payload=function(){return r(s)},i.callback=function(){wc(t,e)}}var n=t.stateNode;return n!==null&&typeof n.componentDidCatch=="function"&&(i.callback=function(){wc(t,e),typeof r!="function"&&(xr===null?xr=new Set([this]):xr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),i}function Gf(t,e,i){var r=t.pingCache;if(r===null){r=t.pingCache=new uS;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(i)||(s.add(i),t=kS.bind(null,t,e,i),e.then(t,t))}function Yf(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Xf(t,e,i,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(e=Vi(-1,1),e.tag=2,wr(i,e,1))),i.lanes|=1),t)}var dS=Qi.ReactCurrentOwner,Pt=!1;function wt(t,e,i,r){e.child=t===null?mv(e,null,i,r):Us(e,t.child,i,r)}function Qf(t,e,i,r,s){i=i.render;var n=e.ref;return Os(e,s),r=vd(t,e,i,r,n,s),i=md(),t!==null&&!Pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Xi(t,e,s)):(we&&i&&nd(e),e.flags|=1,wt(t,e,r,s),e.child)}function Zf(t,e,i,r,s){if(t===null){var n=i.type;return typeof n=="function"&&!Md(n)&&n.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(e.tag=15,e.type=n,Uv(t,e,n,r,s)):(t=ga(i.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(n=t.child,!(t.lanes&s)){var o=n.memoizedProps;if(i=i.compare,i=i!==null?i:eo,i(o,r)&&t.ref===e.ref)return Xi(t,e,s)}return e.flags|=1,t=br(n,r),t.ref=e.ref,t.return=e,e.child=t}function Uv(t,e,i,r,s){if(t!==null){var n=t.memoizedProps;if(eo(n,r)&&t.ref===e.ref)if(Pt=!1,e.pendingProps=r=n,(t.lanes&s)!==0)t.flags&131072&&(Pt=!0);else return e.lanes=t.lanes,Xi(t,e,s)}return xc(t,e,i,r,s)}function Kv(t,e,i){var r=e.pendingProps,s=r.children,n=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},_e(Ms,It),It|=i;else{if(!(i&1073741824))return t=n!==null?n.baseLanes|i:i,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,_e(Ms,It),It|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=n!==null?n.baseLanes:i,_e(Ms,It),It|=r}else n!==null?(r=n.baseLanes|i,e.memoizedState=null):r=i,_e(Ms,It),It|=r;return wt(t,e,s,i),e.child}function Vv(t,e){var i=e.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(e.flags|=512,e.flags|=2097152)}function xc(t,e,i,r,s){var n=Bt(i)?Zr:mt.current;return n=Ws(e,n),Os(e,s),i=vd(t,e,i,r,n,s),r=md(),t!==null&&!Pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Xi(t,e,s)):(we&&r&&nd(e),e.flags|=1,wt(t,e,i,s),e.child)}function Jf(t,e,i,r,s){if(Bt(i)){var n=!0;ja(e)}else n=!1;if(Os(e,s),e.stateNode===null)fa(t,e),jv(e,i,r),Sc(e,i,r,s),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var h=o.context,l=i.contextType;typeof l=="object"&&l!==null?l=si(l):(l=Bt(i)?Zr:mt.current,l=Ws(e,l));var c=i.getDerivedStateFromProps,u=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||h!==l)&&qf(e,o,r,l),hr=!1;var d=e.memoizedState;o.state=d,Va(e,r,o,s),h=e.memoizedState,a!==r||d!==h||Dt.current||hr?(typeof c=="function"&&(yc(e,i,c,r),h=e.memoizedState),(a=hr||Vf(e,i,a,r,d,h,l))?(u||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=h),o.props=r,o.state=h,o.context=l,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,Sv(t,e),a=e.memoizedProps,l=e.type===e.elementType?a:di(e.type,a),o.props=l,u=e.pendingProps,d=o.context,h=i.contextType,typeof h=="object"&&h!==null?h=si(h):(h=Bt(i)?Zr:mt.current,h=Ws(e,h));var f=i.getDerivedStateFromProps;(c=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==u||d!==h)&&qf(e,o,r,h),hr=!1,d=e.memoizedState,o.state=d,Va(e,r,o,s);var p=e.memoizedState;a!==u||d!==p||Dt.current||hr?(typeof f=="function"&&(yc(e,i,f,r),p=e.memoizedState),(l=hr||Vf(e,i,l,r,d,p,h)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,h),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,h)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=h,r=l):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),r=!1)}return Cc(t,e,i,r,n,s)}function Cc(t,e,i,r,s,n){Vv(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&If(e,i,!1),Xi(t,e,n);r=e.stateNode,dS.current=e;var a=o&&typeof i.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Us(e,t.child,null,n),e.child=Us(e,null,a,n)):wt(t,e,a,n),e.memoizedState=r.state,s&&If(e,i,!0),e.child}function qv(t){var e=t.stateNode;e.pendingContext?Of(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Of(t,e.context,!1),fd(t,e.containerInfo)}function e_(t,e,i,r,s){return Hs(),ad(s),e.flags|=256,wt(t,e,i,r),e.child}var bc={dehydrated:null,treeContext:null,retryLane:0};function kc(t){return{baseLanes:t,cachePool:null,transitions:null}}function Gv(t,e,i){var r=e.pendingProps,s=ke.current,n=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(s&2)!==0),a?(n=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),_e(ke,s&1),t===null)return vc(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,n?(r=e.mode,n=e.child,o={mode:"hidden",children:o},!(r&1)&&n!==null?(n.childLanes=0,n.pendingProps=o):n=xl(o,r,0,null),t=Vr(t,r,i,null),n.return=e,t.return=e,n.sibling=t,e.child=n,e.child.memoizedState=kc(i),e.memoizedState=bc,t):wd(e,o));if(s=t.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return fS(t,e,o,r,a,s,i);if(n){n=r.fallback,o=e.mode,s=t.child,a=s.sibling;var h={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=h,e.deletions=null):(r=br(s,h),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?n=br(a,n):(n=Vr(n,o,i,null),n.flags|=2),n.return=e,r.return=e,r.sibling=n,e.child=r,r=n,n=e.child,o=t.child.memoizedState,o=o===null?kc(i):{baseLanes:o.baseLanes|i,cachePool:null,transitions:o.transitions},n.memoizedState=o,n.childLanes=t.childLanes&~i,e.memoizedState=bc,r}return n=t.child,t=n.sibling,r=br(n,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=i),r.return=e,r.sibling=null,t!==null&&(i=e.deletions,i===null?(e.deletions=[t],e.flags|=16):i.push(t)),e.child=r,e.memoizedState=null,r}function wd(t,e){return e=xl({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Wo(t,e,i,r){return r!==null&&ad(r),Us(e,t.child,null,i),t=wd(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function fS(t,e,i,r,s,n,o){if(i)return e.flags&256?(e.flags&=-257,r=ah(Error(I(422))),Wo(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(n=r.fallback,s=e.mode,r=xl({mode:"visible",children:r.children},s,0,null),n=Vr(n,s,o,null),n.flags|=2,r.return=e,n.return=e,r.sibling=n,e.child=r,e.mode&1&&Us(e,t.child,null,o),e.child.memoizedState=kc(o),e.memoizedState=bc,n);if(!(e.mode&1))return Wo(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,n=Error(I(419)),r=ah(n,r,void 0),Wo(t,e,o,r)}if(a=(o&t.childLanes)!==0,Pt||a){if(r=tt,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==n.retryLane&&(n.retryLane=s,Yi(t,s),gi(r,t,s,-1))}return Ld(),r=ah(Error(I(421))),Wo(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=ES.bind(null,t),s._reactRetry=e,null):(t=n.treeContext,zt=Sr(s.nextSibling),Ft=e,we=!0,_i=null,t!==null&&(Zt[Jt++]=Wi,Zt[Jt++]=Hi,Zt[Jt++]=Jr,Wi=t.id,Hi=t.overflow,Jr=e),e=wd(e,r.children),e.flags|=4096,e)}function t_(t,e,i){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),mc(t.return,e,i)}function lh(t,e,i,r,s){var n=t.memoizedState;n===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:i,tailMode:s}:(n.isBackwards=e,n.rendering=null,n.renderingStartTime=0,n.last=r,n.tail=i,n.tailMode=s)}function Yv(t,e,i){var r=e.pendingProps,s=r.revealOrder,n=r.tail;if(wt(t,e,r.children,i),r=ke.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&t_(t,i,e);else if(t.tag===19)t_(t,i,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(_e(ke,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(i=e.child,s=null;i!==null;)t=i.alternate,t!==null&&qa(t)===null&&(s=i),i=i.sibling;i=s,i===null?(s=e.child,e.child=null):(s=i.sibling,i.sibling=null),lh(e,!1,s,i,n);break;case"backwards":for(i=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&qa(t)===null){e.child=s;break}t=s.sibling,s.sibling=i,i=s,s=t}lh(e,!0,i,null,n);break;case"together":lh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function fa(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Xi(t,e,i){if(t!==null&&(e.dependencies=t.dependencies),ts|=e.lanes,!(i&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(I(153));if(e.child!==null){for(t=e.child,i=br(t,t.pendingProps),e.child=i,i.return=e;t.sibling!==null;)t=t.sibling,i=i.sibling=br(t,t.pendingProps),i.return=e;i.sibling=null}return e.child}function _S(t,e,i){switch(e.tag){case 3:qv(e),Hs();break;case 5:wv(e);break;case 1:Bt(e.type)&&ja(e);break;case 4:fd(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;_e(Ua,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(_e(ke,ke.current&1),e.flags|=128,null):i&e.child.childLanes?Gv(t,e,i):(_e(ke,ke.current&1),t=Xi(t,e,i),t!==null?t.sibling:null);_e(ke,ke.current&1);break;case 19:if(r=(i&e.childLanes)!==0,t.flags&128){if(r)return Yv(t,e,i);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),_e(ke,ke.current),r)break;return null;case 22:case 23:return e.lanes=0,Kv(t,e,i)}return Xi(t,e,i)}var Xv,Ec,Qv,Zv;Xv=function(t,e){for(var i=e.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};Ec=function(){};Qv=function(t,e,i,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Wr(Ri.current);var n=null;switch(i){case"input":s=Gh(t,s),r=Gh(t,r),n=[];break;case"select":s=Le({},s,{value:void 0}),r=Le({},r,{value:void 0}),n=[];break;case"textarea":s=Qh(t,s),r=Qh(t,r),n=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=za)}Jh(i,r);var o;i=null;for(l in s)if(!r.hasOwnProperty(l)&&s.hasOwnProperty(l)&&s[l]!=null)if(l==="style"){var a=s[l];for(o in a)a.hasOwnProperty(o)&&(i||(i={}),i[o]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(qn.hasOwnProperty(l)?n||(n=[]):(n=n||[]).push(l,null));for(l in r){var h=r[l];if(a=s!=null?s[l]:void 0,r.hasOwnProperty(l)&&h!==a&&(h!=null||a!=null))if(l==="style")if(a){for(o in a)!a.hasOwnProperty(o)||h&&h.hasOwnProperty(o)||(i||(i={}),i[o]="");for(o in h)h.hasOwnProperty(o)&&a[o]!==h[o]&&(i||(i={}),i[o]=h[o])}else i||(n||(n=[]),n.push(l,i)),i=h;else l==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,a=a?a.__html:void 0,h!=null&&a!==h&&(n=n||[]).push(l,h)):l==="children"?typeof h!="string"&&typeof h!="number"||(n=n||[]).push(l,""+h):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&(qn.hasOwnProperty(l)?(h!=null&&l==="onScroll"&&ge("scroll",t),n||a===h||(n=[])):(n=n||[]).push(l,h))}i&&(n=n||[]).push("style",i);var l=n;(e.updateQueue=l)&&(e.flags|=4)}};Zv=function(t,e,i,r){i!==r&&(e.flags|=4)};function cn(t,e){if(!we)switch(t.tailMode){case"hidden":e=t.tail;for(var i=null;e!==null;)e.alternate!==null&&(i=e),e=e.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function _t(t){var e=t.alternate!==null&&t.alternate.child===t.child,i=0,r=0;if(e)for(var s=t.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=i,e}function pS(t,e,i){var r=e.pendingProps;switch(od(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(e),null;case 1:return Bt(e.type)&&Fa(),_t(e),null;case 3:return r=e.stateNode,Ks(),Se(Dt),Se(mt),pd(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Fo(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,_i!==null&&(Ac(_i),_i=null))),Ec(t,e),_t(e),null;case 5:_d(e);var s=Wr(no.current);if(i=e.type,t!==null&&e.stateNode!=null)Qv(t,e,i,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(I(166));return _t(e),null}if(t=Wr(Ri.current),Fo(e)){r=e.stateNode,i=e.type;var n=e.memoizedProps;switch(r[Ei]=e,r[ro]=n,t=(e.mode&1)!==0,i){case"dialog":ge("cancel",r),ge("close",r);break;case"iframe":case"object":case"embed":ge("load",r);break;case"video":case"audio":for(s=0;s<Ln.length;s++)ge(Ln[s],r);break;case"source":ge("error",r);break;case"img":case"image":case"link":ge("error",r),ge("load",r);break;case"details":ge("toggle",r);break;case"input":cf(r,n),ge("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!n.multiple},ge("invalid",r);break;case"textarea":df(r,n),ge("invalid",r)}Jh(i,n),s=null;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];o==="children"?typeof a=="string"?r.textContent!==a&&(n.suppressHydrationWarning!==!0&&zo(r.textContent,a,t),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(n.suppressHydrationWarning!==!0&&zo(r.textContent,a,t),s=["children",""+a]):qn.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&ge("scroll",r)}switch(i){case"input":Po(r),uf(r,n,!0);break;case"textarea":Po(r),ff(r);break;case"select":case"option":break;default:typeof n.onClick=="function"&&(r.onclick=za)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Eg(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(i,{is:r.is}):(t=o.createElement(i),i==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,i),t[Ei]=e,t[ro]=r,Xv(t,e,!1,!1),e.stateNode=t;e:{switch(o=ec(i,r),i){case"dialog":ge("cancel",t),ge("close",t),s=r;break;case"iframe":case"object":case"embed":ge("load",t),s=r;break;case"video":case"audio":for(s=0;s<Ln.length;s++)ge(Ln[s],t);s=r;break;case"source":ge("error",t),s=r;break;case"img":case"image":case"link":ge("error",t),ge("load",t),s=r;break;case"details":ge("toggle",t),s=r;break;case"input":cf(t,r),s=Gh(t,r),ge("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=Le({},r,{value:void 0}),ge("invalid",t);break;case"textarea":df(t,r),s=Qh(t,r),ge("invalid",t);break;default:s=r}Jh(i,s),a=s;for(n in a)if(a.hasOwnProperty(n)){var h=a[n];n==="style"?Rg(t,h):n==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,h!=null&&Lg(t,h)):n==="children"?typeof h=="string"?(i!=="textarea"||h!=="")&&Gn(t,h):typeof h=="number"&&Gn(t,""+h):n!=="suppressContentEditableWarning"&&n!=="suppressHydrationWarning"&&n!=="autoFocus"&&(qn.hasOwnProperty(n)?h!=null&&n==="onScroll"&&ge("scroll",t):h!=null&&Ku(t,n,h,o))}switch(i){case"input":Po(t),uf(t,r,!1);break;case"textarea":Po(t),ff(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Er(r.value));break;case"select":t.multiple=!!r.multiple,n=r.value,n!=null?Bs(t,!!r.multiple,n,!1):r.defaultValue!=null&&Bs(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=za)}switch(i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return _t(e),null;case 6:if(t&&e.stateNode!=null)Zv(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(I(166));if(i=Wr(no.current),Wr(Ri.current),Fo(e)){if(r=e.stateNode,i=e.memoizedProps,r[Ei]=e,(n=r.nodeValue!==i)&&(t=Ft,t!==null))switch(t.tag){case 3:zo(r.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&zo(r.nodeValue,i,(t.mode&1)!==0)}n&&(e.flags|=4)}else r=(i.nodeType===9?i:i.ownerDocument).createTextNode(r),r[Ei]=e,e.stateNode=r}return _t(e),null;case 13:if(Se(ke),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(we&&zt!==null&&e.mode&1&&!(e.flags&128))gv(),Hs(),e.flags|=98560,n=!1;else if(n=Fo(e),r!==null&&r.dehydrated!==null){if(t===null){if(!n)throw Error(I(318));if(n=e.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(I(317));n[Ei]=e}else Hs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;_t(e),n=!1}else _i!==null&&(Ac(_i),_i=null),n=!0;if(!n)return e.flags&65536?e:null}return e.flags&128?(e.lanes=i,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||ke.current&1?Ue===0&&(Ue=3):Ld())),e.updateQueue!==null&&(e.flags|=4),_t(e),null);case 4:return Ks(),Ec(t,e),t===null&&to(e.stateNode.containerInfo),_t(e),null;case 10:return cd(e.type._context),_t(e),null;case 17:return Bt(e.type)&&Fa(),_t(e),null;case 19:if(Se(ke),n=e.memoizedState,n===null)return _t(e),null;if(r=(e.flags&128)!==0,o=n.rendering,o===null)if(r)cn(n,!1);else{if(Ue!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=qa(t),o!==null){for(e.flags|=128,cn(n,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=i,i=e.child;i!==null;)n=i,t=r,n.flags&=14680066,o=n.alternate,o===null?(n.childLanes=0,n.lanes=t,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,t=o.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return _e(ke,ke.current&1|2),e.child}t=t.sibling}n.tail!==null&&Ne()>qs&&(e.flags|=128,r=!0,cn(n,!1),e.lanes=4194304)}else{if(!r)if(t=qa(o),t!==null){if(e.flags|=128,r=!0,i=t.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),cn(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!we)return _t(e),null}else 2*Ne()-n.renderingStartTime>qs&&i!==1073741824&&(e.flags|=128,r=!0,cn(n,!1),e.lanes=4194304);n.isBackwards?(o.sibling=e.child,e.child=o):(i=n.last,i!==null?i.sibling=o:e.child=o,n.last=o)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=Ne(),e.sibling=null,i=ke.current,_e(ke,r?i&1|2:i&1),e):(_t(e),null);case 22:case 23:return Ed(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?It&1073741824&&(_t(e),e.subtreeFlags&6&&(e.flags|=8192)):_t(e),null;case 24:return null;case 25:return null}throw Error(I(156,e.tag))}function gS(t,e){switch(od(e),e.tag){case 1:return Bt(e.type)&&Fa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ks(),Se(Dt),Se(mt),pd(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return _d(e),null;case 13:if(Se(ke),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(I(340));Hs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Se(ke),null;case 4:return Ks(),null;case 10:return cd(e.type._context),null;case 22:case 23:return Ed(),null;case 24:return null;default:return null}}var Ho=!1,gt=!1,vS=typeof WeakSet=="function"?WeakSet:Set,K=null;function Ls(t,e){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(r){De(t,e,r)}else i.current=null}function Lc(t,e,i){try{i()}catch(r){De(t,e,r)}}var i_=!1;function mS(t,e){if(cc=$a,t=rv(),sd(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var r=i.getSelection&&i.getSelection();if(r&&r.rangeCount!==0){i=r.anchorNode;var s=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{i.nodeType,n.nodeType}catch{i=null;break e}var o=0,a=-1,h=-1,l=0,c=0,u=t,d=null;t:for(;;){for(var f;u!==i||s!==0&&u.nodeType!==3||(a=o+s),u!==n||r!==0&&u.nodeType!==3||(h=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(f=u.firstChild)!==null;)d=u,u=f;for(;;){if(u===t)break t;if(d===i&&++l===s&&(a=o),d===n&&++c===r&&(h=o),(f=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=f}i=a===-1||h===-1?null:{start:a,end:h}}else i=null}i=i||{start:0,end:0}}else i=null;for(uc={focusedElem:t,selectionRange:i},$a=!1,K=e;K!==null;)if(e=K,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,K=t;else for(;K!==null;){e=K;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,x=p.memoizedState,_=e.stateNode,g=_.getSnapshotBeforeUpdate(e.elementType===e.type?m:di(e.type,m),x);_.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(I(163))}}catch(y){De(e,e.return,y)}if(t=e.sibling,t!==null){t.return=e.return,K=t;break}K=e.return}return p=i_,i_=!1,p}function Fn(t,e,i){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var n=s.destroy;s.destroy=void 0,n!==void 0&&Lc(e,i,n)}s=s.next}while(s!==r)}}function Sl(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var r=i.create;i.destroy=r()}i=i.next}while(i!==e)}}function Mc(t){var e=t.ref;if(e!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof e=="function"?e(t):e.current=t}}function Jv(t){var e=t.alternate;e!==null&&(t.alternate=null,Jv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ei],delete e[ro],delete e[_c],delete e[eS],delete e[tS])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function em(t){return t.tag===5||t.tag===3||t.tag===4}function r_(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||em(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Rc(t,e,i){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?i.nodeType===8?i.parentNode.insertBefore(t,e):i.insertBefore(t,e):(i.nodeType===8?(e=i.parentNode,e.insertBefore(t,i)):(e=i,e.appendChild(t)),i=i._reactRootContainer,i!=null||e.onclick!==null||(e.onclick=za));else if(r!==4&&(t=t.child,t!==null))for(Rc(t,e,i),t=t.sibling;t!==null;)Rc(t,e,i),t=t.sibling}function Tc(t,e,i){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?i.insertBefore(t,e):i.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Tc(t,e,i),t=t.sibling;t!==null;)Tc(t,e,i),t=t.sibling}var nt=null,fi=!1;function er(t,e,i){for(i=i.child;i!==null;)tm(t,e,i),i=i.sibling}function tm(t,e,i){if(Mi&&typeof Mi.onCommitFiberUnmount=="function")try{Mi.onCommitFiberUnmount(dl,i)}catch{}switch(i.tag){case 5:gt||Ls(i,e);case 6:var r=nt,s=fi;nt=null,er(t,e,i),nt=r,fi=s,nt!==null&&(fi?(t=nt,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):nt.removeChild(i.stateNode));break;case 18:nt!==null&&(fi?(t=nt,i=i.stateNode,t.nodeType===8?th(t.parentNode,i):t.nodeType===1&&th(t,i),Zn(t)):th(nt,i.stateNode));break;case 4:r=nt,s=fi,nt=i.stateNode.containerInfo,fi=!0,er(t,e,i),nt=r,fi=s;break;case 0:case 11:case 14:case 15:if(!gt&&(r=i.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var n=s,o=n.destroy;n=n.tag,o!==void 0&&(n&2||n&4)&&Lc(i,e,o),s=s.next}while(s!==r)}er(t,e,i);break;case 1:if(!gt&&(Ls(i,e),r=i.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=i.memoizedProps,r.state=i.memoizedState,r.componentWillUnmount()}catch(a){De(i,e,a)}er(t,e,i);break;case 21:er(t,e,i);break;case 22:i.mode&1?(gt=(r=gt)||i.memoizedState!==null,er(t,e,i),gt=r):er(t,e,i);break;default:er(t,e,i)}}function s_(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new vS),e.forEach(function(r){var s=LS.bind(null,t,r);i.has(r)||(i.add(r),r.then(s,s))})}}function li(t,e){var i=e.deletions;if(i!==null)for(var r=0;r<i.length;r++){var s=i[r];try{var n=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:nt=a.stateNode,fi=!1;break e;case 3:nt=a.stateNode.containerInfo,fi=!0;break e;case 4:nt=a.stateNode.containerInfo,fi=!0;break e}a=a.return}if(nt===null)throw Error(I(160));tm(n,o,s),nt=null,fi=!1;var h=s.alternate;h!==null&&(h.return=null),s.return=null}catch(l){De(s,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)im(e,t),e=e.sibling}function im(t,e){var i=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(li(e,t),yi(t),r&4){try{Fn(3,t,t.return),Sl(3,t)}catch(m){De(t,t.return,m)}try{Fn(5,t,t.return)}catch(m){De(t,t.return,m)}}break;case 1:li(e,t),yi(t),r&512&&i!==null&&Ls(i,i.return);break;case 5:if(li(e,t),yi(t),r&512&&i!==null&&Ls(i,i.return),t.flags&32){var s=t.stateNode;try{Gn(s,"")}catch(m){De(t,t.return,m)}}if(r&4&&(s=t.stateNode,s!=null)){var n=t.memoizedProps,o=i!==null?i.memoizedProps:n,a=t.type,h=t.updateQueue;if(t.updateQueue=null,h!==null)try{a==="input"&&n.type==="radio"&&n.name!=null&&bg(s,n),ec(a,o);var l=ec(a,n);for(o=0;o<h.length;o+=2){var c=h[o],u=h[o+1];c==="style"?Rg(s,u):c==="dangerouslySetInnerHTML"?Lg(s,u):c==="children"?Gn(s,u):Ku(s,c,u,l)}switch(a){case"input":Yh(s,n);break;case"textarea":kg(s,n);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!n.multiple;var f=n.value;f!=null?Bs(s,!!n.multiple,f,!1):d!==!!n.multiple&&(n.defaultValue!=null?Bs(s,!!n.multiple,n.defaultValue,!0):Bs(s,!!n.multiple,n.multiple?[]:"",!1))}s[ro]=n}catch(m){De(t,t.return,m)}}break;case 6:if(li(e,t),yi(t),r&4){if(t.stateNode===null)throw Error(I(162));s=t.stateNode,n=t.memoizedProps;try{s.nodeValue=n}catch(m){De(t,t.return,m)}}break;case 3:if(li(e,t),yi(t),r&4&&i!==null&&i.memoizedState.isDehydrated)try{Zn(e.containerInfo)}catch(m){De(t,t.return,m)}break;case 4:li(e,t),yi(t);break;case 13:li(e,t),yi(t),s=t.child,s.flags&8192&&(n=s.memoizedState!==null,s.stateNode.isHidden=n,!n||s.alternate!==null&&s.alternate.memoizedState!==null||(bd=Ne())),r&4&&s_(t);break;case 22:if(c=i!==null&&i.memoizedState!==null,t.mode&1?(gt=(l=gt)||c,li(e,t),gt=l):li(e,t),yi(t),r&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&t.mode&1)for(K=t,c=t.child;c!==null;){for(u=K=c;K!==null;){switch(d=K,f=d.child,d.tag){case 0:case 11:case 14:case 15:Fn(4,d,d.return);break;case 1:Ls(d,d.return);var p=d.stateNode;if(typeof p.componentWillUnmount=="function"){r=d,i=d.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(m){De(r,i,m)}}break;case 5:Ls(d,d.return);break;case 22:if(d.memoizedState!==null){o_(u);continue}}f!==null?(f.return=d,K=f):o_(u)}c=c.sibling}e:for(c=null,u=t;;){if(u.tag===5){if(c===null){c=u;try{s=u.stateNode,l?(n=s.style,typeof n.setProperty=="function"?n.setProperty("display","none","important"):n.display="none"):(a=u.stateNode,h=u.memoizedProps.style,o=h!=null&&h.hasOwnProperty("display")?h.display:null,a.style.display=Mg("display",o))}catch(m){De(t,t.return,m)}}}else if(u.tag===6){if(c===null)try{u.stateNode.nodeValue=l?"":u.memoizedProps}catch(m){De(t,t.return,m)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===t)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===t)break e;for(;u.sibling===null;){if(u.return===null||u.return===t)break e;c===u&&(c=null),u=u.return}c===u&&(c=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:li(e,t),yi(t),r&4&&s_(t);break;case 21:break;default:li(e,t),yi(t)}}function yi(t){var e=t.flags;if(e&2){try{e:{for(var i=t.return;i!==null;){if(em(i)){var r=i;break e}i=i.return}throw Error(I(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Gn(s,""),r.flags&=-33);var n=r_(t);Tc(t,n,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=r_(t);Rc(t,a,o);break;default:throw Error(I(161))}}catch(h){De(t,t.return,h)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function yS(t,e,i){K=t,rm(t)}function rm(t,e,i){for(var r=(t.mode&1)!==0;K!==null;){var s=K,n=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Ho;if(!o){var a=s.alternate,h=a!==null&&a.memoizedState!==null||gt;a=Ho;var l=gt;if(Ho=o,(gt=h)&&!l)for(K=s;K!==null;)o=K,h=o.child,o.tag===22&&o.memoizedState!==null?a_(s):h!==null?(h.return=o,K=h):a_(s);for(;n!==null;)K=n,rm(n),n=n.sibling;K=s,Ho=a,gt=l}n_(t)}else s.subtreeFlags&8772&&n!==null?(n.return=s,K=n):n_(t)}}function n_(t){for(;K!==null;){var e=K;if(e.flags&8772){var i=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:gt||Sl(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!gt)if(i===null)r.componentDidMount();else{var s=e.elementType===e.type?i.memoizedProps:di(e.type,i.memoizedProps);r.componentDidUpdate(s,i.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var n=e.updateQueue;n!==null&&Hf(e,n,r);break;case 3:var o=e.updateQueue;if(o!==null){if(i=null,e.child!==null)switch(e.child.tag){case 5:i=e.child.stateNode;break;case 1:i=e.child.stateNode}Hf(e,o,i)}break;case 5:var a=e.stateNode;if(i===null&&e.flags&4){i=a;var h=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":h.autoFocus&&i.focus();break;case"img":h.src&&(i.src=h.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var l=e.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var u=c.dehydrated;u!==null&&Zn(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(I(163))}gt||e.flags&512&&Mc(e)}catch(d){De(e,e.return,d)}}if(e===t){K=null;break}if(i=e.sibling,i!==null){i.return=e.return,K=i;break}K=e.return}}function o_(t){for(;K!==null;){var e=K;if(e===t){K=null;break}var i=e.sibling;if(i!==null){i.return=e.return,K=i;break}K=e.return}}function a_(t){for(;K!==null;){var e=K;try{switch(e.tag){case 0:case 11:case 15:var i=e.return;try{Sl(4,e)}catch(h){De(e,i,h)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(h){De(e,s,h)}}var n=e.return;try{Mc(e)}catch(h){De(e,n,h)}break;case 5:var o=e.return;try{Mc(e)}catch(h){De(e,o,h)}}}catch(h){De(e,e.return,h)}if(e===t){K=null;break}var a=e.sibling;if(a!==null){a.return=e.return,K=a;break}K=e.return}}var SS=Math.ceil,Xa=Qi.ReactCurrentDispatcher,xd=Qi.ReactCurrentOwner,ii=Qi.ReactCurrentBatchConfig,se=0,tt=null,ze=null,ct=0,It=0,Ms=Tr(0),Ue=0,ho=null,ts=0,wl=0,Cd=0,jn=null,Tt=null,bd=0,qs=1/0,zi=null,Qa=!1,Pc=null,xr=null,Uo=!1,_r=null,Za=0,Wn=0,Dc=null,_a=-1,pa=0;function Ct(){return se&6?Ne():_a!==-1?_a:_a=Ne()}function Cr(t){return t.mode&1?se&2&&ct!==0?ct&-ct:rS.transition!==null?(pa===0&&(pa=jg()),pa):(t=he,t!==0||(t=window.event,t=t===void 0?16:Gg(t.type)),t):1}function gi(t,e,i,r){if(50<Wn)throw Wn=0,Dc=null,Error(I(185));vo(t,i,r),(!(se&2)||t!==tt)&&(t===tt&&(!(se&2)&&(wl|=i),Ue===4&&dr(t,ct)),At(t,r),i===1&&se===0&&!(e.mode&1)&&(qs=Ne()+500,vl&&Pr()))}function At(t,e){var i=t.callbackNode;ry(t,e);var r=Na(t,t===tt?ct:0);if(r===0)i!==null&&gf(i),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(i!=null&&gf(i),e===1)t.tag===0?iS(l_.bind(null,t)):fv(l_.bind(null,t)),Zy(function(){!(se&6)&&Pr()}),i=null;else{switch(Wg(r)){case 1:i=Xu;break;case 4:i=zg;break;case 16:i=Aa;break;case 536870912:i=Fg;break;default:i=Aa}i=um(i,sm.bind(null,t))}t.callbackPriority=e,t.callbackNode=i}}function sm(t,e){if(_a=-1,pa=0,se&6)throw Error(I(327));var i=t.callbackNode;if(Is()&&t.callbackNode!==i)return null;var r=Na(t,t===tt?ct:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Ja(t,r);else{e=r;var s=se;se|=2;var n=om();(tt!==t||ct!==e)&&(zi=null,qs=Ne()+500,Kr(t,e));do try{CS();break}catch(a){nm(t,a)}while(!0);hd(),Xa.current=n,se=s,ze!==null?e=0:(tt=null,ct=0,e=Ue)}if(e!==0){if(e===2&&(s=nc(t),s!==0&&(r=s,e=Bc(t,s))),e===1)throw i=ho,Kr(t,0),dr(t,r),At(t,Ne()),i;if(e===6)dr(t,r);else{if(s=t.current.alternate,!(r&30)&&!wS(s)&&(e=Ja(t,r),e===2&&(n=nc(t),n!==0&&(r=n,e=Bc(t,n))),e===1))throw i=ho,Kr(t,0),dr(t,r),At(t,Ne()),i;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(I(345));case 2:Or(t,Tt,zi);break;case 3:if(dr(t,r),(r&130023424)===r&&(e=bd+500-Ne(),10<e)){if(Na(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){Ct(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=fc(Or.bind(null,t,Tt,zi),e);break}Or(t,Tt,zi);break;case 4:if(dr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-pi(r);n=1<<o,o=e[o],o>s&&(s=o),r&=~n}if(r=s,r=Ne()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*SS(r/1960))-r,10<r){t.timeoutHandle=fc(Or.bind(null,t,Tt,zi),r);break}Or(t,Tt,zi);break;case 5:Or(t,Tt,zi);break;default:throw Error(I(329))}}}return At(t,Ne()),t.callbackNode===i?sm.bind(null,t):null}function Bc(t,e){var i=jn;return t.current.memoizedState.isDehydrated&&(Kr(t,e).flags|=256),t=Ja(t,e),t!==2&&(e=Tt,Tt=i,e!==null&&Ac(e)),t}function Ac(t){Tt===null?Tt=t:Tt.push.apply(Tt,t)}function wS(t){for(var e=t;;){if(e.flags&16384){var i=e.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var r=0;r<i.length;r++){var s=i[r],n=s.getSnapshot;s=s.value;try{if(!vi(n(),s))return!1}catch{return!1}}}if(i=e.child,e.subtreeFlags&16384&&i!==null)i.return=e,e=i;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function dr(t,e){for(e&=~Cd,e&=~wl,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var i=31-pi(e),r=1<<i;t[i]=-1,e&=~r}}function l_(t){if(se&6)throw Error(I(327));Is();var e=Na(t,0);if(!(e&1))return At(t,Ne()),null;var i=Ja(t,e);if(t.tag!==0&&i===2){var r=nc(t);r!==0&&(e=r,i=Bc(t,r))}if(i===1)throw i=ho,Kr(t,0),dr(t,e),At(t,Ne()),i;if(i===6)throw Error(I(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Or(t,Tt,zi),At(t,Ne()),null}function kd(t,e){var i=se;se|=1;try{return t(e)}finally{se=i,se===0&&(qs=Ne()+500,vl&&Pr())}}function is(t){_r!==null&&_r.tag===0&&!(se&6)&&Is();var e=se;se|=1;var i=ii.transition,r=he;try{if(ii.transition=null,he=1,t)return t()}finally{he=r,ii.transition=i,se=e,!(se&6)&&Pr()}}function Ed(){It=Ms.current,Se(Ms)}function Kr(t,e){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,Qy(i)),ze!==null)for(i=ze.return;i!==null;){var r=i;switch(od(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Fa();break;case 3:Ks(),Se(Dt),Se(mt),pd();break;case 5:_d(r);break;case 4:Ks();break;case 13:Se(ke);break;case 19:Se(ke);break;case 10:cd(r.type._context);break;case 22:case 23:Ed()}i=i.return}if(tt=t,ze=t=br(t.current,null),ct=It=e,Ue=0,ho=null,Cd=wl=ts=0,Tt=jn=null,jr!==null){for(e=0;e<jr.length;e++)if(i=jr[e],r=i.interleaved,r!==null){i.interleaved=null;var s=r.next,n=i.pending;if(n!==null){var o=n.next;n.next=s,r.next=o}i.pending=r}jr=null}return t}function nm(t,e){do{var i=ze;try{if(hd(),ua.current=Ya,Ga){for(var r=Ee.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Ga=!1}if(es=0,Ge=He=Ee=null,zn=!1,oo=0,xd.current=null,i===null||i.return===null){Ue=1,ho=e,ze=null;break}e:{var n=t,o=i.return,a=i,h=e;if(e=ct,a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){var l=h,c=a,u=c.tag;if(!(c.mode&1)&&(u===0||u===11||u===15)){var d=c.alternate;d?(c.updateQueue=d.updateQueue,c.memoizedState=d.memoizedState,c.lanes=d.lanes):(c.updateQueue=null,c.memoizedState=null)}var f=Yf(o);if(f!==null){f.flags&=-257,Xf(f,o,a,n,e),f.mode&1&&Gf(n,l,e),e=f,h=l;var p=e.updateQueue;if(p===null){var m=new Set;m.add(h),e.updateQueue=m}else p.add(h);break e}else{if(!(e&1)){Gf(n,l,e),Ld();break e}h=Error(I(426))}}else if(we&&a.mode&1){var x=Yf(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Xf(x,o,a,n,e),ad(Vs(h,a));break e}}n=h=Vs(h,a),Ue!==4&&(Ue=2),jn===null?jn=[n]:jn.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,e&=-e,n.lanes|=e;var _=Wv(n,h,e);Wf(n,_);break e;case 1:a=h;var g=n.type,S=n.stateNode;if(!(n.flags&128)&&(typeof g.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(xr===null||!xr.has(S)))){n.flags|=65536,e&=-e,n.lanes|=e;var y=Hv(n,a,e);Wf(n,y);break e}}n=n.return}while(n!==null)}lm(i)}catch(L){e=L,ze===i&&i!==null&&(ze=i=i.return);continue}break}while(!0)}function om(){var t=Xa.current;return Xa.current=Ya,t===null?Ya:t}function Ld(){(Ue===0||Ue===3||Ue===2)&&(Ue=4),tt===null||!(ts&268435455)&&!(wl&268435455)||dr(tt,ct)}function Ja(t,e){var i=se;se|=2;var r=om();(tt!==t||ct!==e)&&(zi=null,Kr(t,e));do try{xS();break}catch(s){nm(t,s)}while(!0);if(hd(),se=i,Xa.current=r,ze!==null)throw Error(I(261));return tt=null,ct=0,Ue}function xS(){for(;ze!==null;)am(ze)}function CS(){for(;ze!==null&&!G1();)am(ze)}function am(t){var e=cm(t.alternate,t,It);t.memoizedProps=t.pendingProps,e===null?lm(t):ze=e,xd.current=null}function lm(t){var e=t;do{var i=e.alternate;if(t=e.return,e.flags&32768){if(i=gS(i,e),i!==null){i.flags&=32767,ze=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ue=6,ze=null;return}}else if(i=pS(i,e,It),i!==null){ze=i;return}if(e=e.sibling,e!==null){ze=e;return}ze=e=t}while(e!==null);Ue===0&&(Ue=5)}function Or(t,e,i){var r=he,s=ii.transition;try{ii.transition=null,he=1,bS(t,e,i,r)}finally{ii.transition=s,he=r}return null}function bS(t,e,i,r){do Is();while(_r!==null);if(se&6)throw Error(I(327));i=t.finishedWork;var s=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(I(177));t.callbackNode=null,t.callbackPriority=0;var n=i.lanes|i.childLanes;if(sy(t,n),t===tt&&(ze=tt=null,ct=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||Uo||(Uo=!0,um(Aa,function(){return Is(),null})),n=(i.flags&15990)!==0,i.subtreeFlags&15990||n){n=ii.transition,ii.transition=null;var o=he;he=1;var a=se;se|=4,xd.current=null,mS(t,i),im(i,t),Uy(uc),$a=!!cc,uc=cc=null,t.current=i,yS(i),Y1(),se=a,he=o,ii.transition=n}else t.current=i;if(Uo&&(Uo=!1,_r=t,Za=s),n=t.pendingLanes,n===0&&(xr=null),Z1(i.stateNode),At(t,Ne()),e!==null)for(r=t.onRecoverableError,i=0;i<e.length;i++)s=e[i],r(s.value,{componentStack:s.stack,digest:s.digest});if(Qa)throw Qa=!1,t=Pc,Pc=null,t;return Za&1&&t.tag!==0&&Is(),n=t.pendingLanes,n&1?t===Dc?Wn++:(Wn=0,Dc=t):Wn=0,Pr(),null}function Is(){if(_r!==null){var t=Wg(Za),e=ii.transition,i=he;try{if(ii.transition=null,he=16>t?16:t,_r===null)var r=!1;else{if(t=_r,_r=null,Za=0,se&6)throw Error(I(331));var s=se;for(se|=4,K=t.current;K!==null;){var n=K,o=n.child;if(K.flags&16){var a=n.deletions;if(a!==null){for(var h=0;h<a.length;h++){var l=a[h];for(K=l;K!==null;){var c=K;switch(c.tag){case 0:case 11:case 15:Fn(8,c,n)}var u=c.child;if(u!==null)u.return=c,K=u;else for(;K!==null;){c=K;var d=c.sibling,f=c.return;if(Jv(c),c===l){K=null;break}if(d!==null){d.return=f,K=d;break}K=f}}}var p=n.alternate;if(p!==null){var m=p.child;if(m!==null){p.child=null;do{var x=m.sibling;m.sibling=null,m=x}while(m!==null)}}K=n}}if(n.subtreeFlags&2064&&o!==null)o.return=n,K=o;else e:for(;K!==null;){if(n=K,n.flags&2048)switch(n.tag){case 0:case 11:case 15:Fn(9,n,n.return)}var _=n.sibling;if(_!==null){_.return=n.return,K=_;break e}K=n.return}}var g=t.current;for(K=g;K!==null;){o=K;var S=o.child;if(o.subtreeFlags&2064&&S!==null)S.return=o,K=S;else e:for(o=g;K!==null;){if(a=K,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Sl(9,a)}}catch(L){De(a,a.return,L)}if(a===o){K=null;break e}var y=a.sibling;if(y!==null){y.return=a.return,K=y;break e}K=a.return}}if(se=s,Pr(),Mi&&typeof Mi.onPostCommitFiberRoot=="function")try{Mi.onPostCommitFiberRoot(dl,t)}catch{}r=!0}return r}finally{he=i,ii.transition=e}}return!1}function h_(t,e,i){e=Vs(i,e),e=Wv(t,e,1),t=wr(t,e,1),e=Ct(),t!==null&&(vo(t,1,e),At(t,e))}function De(t,e,i){if(t.tag===3)h_(t,t,i);else for(;e!==null;){if(e.tag===3){h_(e,t,i);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(xr===null||!xr.has(r))){t=Vs(i,t),t=Hv(e,t,1),e=wr(e,t,1),t=Ct(),e!==null&&(vo(e,1,t),At(e,t));break}}e=e.return}}function kS(t,e,i){var r=t.pingCache;r!==null&&r.delete(e),e=Ct(),t.pingedLanes|=t.suspendedLanes&i,tt===t&&(ct&i)===i&&(Ue===4||Ue===3&&(ct&130023424)===ct&&500>Ne()-bd?Kr(t,0):Cd|=i),At(t,e)}function hm(t,e){e===0&&(t.mode&1?(e=Ao,Ao<<=1,!(Ao&130023424)&&(Ao=4194304)):e=1);var i=Ct();t=Yi(t,e),t!==null&&(vo(t,e,i),At(t,i))}function ES(t){var e=t.memoizedState,i=0;e!==null&&(i=e.retryLane),hm(t,i)}function LS(t,e){var i=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(i=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(I(314))}r!==null&&r.delete(e),hm(t,i)}var cm;cm=function(t,e,i){if(t!==null)if(t.memoizedProps!==e.pendingProps||Dt.current)Pt=!0;else{if(!(t.lanes&i)&&!(e.flags&128))return Pt=!1,_S(t,e,i);Pt=!!(t.flags&131072)}else Pt=!1,we&&e.flags&1048576&&_v(e,Ha,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;fa(t,e),t=e.pendingProps;var s=Ws(e,mt.current);Os(e,i),s=vd(null,e,r,t,s,i);var n=md();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Bt(r)?(n=!0,ja(e)):n=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,dd(e),s.updater=yl,e.stateNode=s,s._reactInternals=e,Sc(e,r,t,i),e=Cc(null,e,r,!0,n,i)):(e.tag=0,we&&n&&nd(e),wt(null,e,s,i),e=e.child),e;case 16:r=e.elementType;e:{switch(fa(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=RS(r),t=di(r,t),s){case 0:e=xc(null,e,r,t,i);break e;case 1:e=Jf(null,e,r,t,i);break e;case 11:e=Qf(null,e,r,t,i);break e;case 14:e=Zf(null,e,r,di(r.type,t),i);break e}throw Error(I(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:di(r,s),xc(t,e,r,s,i);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:di(r,s),Jf(t,e,r,s,i);case 3:e:{if(qv(e),t===null)throw Error(I(387));r=e.pendingProps,n=e.memoizedState,s=n.element,Sv(t,e),Va(e,r,null,i);var o=e.memoizedState;if(r=o.element,n.isDehydrated)if(n={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=n,e.memoizedState=n,e.flags&256){s=Vs(Error(I(423)),e),e=e_(t,e,r,i,s);break e}else if(r!==s){s=Vs(Error(I(424)),e),e=e_(t,e,r,i,s);break e}else for(zt=Sr(e.stateNode.containerInfo.firstChild),Ft=e,we=!0,_i=null,i=mv(e,null,r,i),e.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Hs(),r===s){e=Xi(t,e,i);break e}wt(t,e,r,i)}e=e.child}return e;case 5:return wv(e),t===null&&vc(e),r=e.type,s=e.pendingProps,n=t!==null?t.memoizedProps:null,o=s.children,dc(r,s)?o=null:n!==null&&dc(r,n)&&(e.flags|=32),Vv(t,e),wt(t,e,o,i),e.child;case 6:return t===null&&vc(e),null;case 13:return Gv(t,e,i);case 4:return fd(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Us(e,null,r,i):wt(t,e,r,i),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:di(r,s),Qf(t,e,r,s,i);case 7:return wt(t,e,e.pendingProps,i),e.child;case 8:return wt(t,e,e.pendingProps.children,i),e.child;case 12:return wt(t,e,e.pendingProps.children,i),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,n=e.memoizedProps,o=s.value,_e(Ua,r._currentValue),r._currentValue=o,n!==null)if(vi(n.value,o)){if(n.children===s.children&&!Dt.current){e=Xi(t,e,i);break e}}else for(n=e.child,n!==null&&(n.return=e);n!==null;){var a=n.dependencies;if(a!==null){o=n.child;for(var h=a.firstContext;h!==null;){if(h.context===r){if(n.tag===1){h=Vi(-1,i&-i),h.tag=2;var l=n.updateQueue;if(l!==null){l=l.shared;var c=l.pending;c===null?h.next=h:(h.next=c.next,c.next=h),l.pending=h}}n.lanes|=i,h=n.alternate,h!==null&&(h.lanes|=i),mc(n.return,i,e),a.lanes|=i;break}h=h.next}}else if(n.tag===10)o=n.type===e.type?null:n.child;else if(n.tag===18){if(o=n.return,o===null)throw Error(I(341));o.lanes|=i,a=o.alternate,a!==null&&(a.lanes|=i),mc(o,i,e),o=n.sibling}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===e){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}wt(t,e,s.children,i),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Os(e,i),s=si(s),r=r(s),e.flags|=1,wt(t,e,r,i),e.child;case 14:return r=e.type,s=di(r,e.pendingProps),s=di(r.type,s),Zf(t,e,r,s,i);case 15:return Uv(t,e,e.type,e.pendingProps,i);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:di(r,s),fa(t,e),e.tag=1,Bt(r)?(t=!0,ja(e)):t=!1,Os(e,i),jv(e,r,s),Sc(e,r,s,i),Cc(null,e,r,!0,t,i);case 19:return Yv(t,e,i);case 22:return Kv(t,e,i)}throw Error(I(156,e.tag))};function um(t,e){return Ig(t,e)}function MS(t,e,i,r){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(t,e,i,r){return new MS(t,e,i,r)}function Md(t){return t=t.prototype,!(!t||!t.isReactComponent)}function RS(t){if(typeof t=="function")return Md(t)?1:0;if(t!=null){if(t=t.$$typeof,t===qu)return 11;if(t===Gu)return 14}return 2}function br(t,e){var i=t.alternate;return i===null?(i=ti(t.tag,e,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=e,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,e=t.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function ga(t,e,i,r,s,n){var o=2;if(r=t,typeof t=="function")Md(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ms:return Vr(i.children,s,n,e);case Vu:o=8,s|=8;break;case Uh:return t=ti(12,i,e,s|2),t.elementType=Uh,t.lanes=n,t;case Kh:return t=ti(13,i,e,s),t.elementType=Kh,t.lanes=n,t;case Vh:return t=ti(19,i,e,s),t.elementType=Vh,t.lanes=n,t;case wg:return xl(i,s,n,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case yg:o=10;break e;case Sg:o=9;break e;case qu:o=11;break e;case Gu:o=14;break e;case lr:o=16,r=null;break e}throw Error(I(130,t==null?t:typeof t,""))}return e=ti(o,i,e,s),e.elementType=t,e.type=r,e.lanes=n,e}function Vr(t,e,i,r){return t=ti(7,t,r,e),t.lanes=i,t}function xl(t,e,i,r){return t=ti(22,t,r,e),t.elementType=wg,t.lanes=i,t.stateNode={isHidden:!1},t}function hh(t,e,i){return t=ti(6,t,null,e),t.lanes=i,t}function ch(t,e,i){return e=ti(4,t.children!==null?t.children:[],t.key,e),e.lanes=i,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function TS(t,e,i,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ul(0),this.expirationTimes=Ul(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ul(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Rd(t,e,i,r,s,n,o,a,h){return t=new TS(t,e,i,a,h),e===1?(e=1,n===!0&&(e|=8)):e=0,n=ti(3,null,null,e),t.current=n,n.stateNode=t,n.memoizedState={element:r,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},dd(n),t}function PS(t,e,i){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:vs,key:r==null?null:""+r,children:t,containerInfo:e,implementation:i}}function dm(t){if(!t)return Lr;t=t._reactInternals;e:{if(as(t)!==t||t.tag!==1)throw Error(I(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Bt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(I(171))}if(t.tag===1){var i=t.type;if(Bt(i))return dv(t,i,e)}return e}function fm(t,e,i,r,s,n,o,a,h){return t=Rd(i,r,!0,t,s,n,o,a,h),t.context=dm(null),i=t.current,r=Ct(),s=Cr(i),n=Vi(r,s),n.callback=e??null,wr(i,n,s),t.current.lanes=s,vo(t,s,r),At(t,r),t}function Cl(t,e,i,r){var s=e.current,n=Ct(),o=Cr(s);return i=dm(i),e.context===null?e.context=i:e.pendingContext=i,e=Vi(n,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=wr(s,e,o),t!==null&&(gi(t,s,o,n),ca(t,s,o)),o}function el(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function c_(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<e?i:e}}function Td(t,e){c_(t,e),(t=t.alternate)&&c_(t,e)}function DS(){return null}var _m=typeof reportError=="function"?reportError:function(t){console.error(t)};function Pd(t){this._internalRoot=t}bl.prototype.render=Pd.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(I(409));Cl(t,e,null,null)};bl.prototype.unmount=Pd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;is(function(){Cl(null,t,null,null)}),e[Gi]=null}};function bl(t){this._internalRoot=t}bl.prototype.unstable_scheduleHydration=function(t){if(t){var e=Kg();t={blockedOn:null,target:t,priority:e};for(var i=0;i<ur.length&&e!==0&&e<ur[i].priority;i++);ur.splice(i,0,t),i===0&&qg(t)}};function Dd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function kl(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function u_(){}function BS(t,e,i,r,s){if(s){if(typeof r=="function"){var n=r;r=function(){var l=el(o);n.call(l)}}var o=fm(e,r,t,0,null,!1,!1,"",u_);return t._reactRootContainer=o,t[Gi]=o.current,to(t.nodeType===8?t.parentNode:t),is(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var l=el(h);a.call(l)}}var h=Rd(t,0,!1,null,null,!1,!1,"",u_);return t._reactRootContainer=h,t[Gi]=h.current,to(t.nodeType===8?t.parentNode:t),is(function(){Cl(e,h,i,r)}),h}function El(t,e,i,r,s){var n=i._reactRootContainer;if(n){var o=n;if(typeof s=="function"){var a=s;s=function(){var h=el(o);a.call(h)}}Cl(e,o,t,s)}else o=BS(i,e,t,s,r);return el(o)}Hg=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var i=En(e.pendingLanes);i!==0&&(Qu(e,i|1),At(e,Ne()),!(se&6)&&(qs=Ne()+500,Pr()))}break;case 13:is(function(){var r=Yi(t,1);if(r!==null){var s=Ct();gi(r,t,1,s)}}),Td(t,1)}};Zu=function(t){if(t.tag===13){var e=Yi(t,134217728);if(e!==null){var i=Ct();gi(e,t,134217728,i)}Td(t,134217728)}};Ug=function(t){if(t.tag===13){var e=Cr(t),i=Yi(t,e);if(i!==null){var r=Ct();gi(i,t,e,r)}Td(t,e)}};Kg=function(){return he};Vg=function(t,e){var i=he;try{return he=t,e()}finally{he=i}};ic=function(t,e,i){switch(e){case"input":if(Yh(t,i),e=i.name,i.type==="radio"&&e!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<i.length;e++){var r=i[e];if(r!==t&&r.form===t.form){var s=gl(r);if(!s)throw Error(I(90));Cg(r),Yh(r,s)}}}break;case"textarea":kg(t,i);break;case"select":e=i.value,e!=null&&Bs(t,!!i.multiple,e,!1)}};Dg=kd;Bg=is;var AS={usingClientEntryPoint:!1,Events:[yo,xs,gl,Tg,Pg,kd]},un={findFiberByHostInstance:Fr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},NS={bundleType:un.bundleType,version:un.version,rendererPackageName:un.rendererPackageName,rendererConfig:un.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Qi.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=$g(t),t===null?null:t.stateNode},findFiberByHostInstance:un.findFiberByHostInstance||DS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ko=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ko.isDisabled&&Ko.supportsFiber)try{dl=Ko.inject(NS),Mi=Ko}catch{}}Wt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AS;Wt.createPortal=function(t,e){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Dd(e))throw Error(I(200));return PS(t,e,null,i)};Wt.createRoot=function(t,e){if(!Dd(t))throw Error(I(299));var i=!1,r="",s=_m;return e!=null&&(e.unstable_strictMode===!0&&(i=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=Rd(t,1,!1,null,null,i,!1,r,s),t[Gi]=e.current,to(t.nodeType===8?t.parentNode:t),new Pd(e)};Wt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(I(188)):(t=Object.keys(t).join(","),Error(I(268,t)));return t=$g(e),t=t===null?null:t.stateNode,t};Wt.flushSync=function(t){return is(t)};Wt.hydrate=function(t,e,i){if(!kl(e))throw Error(I(200));return El(null,t,e,!0,i)};Wt.hydrateRoot=function(t,e,i){if(!Dd(t))throw Error(I(405));var r=i!=null&&i.hydratedSources||null,s=!1,n="",o=_m;if(i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(n=i.identifierPrefix),i.onRecoverableError!==void 0&&(o=i.onRecoverableError)),e=fm(e,null,t,1,i??null,s,!1,n,o),t[Gi]=e.current,to(t),r)for(t=0;t<r.length;t++)i=r[t],s=i._getVersion,s=s(i._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[i,s]:e.mutableSourceEagerHydrationData.push(i,s);return new bl(e)};Wt.render=function(t,e,i){if(!kl(e))throw Error(I(200));return El(null,t,e,!1,i)};Wt.unmountComponentAtNode=function(t){if(!kl(t))throw Error(I(40));return t._reactRootContainer?(is(function(){El(null,null,t,!1,function(){t._reactRootContainer=null,t[Gi]=null})}),!0):!1};Wt.unstable_batchedUpdates=kd;Wt.unstable_renderSubtreeIntoContainer=function(t,e,i,r){if(!kl(i))throw Error(I(200));if(t==null||t._reactInternals===void 0)throw Error(I(38));return El(t,e,i,!1,r)};Wt.version="18.3.1-next-f1338f8080-20240426";function pm(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(pm)}catch(t){console.error(t)}}pm(),pg.exports=Wt;var $S=pg.exports,d_=$S;Wh.createRoot=d_.createRoot,Wh.hydrateRoot=d_.hydrateRoot;const OS={},f_=t=>{let e;const i=new Set,r=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),i.forEach(p=>p(e,f))}},s=()=>e,h={setState:r,getState:s,getInitialState:()=>l,subscribe:c=>(i.add(c),()=>i.delete(c)),destroy:()=>{(OS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},l=e=t(r,s,h);return h},IS=t=>t?f_(t):f_;var gm={exports:{}},vm={},mm={exports:{}},ym={};/**
|
|
40
|
+
`+n.stack}return{value:t,source:e,stack:s,digest:null}}function ah(t,e,i){return{value:t,source:null,stack:i??null,digest:e??null}}function wc(t,e){try{console.error(e.value)}catch(i){setTimeout(function(){throw i})}}var uS=typeof WeakMap=="function"?WeakMap:Map;function Wv(t,e,i){i=Vi(-1,i),i.tag=3,i.payload={element:null};var r=e.value;return i.callback=function(){Qa||(Qa=!0,Pc=r),wc(t,e)},i}function Hv(t,e,i){i=Vi(-1,i),i.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;i.payload=function(){return r(s)},i.callback=function(){wc(t,e)}}var n=t.stateNode;return n!==null&&typeof n.componentDidCatch=="function"&&(i.callback=function(){wc(t,e),typeof r!="function"&&(xr===null?xr=new Set([this]):xr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),i}function Gf(t,e,i){var r=t.pingCache;if(r===null){r=t.pingCache=new uS;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(i)||(s.add(i),t=kS.bind(null,t,e,i),e.then(t,t))}function Yf(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function Xf(t,e,i,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(e=Vi(-1,1),e.tag=2,wr(i,e,1))),i.lanes|=1),t)}var dS=Qi.ReactCurrentOwner,Pt=!1;function wt(t,e,i,r){e.child=t===null?mv(e,null,i,r):Us(e,t.child,i,r)}function Qf(t,e,i,r,s){i=i.render;var n=e.ref;return Os(e,s),r=vd(t,e,i,r,n,s),i=md(),t!==null&&!Pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Xi(t,e,s)):(we&&i&&nd(e),e.flags|=1,wt(t,e,r,s),e.child)}function Zf(t,e,i,r,s){if(t===null){var n=i.type;return typeof n=="function"&&!Md(n)&&n.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(e.tag=15,e.type=n,Uv(t,e,n,r,s)):(t=ga(i.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(n=t.child,!(t.lanes&s)){var o=n.memoizedProps;if(i=i.compare,i=i!==null?i:eo,i(o,r)&&t.ref===e.ref)return Xi(t,e,s)}return e.flags|=1,t=br(n,r),t.ref=e.ref,t.return=e,e.child=t}function Uv(t,e,i,r,s){if(t!==null){var n=t.memoizedProps;if(eo(n,r)&&t.ref===e.ref)if(Pt=!1,e.pendingProps=r=n,(t.lanes&s)!==0)t.flags&131072&&(Pt=!0);else return e.lanes=t.lanes,Xi(t,e,s)}return xc(t,e,i,r,s)}function Kv(t,e,i){var r=e.pendingProps,s=r.children,n=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},pe(Ms,It),It|=i;else{if(!(i&1073741824))return t=n!==null?n.baseLanes|i:i,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,pe(Ms,It),It|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=n!==null?n.baseLanes:i,pe(Ms,It),It|=r}else n!==null?(r=n.baseLanes|i,e.memoizedState=null):r=i,pe(Ms,It),It|=r;return wt(t,e,s,i),e.child}function Vv(t,e){var i=e.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(e.flags|=512,e.flags|=2097152)}function xc(t,e,i,r,s){var n=Bt(i)?Zr:mt.current;return n=Ws(e,n),Os(e,s),i=vd(t,e,i,r,n,s),r=md(),t!==null&&!Pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Xi(t,e,s)):(we&&r&&nd(e),e.flags|=1,wt(t,e,i,s),e.child)}function Jf(t,e,i,r,s){if(Bt(i)){var n=!0;ja(e)}else n=!1;if(Os(e,s),e.stateNode===null)fa(t,e),jv(e,i,r),Sc(e,i,r,s),r=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var h=o.context,l=i.contextType;typeof l=="object"&&l!==null?l=si(l):(l=Bt(i)?Zr:mt.current,l=Ws(e,l));var c=i.getDerivedStateFromProps,u=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||h!==l)&&qf(e,o,r,l),hr=!1;var d=e.memoizedState;o.state=d,Va(e,r,o,s),h=e.memoizedState,a!==r||d!==h||Dt.current||hr?(typeof c=="function"&&(yc(e,i,c,r),h=e.memoizedState),(a=hr||Vf(e,i,a,r,d,h,l))?(u||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=h),o.props=r,o.state=h,o.context=l,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,Sv(t,e),a=e.memoizedProps,l=e.type===e.elementType?a:di(e.type,a),o.props=l,u=e.pendingProps,d=o.context,h=i.contextType,typeof h=="object"&&h!==null?h=si(h):(h=Bt(i)?Zr:mt.current,h=Ws(e,h));var f=i.getDerivedStateFromProps;(c=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==u||d!==h)&&qf(e,o,r,h),hr=!1,d=e.memoizedState,o.state=d,Va(e,r,o,s);var p=e.memoizedState;a!==u||d!==p||Dt.current||hr?(typeof f=="function"&&(yc(e,i,f,r),p=e.memoizedState),(l=hr||Vf(e,i,l,r,d,p,h)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,h),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,h)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=h,r=l):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),r=!1)}return Cc(t,e,i,r,n,s)}function Cc(t,e,i,r,s,n){Vv(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&If(e,i,!1),Xi(t,e,n);r=e.stateNode,dS.current=e;var a=o&&typeof i.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Us(e,t.child,null,n),e.child=Us(e,null,a,n)):wt(t,e,a,n),e.memoizedState=r.state,s&&If(e,i,!0),e.child}function qv(t){var e=t.stateNode;e.pendingContext?Of(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Of(t,e.context,!1),fd(t,e.containerInfo)}function e_(t,e,i,r,s){return Hs(),ad(s),e.flags|=256,wt(t,e,i,r),e.child}var bc={dehydrated:null,treeContext:null,retryLane:0};function kc(t){return{baseLanes:t,cachePool:null,transitions:null}}function Gv(t,e,i){var r=e.pendingProps,s=ke.current,n=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(s&2)!==0),a?(n=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),pe(ke,s&1),t===null)return vc(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,n?(r=e.mode,n=e.child,o={mode:"hidden",children:o},!(r&1)&&n!==null?(n.childLanes=0,n.pendingProps=o):n=xl(o,r,0,null),t=Vr(t,r,i,null),n.return=e,t.return=e,n.sibling=t,e.child=n,e.child.memoizedState=kc(i),e.memoizedState=bc,t):wd(e,o));if(s=t.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return fS(t,e,o,r,a,s,i);if(n){n=r.fallback,o=e.mode,s=t.child,a=s.sibling;var h={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=h,e.deletions=null):(r=br(s,h),r.subtreeFlags=s.subtreeFlags&14680064),a!==null?n=br(a,n):(n=Vr(n,o,i,null),n.flags|=2),n.return=e,r.return=e,r.sibling=n,e.child=r,r=n,n=e.child,o=t.child.memoizedState,o=o===null?kc(i):{baseLanes:o.baseLanes|i,cachePool:null,transitions:o.transitions},n.memoizedState=o,n.childLanes=t.childLanes&~i,e.memoizedState=bc,r}return n=t.child,t=n.sibling,r=br(n,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=i),r.return=e,r.sibling=null,t!==null&&(i=e.deletions,i===null?(e.deletions=[t],e.flags|=16):i.push(t)),e.child=r,e.memoizedState=null,r}function wd(t,e){return e=xl({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Wo(t,e,i,r){return r!==null&&ad(r),Us(e,t.child,null,i),t=wd(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function fS(t,e,i,r,s,n,o){if(i)return e.flags&256?(e.flags&=-257,r=ah(Error(I(422))),Wo(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(n=r.fallback,s=e.mode,r=xl({mode:"visible",children:r.children},s,0,null),n=Vr(n,s,o,null),n.flags|=2,r.return=e,n.return=e,r.sibling=n,e.child=r,e.mode&1&&Us(e,t.child,null,o),e.child.memoizedState=kc(o),e.memoizedState=bc,n);if(!(e.mode&1))return Wo(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var a=r.dgst;return r=a,n=Error(I(419)),r=ah(n,r,void 0),Wo(t,e,o,r)}if(a=(o&t.childLanes)!==0,Pt||a){if(r=tt,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==n.retryLane&&(n.retryLane=s,Yi(t,s),gi(r,t,s,-1))}return Ld(),r=ah(Error(I(421))),Wo(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=ES.bind(null,t),s._reactRetry=e,null):(t=n.treeContext,zt=Sr(s.nextSibling),Ft=e,we=!0,_i=null,t!==null&&(Zt[Jt++]=Wi,Zt[Jt++]=Hi,Zt[Jt++]=Jr,Wi=t.id,Hi=t.overflow,Jr=e),e=wd(e,r.children),e.flags|=4096,e)}function t_(t,e,i){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),mc(t.return,e,i)}function lh(t,e,i,r,s){var n=t.memoizedState;n===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:i,tailMode:s}:(n.isBackwards=e,n.rendering=null,n.renderingStartTime=0,n.last=r,n.tail=i,n.tailMode=s)}function Yv(t,e,i){var r=e.pendingProps,s=r.revealOrder,n=r.tail;if(wt(t,e,r.children,i),r=ke.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&t_(t,i,e);else if(t.tag===19)t_(t,i,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(pe(ke,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(i=e.child,s=null;i!==null;)t=i.alternate,t!==null&&qa(t)===null&&(s=i),i=i.sibling;i=s,i===null?(s=e.child,e.child=null):(s=i.sibling,i.sibling=null),lh(e,!1,s,i,n);break;case"backwards":for(i=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&qa(t)===null){e.child=s;break}t=s.sibling,s.sibling=i,i=s,s=t}lh(e,!0,i,null,n);break;case"together":lh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function fa(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Xi(t,e,i){if(t!==null&&(e.dependencies=t.dependencies),ts|=e.lanes,!(i&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(I(153));if(e.child!==null){for(t=e.child,i=br(t,t.pendingProps),e.child=i,i.return=e;t.sibling!==null;)t=t.sibling,i=i.sibling=br(t,t.pendingProps),i.return=e;i.sibling=null}return e.child}function _S(t,e,i){switch(e.tag){case 3:qv(e),Hs();break;case 5:wv(e);break;case 1:Bt(e.type)&&ja(e);break;case 4:fd(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;pe(Ua,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(pe(ke,ke.current&1),e.flags|=128,null):i&e.child.childLanes?Gv(t,e,i):(pe(ke,ke.current&1),t=Xi(t,e,i),t!==null?t.sibling:null);pe(ke,ke.current&1);break;case 19:if(r=(i&e.childLanes)!==0,t.flags&128){if(r)return Yv(t,e,i);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),pe(ke,ke.current),r)break;return null;case 22:case 23:return e.lanes=0,Kv(t,e,i)}return Xi(t,e,i)}var Xv,Ec,Qv,Zv;Xv=function(t,e){for(var i=e.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};Ec=function(){};Qv=function(t,e,i,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Wr(Ri.current);var n=null;switch(i){case"input":s=Gh(t,s),r=Gh(t,r),n=[];break;case"select":s=Le({},s,{value:void 0}),r=Le({},r,{value:void 0}),n=[];break;case"textarea":s=Qh(t,s),r=Qh(t,r),n=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=za)}Jh(i,r);var o;i=null;for(l in s)if(!r.hasOwnProperty(l)&&s.hasOwnProperty(l)&&s[l]!=null)if(l==="style"){var a=s[l];for(o in a)a.hasOwnProperty(o)&&(i||(i={}),i[o]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(qn.hasOwnProperty(l)?n||(n=[]):(n=n||[]).push(l,null));for(l in r){var h=r[l];if(a=s!=null?s[l]:void 0,r.hasOwnProperty(l)&&h!==a&&(h!=null||a!=null))if(l==="style")if(a){for(o in a)!a.hasOwnProperty(o)||h&&h.hasOwnProperty(o)||(i||(i={}),i[o]="");for(o in h)h.hasOwnProperty(o)&&a[o]!==h[o]&&(i||(i={}),i[o]=h[o])}else i||(n||(n=[]),n.push(l,i)),i=h;else l==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,a=a?a.__html:void 0,h!=null&&a!==h&&(n=n||[]).push(l,h)):l==="children"?typeof h!="string"&&typeof h!="number"||(n=n||[]).push(l,""+h):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&(qn.hasOwnProperty(l)?(h!=null&&l==="onScroll"&&ve("scroll",t),n||a===h||(n=[])):(n=n||[]).push(l,h))}i&&(n=n||[]).push("style",i);var l=n;(e.updateQueue=l)&&(e.flags|=4)}};Zv=function(t,e,i,r){i!==r&&(e.flags|=4)};function cn(t,e){if(!we)switch(t.tailMode){case"hidden":e=t.tail;for(var i=null;e!==null;)e.alternate!==null&&(i=e),e=e.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var r=null;i!==null;)i.alternate!==null&&(r=i),i=i.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function _t(t){var e=t.alternate!==null&&t.alternate.child===t.child,i=0,r=0;if(e)for(var s=t.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)i|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=i,e}function pS(t,e,i){var r=e.pendingProps;switch(od(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(e),null;case 1:return Bt(e.type)&&Fa(),_t(e),null;case 3:return r=e.stateNode,Ks(),Se(Dt),Se(mt),pd(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Fo(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,_i!==null&&(Ac(_i),_i=null))),Ec(t,e),_t(e),null;case 5:_d(e);var s=Wr(no.current);if(i=e.type,t!==null&&e.stateNode!=null)Qv(t,e,i,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(I(166));return _t(e),null}if(t=Wr(Ri.current),Fo(e)){r=e.stateNode,i=e.type;var n=e.memoizedProps;switch(r[Ei]=e,r[ro]=n,t=(e.mode&1)!==0,i){case"dialog":ve("cancel",r),ve("close",r);break;case"iframe":case"object":case"embed":ve("load",r);break;case"video":case"audio":for(s=0;s<Ln.length;s++)ve(Ln[s],r);break;case"source":ve("error",r);break;case"img":case"image":case"link":ve("error",r),ve("load",r);break;case"details":ve("toggle",r);break;case"input":cf(r,n),ve("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!n.multiple},ve("invalid",r);break;case"textarea":df(r,n),ve("invalid",r)}Jh(i,n),s=null;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];o==="children"?typeof a=="string"?r.textContent!==a&&(n.suppressHydrationWarning!==!0&&zo(r.textContent,a,t),s=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(n.suppressHydrationWarning!==!0&&zo(r.textContent,a,t),s=["children",""+a]):qn.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&ve("scroll",r)}switch(i){case"input":Po(r),uf(r,n,!0);break;case"textarea":Po(r),ff(r);break;case"select":case"option":break;default:typeof n.onClick=="function"&&(r.onclick=za)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Eg(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(i,{is:r.is}):(t=o.createElement(i),i==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,i),t[Ei]=e,t[ro]=r,Xv(t,e,!1,!1),e.stateNode=t;e:{switch(o=ec(i,r),i){case"dialog":ve("cancel",t),ve("close",t),s=r;break;case"iframe":case"object":case"embed":ve("load",t),s=r;break;case"video":case"audio":for(s=0;s<Ln.length;s++)ve(Ln[s],t);s=r;break;case"source":ve("error",t),s=r;break;case"img":case"image":case"link":ve("error",t),ve("load",t),s=r;break;case"details":ve("toggle",t),s=r;break;case"input":cf(t,r),s=Gh(t,r),ve("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=Le({},r,{value:void 0}),ve("invalid",t);break;case"textarea":df(t,r),s=Qh(t,r),ve("invalid",t);break;default:s=r}Jh(i,s),a=s;for(n in a)if(a.hasOwnProperty(n)){var h=a[n];n==="style"?Rg(t,h):n==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,h!=null&&Lg(t,h)):n==="children"?typeof h=="string"?(i!=="textarea"||h!=="")&&Gn(t,h):typeof h=="number"&&Gn(t,""+h):n!=="suppressContentEditableWarning"&&n!=="suppressHydrationWarning"&&n!=="autoFocus"&&(qn.hasOwnProperty(n)?h!=null&&n==="onScroll"&&ve("scroll",t):h!=null&&Ku(t,n,h,o))}switch(i){case"input":Po(t),uf(t,r,!1);break;case"textarea":Po(t),ff(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Er(r.value));break;case"select":t.multiple=!!r.multiple,n=r.value,n!=null?Bs(t,!!r.multiple,n,!1):r.defaultValue!=null&&Bs(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=za)}switch(i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return _t(e),null;case 6:if(t&&e.stateNode!=null)Zv(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(I(166));if(i=Wr(no.current),Wr(Ri.current),Fo(e)){if(r=e.stateNode,i=e.memoizedProps,r[Ei]=e,(n=r.nodeValue!==i)&&(t=Ft,t!==null))switch(t.tag){case 3:zo(r.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&zo(r.nodeValue,i,(t.mode&1)!==0)}n&&(e.flags|=4)}else r=(i.nodeType===9?i:i.ownerDocument).createTextNode(r),r[Ei]=e,e.stateNode=r}return _t(e),null;case 13:if(Se(ke),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(we&&zt!==null&&e.mode&1&&!(e.flags&128))gv(),Hs(),e.flags|=98560,n=!1;else if(n=Fo(e),r!==null&&r.dehydrated!==null){if(t===null){if(!n)throw Error(I(318));if(n=e.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(I(317));n[Ei]=e}else Hs(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;_t(e),n=!1}else _i!==null&&(Ac(_i),_i=null),n=!0;if(!n)return e.flags&65536?e:null}return e.flags&128?(e.lanes=i,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||ke.current&1?Ue===0&&(Ue=3):Ld())),e.updateQueue!==null&&(e.flags|=4),_t(e),null);case 4:return Ks(),Ec(t,e),t===null&&to(e.stateNode.containerInfo),_t(e),null;case 10:return cd(e.type._context),_t(e),null;case 17:return Bt(e.type)&&Fa(),_t(e),null;case 19:if(Se(ke),n=e.memoizedState,n===null)return _t(e),null;if(r=(e.flags&128)!==0,o=n.rendering,o===null)if(r)cn(n,!1);else{if(Ue!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=qa(t),o!==null){for(e.flags|=128,cn(n,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=i,i=e.child;i!==null;)n=i,t=r,n.flags&=14680066,o=n.alternate,o===null?(n.childLanes=0,n.lanes=t,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,t=o.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return pe(ke,ke.current&1|2),e.child}t=t.sibling}n.tail!==null&&Ne()>qs&&(e.flags|=128,r=!0,cn(n,!1),e.lanes=4194304)}else{if(!r)if(t=qa(o),t!==null){if(e.flags|=128,r=!0,i=t.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),cn(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!we)return _t(e),null}else 2*Ne()-n.renderingStartTime>qs&&i!==1073741824&&(e.flags|=128,r=!0,cn(n,!1),e.lanes=4194304);n.isBackwards?(o.sibling=e.child,e.child=o):(i=n.last,i!==null?i.sibling=o:e.child=o,n.last=o)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=Ne(),e.sibling=null,i=ke.current,pe(ke,r?i&1|2:i&1),e):(_t(e),null);case 22:case 23:return Ed(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?It&1073741824&&(_t(e),e.subtreeFlags&6&&(e.flags|=8192)):_t(e),null;case 24:return null;case 25:return null}throw Error(I(156,e.tag))}function gS(t,e){switch(od(e),e.tag){case 1:return Bt(e.type)&&Fa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ks(),Se(Dt),Se(mt),pd(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return _d(e),null;case 13:if(Se(ke),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(I(340));Hs()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Se(ke),null;case 4:return Ks(),null;case 10:return cd(e.type._context),null;case 22:case 23:return Ed(),null;case 24:return null;default:return null}}var Ho=!1,gt=!1,vS=typeof WeakSet=="function"?WeakSet:Set,K=null;function Ls(t,e){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(r){De(t,e,r)}else i.current=null}function Lc(t,e,i){try{i()}catch(r){De(t,e,r)}}var i_=!1;function mS(t,e){if(cc=$a,t=rv(),sd(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var r=i.getSelection&&i.getSelection();if(r&&r.rangeCount!==0){i=r.anchorNode;var s=r.anchorOffset,n=r.focusNode;r=r.focusOffset;try{i.nodeType,n.nodeType}catch{i=null;break e}var o=0,a=-1,h=-1,l=0,c=0,u=t,d=null;t:for(;;){for(var f;u!==i||s!==0&&u.nodeType!==3||(a=o+s),u!==n||r!==0&&u.nodeType!==3||(h=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(f=u.firstChild)!==null;)d=u,u=f;for(;;){if(u===t)break t;if(d===i&&++l===s&&(a=o),d===n&&++c===r&&(h=o),(f=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=f}i=a===-1||h===-1?null:{start:a,end:h}}else i=null}i=i||{start:0,end:0}}else i=null;for(uc={focusedElem:t,selectionRange:i},$a=!1,K=e;K!==null;)if(e=K,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,K=t;else for(;K!==null;){e=K;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,x=p.memoizedState,_=e.stateNode,g=_.getSnapshotBeforeUpdate(e.elementType===e.type?m:di(e.type,m),x);_.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(I(163))}}catch(y){De(e,e.return,y)}if(t=e.sibling,t!==null){t.return=e.return,K=t;break}K=e.return}return p=i_,i_=!1,p}function Fn(t,e,i){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var n=s.destroy;s.destroy=void 0,n!==void 0&&Lc(e,i,n)}s=s.next}while(s!==r)}}function Sl(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var r=i.create;i.destroy=r()}i=i.next}while(i!==e)}}function Mc(t){var e=t.ref;if(e!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof e=="function"?e(t):e.current=t}}function Jv(t){var e=t.alternate;e!==null&&(t.alternate=null,Jv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ei],delete e[ro],delete e[_c],delete e[eS],delete e[tS])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function em(t){return t.tag===5||t.tag===3||t.tag===4}function r_(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||em(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Rc(t,e,i){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?i.nodeType===8?i.parentNode.insertBefore(t,e):i.insertBefore(t,e):(i.nodeType===8?(e=i.parentNode,e.insertBefore(t,i)):(e=i,e.appendChild(t)),i=i._reactRootContainer,i!=null||e.onclick!==null||(e.onclick=za));else if(r!==4&&(t=t.child,t!==null))for(Rc(t,e,i),t=t.sibling;t!==null;)Rc(t,e,i),t=t.sibling}function Tc(t,e,i){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?i.insertBefore(t,e):i.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Tc(t,e,i),t=t.sibling;t!==null;)Tc(t,e,i),t=t.sibling}var nt=null,fi=!1;function er(t,e,i){for(i=i.child;i!==null;)tm(t,e,i),i=i.sibling}function tm(t,e,i){if(Mi&&typeof Mi.onCommitFiberUnmount=="function")try{Mi.onCommitFiberUnmount(dl,i)}catch{}switch(i.tag){case 5:gt||Ls(i,e);case 6:var r=nt,s=fi;nt=null,er(t,e,i),nt=r,fi=s,nt!==null&&(fi?(t=nt,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):nt.removeChild(i.stateNode));break;case 18:nt!==null&&(fi?(t=nt,i=i.stateNode,t.nodeType===8?th(t.parentNode,i):t.nodeType===1&&th(t,i),Zn(t)):th(nt,i.stateNode));break;case 4:r=nt,s=fi,nt=i.stateNode.containerInfo,fi=!0,er(t,e,i),nt=r,fi=s;break;case 0:case 11:case 14:case 15:if(!gt&&(r=i.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var n=s,o=n.destroy;n=n.tag,o!==void 0&&(n&2||n&4)&&Lc(i,e,o),s=s.next}while(s!==r)}er(t,e,i);break;case 1:if(!gt&&(Ls(i,e),r=i.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=i.memoizedProps,r.state=i.memoizedState,r.componentWillUnmount()}catch(a){De(i,e,a)}er(t,e,i);break;case 21:er(t,e,i);break;case 22:i.mode&1?(gt=(r=gt)||i.memoizedState!==null,er(t,e,i),gt=r):er(t,e,i);break;default:er(t,e,i)}}function s_(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new vS),e.forEach(function(r){var s=LS.bind(null,t,r);i.has(r)||(i.add(r),r.then(s,s))})}}function li(t,e){var i=e.deletions;if(i!==null)for(var r=0;r<i.length;r++){var s=i[r];try{var n=t,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:nt=a.stateNode,fi=!1;break e;case 3:nt=a.stateNode.containerInfo,fi=!0;break e;case 4:nt=a.stateNode.containerInfo,fi=!0;break e}a=a.return}if(nt===null)throw Error(I(160));tm(n,o,s),nt=null,fi=!1;var h=s.alternate;h!==null&&(h.return=null),s.return=null}catch(l){De(s,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)im(e,t),e=e.sibling}function im(t,e){var i=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(li(e,t),yi(t),r&4){try{Fn(3,t,t.return),Sl(3,t)}catch(m){De(t,t.return,m)}try{Fn(5,t,t.return)}catch(m){De(t,t.return,m)}}break;case 1:li(e,t),yi(t),r&512&&i!==null&&Ls(i,i.return);break;case 5:if(li(e,t),yi(t),r&512&&i!==null&&Ls(i,i.return),t.flags&32){var s=t.stateNode;try{Gn(s,"")}catch(m){De(t,t.return,m)}}if(r&4&&(s=t.stateNode,s!=null)){var n=t.memoizedProps,o=i!==null?i.memoizedProps:n,a=t.type,h=t.updateQueue;if(t.updateQueue=null,h!==null)try{a==="input"&&n.type==="radio"&&n.name!=null&&bg(s,n),ec(a,o);var l=ec(a,n);for(o=0;o<h.length;o+=2){var c=h[o],u=h[o+1];c==="style"?Rg(s,u):c==="dangerouslySetInnerHTML"?Lg(s,u):c==="children"?Gn(s,u):Ku(s,c,u,l)}switch(a){case"input":Yh(s,n);break;case"textarea":kg(s,n);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!n.multiple;var f=n.value;f!=null?Bs(s,!!n.multiple,f,!1):d!==!!n.multiple&&(n.defaultValue!=null?Bs(s,!!n.multiple,n.defaultValue,!0):Bs(s,!!n.multiple,n.multiple?[]:"",!1))}s[ro]=n}catch(m){De(t,t.return,m)}}break;case 6:if(li(e,t),yi(t),r&4){if(t.stateNode===null)throw Error(I(162));s=t.stateNode,n=t.memoizedProps;try{s.nodeValue=n}catch(m){De(t,t.return,m)}}break;case 3:if(li(e,t),yi(t),r&4&&i!==null&&i.memoizedState.isDehydrated)try{Zn(e.containerInfo)}catch(m){De(t,t.return,m)}break;case 4:li(e,t),yi(t);break;case 13:li(e,t),yi(t),s=t.child,s.flags&8192&&(n=s.memoizedState!==null,s.stateNode.isHidden=n,!n||s.alternate!==null&&s.alternate.memoizedState!==null||(bd=Ne())),r&4&&s_(t);break;case 22:if(c=i!==null&&i.memoizedState!==null,t.mode&1?(gt=(l=gt)||c,li(e,t),gt=l):li(e,t),yi(t),r&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&t.mode&1)for(K=t,c=t.child;c!==null;){for(u=K=c;K!==null;){switch(d=K,f=d.child,d.tag){case 0:case 11:case 14:case 15:Fn(4,d,d.return);break;case 1:Ls(d,d.return);var p=d.stateNode;if(typeof p.componentWillUnmount=="function"){r=d,i=d.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(m){De(r,i,m)}}break;case 5:Ls(d,d.return);break;case 22:if(d.memoizedState!==null){o_(u);continue}}f!==null?(f.return=d,K=f):o_(u)}c=c.sibling}e:for(c=null,u=t;;){if(u.tag===5){if(c===null){c=u;try{s=u.stateNode,l?(n=s.style,typeof n.setProperty=="function"?n.setProperty("display","none","important"):n.display="none"):(a=u.stateNode,h=u.memoizedProps.style,o=h!=null&&h.hasOwnProperty("display")?h.display:null,a.style.display=Mg("display",o))}catch(m){De(t,t.return,m)}}}else if(u.tag===6){if(c===null)try{u.stateNode.nodeValue=l?"":u.memoizedProps}catch(m){De(t,t.return,m)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===t)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===t)break e;for(;u.sibling===null;){if(u.return===null||u.return===t)break e;c===u&&(c=null),u=u.return}c===u&&(c=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:li(e,t),yi(t),r&4&&s_(t);break;case 21:break;default:li(e,t),yi(t)}}function yi(t){var e=t.flags;if(e&2){try{e:{for(var i=t.return;i!==null;){if(em(i)){var r=i;break e}i=i.return}throw Error(I(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Gn(s,""),r.flags&=-33);var n=r_(t);Tc(t,n,s);break;case 3:case 4:var o=r.stateNode.containerInfo,a=r_(t);Rc(t,a,o);break;default:throw Error(I(161))}}catch(h){De(t,t.return,h)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function yS(t,e,i){K=t,rm(t)}function rm(t,e,i){for(var r=(t.mode&1)!==0;K!==null;){var s=K,n=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Ho;if(!o){var a=s.alternate,h=a!==null&&a.memoizedState!==null||gt;a=Ho;var l=gt;if(Ho=o,(gt=h)&&!l)for(K=s;K!==null;)o=K,h=o.child,o.tag===22&&o.memoizedState!==null?a_(s):h!==null?(h.return=o,K=h):a_(s);for(;n!==null;)K=n,rm(n),n=n.sibling;K=s,Ho=a,gt=l}n_(t)}else s.subtreeFlags&8772&&n!==null?(n.return=s,K=n):n_(t)}}function n_(t){for(;K!==null;){var e=K;if(e.flags&8772){var i=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:gt||Sl(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!gt)if(i===null)r.componentDidMount();else{var s=e.elementType===e.type?i.memoizedProps:di(e.type,i.memoizedProps);r.componentDidUpdate(s,i.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var n=e.updateQueue;n!==null&&Hf(e,n,r);break;case 3:var o=e.updateQueue;if(o!==null){if(i=null,e.child!==null)switch(e.child.tag){case 5:i=e.child.stateNode;break;case 1:i=e.child.stateNode}Hf(e,o,i)}break;case 5:var a=e.stateNode;if(i===null&&e.flags&4){i=a;var h=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":h.autoFocus&&i.focus();break;case"img":h.src&&(i.src=h.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var l=e.alternate;if(l!==null){var c=l.memoizedState;if(c!==null){var u=c.dehydrated;u!==null&&Zn(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(I(163))}gt||e.flags&512&&Mc(e)}catch(d){De(e,e.return,d)}}if(e===t){K=null;break}if(i=e.sibling,i!==null){i.return=e.return,K=i;break}K=e.return}}function o_(t){for(;K!==null;){var e=K;if(e===t){K=null;break}var i=e.sibling;if(i!==null){i.return=e.return,K=i;break}K=e.return}}function a_(t){for(;K!==null;){var e=K;try{switch(e.tag){case 0:case 11:case 15:var i=e.return;try{Sl(4,e)}catch(h){De(e,i,h)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(h){De(e,s,h)}}var n=e.return;try{Mc(e)}catch(h){De(e,n,h)}break;case 5:var o=e.return;try{Mc(e)}catch(h){De(e,o,h)}}}catch(h){De(e,e.return,h)}if(e===t){K=null;break}var a=e.sibling;if(a!==null){a.return=e.return,K=a;break}K=e.return}}var SS=Math.ceil,Xa=Qi.ReactCurrentDispatcher,xd=Qi.ReactCurrentOwner,ii=Qi.ReactCurrentBatchConfig,se=0,tt=null,ze=null,ct=0,It=0,Ms=Tr(0),Ue=0,ho=null,ts=0,wl=0,Cd=0,jn=null,Tt=null,bd=0,qs=1/0,zi=null,Qa=!1,Pc=null,xr=null,Uo=!1,_r=null,Za=0,Wn=0,Dc=null,_a=-1,pa=0;function Ct(){return se&6?Ne():_a!==-1?_a:_a=Ne()}function Cr(t){return t.mode&1?se&2&&ct!==0?ct&-ct:rS.transition!==null?(pa===0&&(pa=jg()),pa):(t=he,t!==0||(t=window.event,t=t===void 0?16:Gg(t.type)),t):1}function gi(t,e,i,r){if(50<Wn)throw Wn=0,Dc=null,Error(I(185));vo(t,i,r),(!(se&2)||t!==tt)&&(t===tt&&(!(se&2)&&(wl|=i),Ue===4&&dr(t,ct)),At(t,r),i===1&&se===0&&!(e.mode&1)&&(qs=Ne()+500,vl&&Pr()))}function At(t,e){var i=t.callbackNode;ry(t,e);var r=Na(t,t===tt?ct:0);if(r===0)i!==null&&gf(i),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(i!=null&&gf(i),e===1)t.tag===0?iS(l_.bind(null,t)):fv(l_.bind(null,t)),Zy(function(){!(se&6)&&Pr()}),i=null;else{switch(Wg(r)){case 1:i=Xu;break;case 4:i=zg;break;case 16:i=Aa;break;case 536870912:i=Fg;break;default:i=Aa}i=um(i,sm.bind(null,t))}t.callbackPriority=e,t.callbackNode=i}}function sm(t,e){if(_a=-1,pa=0,se&6)throw Error(I(327));var i=t.callbackNode;if(Is()&&t.callbackNode!==i)return null;var r=Na(t,t===tt?ct:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Ja(t,r);else{e=r;var s=se;se|=2;var n=om();(tt!==t||ct!==e)&&(zi=null,qs=Ne()+500,Kr(t,e));do try{CS();break}catch(a){nm(t,a)}while(!0);hd(),Xa.current=n,se=s,ze!==null?e=0:(tt=null,ct=0,e=Ue)}if(e!==0){if(e===2&&(s=nc(t),s!==0&&(r=s,e=Bc(t,s))),e===1)throw i=ho,Kr(t,0),dr(t,r),At(t,Ne()),i;if(e===6)dr(t,r);else{if(s=t.current.alternate,!(r&30)&&!wS(s)&&(e=Ja(t,r),e===2&&(n=nc(t),n!==0&&(r=n,e=Bc(t,n))),e===1))throw i=ho,Kr(t,0),dr(t,r),At(t,Ne()),i;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(I(345));case 2:Or(t,Tt,zi);break;case 3:if(dr(t,r),(r&130023424)===r&&(e=bd+500-Ne(),10<e)){if(Na(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){Ct(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=fc(Or.bind(null,t,Tt,zi),e);break}Or(t,Tt,zi);break;case 4:if(dr(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-pi(r);n=1<<o,o=e[o],o>s&&(s=o),r&=~n}if(r=s,r=Ne()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*SS(r/1960))-r,10<r){t.timeoutHandle=fc(Or.bind(null,t,Tt,zi),r);break}Or(t,Tt,zi);break;case 5:Or(t,Tt,zi);break;default:throw Error(I(329))}}}return At(t,Ne()),t.callbackNode===i?sm.bind(null,t):null}function Bc(t,e){var i=jn;return t.current.memoizedState.isDehydrated&&(Kr(t,e).flags|=256),t=Ja(t,e),t!==2&&(e=Tt,Tt=i,e!==null&&Ac(e)),t}function Ac(t){Tt===null?Tt=t:Tt.push.apply(Tt,t)}function wS(t){for(var e=t;;){if(e.flags&16384){var i=e.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var r=0;r<i.length;r++){var s=i[r],n=s.getSnapshot;s=s.value;try{if(!vi(n(),s))return!1}catch{return!1}}}if(i=e.child,e.subtreeFlags&16384&&i!==null)i.return=e,e=i;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function dr(t,e){for(e&=~Cd,e&=~wl,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var i=31-pi(e),r=1<<i;t[i]=-1,e&=~r}}function l_(t){if(se&6)throw Error(I(327));Is();var e=Na(t,0);if(!(e&1))return At(t,Ne()),null;var i=Ja(t,e);if(t.tag!==0&&i===2){var r=nc(t);r!==0&&(e=r,i=Bc(t,r))}if(i===1)throw i=ho,Kr(t,0),dr(t,e),At(t,Ne()),i;if(i===6)throw Error(I(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Or(t,Tt,zi),At(t,Ne()),null}function kd(t,e){var i=se;se|=1;try{return t(e)}finally{se=i,se===0&&(qs=Ne()+500,vl&&Pr())}}function is(t){_r!==null&&_r.tag===0&&!(se&6)&&Is();var e=se;se|=1;var i=ii.transition,r=he;try{if(ii.transition=null,he=1,t)return t()}finally{he=r,ii.transition=i,se=e,!(se&6)&&Pr()}}function Ed(){It=Ms.current,Se(Ms)}function Kr(t,e){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,Qy(i)),ze!==null)for(i=ze.return;i!==null;){var r=i;switch(od(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Fa();break;case 3:Ks(),Se(Dt),Se(mt),pd();break;case 5:_d(r);break;case 4:Ks();break;case 13:Se(ke);break;case 19:Se(ke);break;case 10:cd(r.type._context);break;case 22:case 23:Ed()}i=i.return}if(tt=t,ze=t=br(t.current,null),ct=It=e,Ue=0,ho=null,Cd=wl=ts=0,Tt=jn=null,jr!==null){for(e=0;e<jr.length;e++)if(i=jr[e],r=i.interleaved,r!==null){i.interleaved=null;var s=r.next,n=i.pending;if(n!==null){var o=n.next;n.next=s,r.next=o}i.pending=r}jr=null}return t}function nm(t,e){do{var i=ze;try{if(hd(),ua.current=Ya,Ga){for(var r=Ee.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Ga=!1}if(es=0,Ge=He=Ee=null,zn=!1,oo=0,xd.current=null,i===null||i.return===null){Ue=1,ho=e,ze=null;break}e:{var n=t,o=i.return,a=i,h=e;if(e=ct,a.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){var l=h,c=a,u=c.tag;if(!(c.mode&1)&&(u===0||u===11||u===15)){var d=c.alternate;d?(c.updateQueue=d.updateQueue,c.memoizedState=d.memoizedState,c.lanes=d.lanes):(c.updateQueue=null,c.memoizedState=null)}var f=Yf(o);if(f!==null){f.flags&=-257,Xf(f,o,a,n,e),f.mode&1&&Gf(n,l,e),e=f,h=l;var p=e.updateQueue;if(p===null){var m=new Set;m.add(h),e.updateQueue=m}else p.add(h);break e}else{if(!(e&1)){Gf(n,l,e),Ld();break e}h=Error(I(426))}}else if(we&&a.mode&1){var x=Yf(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Xf(x,o,a,n,e),ad(Vs(h,a));break e}}n=h=Vs(h,a),Ue!==4&&(Ue=2),jn===null?jn=[n]:jn.push(n),n=o;do{switch(n.tag){case 3:n.flags|=65536,e&=-e,n.lanes|=e;var _=Wv(n,h,e);Wf(n,_);break e;case 1:a=h;var g=n.type,S=n.stateNode;if(!(n.flags&128)&&(typeof g.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(xr===null||!xr.has(S)))){n.flags|=65536,e&=-e,n.lanes|=e;var y=Hv(n,a,e);Wf(n,y);break e}}n=n.return}while(n!==null)}lm(i)}catch(L){e=L,ze===i&&i!==null&&(ze=i=i.return);continue}break}while(!0)}function om(){var t=Xa.current;return Xa.current=Ya,t===null?Ya:t}function Ld(){(Ue===0||Ue===3||Ue===2)&&(Ue=4),tt===null||!(ts&268435455)&&!(wl&268435455)||dr(tt,ct)}function Ja(t,e){var i=se;se|=2;var r=om();(tt!==t||ct!==e)&&(zi=null,Kr(t,e));do try{xS();break}catch(s){nm(t,s)}while(!0);if(hd(),se=i,Xa.current=r,ze!==null)throw Error(I(261));return tt=null,ct=0,Ue}function xS(){for(;ze!==null;)am(ze)}function CS(){for(;ze!==null&&!G1();)am(ze)}function am(t){var e=cm(t.alternate,t,It);t.memoizedProps=t.pendingProps,e===null?lm(t):ze=e,xd.current=null}function lm(t){var e=t;do{var i=e.alternate;if(t=e.return,e.flags&32768){if(i=gS(i,e),i!==null){i.flags&=32767,ze=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ue=6,ze=null;return}}else if(i=pS(i,e,It),i!==null){ze=i;return}if(e=e.sibling,e!==null){ze=e;return}ze=e=t}while(e!==null);Ue===0&&(Ue=5)}function Or(t,e,i){var r=he,s=ii.transition;try{ii.transition=null,he=1,bS(t,e,i,r)}finally{ii.transition=s,he=r}return null}function bS(t,e,i,r){do Is();while(_r!==null);if(se&6)throw Error(I(327));i=t.finishedWork;var s=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(I(177));t.callbackNode=null,t.callbackPriority=0;var n=i.lanes|i.childLanes;if(sy(t,n),t===tt&&(ze=tt=null,ct=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||Uo||(Uo=!0,um(Aa,function(){return Is(),null})),n=(i.flags&15990)!==0,i.subtreeFlags&15990||n){n=ii.transition,ii.transition=null;var o=he;he=1;var a=se;se|=4,xd.current=null,mS(t,i),im(i,t),Uy(uc),$a=!!cc,uc=cc=null,t.current=i,yS(i),Y1(),se=a,he=o,ii.transition=n}else t.current=i;if(Uo&&(Uo=!1,_r=t,Za=s),n=t.pendingLanes,n===0&&(xr=null),Z1(i.stateNode),At(t,Ne()),e!==null)for(r=t.onRecoverableError,i=0;i<e.length;i++)s=e[i],r(s.value,{componentStack:s.stack,digest:s.digest});if(Qa)throw Qa=!1,t=Pc,Pc=null,t;return Za&1&&t.tag!==0&&Is(),n=t.pendingLanes,n&1?t===Dc?Wn++:(Wn=0,Dc=t):Wn=0,Pr(),null}function Is(){if(_r!==null){var t=Wg(Za),e=ii.transition,i=he;try{if(ii.transition=null,he=16>t?16:t,_r===null)var r=!1;else{if(t=_r,_r=null,Za=0,se&6)throw Error(I(331));var s=se;for(se|=4,K=t.current;K!==null;){var n=K,o=n.child;if(K.flags&16){var a=n.deletions;if(a!==null){for(var h=0;h<a.length;h++){var l=a[h];for(K=l;K!==null;){var c=K;switch(c.tag){case 0:case 11:case 15:Fn(8,c,n)}var u=c.child;if(u!==null)u.return=c,K=u;else for(;K!==null;){c=K;var d=c.sibling,f=c.return;if(Jv(c),c===l){K=null;break}if(d!==null){d.return=f,K=d;break}K=f}}}var p=n.alternate;if(p!==null){var m=p.child;if(m!==null){p.child=null;do{var x=m.sibling;m.sibling=null,m=x}while(m!==null)}}K=n}}if(n.subtreeFlags&2064&&o!==null)o.return=n,K=o;else e:for(;K!==null;){if(n=K,n.flags&2048)switch(n.tag){case 0:case 11:case 15:Fn(9,n,n.return)}var _=n.sibling;if(_!==null){_.return=n.return,K=_;break e}K=n.return}}var g=t.current;for(K=g;K!==null;){o=K;var S=o.child;if(o.subtreeFlags&2064&&S!==null)S.return=o,K=S;else e:for(o=g;K!==null;){if(a=K,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Sl(9,a)}}catch(L){De(a,a.return,L)}if(a===o){K=null;break e}var y=a.sibling;if(y!==null){y.return=a.return,K=y;break e}K=a.return}}if(se=s,Pr(),Mi&&typeof Mi.onPostCommitFiberRoot=="function")try{Mi.onPostCommitFiberRoot(dl,t)}catch{}r=!0}return r}finally{he=i,ii.transition=e}}return!1}function h_(t,e,i){e=Vs(i,e),e=Wv(t,e,1),t=wr(t,e,1),e=Ct(),t!==null&&(vo(t,1,e),At(t,e))}function De(t,e,i){if(t.tag===3)h_(t,t,i);else for(;e!==null;){if(e.tag===3){h_(e,t,i);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(xr===null||!xr.has(r))){t=Vs(i,t),t=Hv(e,t,1),e=wr(e,t,1),t=Ct(),e!==null&&(vo(e,1,t),At(e,t));break}}e=e.return}}function kS(t,e,i){var r=t.pingCache;r!==null&&r.delete(e),e=Ct(),t.pingedLanes|=t.suspendedLanes&i,tt===t&&(ct&i)===i&&(Ue===4||Ue===3&&(ct&130023424)===ct&&500>Ne()-bd?Kr(t,0):Cd|=i),At(t,e)}function hm(t,e){e===0&&(t.mode&1?(e=Ao,Ao<<=1,!(Ao&130023424)&&(Ao=4194304)):e=1);var i=Ct();t=Yi(t,e),t!==null&&(vo(t,e,i),At(t,i))}function ES(t){var e=t.memoizedState,i=0;e!==null&&(i=e.retryLane),hm(t,i)}function LS(t,e){var i=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(i=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(I(314))}r!==null&&r.delete(e),hm(t,i)}var cm;cm=function(t,e,i){if(t!==null)if(t.memoizedProps!==e.pendingProps||Dt.current)Pt=!0;else{if(!(t.lanes&i)&&!(e.flags&128))return Pt=!1,_S(t,e,i);Pt=!!(t.flags&131072)}else Pt=!1,we&&e.flags&1048576&&_v(e,Ha,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;fa(t,e),t=e.pendingProps;var s=Ws(e,mt.current);Os(e,i),s=vd(null,e,r,t,s,i);var n=md();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Bt(r)?(n=!0,ja(e)):n=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,dd(e),s.updater=yl,e.stateNode=s,s._reactInternals=e,Sc(e,r,t,i),e=Cc(null,e,r,!0,n,i)):(e.tag=0,we&&n&&nd(e),wt(null,e,s,i),e=e.child),e;case 16:r=e.elementType;e:{switch(fa(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=RS(r),t=di(r,t),s){case 0:e=xc(null,e,r,t,i);break e;case 1:e=Jf(null,e,r,t,i);break e;case 11:e=Qf(null,e,r,t,i);break e;case 14:e=Zf(null,e,r,di(r.type,t),i);break e}throw Error(I(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:di(r,s),xc(t,e,r,s,i);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:di(r,s),Jf(t,e,r,s,i);case 3:e:{if(qv(e),t===null)throw Error(I(387));r=e.pendingProps,n=e.memoizedState,s=n.element,Sv(t,e),Va(e,r,null,i);var o=e.memoizedState;if(r=o.element,n.isDehydrated)if(n={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=n,e.memoizedState=n,e.flags&256){s=Vs(Error(I(423)),e),e=e_(t,e,r,i,s);break e}else if(r!==s){s=Vs(Error(I(424)),e),e=e_(t,e,r,i,s);break e}else for(zt=Sr(e.stateNode.containerInfo.firstChild),Ft=e,we=!0,_i=null,i=mv(e,null,r,i),e.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Hs(),r===s){e=Xi(t,e,i);break e}wt(t,e,r,i)}e=e.child}return e;case 5:return wv(e),t===null&&vc(e),r=e.type,s=e.pendingProps,n=t!==null?t.memoizedProps:null,o=s.children,dc(r,s)?o=null:n!==null&&dc(r,n)&&(e.flags|=32),Vv(t,e),wt(t,e,o,i),e.child;case 6:return t===null&&vc(e),null;case 13:return Gv(t,e,i);case 4:return fd(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Us(e,null,r,i):wt(t,e,r,i),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:di(r,s),Qf(t,e,r,s,i);case 7:return wt(t,e,e.pendingProps,i),e.child;case 8:return wt(t,e,e.pendingProps.children,i),e.child;case 12:return wt(t,e,e.pendingProps.children,i),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,n=e.memoizedProps,o=s.value,pe(Ua,r._currentValue),r._currentValue=o,n!==null)if(vi(n.value,o)){if(n.children===s.children&&!Dt.current){e=Xi(t,e,i);break e}}else for(n=e.child,n!==null&&(n.return=e);n!==null;){var a=n.dependencies;if(a!==null){o=n.child;for(var h=a.firstContext;h!==null;){if(h.context===r){if(n.tag===1){h=Vi(-1,i&-i),h.tag=2;var l=n.updateQueue;if(l!==null){l=l.shared;var c=l.pending;c===null?h.next=h:(h.next=c.next,c.next=h),l.pending=h}}n.lanes|=i,h=n.alternate,h!==null&&(h.lanes|=i),mc(n.return,i,e),a.lanes|=i;break}h=h.next}}else if(n.tag===10)o=n.type===e.type?null:n.child;else if(n.tag===18){if(o=n.return,o===null)throw Error(I(341));o.lanes|=i,a=o.alternate,a!==null&&(a.lanes|=i),mc(o,i,e),o=n.sibling}else o=n.child;if(o!==null)o.return=n;else for(o=n;o!==null;){if(o===e){o=null;break}if(n=o.sibling,n!==null){n.return=o.return,o=n;break}o=o.return}n=o}wt(t,e,s.children,i),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Os(e,i),s=si(s),r=r(s),e.flags|=1,wt(t,e,r,i),e.child;case 14:return r=e.type,s=di(r,e.pendingProps),s=di(r.type,s),Zf(t,e,r,s,i);case 15:return Uv(t,e,e.type,e.pendingProps,i);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:di(r,s),fa(t,e),e.tag=1,Bt(r)?(t=!0,ja(e)):t=!1,Os(e,i),jv(e,r,s),Sc(e,r,s,i),Cc(null,e,r,!0,t,i);case 19:return Yv(t,e,i);case 22:return Kv(t,e,i)}throw Error(I(156,e.tag))};function um(t,e){return Ig(t,e)}function MS(t,e,i,r){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(t,e,i,r){return new MS(t,e,i,r)}function Md(t){return t=t.prototype,!(!t||!t.isReactComponent)}function RS(t){if(typeof t=="function")return Md(t)?1:0;if(t!=null){if(t=t.$$typeof,t===qu)return 11;if(t===Gu)return 14}return 2}function br(t,e){var i=t.alternate;return i===null?(i=ti(t.tag,e,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=e,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,e=t.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function ga(t,e,i,r,s,n){var o=2;if(r=t,typeof t=="function")Md(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ms:return Vr(i.children,s,n,e);case Vu:o=8,s|=8;break;case Uh:return t=ti(12,i,e,s|2),t.elementType=Uh,t.lanes=n,t;case Kh:return t=ti(13,i,e,s),t.elementType=Kh,t.lanes=n,t;case Vh:return t=ti(19,i,e,s),t.elementType=Vh,t.lanes=n,t;case wg:return xl(i,s,n,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case yg:o=10;break e;case Sg:o=9;break e;case qu:o=11;break e;case Gu:o=14;break e;case lr:o=16,r=null;break e}throw Error(I(130,t==null?t:typeof t,""))}return e=ti(o,i,e,s),e.elementType=t,e.type=r,e.lanes=n,e}function Vr(t,e,i,r){return t=ti(7,t,r,e),t.lanes=i,t}function xl(t,e,i,r){return t=ti(22,t,r,e),t.elementType=wg,t.lanes=i,t.stateNode={isHidden:!1},t}function hh(t,e,i){return t=ti(6,t,null,e),t.lanes=i,t}function ch(t,e,i){return e=ti(4,t.children!==null?t.children:[],t.key,e),e.lanes=i,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function TS(t,e,i,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ul(0),this.expirationTimes=Ul(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ul(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Rd(t,e,i,r,s,n,o,a,h){return t=new TS(t,e,i,a,h),e===1?(e=1,n===!0&&(e|=8)):e=0,n=ti(3,null,null,e),t.current=n,n.stateNode=t,n.memoizedState={element:r,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},dd(n),t}function PS(t,e,i){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:vs,key:r==null?null:""+r,children:t,containerInfo:e,implementation:i}}function dm(t){if(!t)return Lr;t=t._reactInternals;e:{if(as(t)!==t||t.tag!==1)throw Error(I(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Bt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(I(171))}if(t.tag===1){var i=t.type;if(Bt(i))return dv(t,i,e)}return e}function fm(t,e,i,r,s,n,o,a,h){return t=Rd(i,r,!0,t,s,n,o,a,h),t.context=dm(null),i=t.current,r=Ct(),s=Cr(i),n=Vi(r,s),n.callback=e??null,wr(i,n,s),t.current.lanes=s,vo(t,s,r),At(t,r),t}function Cl(t,e,i,r){var s=e.current,n=Ct(),o=Cr(s);return i=dm(i),e.context===null?e.context=i:e.pendingContext=i,e=Vi(n,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=wr(s,e,o),t!==null&&(gi(t,s,o,n),ca(t,s,o)),o}function el(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function c_(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<e?i:e}}function Td(t,e){c_(t,e),(t=t.alternate)&&c_(t,e)}function DS(){return null}var _m=typeof reportError=="function"?reportError:function(t){console.error(t)};function Pd(t){this._internalRoot=t}bl.prototype.render=Pd.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(I(409));Cl(t,e,null,null)};bl.prototype.unmount=Pd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;is(function(){Cl(null,t,null,null)}),e[Gi]=null}};function bl(t){this._internalRoot=t}bl.prototype.unstable_scheduleHydration=function(t){if(t){var e=Kg();t={blockedOn:null,target:t,priority:e};for(var i=0;i<ur.length&&e!==0&&e<ur[i].priority;i++);ur.splice(i,0,t),i===0&&qg(t)}};function Dd(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function kl(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function u_(){}function BS(t,e,i,r,s){if(s){if(typeof r=="function"){var n=r;r=function(){var l=el(o);n.call(l)}}var o=fm(e,r,t,0,null,!1,!1,"",u_);return t._reactRootContainer=o,t[Gi]=o.current,to(t.nodeType===8?t.parentNode:t),is(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var a=r;r=function(){var l=el(h);a.call(l)}}var h=Rd(t,0,!1,null,null,!1,!1,"",u_);return t._reactRootContainer=h,t[Gi]=h.current,to(t.nodeType===8?t.parentNode:t),is(function(){Cl(e,h,i,r)}),h}function El(t,e,i,r,s){var n=i._reactRootContainer;if(n){var o=n;if(typeof s=="function"){var a=s;s=function(){var h=el(o);a.call(h)}}Cl(e,o,t,s)}else o=BS(i,e,t,s,r);return el(o)}Hg=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var i=En(e.pendingLanes);i!==0&&(Qu(e,i|1),At(e,Ne()),!(se&6)&&(qs=Ne()+500,Pr()))}break;case 13:is(function(){var r=Yi(t,1);if(r!==null){var s=Ct();gi(r,t,1,s)}}),Td(t,1)}};Zu=function(t){if(t.tag===13){var e=Yi(t,134217728);if(e!==null){var i=Ct();gi(e,t,134217728,i)}Td(t,134217728)}};Ug=function(t){if(t.tag===13){var e=Cr(t),i=Yi(t,e);if(i!==null){var r=Ct();gi(i,t,e,r)}Td(t,e)}};Kg=function(){return he};Vg=function(t,e){var i=he;try{return he=t,e()}finally{he=i}};ic=function(t,e,i){switch(e){case"input":if(Yh(t,i),e=i.name,i.type==="radio"&&e!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<i.length;e++){var r=i[e];if(r!==t&&r.form===t.form){var s=gl(r);if(!s)throw Error(I(90));Cg(r),Yh(r,s)}}}break;case"textarea":kg(t,i);break;case"select":e=i.value,e!=null&&Bs(t,!!i.multiple,e,!1)}};Dg=kd;Bg=is;var AS={usingClientEntryPoint:!1,Events:[yo,xs,gl,Tg,Pg,kd]},un={findFiberByHostInstance:Fr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},NS={bundleType:un.bundleType,version:un.version,rendererPackageName:un.rendererPackageName,rendererConfig:un.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Qi.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=$g(t),t===null?null:t.stateNode},findFiberByHostInstance:un.findFiberByHostInstance||DS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ko=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ko.isDisabled&&Ko.supportsFiber)try{dl=Ko.inject(NS),Mi=Ko}catch{}}Wt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=AS;Wt.createPortal=function(t,e){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Dd(e))throw Error(I(200));return PS(t,e,null,i)};Wt.createRoot=function(t,e){if(!Dd(t))throw Error(I(299));var i=!1,r="",s=_m;return e!=null&&(e.unstable_strictMode===!0&&(i=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=Rd(t,1,!1,null,null,i,!1,r,s),t[Gi]=e.current,to(t.nodeType===8?t.parentNode:t),new Pd(e)};Wt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(I(188)):(t=Object.keys(t).join(","),Error(I(268,t)));return t=$g(e),t=t===null?null:t.stateNode,t};Wt.flushSync=function(t){return is(t)};Wt.hydrate=function(t,e,i){if(!kl(e))throw Error(I(200));return El(null,t,e,!0,i)};Wt.hydrateRoot=function(t,e,i){if(!Dd(t))throw Error(I(405));var r=i!=null&&i.hydratedSources||null,s=!1,n="",o=_m;if(i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(n=i.identifierPrefix),i.onRecoverableError!==void 0&&(o=i.onRecoverableError)),e=fm(e,null,t,1,i??null,s,!1,n,o),t[Gi]=e.current,to(t),r)for(t=0;t<r.length;t++)i=r[t],s=i._getVersion,s=s(i._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[i,s]:e.mutableSourceEagerHydrationData.push(i,s);return new bl(e)};Wt.render=function(t,e,i){if(!kl(e))throw Error(I(200));return El(null,t,e,!1,i)};Wt.unmountComponentAtNode=function(t){if(!kl(t))throw Error(I(40));return t._reactRootContainer?(is(function(){El(null,null,t,!1,function(){t._reactRootContainer=null,t[Gi]=null})}),!0):!1};Wt.unstable_batchedUpdates=kd;Wt.unstable_renderSubtreeIntoContainer=function(t,e,i,r){if(!kl(i))throw Error(I(200));if(t==null||t._reactInternals===void 0)throw Error(I(38));return El(t,e,i,!1,r)};Wt.version="18.3.1-next-f1338f8080-20240426";function pm(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(pm)}catch(t){console.error(t)}}pm(),pg.exports=Wt;var $S=pg.exports,d_=$S;Wh.createRoot=d_.createRoot,Wh.hydrateRoot=d_.hydrateRoot;const OS={},f_=t=>{let e;const i=new Set,r=(c,u)=>{const d=typeof c=="function"?c(e):c;if(!Object.is(d,e)){const f=e;e=u??(typeof d!="object"||d===null)?d:Object.assign({},e,d),i.forEach(p=>p(e,f))}},s=()=>e,h={setState:r,getState:s,getInitialState:()=>l,subscribe:c=>(i.add(c),()=>i.delete(c)),destroy:()=>{(OS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),i.clear()}},l=e=t(r,s,h);return h},IS=t=>t?f_(t):f_;var gm={exports:{}},vm={},mm={exports:{}},ym={};/**
|
|
41
41
|
* @license React
|
|
42
42
|
* use-sync-external-store-shim.production.js
|
|
43
43
|
*
|
|
@@ -53,7 +53,7 @@ Error generating stack: `+n.message+`
|
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the MIT license found in the
|
|
55
55
|
* LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/var Ll=O,YS=GS;function XS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var QS=typeof Object.is=="function"?Object.is:XS,ZS=YS.useSyncExternalStore,JS=Ll.useRef,ew=Ll.useEffect,tw=Ll.useMemo,iw=Ll.useDebugValue;vm.useSyncExternalStoreWithSelector=function(t,e,i,r,s){var n=JS(null);if(n.current===null){var o={hasValue:!1,value:null};n.current=o}else o=n.current;n=tw(function(){function h(f){if(!l){if(l=!0,c=f,f=r(f),s!==void 0&&o.hasValue){var p=o.value;if(s(p,f))return u=p}return u=f}if(p=u,QS(c,f))return p;var m=r(f);return s!==void 0&&s(p,m)?(c=f,p):(c=f,u=m)}var l=!1,c,u,d=i===void 0?null:i;return[function(){return h(e())},d===null?void 0:function(){return h(d())}]},[e,i,r,s]);var a=ZS(t,n[0],n[1]);return ew(function(){o.hasValue=!0,o.value=a},[a]),iw(a),a};gm.exports=vm;var rw=gm.exports;const sw=rg(rw),Sm={},{useDebugValue:nw}=Wu,{useSyncExternalStoreWithSelector:ow}=sw;let __=!1;const aw=t=>t;function lw(t,e=aw,i){(Sm?"production":void 0)!=="production"&&i&&!__&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),__=!0);const r=ow(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,i);return nw(r),r}const p_=t=>{(Sm?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?IS(t):t,i=(r,s)=>lw(e,r,s);return Object.assign(i,e),i},wo=t=>t?p_(t):p_,oe=wo((t,e)=>({sessions:{},activePorts:{},claudeStatus:{},gitBranches:{},editorNeedsAccessibility:!1,createSession:(i,r)=>t(s=>({sessions:{...s.sessions,[i]:{terminalId:i,projectId:r,terminal:null,title:"Terminal",alive:!0}}})),setTerminalInstance:(i,r)=>t(s=>{const n=s.sessions[i];return n?{sessions:{...s.sessions,[i]:{...n,terminal:r}}}:s}),setTitle:(i,r)=>t(s=>{const n=s.sessions[i];return n?{sessions:{...s.sessions,[i]:{...n,title:r}}}:s}),markDead:i=>t(r=>{const s=r.sessions[i];return s?{sessions:{...r.sessions,[i]:{...s,alive:!1}}}:r}),removeSession:i=>t(r=>{const{[i]:s,...n}=r.sessions;return{sessions:n}}),getSession:i=>e().sessions[i],getProjectSessions:i=>Object.values(e().sessions).filter(r=>r.projectId===i),setActivePorts:i=>t({activePorts:i}),setClaudeStatus:i=>t({claudeStatus:i}),setGitBranches:i=>t({gitBranches:i}),setEditorNeedsAccessibility:i=>t({editorNeedsAccessibility:i})}));let Vo=null,dn=null;function Hn(t){dn=dn?{...dn,...t}:{...t},Vo&&clearTimeout(Vo),Vo=setTimeout(()=>{const e=dn;dn=null,Vo=null,fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(()=>{})},300)}const ae=wo()((t,e)=>({projects:{},activeProjectId:null,setActiveProject:i=>{t({activeProjectId:i}),Hn({activeProjectId:i})},addProject:i=>t(r=>({projects:{...r.projects,[i.id]:i},activeProjectId:r.activeProjectId??i.id})),removeProject:i=>t(r=>{const{[i]:s,...n}=r.projects,o=r.activeProjectId===i?Object.keys(n)[0]??null:r.activeProjectId;return{projects:n,activeProjectId:o}}),addTerminalToProject:(i,r)=>t(s=>{const n=s.projects[i];return!n||n.terminalIds.includes(r)?s:{projects:{...s.projects,[i]:{...n,terminalIds:[...n.terminalIds,r]}}}}),removeTerminalFromProject:(i,r)=>t(s=>{const n=s.projects[i];return n?{projects:{...s.projects,[i]:{...n,terminalIds:n.terminalIds.filter(o=>o!==r)}}}:s}),clearProjectTerminals:i=>t(r=>{const s=r.projects[i];return s?{projects:{...r.projects,[i]:{...s,terminalIds:[]}}}:r}),getActiveProject:()=>{const{projects:i,activeProjectId:r}=e();return r?i[r]??null:null},hydrateFromServer:async()=>{try{const[i,r]=await Promise.all([fetch("/api/projects"),fetch("/api/settings")]),s=await i.json(),n=await r.json(),o={};for(const h of s)o[h.id]={id:h.id,name:h.name,cwd:h.cwd,terminalIds:[]};const a=n.activeProjectId&&o[n.activeProjectId]?n.activeProjectId:Object.keys(o)[0]??null;t({projects:o,activeProjectId:a})}catch{}}})),hw=.1,cw=.9,uw=50,dw={background:"#0a0a0f",foreground:"#ececf1",cursor:"#ececf1",cursorAccent:"#0a0a0f",selectionBackground:"#5b5bd640",selectionForeground:"#ececf1",black:"#1a1a24",red:"#e5484d",green:"#30a46c",yellow:"#f5d90a",blue:"#5b5bd6",magenta:"#ab4aba",cyan:"#12a594",white:"#ececf1",brightBlack:"#6b6b80",brightRed:"#ff6369",brightGreen:"#3dd68c",brightYellow:"#ffef5c",brightBlue:"#849dff",brightMagenta:"#d19dff",brightCyan:"#0ac5b3",brightWhite:"#ffffff"},fw={background:"#ffffff",foreground:"#1a1a2e",cursor:"#1a1a2e",cursorAccent:"#ffffff",selectionBackground:"#5b5bd630",selectionForeground:"#1a1a2e",black:"#1a1a2e",red:"#dc3545",green:"#1a8f5c",yellow:"#b58900",blue:"#5b5bd6",magenta:"#9b3bb0",cyan:"#0f8a7e",white:"#d0d0d8",brightBlack:"#8888a0",brightRed:"#e5484d",brightGreen:"#30a46c",brightYellow:"#d4a017",brightBlue:"#6e6ee6",brightMagenta:"#ab4aba",brightCyan:"#12a594",brightWhite:"#d0d0d8"};function ue(t){return t?t.type==="leaf"?[t.terminalId]:[...ue(t.first),...ue(t.second)]:[]}function Nc(t,e){if(t.type==="leaf")return null;const i=ue(t.first),r=ue(t.second);return i.includes(e)||r.includes(e)?t.direction:Nc(t.first,e)??Nc(t.second,e)}function _w(t,e,i,r){if(!t)return{type:"leaf",terminalId:i};const s=r??(Nc(t,e)==="vertical"?"horizontal":"vertical");return $c(t,e,i,s)}function $c(t,e,i,r){return t.type==="leaf"?t.terminalId===e?{type:"split",direction:r,ratio:.5,first:t,second:{type:"leaf",terminalId:i}}:t:{...t,first:$c(t.first,e,i,r),second:$c(t.second,e,i,r)}}function tl(t,e){if(!t)return null;if(t.type==="leaf")return t.terminalId===e?null:t;const i=ue(t.first),r=ue(t.second);if(t.first.type==="leaf"&&t.first.terminalId===e)return t.second;if(t.second.type==="leaf"&&t.second.terminalId===e)return t.first;if(i.includes(e)){const s=tl(t.first,e);return s?{...t,first:s}:t.second}if(r.includes(e)){const s=tl(t.second,e);return s?{...t,second:s}:t.first}return t}function Oc(t,e,i){const r=Math.max(hw,Math.min(cw,i));if(e.length===0)return t.type==="split"?{...t,ratio:r}:t;if(t.type==="leaf")return t;const[s,...n]=e;return s===0?{...t,first:Oc(t.first,n,r)}:{...t,second:Oc(t.second,n,r)}}function Ic(t,e,i){return t.type==="leaf"?t.terminalId===e?{...t,terminalId:i}:t.terminalId===i?{...t,terminalId:e}:t:{...t,first:Ic(t.first,e,i),second:Ic(t.second,e,i)}}function pw(t,e,i,r){const s=tl(t,e);return s?zc(s,i,e,r==="left"||r==="right"?"vertical":"horizontal",r==="left"||r==="top"):null}function zc(t,e,i,r,s){if(t.type==="leaf"){if(t.terminalId===e){const n={type:"leaf",terminalId:i};return{type:"split",direction:r,ratio:.5,first:s?n:t,second:s?t:n}}return t}return{...t,first:zc(t.first,e,i,r,s),second:zc(t.second,e,i,r,s)}}const zs=["even-horizontal","even-vertical","main-left","main-top","grid"];function rs(t,e){if(t.length===0)return null;if(t.length===1)return{type:"leaf",terminalId:t[0]};switch(e){case"even-horizontal":return qr(t,"horizontal");case"even-vertical":return qr(t,"vertical");case"main-left":return g_(t,"vertical");case"main-top":return g_(t,"horizontal");case"grid":return gw(t)}}function qr(t,e){if(t.length===1)return{type:"leaf",terminalId:t[0]};if(t.length===2)return{type:"split",direction:e,ratio:.5,first:{type:"leaf",terminalId:t[0]},second:{type:"leaf",terminalId:t[1]}};const i=1/t.length;return{type:"split",direction:e,ratio:i,first:{type:"leaf",terminalId:t[0]},second:qr(t.slice(1),e)}}function g_(t,e,i){const[r,...s]=t,o=qr(s,e==="vertical"?"horizontal":"vertical");return{type:"split",direction:e,ratio:.6,first:{type:"leaf",terminalId:r},second:o}}function gw(t){if(t.length<=2)return qr(t,"vertical");const e=Math.ceil(t.length/2),i=t.slice(0,e),r=t.slice(e);return{type:"split",direction:"horizontal",ratio:.5,first:qr(i,"vertical"),second:r.length>0?qr(r,"vertical"):{type:"leaf",terminalId:i[i.length-1]}}}function v_(t,e,i){const r=ue(t),s=r.indexOf(e);return s===-1?null:i==="left"||i==="up"?s>0?r[s-1]:null:s<r.length-1?r[s+1]:null}const X=wo((t,e)=>({layouts:{},currentPresetIndex:0,getLayout:i=>e().layouts[i]??null,setLayout:(i,r)=>t(s=>({layouts:{...s.layouts,[i]:r}})),addPaneToProject:(i,r,s,n)=>t(o=>{const a=o.layouts[i]??null,h=_w(a,r,s,n);return{layouts:{...o.layouts,[i]:h}}}),removePaneFromProject:(i,r)=>t(s=>{const n=s.layouts[i];if(!n)return s;const o=tl(n,r);return{layouts:{...s.layouts,[i]:o}}}),resizePaneInProject:(i,r,s)=>t(n=>{const o=n.layouts[i];if(!o)return n;const a=Oc(o,r,s);return{layouts:{...n.layouts,[i]:a}}}),swapPanesInProject:(i,r,s)=>t(n=>{const o=n.layouts[i];if(!o)return n;const a=Ic(o,r,s);return{layouts:{...n.layouts,[i]:a}}}),movePaneInProject:(i,r,s,n)=>t(o=>{const a=o.layouts[i];if(!a)return o;const h=pw(a,r,s,n);return{layouts:{...o.layouts,[i]:h}}}),applyPresetToProject:(i,r)=>t(s=>{const n=zs[s.currentPresetIndex],o=rs(r,n);return{layouts:{...s.layouts,[i]:o}}}),cyclePreset:(i,r)=>t(s=>{const n=(s.currentPresetIndex+1)%zs.length,o=zs[n],a=rs(r,o);return{currentPresetIndex:n,layouts:{...s.layouts,[i]:a}}}),removeProjectLayout:i=>t(r=>{const{[i]:s,...n}=r.layouts;return{layouts:n}})}));function va(t){document.documentElement.setAttribute("data-theme",t)}function Bd(t){return t==="system"?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":t}function vw(){const t=document.cookie.match(/(?:^|; )paneful_theme=(system|dark|light)/);return(t==null?void 0:t[1])??"system"}function dh(t){document.cookie=`paneful_theme=${t};path=/;max-age=31536000;SameSite=Lax`}const wm=vw();va(wm);function fn(t){const{theme:e,sidebarWidth:i,editorSyncEnabled:r,gpuRendering:s}=t();Hn({ui:{theme:e,sidebarWidth:i,editorSyncEnabled:r,gpuRendering:s}})}const F=wo((t,e)=>({focusedTerminalId:null,sidebarOpen:!0,sidebarWidth:224,draggingTerminalId:null,dropTarget:null,connectionStatus:"connecting",editorSyncEnabled:!0,gpuRendering:!0,theme:wm,syncToast:null,searchTerminalId:null,commandPaletteOpen:!1,pendingFavouriteLaunchId:null,setFocusedTerminal:i=>t({focusedTerminalId:i}),toggleSidebar:()=>t(i=>({sidebarOpen:!i.sidebarOpen})),setSidebarOpen:i=>t({sidebarOpen:i}),setSidebarWidth:i=>{const r=Math.min(700,Math.max(160,i));t({sidebarWidth:r}),fn(e)},setDragging:i=>t({draggingTerminalId:i}),setDropTarget:i=>t({dropTarget:i}),setConnectionStatus:i=>t({connectionStatus:i}),toggleEditorSync:()=>{t(i=>({editorSyncEnabled:!i.editorSyncEnabled})),fn(e)},toggleGpuRendering:()=>{t(i=>({gpuRendering:!i.gpuRendering})),fn(e)},setTheme:i=>{dh(i),va(i),t({theme:i}),fn(e)},cycleTheme:()=>{const i=["system","light","dark"],r=e().theme,s=i[(i.indexOf(r)+1)%i.length];dh(s),va(s),t({theme:s}),fn(e)},openSearch:i=>t({searchTerminalId:i}),closeSearch:()=>t({searchTerminalId:null}),toggleCommandPalette:()=>t(i=>({commandPaletteOpen:!i.commandPaletteOpen})),closeCommandPalette:()=>t({commandPaletteOpen:!1}),requestFavouriteLaunch:i=>t({pendingFavouriteLaunchId:i}),clearPendingFavouriteLaunch:()=>t({pendingFavouriteLaunchId:null}),showSyncToast:i=>{t({syncToast:{projectName:i,id:Date.now()}})},dismissSyncToast:()=>t({syncToast:null}),hydrateFromServer:async()=>{try{const r=await(await fetch("/api/settings")).json();if(r.ui){const{theme:s,sidebarWidth:n,editorSyncEnabled:o,gpuRendering:a}=r.ui;s&&(dh(s),va(s)),t({...s?{theme:s}:{},...n!==void 0?{sidebarWidth:n}:{},...o!==void 0?{editorSyncEnabled:o}:{},...a!==void 0?{gpuRendering:a}:{}})}}catch{}}}));/**
|
|
56
|
+
*/var Ll=O,YS=GS;function XS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var QS=typeof Object.is=="function"?Object.is:XS,ZS=YS.useSyncExternalStore,JS=Ll.useRef,ew=Ll.useEffect,tw=Ll.useMemo,iw=Ll.useDebugValue;vm.useSyncExternalStoreWithSelector=function(t,e,i,r,s){var n=JS(null);if(n.current===null){var o={hasValue:!1,value:null};n.current=o}else o=n.current;n=tw(function(){function h(f){if(!l){if(l=!0,c=f,f=r(f),s!==void 0&&o.hasValue){var p=o.value;if(s(p,f))return u=p}return u=f}if(p=u,QS(c,f))return p;var m=r(f);return s!==void 0&&s(p,m)?(c=f,p):(c=f,u=m)}var l=!1,c,u,d=i===void 0?null:i;return[function(){return h(e())},d===null?void 0:function(){return h(d())}]},[e,i,r,s]);var a=ZS(t,n[0],n[1]);return ew(function(){o.hasValue=!0,o.value=a},[a]),iw(a),a};gm.exports=vm;var rw=gm.exports;const sw=rg(rw),Sm={},{useDebugValue:nw}=Wu,{useSyncExternalStoreWithSelector:ow}=sw;let __=!1;const aw=t=>t;function lw(t,e=aw,i){(Sm?"production":void 0)!=="production"&&i&&!__&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),__=!0);const r=ow(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,i);return nw(r),r}const p_=t=>{(Sm?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?IS(t):t,i=(r,s)=>lw(e,r,s);return Object.assign(i,e),i},wo=t=>t?p_(t):p_,oe=wo((t,e)=>({sessions:{},activePorts:{},claudeStatus:{},gitBranches:{},editorNeedsAccessibility:!1,createSession:(i,r)=>t(s=>({sessions:{...s.sessions,[i]:{terminalId:i,projectId:r,terminal:null,title:"Terminal",alive:!0}}})),setTerminalInstance:(i,r)=>t(s=>{const n=s.sessions[i];return n?{sessions:{...s.sessions,[i]:{...n,terminal:r}}}:s}),setTitle:(i,r)=>t(s=>{const n=s.sessions[i];return n?{sessions:{...s.sessions,[i]:{...n,title:r}}}:s}),markDead:i=>t(r=>{const s=r.sessions[i];return s?{sessions:{...r.sessions,[i]:{...s,alive:!1}}}:r}),removeSession:i=>t(r=>{const{[i]:s,...n}=r.sessions;return{sessions:n}}),getSession:i=>e().sessions[i],getProjectSessions:i=>Object.values(e().sessions).filter(r=>r.projectId===i),setActivePorts:i=>t({activePorts:i}),setClaudeStatus:i=>t({claudeStatus:i}),setGitBranches:i=>t({gitBranches:i}),setEditorNeedsAccessibility:i=>t({editorNeedsAccessibility:i})}));let Vo=null,dn=null;function Hn(t){dn=dn?{...dn,...t}:{...t},Vo&&clearTimeout(Vo),Vo=setTimeout(()=>{const e=dn;dn=null,Vo=null,fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).catch(()=>{})},300)}const ae=wo()((t,e)=>({projects:{},activeProjectId:null,setActiveProject:i=>{t({activeProjectId:i}),Hn({activeProjectId:i})},addProject:i=>t(r=>({projects:{...r.projects,[i.id]:i},activeProjectId:r.activeProjectId??i.id})),removeProject:i=>t(r=>{const{[i]:s,...n}=r.projects,o=r.activeProjectId===i?Object.keys(n)[0]??null:r.activeProjectId;return{projects:n,activeProjectId:o}}),addTerminalToProject:(i,r)=>t(s=>{const n=s.projects[i];return!n||n.terminalIds.includes(r)?s:{projects:{...s.projects,[i]:{...n,terminalIds:[...n.terminalIds,r]}}}}),removeTerminalFromProject:(i,r)=>t(s=>{const n=s.projects[i];return n?{projects:{...s.projects,[i]:{...n,terminalIds:n.terminalIds.filter(o=>o!==r)}}}:s}),clearProjectTerminals:i=>t(r=>{const s=r.projects[i];return s?{projects:{...r.projects,[i]:{...s,terminalIds:[]}}}:r}),getActiveProject:()=>{const{projects:i,activeProjectId:r}=e();return r?i[r]??null:null},hydrateFromServer:async()=>{try{const[i,r]=await Promise.all([fetch("/api/projects"),fetch("/api/settings")]),s=await i.json(),n=await r.json(),o={};for(const h of s)o[h.id]={id:h.id,name:h.name,cwd:h.cwd,terminalIds:[]};const a=n.activeProjectId&&o[n.activeProjectId]?n.activeProjectId:Object.keys(o)[0]??null;t({projects:o,activeProjectId:a})}catch{}}})),hw=.1,cw=.9,uw=50,dw={background:"#0a0a0f",foreground:"#ececf1",cursor:"#ececf1",cursorAccent:"#0a0a0f",selectionBackground:"#5b5bd640",selectionForeground:"#ececf1",black:"#1a1a24",red:"#e5484d",green:"#30a46c",yellow:"#f5d90a",blue:"#5b5bd6",magenta:"#ab4aba",cyan:"#12a594",white:"#ececf1",brightBlack:"#6b6b80",brightRed:"#ff6369",brightGreen:"#3dd68c",brightYellow:"#ffef5c",brightBlue:"#849dff",brightMagenta:"#d19dff",brightCyan:"#0ac5b3",brightWhite:"#ffffff"},fw={background:"#ffffff",foreground:"#1a1a2e",cursor:"#1a1a2e",cursorAccent:"#ffffff",selectionBackground:"#5b5bd630",selectionForeground:"#1a1a2e",black:"#1a1a2e",red:"#dc3545",green:"#1a8f5c",yellow:"#b58900",blue:"#5b5bd6",magenta:"#9b3bb0",cyan:"#0f8a7e",white:"#d0d0d8",brightBlack:"#8888a0",brightRed:"#e5484d",brightGreen:"#30a46c",brightYellow:"#d4a017",brightBlue:"#6e6ee6",brightMagenta:"#ab4aba",brightCyan:"#12a594",brightWhite:"#d0d0d8"};function de(t){return t?t.type==="leaf"?[t.terminalId]:[...de(t.first),...de(t.second)]:[]}function Nc(t,e){if(t.type==="leaf")return null;const i=de(t.first),r=de(t.second);return i.includes(e)||r.includes(e)?t.direction:Nc(t.first,e)??Nc(t.second,e)}function _w(t,e,i,r){if(!t)return{type:"leaf",terminalId:i};const s=r??(Nc(t,e)==="vertical"?"horizontal":"vertical");return $c(t,e,i,s)}function $c(t,e,i,r){return t.type==="leaf"?t.terminalId===e?{type:"split",direction:r,ratio:.5,first:t,second:{type:"leaf",terminalId:i}}:t:{...t,first:$c(t.first,e,i,r),second:$c(t.second,e,i,r)}}function tl(t,e){if(!t)return null;if(t.type==="leaf")return t.terminalId===e?null:t;const i=de(t.first),r=de(t.second);if(t.first.type==="leaf"&&t.first.terminalId===e)return t.second;if(t.second.type==="leaf"&&t.second.terminalId===e)return t.first;if(i.includes(e)){const s=tl(t.first,e);return s?{...t,first:s}:t.second}if(r.includes(e)){const s=tl(t.second,e);return s?{...t,second:s}:t.first}return t}function Oc(t,e,i){const r=Math.max(hw,Math.min(cw,i));if(e.length===0)return t.type==="split"?{...t,ratio:r}:t;if(t.type==="leaf")return t;const[s,...n]=e;return s===0?{...t,first:Oc(t.first,n,r)}:{...t,second:Oc(t.second,n,r)}}function Ic(t,e,i){return t.type==="leaf"?t.terminalId===e?{...t,terminalId:i}:t.terminalId===i?{...t,terminalId:e}:t:{...t,first:Ic(t.first,e,i),second:Ic(t.second,e,i)}}function pw(t,e,i,r){const s=tl(t,e);return s?zc(s,i,e,r==="left"||r==="right"?"vertical":"horizontal",r==="left"||r==="top"):null}function zc(t,e,i,r,s){if(t.type==="leaf"){if(t.terminalId===e){const n={type:"leaf",terminalId:i};return{type:"split",direction:r,ratio:.5,first:s?n:t,second:s?t:n}}return t}return{...t,first:zc(t.first,e,i,r,s),second:zc(t.second,e,i,r,s)}}const zs=["even-horizontal","even-vertical","main-left","main-top","grid"];function rs(t,e){if(t.length===0)return null;if(t.length===1)return{type:"leaf",terminalId:t[0]};switch(e){case"even-horizontal":return qr(t,"horizontal");case"even-vertical":return qr(t,"vertical");case"main-left":return g_(t,"vertical");case"main-top":return g_(t,"horizontal");case"grid":return gw(t)}}function qr(t,e){if(t.length===1)return{type:"leaf",terminalId:t[0]};if(t.length===2)return{type:"split",direction:e,ratio:.5,first:{type:"leaf",terminalId:t[0]},second:{type:"leaf",terminalId:t[1]}};const i=1/t.length;return{type:"split",direction:e,ratio:i,first:{type:"leaf",terminalId:t[0]},second:qr(t.slice(1),e)}}function g_(t,e,i){const[r,...s]=t,o=qr(s,e==="vertical"?"horizontal":"vertical");return{type:"split",direction:e,ratio:.6,first:{type:"leaf",terminalId:r},second:o}}function gw(t){if(t.length<=2)return qr(t,"vertical");const e=Math.ceil(t.length/2),i=t.slice(0,e),r=t.slice(e);return{type:"split",direction:"horizontal",ratio:.5,first:qr(i,"vertical"),second:r.length>0?qr(r,"vertical"):{type:"leaf",terminalId:i[i.length-1]}}}function v_(t,e,i){const r=de(t),s=r.indexOf(e);return s===-1?null:i==="left"||i==="up"?s>0?r[s-1]:null:s<r.length-1?r[s+1]:null}const X=wo((t,e)=>({layouts:{},currentPresetIndex:0,getLayout:i=>e().layouts[i]??null,setLayout:(i,r)=>t(s=>({layouts:{...s.layouts,[i]:r}})),addPaneToProject:(i,r,s,n)=>t(o=>{const a=o.layouts[i]??null,h=_w(a,r,s,n);return{layouts:{...o.layouts,[i]:h}}}),removePaneFromProject:(i,r)=>t(s=>{const n=s.layouts[i];if(!n)return s;const o=tl(n,r);return{layouts:{...s.layouts,[i]:o}}}),resizePaneInProject:(i,r,s)=>t(n=>{const o=n.layouts[i];if(!o)return n;const a=Oc(o,r,s);return{layouts:{...n.layouts,[i]:a}}}),swapPanesInProject:(i,r,s)=>t(n=>{const o=n.layouts[i];if(!o)return n;const a=Ic(o,r,s);return{layouts:{...n.layouts,[i]:a}}}),movePaneInProject:(i,r,s,n)=>t(o=>{const a=o.layouts[i];if(!a)return o;const h=pw(a,r,s,n);return{layouts:{...o.layouts,[i]:h}}}),applyPresetToProject:(i,r)=>t(s=>{const n=zs[s.currentPresetIndex],o=rs(r,n);return{layouts:{...s.layouts,[i]:o}}}),cyclePreset:(i,r)=>t(s=>{const n=(s.currentPresetIndex+1)%zs.length,o=zs[n],a=rs(r,o);return{currentPresetIndex:n,layouts:{...s.layouts,[i]:a}}}),removeProjectLayout:i=>t(r=>{const{[i]:s,...n}=r.layouts;return{layouts:n}})}));function va(t){document.documentElement.setAttribute("data-theme",t)}function Bd(t){return t==="system"?window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark":t}function vw(){const t=document.cookie.match(/(?:^|; )paneful_theme=(system|dark|light)/);return(t==null?void 0:t[1])??"system"}function dh(t){document.cookie=`paneful_theme=${t};path=/;max-age=31536000;SameSite=Lax`}const wm=vw();va(wm);function fn(t){const{theme:e,sidebarWidth:i,editorSyncEnabled:r,gpuRendering:s}=t();Hn({ui:{theme:e,sidebarWidth:i,editorSyncEnabled:r,gpuRendering:s}})}const F=wo((t,e)=>({focusedTerminalId:null,sidebarOpen:!0,sidebarWidth:224,draggingTerminalId:null,dropTarget:null,connectionStatus:"connecting",editorSyncEnabled:!0,gpuRendering:!0,theme:wm,syncToast:null,searchTerminalId:null,commandPaletteOpen:!1,pendingFavouriteLaunchId:null,setFocusedTerminal:i=>t({focusedTerminalId:i}),toggleSidebar:()=>t(i=>({sidebarOpen:!i.sidebarOpen})),setSidebarOpen:i=>t({sidebarOpen:i}),setSidebarWidth:i=>{const r=Math.min(700,Math.max(160,i));t({sidebarWidth:r}),fn(e)},setDragging:i=>t({draggingTerminalId:i}),setDropTarget:i=>t({dropTarget:i}),setConnectionStatus:i=>t({connectionStatus:i}),toggleEditorSync:()=>{t(i=>({editorSyncEnabled:!i.editorSyncEnabled})),fn(e)},toggleGpuRendering:()=>{t(i=>({gpuRendering:!i.gpuRendering})),fn(e)},setTheme:i=>{dh(i),va(i),t({theme:i}),fn(e)},cycleTheme:()=>{const i=["system","light","dark"],r=e().theme,s=i[(i.indexOf(r)+1)%i.length];dh(s),va(s),t({theme:s}),fn(e)},openSearch:i=>t({searchTerminalId:i}),closeSearch:()=>t({searchTerminalId:null}),toggleCommandPalette:()=>t(i=>({commandPaletteOpen:!i.commandPaletteOpen})),closeCommandPalette:()=>t({commandPaletteOpen:!1}),requestFavouriteLaunch:i=>t({pendingFavouriteLaunchId:i}),clearPendingFavouriteLaunch:()=>t({pendingFavouriteLaunchId:null}),showSyncToast:i=>{t({syncToast:{projectName:i,id:Date.now()}})},dismissSyncToast:()=>t({syncToast:null}),hydrateFromServer:async()=>{try{const r=await(await fetch("/api/settings")).json();if(r.ui){const{theme:s,sidebarWidth:n,editorSyncEnabled:o,gpuRendering:a}=r.ui;s&&(dh(s),va(s)),t({...s?{theme:s}:{},...n!==void 0?{sidebarWidth:n}:{},...o!==void 0?{editorSyncEnabled:o}:{},...a!==void 0?{gpuRendering:a}:{}})}}catch{}}}));/**
|
|
57
57
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
58
58
|
* @license MIT
|
|
59
59
|
*
|
|
@@ -70,15 +70,15 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
70
70
|
|
|
71
71
|
`+e.stack):new Error(e.message+`
|
|
72
72
|
|
|
73
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(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)}},Bw=new Dw;function ma(t){Aw(t)||Bw.onUnexpectedError(t)}var Uc="Canceled";function Aw(t){return t instanceof Nw?!0:t instanceof Error&&t.name===Uc&&t.message===Uc}var Nw=class extends Error{constructor(){super(Uc),this.name=this.message}};function $w(t){return new Error(`Illegal argument: ${t}`)}var x_=class Kc extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Kc)return e;let i=new Kc;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Vc=class Am extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,Am.prototype)}};function $t(t,e=0){return t[t.length-(1+e)]}var Ow;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(Ow||(Ow={}));function Iw(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var Nm;(t=>{function e(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(y){yield y}t.single=s;function n(y){return e(y)?y:s(y)}t.wrap=n;function o(y){return y||i}t.from=o;function*a(y){for(let L=y.length-1;L>=0;L--)yield y[L]}t.reverse=a;function h(y){return!y||y[Symbol.iterator]().next().done===!0}t.isEmpty=h;function l(y){return y[Symbol.iterator]().next().value}t.first=l;function c(y,L){let P=0;for(let N of y)if(L(N,P++))return!0;return!1}t.some=c;function u(y,L){for(let P of y)if(L(P))return P}t.find=u;function*d(y,L){for(let P of y)L(P)&&(yield P)}t.filter=d;function*f(y,L){let P=0;for(let N of y)yield L(N,P++)}t.map=f;function*p(y,L){let P=0;for(let N of y)yield*L(N,P++)}t.flatMap=p;function*m(...y){for(let L of y)yield*L}t.concat=m;function x(y,L,P){let N=P;for(let B of y)N=L(N,B);return N}t.reduce=x;function*_(y,L,P=y.length){for(L<0&&(L+=y.length),P<0?P+=y.length:P>y.length&&(P=y.length);L<P;L++)yield y[L]}t.slice=_;function g(y,L=Number.POSITIVE_INFINITY){let P=[];if(L===0)return[P,y];let N=y[Symbol.iterator]();for(let B=0;B<L;B++){let U=N.next();if(U.done)return[P,t.empty()];P.push(U.value)}return[P,{[Symbol.iterator](){return N}}]}t.consume=g;async function S(y){let L=[];for await(let P of y)L.push(P);return Promise.resolve(L)}t.asyncToArray=S})(Nm||(Nm={}));function ss(t){if(Nm.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function zw(...t){return xe(()=>ss(t))}function xe(t){return{dispose:Iw(()=>{t()})}}var $m=class Om{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{ss(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Om.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};$m.DISABLE_DISPOSED_WARNING=!1;var kr=$m,ee=class{constructor(){this._store=new kr,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)}};ee.None=Object.freeze({dispose(){}});var Ys=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var i;this._isDisposed||e===this._value||((i=this._value)==null||i.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Ui=typeof window=="object"?window:globalThis,qc=class Gc{constructor(e){this.element=e,this.next=Gc.Undefined,this.prev=Gc.Undefined}};qc.Undefined=new qc(void 0);var Ce=qc,C_=class{constructor(){this._first=Ce.Undefined,this._last=Ce.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ce.Undefined}clear(){let e=this._first;for(;e!==Ce.Undefined;){let i=e.next;e.prev=Ce.Undefined,e.next=Ce.Undefined,e=i}this._first=Ce.Undefined,this._last=Ce.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let r=new Ce(e);if(this._first===Ce.Undefined)this._first=r,this._last=r;else if(i){let n=this._last;this._last=r,r.prev=n,n.next=r}else{let n=this._first;this._first=r,r.next=n,n.prev=r}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(r))}}shift(){if(this._first!==Ce.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ce.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ce.Undefined&&e.next!==Ce.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===Ce.Undefined&&e.next===Ce.Undefined?(this._first=Ce.Undefined,this._last=Ce.Undefined):e.next===Ce.Undefined?(this._last=this._last.prev,this._last.next=Ce.Undefined):e.prev===Ce.Undefined&&(this._first=this._first.next,this._first.prev=Ce.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ce.Undefined;)yield e.element,e=e.next}},Fw=globalThis.performance&&typeof globalThis.performance.now=="function",jw=class Im{static create(e){return new Im(e)}constructor(e){this._now=Fw&&e===!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}},ht;(t=>{t.None=()=>ee.None;function e(C,w){return u(C,()=>{},0,void 0,!0,void 0,w)}t.defer=e;function i(C){return(w,b=null,k)=>{let M=!1,T;return T=C(E=>{if(!M)return T?T.dispose():M=!0,w.call(b,E)},null,k),M&&T.dispose(),T}}t.once=i;function r(C,w,b){return l((k,M=null,T)=>C(E=>k.call(M,w(E)),null,T),b)}t.map=r;function s(C,w,b){return l((k,M=null,T)=>C(E=>{w(E),k.call(M,E)},null,T),b)}t.forEach=s;function n(C,w,b){return l((k,M=null,T)=>C(E=>w(E)&&k.call(M,E),null,T),b)}t.filter=n;function o(C){return C}t.signal=o;function a(...C){return(w,b=null,k)=>{let M=zw(...C.map(T=>T(E=>w.call(b,E))));return c(M,k)}}t.any=a;function h(C,w,b,k){let M=b;return r(C,T=>(M=w(M,T),M),k)}t.reduce=h;function l(C,w){let b,k={onWillAddFirstListener(){b=C(M.fire,M)},onDidRemoveLastListener(){b==null||b.dispose()}},M=new z(k);return w==null||w.add(M),M.event}function c(C,w){return w instanceof Array?w.push(C):w&&w.add(C),C}function u(C,w,b=100,k=!1,M=!1,T,E){let R,D,j,G=0,q,de={leakWarningThreshold:T,onWillAddFirstListener(){R=C(le=>{G++,D=w(D,le),k&&!j&&(Q.fire(D),D=void 0),q=()=>{let Z=D;D=void 0,j=void 0,(!k||G>1)&&Q.fire(Z),G=0},typeof b=="number"?(clearTimeout(j),j=setTimeout(q,b)):j===void 0&&(j=0,queueMicrotask(q))})},onWillRemoveListener(){M&&G>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,R.dispose()}},Q=new z(de);return E==null||E.add(Q),Q.event}t.debounce=u;function d(C,w=0,b){return t.debounce(C,(k,M)=>k?(k.push(M),k):[M],w,void 0,!0,void 0,b)}t.accumulate=d;function f(C,w=(k,M)=>k===M,b){let k=!0,M;return n(C,T=>{let E=k||!w(T,M);return k=!1,M=T,E},b)}t.latch=f;function p(C,w,b){return[t.filter(C,w,b),t.filter(C,k=>!w(k),b)]}t.split=p;function m(C,w=!1,b=[],k){let M=b.slice(),T=C(D=>{M?M.push(D):R.fire(D)});k&&k.add(T);let E=()=>{M==null||M.forEach(D=>R.fire(D)),M=null},R=new z({onWillAddFirstListener(){T||(T=C(D=>R.fire(D)),k&&k.add(T))},onDidAddFirstListener(){M&&(w?setTimeout(E):E())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return k&&k.add(R),R.event}t.buffer=m;function x(C,w){return(b,k,M)=>{let T=w(new g);return C(function(E){let R=T.evaluate(E);R!==_&&b.call(k,R)},void 0,M)}}t.chain=x;let _=Symbol("HaltChainable");class g{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(b=>(w(b),b)),this}filter(w){return this.steps.push(b=>w(b)?b:_),this}reduce(w,b){let k=b;return this.steps.push(M=>(k=w(k,M),k)),this}latch(w=(b,k)=>b===k){let b=!0,k;return this.steps.push(M=>{let T=b||!w(M,k);return b=!1,k=M,T?M:_}),this}evaluate(w){for(let b of this.steps)if(w=b(w),w===_)break;return w}}function S(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.on(w,k),T=()=>C.removeListener(w,k),E=new z({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromNodeEventEmitter=S;function y(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.addEventListener(w,k),T=()=>C.removeEventListener(w,k),E=new z({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromDOMEventEmitter=y;function L(C){return new Promise(w=>i(C)(w))}t.toPromise=L;function P(C){let w=new z;return C.then(b=>{w.fire(b)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}t.fromPromise=P;function N(C,w){return C(b=>w.fire(b))}t.forward=N;function B(C,w,b){return w(b),C(k=>w(k))}t.runAndSubscribe=B;class U{constructor(w,b){this._observable=w,this._counter=0,this._hasChanged=!1;let k={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};this.emitter=new z(k),b&&b.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,b){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function W(C,w){return new U(C,w).emitter.event}t.fromObservable=W;function V(C){return(w,b,k)=>{let M=0,T=!1,E={beginUpdate(){M++},endUpdate(){M--,M===0&&(C.reportChanges(),T&&(T=!1,w.call(b)))},handlePossibleChange(){},handleChange(){T=!0}};C.addObserver(E),C.reportChanges();let R={dispose(){C.removeObserver(E)}};return k instanceof kr?k.add(R):Array.isArray(k)&&k.push(R),R}}t.fromObservableLight=V})(ht||(ht={}));var Yc=class Xc{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Xc._idPool++}`,Xc.all.add(this)}start(e){this._stopWatch=new jw,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Yc.all=new Set,Yc._idPool=0;var Ww=Yc,Hw=-1,zm=class Fm{constructor(e,i,r=(Fm._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new Vw(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};zm._idPool=1;var Uw=zm,Kw=class jm{constructor(e){this.value=e}static create(){let e=new Error;return new jm(e.stack??"")}print(){console.warn(this.value.split(`
|
|
73
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(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)}},Bw=new Dw;function ma(t){Aw(t)||Bw.onUnexpectedError(t)}var Uc="Canceled";function Aw(t){return t instanceof Nw?!0:t instanceof Error&&t.name===Uc&&t.message===Uc}var Nw=class extends Error{constructor(){super(Uc),this.name=this.message}};function $w(t){return new Error(`Illegal argument: ${t}`)}var x_=class Kc extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Kc)return e;let i=new Kc;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Vc=class Am extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,Am.prototype)}};function $t(t,e=0){return t[t.length-(1+e)]}var Ow;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(Ow||(Ow={}));function Iw(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var Nm;(t=>{function e(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(y){yield y}t.single=s;function n(y){return e(y)?y:s(y)}t.wrap=n;function o(y){return y||i}t.from=o;function*a(y){for(let L=y.length-1;L>=0;L--)yield y[L]}t.reverse=a;function h(y){return!y||y[Symbol.iterator]().next().done===!0}t.isEmpty=h;function l(y){return y[Symbol.iterator]().next().value}t.first=l;function c(y,L){let P=0;for(let N of y)if(L(N,P++))return!0;return!1}t.some=c;function u(y,L){for(let P of y)if(L(P))return P}t.find=u;function*d(y,L){for(let P of y)L(P)&&(yield P)}t.filter=d;function*f(y,L){let P=0;for(let N of y)yield L(N,P++)}t.map=f;function*p(y,L){let P=0;for(let N of y)yield*L(N,P++)}t.flatMap=p;function*m(...y){for(let L of y)yield*L}t.concat=m;function x(y,L,P){let N=P;for(let B of y)N=L(N,B);return N}t.reduce=x;function*_(y,L,P=y.length){for(L<0&&(L+=y.length),P<0?P+=y.length:P>y.length&&(P=y.length);L<P;L++)yield y[L]}t.slice=_;function g(y,L=Number.POSITIVE_INFINITY){let P=[];if(L===0)return[P,y];let N=y[Symbol.iterator]();for(let B=0;B<L;B++){let U=N.next();if(U.done)return[P,t.empty()];P.push(U.value)}return[P,{[Symbol.iterator](){return N}}]}t.consume=g;async function S(y){let L=[];for await(let P of y)L.push(P);return Promise.resolve(L)}t.asyncToArray=S})(Nm||(Nm={}));function ss(t){if(Nm.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function zw(...t){return xe(()=>ss(t))}function xe(t){return{dispose:Iw(()=>{t()})}}var $m=class Om{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{ss(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Om.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};$m.DISABLE_DISPOSED_WARNING=!1;var kr=$m,ee=class{constructor(){this._store=new kr,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)}};ee.None=Object.freeze({dispose(){}});var Ys=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var i;this._isDisposed||e===this._value||((i=this._value)==null||i.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Ui=typeof window=="object"?window:globalThis,qc=class Gc{constructor(e){this.element=e,this.next=Gc.Undefined,this.prev=Gc.Undefined}};qc.Undefined=new qc(void 0);var Ce=qc,C_=class{constructor(){this._first=Ce.Undefined,this._last=Ce.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ce.Undefined}clear(){let e=this._first;for(;e!==Ce.Undefined;){let i=e.next;e.prev=Ce.Undefined,e.next=Ce.Undefined,e=i}this._first=Ce.Undefined,this._last=Ce.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let r=new Ce(e);if(this._first===Ce.Undefined)this._first=r,this._last=r;else if(i){let n=this._last;this._last=r,r.prev=n,n.next=r}else{let n=this._first;this._first=r,r.next=n,n.prev=r}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(r))}}shift(){if(this._first!==Ce.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ce.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ce.Undefined&&e.next!==Ce.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===Ce.Undefined&&e.next===Ce.Undefined?(this._first=Ce.Undefined,this._last=Ce.Undefined):e.next===Ce.Undefined?(this._last=this._last.prev,this._last.next=Ce.Undefined):e.prev===Ce.Undefined&&(this._first=this._first.next,this._first.prev=Ce.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ce.Undefined;)yield e.element,e=e.next}},Fw=globalThis.performance&&typeof globalThis.performance.now=="function",jw=class Im{static create(e){return new Im(e)}constructor(e){this._now=Fw&&e===!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}},ht;(t=>{t.None=()=>ee.None;function e(C,w){return u(C,()=>{},0,void 0,!0,void 0,w)}t.defer=e;function i(C){return(w,b=null,k)=>{let M=!1,T;return T=C(E=>{if(!M)return T?T.dispose():M=!0,w.call(b,E)},null,k),M&&T.dispose(),T}}t.once=i;function r(C,w,b){return l((k,M=null,T)=>C(E=>k.call(M,w(E)),null,T),b)}t.map=r;function s(C,w,b){return l((k,M=null,T)=>C(E=>{w(E),k.call(M,E)},null,T),b)}t.forEach=s;function n(C,w,b){return l((k,M=null,T)=>C(E=>w(E)&&k.call(M,E),null,T),b)}t.filter=n;function o(C){return C}t.signal=o;function a(...C){return(w,b=null,k)=>{let M=zw(...C.map(T=>T(E=>w.call(b,E))));return c(M,k)}}t.any=a;function h(C,w,b,k){let M=b;return r(C,T=>(M=w(M,T),M),k)}t.reduce=h;function l(C,w){let b,k={onWillAddFirstListener(){b=C(M.fire,M)},onDidRemoveLastListener(){b==null||b.dispose()}},M=new z(k);return w==null||w.add(M),M.event}function c(C,w){return w instanceof Array?w.push(C):w&&w.add(C),C}function u(C,w,b=100,k=!1,M=!1,T,E){let R,D,j,G=0,q,fe={leakWarningThreshold:T,onWillAddFirstListener(){R=C(le=>{G++,D=w(D,le),k&&!j&&(Q.fire(D),D=void 0),q=()=>{let Z=D;D=void 0,j=void 0,(!k||G>1)&&Q.fire(Z),G=0},typeof b=="number"?(clearTimeout(j),j=setTimeout(q,b)):j===void 0&&(j=0,queueMicrotask(q))})},onWillRemoveListener(){M&&G>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,R.dispose()}},Q=new z(fe);return E==null||E.add(Q),Q.event}t.debounce=u;function d(C,w=0,b){return t.debounce(C,(k,M)=>k?(k.push(M),k):[M],w,void 0,!0,void 0,b)}t.accumulate=d;function f(C,w=(k,M)=>k===M,b){let k=!0,M;return n(C,T=>{let E=k||!w(T,M);return k=!1,M=T,E},b)}t.latch=f;function p(C,w,b){return[t.filter(C,w,b),t.filter(C,k=>!w(k),b)]}t.split=p;function m(C,w=!1,b=[],k){let M=b.slice(),T=C(D=>{M?M.push(D):R.fire(D)});k&&k.add(T);let E=()=>{M==null||M.forEach(D=>R.fire(D)),M=null},R=new z({onWillAddFirstListener(){T||(T=C(D=>R.fire(D)),k&&k.add(T))},onDidAddFirstListener(){M&&(w?setTimeout(E):E())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return k&&k.add(R),R.event}t.buffer=m;function x(C,w){return(b,k,M)=>{let T=w(new g);return C(function(E){let R=T.evaluate(E);R!==_&&b.call(k,R)},void 0,M)}}t.chain=x;let _=Symbol("HaltChainable");class g{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(b=>(w(b),b)),this}filter(w){return this.steps.push(b=>w(b)?b:_),this}reduce(w,b){let k=b;return this.steps.push(M=>(k=w(k,M),k)),this}latch(w=(b,k)=>b===k){let b=!0,k;return this.steps.push(M=>{let T=b||!w(M,k);return b=!1,k=M,T?M:_}),this}evaluate(w){for(let b of this.steps)if(w=b(w),w===_)break;return w}}function S(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.on(w,k),T=()=>C.removeListener(w,k),E=new z({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromNodeEventEmitter=S;function y(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.addEventListener(w,k),T=()=>C.removeEventListener(w,k),E=new z({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromDOMEventEmitter=y;function L(C){return new Promise(w=>i(C)(w))}t.toPromise=L;function P(C){let w=new z;return C.then(b=>{w.fire(b)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}t.fromPromise=P;function N(C,w){return C(b=>w.fire(b))}t.forward=N;function B(C,w,b){return w(b),C(k=>w(k))}t.runAndSubscribe=B;class U{constructor(w,b){this._observable=w,this._counter=0,this._hasChanged=!1;let k={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};this.emitter=new z(k),b&&b.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,b){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function W(C,w){return new U(C,w).emitter.event}t.fromObservable=W;function V(C){return(w,b,k)=>{let M=0,T=!1,E={beginUpdate(){M++},endUpdate(){M--,M===0&&(C.reportChanges(),T&&(T=!1,w.call(b)))},handlePossibleChange(){},handleChange(){T=!0}};C.addObserver(E),C.reportChanges();let R={dispose(){C.removeObserver(E)}};return k instanceof kr?k.add(R):Array.isArray(k)&&k.push(R),R}}t.fromObservableLight=V})(ht||(ht={}));var Yc=class Xc{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Xc._idPool++}`,Xc.all.add(this)}start(e){this._stopWatch=new jw,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Yc.all=new Set,Yc._idPool=0;var Ww=Yc,Hw=-1,zm=class Fm{constructor(e,i,r=(Fm._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new Vw(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};zm._idPool=1;var Uw=zm,Kw=class jm{constructor(e){this.value=e}static create(){let e=new Error;return new jm(e.stack??"")}print(){console.warn(this.value.split(`
|
|
74
74
|
`).slice(2).join(`
|
|
75
75
|
`))}},Vw=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},qw=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},Gw=0,_h=class{constructor(e){this.value=e,this.id=Gw++}},Yw=2,Xw,z=class{constructor(e){var i,r,s,n;this._size=0,this._options=e,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new Uw((e==null?void 0:e.onListenerError)??ma,((r=this._options)==null?void 0:r.leakWarningThreshold)??Hw):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new Ww(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,i,r,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||r.call(i),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,i,r)=>{var a,h,l,c,u;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 f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new qw(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||ma)(p),ee.None}if(this._disposed)return ee.None;i&&(e=e.bind(i));let s=new _h(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=Kw.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof _h?(this._deliveryQueue??(this._deliveryQueue=new Qw),this._listeners=[this._listeners,s]):this._listeners.push(s):((l=(h=this._options)==null?void 0:h.onWillAddFirstListener)==null||l.call(h,this),this._listeners=s,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let o=xe(()=>{n==null||n(),this._removeListener(s)});return r instanceof kr?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var n,o,a,h;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(h=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null||h.call(a,this),this._size=0;return}let i=this._listeners,r=i.indexOf(e);if(r===-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--,i[r]=void 0;let s=this._deliveryQueue.current===this;if(this._size*Yw<=i.length){let l=0;for(let c=0;c<i.length;c++)i[c]?i[l++]=i[c]:s&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=l}}_deliver(e,i){var s;if(!e)return;let r=((s=this._options)==null?void 0:s.onListenerError)||ma;if(!r){e.value(i);return}try{e.value(i)}catch(n){r(n)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){var i,r,s,n;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof _h)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},Qw=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,r){this.i=0,this.end=r,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Qc=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new z,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new z,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Qc.INSTANCE=new Qc;var $d=Qc;function Zw(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}$d.INSTANCE.onDidChangeZoomLevel;function Jw(t){return $d.INSTANCE.getZoomFactor(t)}$d.INSTANCE.onDidChangeFullscreen;var en=typeof navigator=="object"?navigator.userAgent:"",Zc=en.indexOf("Firefox")>=0,ex=en.indexOf("AppleWebKit")>=0,Od=en.indexOf("Chrome")>=0,tx=!Od&&en.indexOf("Safari")>=0;en.indexOf("Electron/")>=0;en.indexOf("Android")>=0;var ph=!1;if(typeof Ui.matchMedia=="function"){let t=Ui.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Ui.matchMedia("(display-mode: fullscreen)");ph=t.matches,Zw(Ui,t,({matches:i})=>{ph&&e.matches||(ph=i)})}var Rs="en",Jc=!1,eu=!1,ya=!1,Wm=!1,qo,Sa=Rs,b_=Rs,ix,hi,Gr=globalThis,ot,Gp;typeof Gr.vscode<"u"&&typeof Gr.vscode.process<"u"?ot=Gr.vscode.process:typeof process<"u"&&typeof((Gp=process==null?void 0:process.versions)==null?void 0:Gp.node)=="string"&&(ot=process);var Yp,rx=typeof((Yp=ot==null?void 0:ot.versions)==null?void 0:Yp.electron)=="string",sx=rx&&(ot==null?void 0:ot.type)==="renderer",Xp;if(typeof ot=="object"){Jc=ot.platform==="win32",eu=ot.platform==="darwin",ya=ot.platform==="linux",ya&&ot.env.SNAP&&ot.env.SNAP_REVISION,ot.env.CI||ot.env.BUILD_ARTIFACTSTAGINGDIRECTORY,qo=Rs,Sa=Rs;let t=ot.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);qo=e.userLocale,b_=e.osLocale,Sa=e.resolvedLanguage||Rs,ix=(Xp=e.languagePack)==null?void 0:Xp.translationsConfigFile}catch{}Wm=!0}else typeof navigator=="object"&&!sx?(hi=navigator.userAgent,Jc=hi.indexOf("Windows")>=0,eu=hi.indexOf("Macintosh")>=0,(hi.indexOf("Macintosh")>=0||hi.indexOf("iPad")>=0||hi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ya=hi.indexOf("Linux")>=0,(hi==null?void 0:hi.indexOf("Mobi"))>=0,Sa=globalThis._VSCODE_NLS_LANGUAGE||Rs,qo=navigator.language.toLowerCase(),b_=qo):console.error("Unable to resolve platform.");var Hm=Jc,Ti=eu,nx=ya,k_=Wm,Pi=hi,tr=Sa,ox;(t=>{function e(){return tr}t.value=e;function i(){return tr.length===2?tr==="en":tr.length>=3?tr[0]==="e"&&tr[1]==="n"&&tr[2]==="-":!1}t.isDefaultVariant=i;function r(){return tr==="en"}t.isDefault=r})(ox||(ox={}));var ax=typeof Gr.postMessage=="function"&&!Gr.importScripts;(()=>{if(ax){let t=[];Gr.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r<s;r++){let n=t[r];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(r,1),n.callback();return}}});let e=0;return i=>{let r=++e;t.push({id:r,callback:i}),Gr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var lx=!!(Pi&&Pi.indexOf("Chrome")>=0);Pi&&Pi.indexOf("Firefox")>=0;!lx&&Pi&&Pi.indexOf("Safari")>=0;Pi&&Pi.indexOf("Edg/")>=0;Pi&&Pi.indexOf("Android")>=0;var ds=typeof navigator=="object"?navigator:{};k_||document.queryCommandSupported&&document.queryCommandSupported("copy")||ds&&ds.clipboard&&ds.clipboard.writeText,k_||ds&&ds.clipboard&&ds.clipboard.readText;var Id=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},gh=new Id,E_=new Id,L_=new Id,hx=new Array(230),Um;(t=>{function e(a){return gh.keyCodeToStr(a)}t.toString=e;function i(a){return gh.strToKeyCode(a)}t.fromString=i;function r(a){return E_.keyCodeToStr(a)}t.toUserSettingsUS=r;function s(a){return L_.keyCodeToStr(a)}t.toUserSettingsGeneral=s;function n(a){return E_.strToKeyCode(a)||L_.strToKeyCode(a)}t.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return gh.keyCodeToStr(a)}t.toElectronAccelerator=o})(Um||(Um={}));var cx=class Km{constructor(e,i,r,s,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(e){return e instanceof Km&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${e}${i}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new ux([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},ux=class{constructor(t){if(t.length===0)throw $w("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e<i;e++)e!==0&&(t+=";"),t+=this.chords[e].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(t.chords[e]))return!1;return!0}};function dx(t){if(t.charCode){let i=String.fromCharCode(t.charCode).toUpperCase();return Um.fromString(i)}let e=t.keyCode;if(e===3)return 7;if(Zc)switch(e){case 59:return 85;case 60:if(nx)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ti)return 57;break}else if(ex&&(Ti&&e===93||!Ti&&e===92))return 57;return hx[e]||0}var fx=Ti?256:2048,_x=512,px=1024,gx=Ti?2048:256,M_=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let i=e;this.browserEvent=i,this.target=i.target,this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,this.altGraphKey=(r=i.getModifierState)==null?void 0:r.call(i,"AltGraph"),this.keyCode=dx(i),this.code=i.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 i=0;return this.ctrlKey&&(i|=fx),this.altKey&&(i|=_x),this.shiftKey&&(i|=px),this.metaKey&&(i|=gx),i|=e,i}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new cx(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},R_=new WeakMap;function vx(t){if(!t.parent||t.parent===t)return null;try{let e=t.location,i=t.parent.location;if(e.origin!=="null"&&i.origin!=="null"&&e.origin!==i.origin)return null}catch{return null}return t.parent}var mx=class{static getSameOriginWindowChain(t){let e=R_.get(t);if(!e){e=[],R_.set(t,e);let i=t,r;do r=vx(i),r?e.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):e.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(t,e){if(!e||t===e)return{top:0,left:0};let i=0,r=0,s=this.getSameOriginWindowChain(t);for(let n of s){let o=n.window.deref();if(i+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===e||!n.iframeElement)break;let a=n.iframeElement.getBoundingClientRect();i+=a.top,r+=a.left}return{top:i,left:r}}},Go=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=i.button===0,this.middleButton=i.button===1,this.rightButton=i.button===2,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,i.type==="dblclick"&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,typeof i.pageX=="number"?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=mx.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},T_=class{constructor(e,i=0,r=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=i;let s=!1;if(Od){let o=navigator.userAgent.match(/Chrome\/(\d+)/);s=(o?parseInt(o[1]):123)<=122}if(e){let o=e,a=e,h=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")s?this.deltaY=o.wheelDeltaY/(120*h):this.deltaY=o.wheelDeltaY/120;else if(typeof a.VERTICAL_AXIS<"u"&&a.axis===a.VERTICAL_AXIS)this.deltaY=-a.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?Zc&&!Ti?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")tx&&Hm?this.deltaX=-(o.wheelDeltaX/120):s?this.deltaX=o.wheelDeltaX/(120*h):this.deltaX=o.wheelDeltaX/120;else if(typeof a.HORIZONTAL_AXIS<"u"&&a.axis===a.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?Zc&&!Ti?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Vm=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),yx;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof Sx?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ht.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Vm})})(yx||(yx={}));var Sx=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?Vm:(this._emitter||(this._emitter=new z),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},zd=class{constructor(e,i){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof i=="number"&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new Vc("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new Vc("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},wx=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,i,r=globalThis){if(this.isDisposed)throw new Vc("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=r.setInterval(()=>{e()},i);this.disposable=xe(()=>{r.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},xx;(t=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(xx||(xx={}));var P_=class Vt{static fromArray(e){return new Vt(i=>{i.emitMany(e)})}static fromPromise(e){return new Vt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new Vt(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new Vt(async i=>{await Promise.all(e.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new z,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await ht.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new Vt(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return Vt.map(this,e)}static filter(e,i){return new Vt(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return Vt.filter(this,e)}static coalesce(e){return Vt.filter(e,i=>!!i)}coalesce(){return Vt.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return Vt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};P_.EMPTY=P_.fromArray([]);var{getWindow:Li,getWindowId:Cx,onDidRegisterWindow:bx}=function(){let t=new Map,e={window:Ui,disposables:new kr};t.set(Ui.vscodeWindowId,e);let i=new z,r=new z,s=new z;function n(o,a){return(typeof o=="number"?t.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(t.has(o.vscodeWindowId))return ee.None;let a=new kr,h={window:o,disposables:a.add(new kr)};return t.set(o.vscodeWindowId,h),a.add(xe(()=>{t.delete(o.vscodeWindowId),r.fire(o)})),a.add(Y(o,qe.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(h),a},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var l;let a=o;if((l=a==null?void 0:a.ownerDocument)!=null&&l.defaultView)return a.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:Ui},getDocument(o){return Li(o).document}}}(),kx=class{constructor(e,i,r,s){this._node=e,this._type=i,this._handler=r,this._options=s||!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 Y(t,e,i,r){return new kx(t,e,i,r)}var D_=function(t,e,i,r){return Y(t,e,i,r)},Fd,Ex=class extends wx{constructor(t){super(),this.defaultTarget=t&&Li(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},B_=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ma(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let t=new Map,e=new Map,i=new Map,r=new Map,s=n=>{i.set(n,!1);let o=t.get(n)??[];for(e.set(n,o),t.set(n,[]),r.set(n,!0);o.length>0;)o.sort(B_.sort),o.shift().execute();r.set(n,!1)};Fd=(n,o,a=0)=>{let h=Cx(n),l=new B_(o,a),c=t.get(h);return c||(c=[],t.set(h,c)),c.push(l),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>s(h))),l}})();function Lx(t){let e=t.getBoundingClientRect(),i=Li(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var qe={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"},Mx=class{constructor(t){this.domNode=t,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(t){let e=Mt(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Mt(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Mt(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Mt(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Mt(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Mt(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Mt(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Mt(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Mt(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Mt(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Mt(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=Mt(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=Mt(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Mt(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Mt(t){return typeof t=="number"?`${t}px`:t}function Un(t){return new Mx(t)}var qm=class{constructor(){this._hooks=new kr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,r,s,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=n;let o=e;try{e.setPointerCapture(i),this._hooks.add(xe(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=Li(e)}this._hooks.add(Y(o,qe.POINTER_MOVE,a=>{if(a.buttons!==r){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(Y(o,qe.POINTER_UP,a=>this.stopMonitoring(!0)))}};function Rx(t,e,i){let r=null,s=null;if(typeof i.value=="function"?(r="value",s=i.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",s=i.get),!s)throw new Error("not supported");let n=`$memoize$${e}`;i[r]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var Ci;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(Ci||(Ci={}));var Mn=class pt extends ee{constructor(){super(),this.dispatched=!1,this.targets=new C_,this.ignoreTargets=new C_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ht.runAndSubscribe(bx,({window:e,disposables:i})=>{i.add(Y(e.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(Y(e.document,"touchend",r=>this.onTouchEnd(e,r))),i.add(Y(e.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:Ui,disposables:this._store}))}static addTarget(e){if(!pt.isTouchDevice())return ee.None;pt.INSTANCE||(pt.INSTANCE=new pt);let i=pt.INSTANCE.targets.push(e);return xe(i)}static ignoreTarget(e){if(!pt.isTouchDevice())return ee.None;pt.INSTANCE||(pt.INSTANCE=new pt);let i=pt.INSTANCE.ignoreTargets.push(e);return xe(i)}static isTouchDevice(){return"ontouchstart"in Ui||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=e.targetTouches.length;r<s;r++){let n=e.targetTouches.item(r);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(Ci.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,i){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let a=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let h=this.activeTouches[a.identifier],l=Date.now()-h.initialTimeStamp;if(l<pt.HOLD_DELAY&&Math.abs(h.initialPageX-$t(h.rollingPageX))<30&&Math.abs(h.initialPageY-$t(h.rollingPageY))<30){let c=this.newGestureEvent(Ci.Tap,h.initialTarget);c.pageX=$t(h.rollingPageX),c.pageY=$t(h.rollingPageY),this.dispatchEvent(c)}else if(l>=pt.HOLD_DELAY&&Math.abs(h.initialPageX-$t(h.rollingPageX))<30&&Math.abs(h.initialPageY-$t(h.rollingPageY))<30){let c=this.newGestureEvent(Ci.Contextmenu,h.initialTarget);c.pageX=$t(h.rollingPageX),c.pageY=$t(h.rollingPageY),this.dispatchEvent(c)}else if(s===1){let c=$t(h.rollingPageX),u=$t(h.rollingPageY),d=$t(h.rollingTimestamps)-h.rollingTimestamps[0],f=c-h.rollingPageX[0],p=u-h.rollingPageY[0],m=[...this.targets].filter(x=>h.initialTarget instanceof Node&&x.contains(h.initialTarget));this.inertia(e,m,r,Math.abs(f)/d,f>0?1:-1,c,Math.abs(p)/d,p>0?1:-1,u)}this.dispatchEvent(this.newGestureEvent(Ci.End,h.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(e){if(e.type===Ci.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>pt.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,e.tapCount=r}else(e.type===Ci.Change||e.type===Ci.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(e.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(e.initialTarget)){let s=0,n=e.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;i.push([s,r])}i.sort((r,s)=>r[0]-s[0]);for(let[r,s]of i)s.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,r,s,n,o,a,h,l){this.handle=Fd(e,()=>{let c=Date.now(),u=c-r,d=0,f=0,p=!0;s+=pt.SCROLL_FRICTION*u,a+=pt.SCROLL_FRICTION*u,s>0&&(p=!1,d=n*s*u),a>0&&(p=!1,f=h*a*u);let m=this.newGestureEvent(Ci.Change);m.translationX=d,m.translationY=f,i.forEach(x=>x.dispatchEvent(m)),p||this.inertia(e,i,c,s,n,o+d,a,h,l+f)})}onTouchMove(e){let i=Date.now();for(let r=0,s=e.changedTouches.length;r<s;r++){let n=e.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],a=this.newGestureEvent(Ci.Change,o.initialTarget);a.translationX=n.pageX-$t(o.rollingPageX),a.translationY=n.pageY-$t(o.rollingPageY),a.pageX=n.pageX,a.pageY=n.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};Mn.SCROLL_FRICTION=-.005,Mn.HOLD_DELAY=700,Mn.CLEAR_TAP_COUNT_TIME=400,Be([Rx],Mn,"isTouchDevice",1);var Tx=Mn,jd=class extends ee{onclick(e,i){this._register(Y(e,qe.CLICK,r=>i(new Go(Li(e),r))))}onmousedown(e,i){this._register(Y(e,qe.MOUSE_DOWN,r=>i(new Go(Li(e),r))))}onmouseover(e,i){this._register(Y(e,qe.MOUSE_OVER,r=>i(new Go(Li(e),r))))}onmouseleave(e,i){this._register(Y(e,qe.MOUSE_LEAVE,r=>i(new Go(Li(e),r))))}onkeydown(e,i){this._register(Y(e,qe.KEY_DOWN,r=>i(new M_(r))))}onkeyup(e,i){this._register(Y(e,qe.KEY_UP,r=>i(new M_(r))))}oninput(e,i){this._register(Y(e,qe.INPUT,i))}onblur(e,i){this._register(Y(e,qe.BLUR,i))}onfocus(e,i){this._register(Y(e,qe.FOCUS,i))}onchange(e,i){this._register(Y(e,qe.CHANGE,i))}ignoreGesture(e){return Tx.ignoreTarget(e)}},A_=11,Px=class extends jd{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=A_+"px",this.domNode.style.height=A_+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new qm),this._register(D_(this.bgDomNode,qe.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(D_(this.domNode,qe.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Ex),this._pointerdownScheduleRepeatTimer=this._register(new zd)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Li(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},Dx=class tu{constructor(e,i,r,s,n,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,s=s|0,n=n|0,o=o|0,a=a|0),this.rawScrollLeft=s,this.rawScrollTop=a,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,i){return new tu(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new tu(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let r=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,h=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:h}}},Bx=class extends ee{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new Dx(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){var r;let i=this._state.withScrollDimensions(t,e);this._setState(i,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let i=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;e?r=new $_(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(t);this._smoothScrolling=$_.start(this._state,i,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 t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let i=this._state;i.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(i,e)))}},N_=class{constructor(e,i,r){this.scrollLeft=e,this.scrollTop=i,this.isDone=r}};function vh(t,e){let i=e-t;return function(r){return t+i*$x(r)}}function Ax(t,e,i){return function(r){return r<i?t(r/i):e((r-i)/(1-i))}}var $_=class iu{constructor(e,i,r,s){this.from=e,this.to=i,this.duration=s,this.startTime=r,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(e,i,r){if(Math.abs(e-i)>2.5*r){let s,n;return e<i?(s=e+.75*r,n=i-.75*r):(s=e-.75*r,n=i+.75*r),Ax(vh(e,s),vh(n,i),.33)}return vh(e,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),s=this.scrollTop(i);return new N_(r,s,!1)}return new N_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,i,r){return iu.start(e,i,r)}static start(e,i,r){r=r+10;let s=Date.now()-10;return new iu(e,i,s,r)}};function Nx(t){return Math.pow(t,3)}function $x(t){return 1-Nx(1-t)}var Ox=class extends ee{constructor(e,i,r){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new zd)}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(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var i;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(i=this._domNode)==null||i.setClassName(this._invisibleClassName+(e?" fade":"")))}},Ix=140,Gm=class extends jd{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 Ox(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new qm),this._shouldRender=!0,this.domNode=Un(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(Y(this.domNode.domNode,qe.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new Px(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,r,s){this.slider=Un(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),typeof r=="number"&&this.slider.setWidth(r),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Y(this.slider.domNode,qe.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.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 i=this.domNode.domNode.getClientRects()[0].top,r=i+this._scrollbarState.getSliderPosition(),s=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);r<=n&&n<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")i=e.offsetX,r=e.offsetY;else{let n=Lx(this.domNode.domNode);i=e.pageX-n.left,r=e.pageY-n.top}let s=this._pointerDownRelativePosition(i,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),a=Math.abs(o-r);if(Hm&&a>Ix){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let h=this._sliderPointerPosition(n)-i;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(h))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Ym=class ru{constructor(e,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new ru(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,r,s,n){let o=Math.max(0,r-e),a=Math.max(0,o-2*i),h=s>0&&s>r;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(r*a/s))),c=(a-l)/(s-r),u=n*c;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:c,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let e=ru._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.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(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+e;return Math.round(i/this._computedSliderRatio)}},zx=class extends Gm{constructor(e,i,r){let s=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:r,scrollbarState:new Ym(i.horizontalHasArrows?i.arrowSize:0,i.horizontal===2?0:i.horizontalScrollbarSize,i.vertical===2?0:i.verticalScrollbarSize,s.width,s.scrollWidth,n.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),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,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}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}},Fx=class extends Gm{constructor(t,e,i){let r=t.getScrollDimensions(),s=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new Ym(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(t,e){this.slider.setHeight(t),this.slider.setTop(e)}_renderDomNode(t,e){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return e}_sliderPointerPosition(t){return t.pageY}_sliderOrthogonalPointerPosition(t){return t.pageX}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,e){t.scrollTop=e}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}},jx=500,O_=50,Wx=class{constructor(e,i,r){this.timestamp=e,this.deltaX=i,this.deltaY=r,this.score=0}},su=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,i=0,r=1,s=this._rear;do{let n=s===this._front?e:Math.pow(2,-r);if(e-=n,i+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(e){if(Od){let i=Li(e.browserEvent),r=Jw(i);this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,r){let s=null,n=new Wx(e,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(s=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]=n),n.score=this._computeScore(n,s)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(r+=.25),i){let s=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),a=Math.abs(i.deltaY),h=Math.max(Math.min(s,o),1),l=Math.max(Math.min(n,a),1),c=Math.max(s,o),u=Math.max(n,a);c%h===0&&u%l===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};su.INSTANCE=new su;var Hx=su,Ux=class extends jd{constructor(t,e,i){super(),this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new z),this.onWillScroll=this._onWillScroll.event,this._options=Vx(e),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Fx(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new zx(this._scrollable,this._options,r)),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(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Un(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Un(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Un(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new zd),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ss(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,Ti&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new T_(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=ss(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new T_(i))};this._mouseWheelToDispose.push(Y(this._listenOnDomNode,qe.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){var s;if((s=t.browserEvent)!=null&&s.defaultPrevented)return;let e=Hx.INSTANCE;e.acceptStandardWheelEvent(t);let i=!1;if(t.deltaY||t.deltaX){let n=t.deltaY*this._options.mouseWheelScrollSensitivity,o=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let a=!Ti&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=n,n=0),t.browserEvent&&t.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),l={};if(n){let c=O_*n,u=h.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(l,u)}if(o){let c=O_*o,u=h.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(l,u)}l=this._scrollable.validateScrollPosition(l),(h.scrollLeft!==l.scrollLeft||h.scrollTop!==l.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||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 t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,i=t.scrollLeft>0,r=i?" left":"",s=e?" top":"",n=i||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){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(),jx)}},Kx=class extends Ux{constructor(e,i,r){super(e,i,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Vx(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,Ti&&(e.className+=" mac"),e}var nu=class extends ee{constructor(e,i,r,s,n,o,a,h){super(),this._bufferService=r,this._optionsService=a,this._renderService=h,this._onRequestScrollLines=this._register(new z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new Bx({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Fd(s.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Kx(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ht.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(xe(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(xe(()=>this._styleElement.remove())),this._register(ht.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
76
76
|
`)})),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(c=>this._handleScroll(c)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.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 i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=i-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};nu=Be([H(2,Et),H(3,Zi),H(4,Rm),H(5,Js),H(6,Lt),H(7,Ji)],nu);var ou=class extends ee{constructor(e,i,r,s,n){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=r,this._decorationService=s,this._renderService=n,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(o=>this._removeDecoration(o))),this._register(xe(()=>{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){var s;let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.layer)==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,i=e.element){if(!i)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var i;(i=this._decorationElements.get(e))==null||i.remove(),this._decorationElements.delete(e),e.dispose()}};ou=Be([H(1,Et),H(2,Zi),H(3,Co),H(4,Ji)],ou);var qx=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 i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(i,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,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,r){return i>=e.startBufferLine-this._linePadding[r||"full"]&&i<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},Si={full:0,left:0,center:0,right:0},ir={full:0,left:0,center:0,right:0},_n={full:0,left:0,center:0,right:0},rl=class extends ee{constructor(e,i,r,s,n,o,a,h){var c;super(),this._viewportElement=e,this._screenElement=i,this._bufferService=r,this._decorationService=s,this._renderService=n,this._optionsService=o,this._themeService=a,this._coreBrowserService=h,this._colorZoneStore=new qx,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(xe(()=>{var u;return(u=this._canvas)==null?void 0:u.remove()}));let l=this._canvas.getContext("2d");if(l)this._ctx=l;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(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);ir.full=this._canvas.width,ir.left=e,ir.center=i,ir.right=e,this._refreshDrawHeightConstants(),_n.full=1,_n.left=1,_n.center=1+ir.left,_n.right=1+ir.left+ir.center}_refreshDrawHeightConstants(){Si.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Si.left=i,Si.center=i,Si.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Si.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 i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);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(_n[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Si[e.position||"full"]/2),ir[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Si[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};rl=Be([H(2,Et),H(3,Co),H(4,Ji),H(5,Lt),H(6,Js),H(7,Zi)],rl);var $;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
|
|
77
|
-
`,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))($||($={}));var wa;(t=>(t.PAD="",t.HOP="",t.BPH="",t.NBH="",t.IND="",t.NEL="
",t.SSA="",t.ESA="",t.HTS="",t.HTJ="",t.VTS="",t.PLD="",t.PLU="",t.RI="",t.SS2="",t.SS3="",t.DCS="",t.PU1="",t.PU2="",t.STS="",t.CCH="",t.MW="",t.SPA="",t.EPA="",t.SOS="",t.SGCI="",t.SCI="",t.CSI="",t.ST="",t.OSC="",t.PM="",t.APC=""))(wa||(wa={}));var Xm;(t=>t.ST=`${$.ESC}\\`)(Xm||(Xm={}));var au=class{constructor(e,i,r,s,n,o){this._textarea=e,this._compositionView=i,this._bufferService=r,this._optionsService=s,this._coreService=n,this._renderService=o,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 i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;i.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(i.start,this._compositionPosition.start):r=this._textarea.value.substring(i.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,r=i.replace(e,"");this._dataAlreadySent=r,i.length>e.length?this._coreService.triggerDataEvent(r,!0):i.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};au=Be([H(2,Et),H(3,Lt),H(4,ls),H(5,Ji)],au);var Ye=0,Xe=0,Qe=0,Te=0,I_={css:"#00000000",rgba:0},Ie;(t=>{function e(s,n,o,a){return a!==void 0?`#${Ar(s)}${Ar(n)}${Ar(o)}${Ar(a)}`:`#${Ar(s)}${Ar(n)}${Ar(o)}`}t.toCss=e;function i(s,n,o,a=255){return(s<<24|n<<16|o<<8|a)>>>0}t.toRgba=i;function r(s,n,o,a){return{css:t.toCss(s,n,o,a),rgba:t.toRgba(s,n,o,a)}}t.toColor=r})(Ie||(Ie={}));var ve;(t=>{function e(h,l){if(Te=(l.rgba&255)/255,Te===1)return{css:l.css,rgba:l.rgba};let c=l.rgba>>24&255,u=l.rgba>>16&255,d=l.rgba>>8&255,f=h.rgba>>24&255,p=h.rgba>>16&255,m=h.rgba>>8&255;Ye=f+Math.round((c-f)*Te),Xe=p+Math.round((u-p)*Te),Qe=m+Math.round((d-m)*Te);let x=Ie.toCss(Ye,Xe,Qe),_=Ie.toRgba(Ye,Xe,Qe);return{css:x,rgba:_}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function r(h,l,c){let u=xa.ensureContrastRatio(h.rgba,l.rgba,c);if(u)return Ie.toColor(u>>24&255,u>>16&255,u>>8&255)}t.ensureContrastRatio=r;function s(h){let l=(h.rgba|255)>>>0;return[Ye,Xe,Qe]=xa.toChannels(l),{css:Ie.toCss(Ye,Xe,Qe),rgba:l}}t.opaque=s;function n(h,l){return Te=Math.round(l*255),[Ye,Xe,Qe]=xa.toChannels(h.rgba),{css:Ie.toCss(Ye,Xe,Qe,Te),rgba:Ie.toRgba(Ye,Xe,Qe,Te)}}t.opacity=n;function o(h,l){return Te=h.rgba&255,n(h,Te*l/255)}t.multiplyOpacity=o;function a(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=a})(ve||(ve={}));var be;(t=>{let e,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Ye=parseInt(s.slice(1,2).repeat(2),16),Xe=parseInt(s.slice(2,3).repeat(2),16),Qe=parseInt(s.slice(3,4).repeat(2),16),Ie.toColor(Ye,Xe,Qe);case 5:return Ye=parseInt(s.slice(1,2).repeat(2),16),Xe=parseInt(s.slice(2,3).repeat(2),16),Qe=parseInt(s.slice(3,4).repeat(2),16),Te=parseInt(s.slice(4,5).repeat(2),16),Ie.toColor(Ye,Xe,Qe,Te);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Ye=parseInt(n[1]),Xe=parseInt(n[2]),Qe=parseInt(n[3]),Te=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ie.toColor(Ye,Xe,Qe,Te);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ye,Xe,Qe,Te]=e.getImageData(0,0,1,1).data,Te!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ie.toRgba(Ye,Xe,Qe,Te),css:s}}t.toColor=r})(be||(be={}));var yt;(t=>{function e(r){return i(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=e;function i(r,s,n){let o=r/255,a=s/255,h=n/255,l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),u=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return l*.2126+c*.7152+u*.0722}t.relativeLuminance2=i})(yt||(yt={}));var xa;(t=>{function e(o,a){if(Te=(a&255)/255,Te===1)return a;let h=a>>24&255,l=a>>16&255,c=a>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return Ye=u+Math.round((h-u)*Te),Xe=d+Math.round((l-d)*Te),Qe=f+Math.round((c-f)*Te),Ie.toRgba(Ye,Xe,Qe)}t.blend=e;function i(o,a,h){let l=yt.relativeLuminance(o>>8),c=yt.relativeLuminance(a>>8);if(Ni(l,c)<h){if(c<l){let f=r(o,a,h),p=Ni(l,yt.relativeLuminance(f>>8));if(p<h){let m=s(o,a,h),x=Ni(l,yt.relativeLuminance(m>>8));return p>x?f:m}return f}let u=s(o,a,h),d=Ni(l,yt.relativeLuminance(u>>8));if(d<h){let f=r(o,a,h),p=Ni(l,yt.relativeLuminance(f>>8));return d>p?u:f}return u}}t.ensureContrastRatio=i;function r(o,a,h){let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,m=Ni(yt.relativeLuminance2(d,f,p),yt.relativeLuminance2(l,c,u));for(;m<h&&(d>0||f>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m=Ni(yt.relativeLuminance2(d,f,p),yt.relativeLuminance2(l,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.reduceLuminance=r;function s(o,a,h){let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,m=Ni(yt.relativeLuminance2(d,f,p),yt.relativeLuminance2(l,c,u));for(;m<h&&(d<255||f<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=Ni(yt.relativeLuminance2(d,f,p),yt.relativeLuminance2(l,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(xa||(xa={}));function Ar(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Ni(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var Gx=class extends xo{constructor(e,i,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=r}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()]}},sl=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ri}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let i=[],r=e.translateToString(!0),s=0,n=0,o=0,a=e.getFg(0),h=e.getBg(0);for(let l=0;l<e.getTrimmedLength();l++)if(e.loadCell(l,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==h){if(l-s>1){let c=this._getJoinedRanges(r,o,n,e,s);for(let u=0;u<c.length;u++)i.push(c[u])}s=l,o=n,a=this._workCell.fg,h=this._workCell.bg}n+=this._workCell.getChars().length||pr.length}if(this._bufferService.cols-s>1){let l=this._getJoinedRanges(r,o,n,e,s);for(let c=0;c<l.length;c++)i.push(l[c])}return i}_getJoinedRanges(t,e,i,r,s){let n=t.substring(e,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let h=this._characterJoiners[a].handler(n);for(let l=0;l<h.length;l++)sl._mergeRanges(o,h[l])}catch(h){console.error(h)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(t,e,i){let r=0,s=!1,n=0,o=t[r];if(o){for(let a=i;a<this._bufferService.cols;a++){let h=e.getWidth(a),l=e.getString(a).length||pr.length;if(h!==0){if(!s&&o[0]<=n&&(o[0]=a,s=!0),o[1]<=n){if(o[1]=a,o=t[++r],!o)break;o[0]<=n?(o[0]=a,s=!0):s=!1}n+=l}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let i=!1;for(let r=0;r<t.length;r++){let s=t[r];if(i){if(e[1]<=s[0])return t[r-1][1]=e[1],t;if(e[1]<=s[1])return t[r-1][1]=Math.max(e[1],s[1]),t.splice(r,1),t;t.splice(r,1),r--}else{if(e[1]<=s[0])return t.splice(r,0,e),t;if(e[1]<=s[1])return s[0]=Math.min(e[0],s[0]),t;e[0]<s[1]&&(s[0]=Math.min(e[0],s[0]),i=!0);continue}}return i?t[t.length-1][1]=e[1]:t.push(e),t}};sl=Be([H(0,Et)],sl);function Yx(t){return 57508<=t&&t<=57558}function Xx(t){return 9472<=t&&t<=9631}function Qx(t){return Yx(t)||Xx(t)}function Zx(){return{css:{canvas:Yo(),cell:Yo()},device:{canvas:Yo(),cell:Yo(),char:{width:0,height:0,left:0,top:0}}}}function Yo(){return{width:0,height:0}}var lu=class{constructor(e,i,r,s,n,o,a){this._document=e,this._characterJoinerService=i,this._optionsService=r,this._coreBrowserService=s,this._coreService=n,this._decorationService=o,this._themeService=a,this._workCell=new ri,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,r){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=r}createRow(e,i,r,s,n,o,a,h,l,c,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(i),p=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<o+1&&(m=o+1);let x,_=0,g="",S=0,y=0,L=0,P=0,N=!1,B=0,U=!1,W=0,V=0,C=[],w=c!==-1&&u!==-1;for(let b=0;b<m;b++){e.loadCell(b,this._workCell);let k=this._workCell.getWidth();if(k===0)continue;let M=!1,T=b>=V,E=b,R=this._workCell;if(f.length>0&&b===f[0][0]&&T){let te=f.shift(),Dr=this._isCellInSelection(te[0],i);for(S=te[0]+1;S<te[1];S++)T&&(T=Dr===this._isCellInSelection(S,i));T&&(T=!r||o<te[0]||o>=te[1]),T?(M=!0,R=new Gx(this._workCell,e.translateToString(!0,te[0],te[1]),te[1]-te[0]),E=te[1]-1,k=R.getWidth()):V=te[1]}let D=this._isCellInSelection(b,i),j=r&&b===o,G=w&&b>=c&&b<=u,q=!1;this._decorationService.forEachDecorationAtCell(b,i,void 0,te=>{q=!0});let de=R.getChars()||pr;if(de===" "&&(R.isUnderline()||R.isOverline())&&(de=" "),W=k*h-l.get(de,R.isBold(),R.isItalic()),!x)x=this._document.createElement("span");else if(_&&(D&&U||!D&&!U&&R.bg===y)&&(D&&U&&p.selectionForeground||R.fg===L)&&R.extended.ext===P&&G===N&&W===B&&!j&&!M&&!q&&T){R.isInvisible()?g+=pr:g+=de,_++;continue}else _&&(x.textContent=g),x=this._document.createElement("span"),_=0,g="";if(y=R.bg,L=R.fg,P=R.extended.ext,N=G,B=W,U=D,M&&o>=b&&o<=E&&(o=b),!this._coreService.isCursorHidden&&j&&this._coreService.isCursorInitialized){if(C.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&C.push("xterm-cursor-blink"),C.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":C.push("xterm-cursor-outline");break;case"block":C.push("xterm-cursor-block");break;case"bar":C.push("xterm-cursor-bar");break;case"underline":C.push("xterm-cursor-underline");break}}if(R.isBold()&&C.push("xterm-bold"),R.isItalic()&&C.push("xterm-italic"),R.isDim()&&C.push("xterm-dim"),R.isInvisible()?g=pr:g=R.getChars()||pr,R.isUnderline()&&(C.push(`xterm-underline-${R.extended.underlineStyle}`),g===" "&&(g=" "),!R.isUnderlineColorDefault()))if(R.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${xo.toColorRGB(R.getUnderlineColor()).join(",")})`;else{let te=R.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&R.isBold()&&te<8&&(te+=8),x.style.textDecorationColor=p.ansi[te].css}R.isOverline()&&(C.push("xterm-overline"),g===" "&&(g=" ")),R.isStrikethrough()&&C.push("xterm-strikethrough"),G&&(x.style.textDecoration="underline");let Q=R.getFgColor(),le=R.getFgColorMode(),Z=R.getBgColor(),re=R.getBgColorMode(),fe=!!R.isInverse();if(fe){let te=Q;Q=Z,Z=te;let Dr=le;le=re,re=Dr}let rt,oi,Ut=!1;this._decorationService.forEachDecorationAtCell(b,i,void 0,te=>{te.options.layer!=="top"&&Ut||(te.backgroundColorRGB&&(re=50331648,Z=te.backgroundColorRGB.rgba>>8&16777215,rt=te.backgroundColorRGB),te.foregroundColorRGB&&(le=50331648,Q=te.foregroundColorRGB.rgba>>8&16777215,oi=te.foregroundColorRGB),Ut=te.options.layer==="top")}),!Ut&&D&&(rt=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Z=rt.rgba>>8&16777215,re=50331648,Ut=!0,p.selectionForeground&&(le=50331648,Q=p.selectionForeground.rgba>>8&16777215,oi=p.selectionForeground)),Ut&&C.push("xterm-decoration-top");let Nt;switch(re){case 16777216:case 33554432:Nt=p.ansi[Z],C.push(`xterm-bg-${Z}`);break;case 50331648:Nt=Ie.toColor(Z>>16,Z>>8&255,Z&255),this._addStyle(x,`background-color:#${z_((Z>>>0).toString(16),"0",6)}`);break;case 0:default:fe?(Nt=p.foreground,C.push("xterm-bg-257")):Nt=p.background}switch(rt||R.isDim()&&(rt=ve.multiplyOpacity(Nt,.5)),le){case 16777216:case 33554432:R.isBold()&&Q<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Q+=8),this._applyMinimumContrast(x,Nt,p.ansi[Q],R,rt,void 0)||C.push(`xterm-fg-${Q}`);break;case 50331648:let te=Ie.toColor(Q>>16&255,Q>>8&255,Q&255);this._applyMinimumContrast(x,Nt,te,R,rt,oi)||this._addStyle(x,`color:#${z_(Q.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(x,Nt,p.foreground,R,rt,oi)||fe&&C.push("xterm-fg-257")}C.length&&(x.className=C.join(" "),C.length=0),!j&&!M&&!q&&T?_++:x.textContent=g,W!==this.defaultSpacing&&(x.style.letterSpacing=`${W}px`),d.push(x),b=E}return x&&_&&(x.textContent=g),d}_applyMinimumContrast(e,i,r,s,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Qx(s.getCode()))return!1;let a=this._getContrastCache(s),h;if(!n&&!o&&(h=a.getColor(i.rgba,r.rgba)),h===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);h=ve.ensureContrastRatio(n||i,o||r,l),a.setColor((n||i).rgba,(o||r).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let r=this._selectionStart,s=this._selectionEnd;return!r||!s?!1:this._columnSelectMode?r[0]<=s[0]?e>=r[0]&&i>=r[1]&&e<s[0]&&i<=s[1]:e<r[0]&&i>=r[1]&&e>=s[0]&&i<=s[1]:i>r[1]&&i<s[1]||r[1]===s[1]&&i===r[1]&&e>=r[0]&&e<s[0]||r[1]<s[1]&&i===s[1]&&e<s[0]||r[1]<s[1]&&i===r[1]&&e>=r[0]}};lu=Be([H(1,Dm),H(2,Lt),H(3,Zi),H(4,ls),H(5,Co),H(6,Js)],lu);function z_(t,e,i){for(;t.length<i;)t=e+t;return t}var Jx=class{constructor(e,i){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 r=e.createElement("span");r.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,s,n,o],this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),this._container.appendChild(o),i.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,i,r,s){e===this._font&&i===this._fontSize&&r===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=i,this._weight=r,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,i,r){let s=0;if(!i&&!r&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let a=this._measure(e,0);return a>0&&(this._flat[s]=a),a}let n=e;i&&(n+="B"),r&&(n+="I");let o=this._holey.get(n);if(o===void 0){let a=0;i&&(a|=1),r&&(a|=2),o=this._measure(e,a),o>0&&this._holey.set(n,o)}return o}_measure(e,i){let r=this._measureElements[i];return r.textContent=e.repeat(32),r.offsetWidth/32}},eC=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,i,r,s=!1){if(this.selectionStart=i,this.selectionEnd=r,!i||!r||i[0]===r[0]&&i[1]===r[1]){this.clear();return}let n=e.buffers.active.ydisp,o=i[1]-n,a=r[1]-n,h=Math.max(o,0),l=Math.min(a,e.rows-1);if(h>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=a,this.viewportCappedStartRow=h,this.viewportCappedEndRow=l,this.startCol=i[0],this.endCol=r[0]}isCellSelected(e,i,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&r>=this.viewportCappedStartRow&&i<this.endCol&&r<=this.viewportCappedEndRow:i<this.startCol&&r>=this.viewportCappedStartRow&&i>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol):!1}};function tC(){return new eC}var mh="xterm-dom-renderer-owner-",Kt="xterm-rows",Xo="xterm-fg-",F_="xterm-bg-",pn="xterm-focus",Qo="xterm-selection",iC=1,hu=class extends ee{constructor(e,i,r,s,n,o,a,h,l,c,u,d,f,p){super(),this._terminal=e,this._document=i,this._element=r,this._screenElement=s,this._viewportElement=n,this._helperContainer=o,this._linkifier2=a,this._charSizeService=l,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=iC++,this._rowElements=[],this._selectionRenderModel=tC(),this.onRequestRedraw=this._register(new z).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Kt),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(Qo),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Zx(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(lu,document),this._element.classList.add(mh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(xe(()=>{this._element.classList.remove(mh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Jx(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 r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${Kt} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,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 i=`${this._terminalSelector} .${Kt} { 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}`;i+=`${this._terminalSelector} .${Kt} .xterm-dim { color: ${ve.multiplyOpacity(e.foreground,.5).css};}`,i+=`${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 r=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${s} { 50% { box-shadow: none; }}`,i+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${Kt}.${pn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Kt}.${pn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Kt}.${pn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${Qo} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Qo} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Qo} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,a]of e.ansi.entries())i+=`${this._terminalSelector} .${Xo}${o} { color: ${a.css}; }${this._terminalSelector} .${Xo}${o}.xterm-dim { color: ${ve.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${F_}${o} { background-color: ${a.css}; }`;i+=`${this._terminalSelector} .${Xo}257 { color: ${ve.opaque(e.background).css}; }${this._terminalSelector} .${Xo}257.xterm-dim { color: ${ve.multiplyOpacity(ve.opaque(e.background),.5).css}; }${this._terminalSelector} .${F_}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_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,i){for(let r=this._rowElements.length;r<=i;r++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(pn),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(pn),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(r){let l=e[0]>i[0];h.appendChild(this._createSelectionElement(o,l?i[0]:e[0],l?e[0]:i[0],a-o+1))}else{let l=s===o?e[0]:0,c=o===n?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(o,l,c));let u=a-o-1;if(h.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,u)),o!==a){let d=n===a?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(a,0,d))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,i,r,s=1){let n=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(r-i);return o+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-o),n.style.height=`${s*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${a}px`,n}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,i){let r=this._bufferService.buffer,s=r.ybase+r.y,n=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=i;l++){let c=l+r.ydisp,u=this._rowElements[l],d=r.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===s,a,h,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${mh}${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,i,r,s,n,o){r<0&&(e=0),s<0&&(i=0);let a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),s=Math.max(Math.min(s,a),0),n=Math.min(n,this._bufferService.cols);let h=this._bufferService.buffer,l=h.ybase+h.y,c=Math.min(h.x,n-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=r;p<=s;++p){let m=p+h.ydisp,x=this._rowElements[p],_=h.lines.get(m);if(!x||!_)break;x.replaceChildren(...this._rowFactory.createRow(_,m,m===l,d,f,c,u,this.dimensions.css.cell.width,this._widthCache,o?p===r?e:0:-1,o?(p===s?i:n)-1:-1))}}};hu=Be([H(7,Ad),H(8,Rl),H(9,Lt),H(10,Et),H(11,ls),H(12,Zi),H(13,Js)],hu);var cu=class extends ee{constructor(e,i,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new z),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new sC(this._optionsService))}catch{this._measureStrategy=this._register(new rC(e,i,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())}};cu=Be([H(2,Lt)],cu);var Qm=class extends ee{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},rC=class extends Qm{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},sC=class extends Qm{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))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}},nC=class extends ee{constructor(e,i,r){super(),this._textarea=e,this._window=i,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new oC(this._window)),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new z),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(ht.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Y(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Y(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}},oC=class extends ee{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ys),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(xe(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Y(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},aC=class extends ee{constructor(){super(),this.linkProviders=[],this._register(xe(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function Wd(t,e,i){let r=i.getBoundingClientRect(),s=t.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[e.clientX-r.left-n,e.clientY-r.top-o]}function lC(t,e,i,r,s,n,o,a,h){if(!n)return;let l=Wd(t,e,i);if(l)return l[0]=Math.ceil((l[0]+(h?o/2:0))/o),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),r+(h?1:0)),l[1]=Math.min(Math.max(l[1],1),s),l}var uu=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,r,s,n){return lC(window,e,i,r,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,i){let r=Wd(window,e,i);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};uu=Be([H(0,Ji),H(1,Rl)],uu);var hC=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,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,i,r){this._rowCount=r,e=e!==void 0?e:0,i=i!==void 0?i: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,i):i,!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),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Zm={};yw(Zm,{getSafariVersion:()=>uC,isChromeOS:()=>i0,isFirefox:()=>Jm,isIpad:()=>dC,isIphone:()=>fC,isLegacyEdge:()=>cC,isLinux:()=>Hd,isMac:()=>nl,isNode:()=>Tl,isSafari:()=>e0,isWindows:()=>t0});var Tl=typeof process<"u"&&"title"in process,bo=Tl?"node":navigator.userAgent,ko=Tl?"node":navigator.platform,Jm=bo.includes("Firefox"),cC=bo.includes("Edge"),e0=/^((?!chrome|android).)*safari/i.test(bo);function uC(){if(!e0)return 0;let t=bo.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var nl=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ko),dC=ko==="iPad",fC=ko==="iPhone",t0=["Windows","Win16","Win32","WinCE"].includes(ko),Hd=ko.indexOf("Linux")>=0,i0=/\bCrOS\b/.test(bo),r0=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,r=t.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),s=t.timeRemaining(),i*1.5>s){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=s}this.clear()}},_C=class extends r0{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},pC=class extends r0{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},ol=!Tl&&"requestIdleCallback"in window?pC:_C,gC=class{constructor(){this._queue=new ol}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},du=class extends ee{constructor(e,i,r,s,n,o,a,h,l){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=s,this._coreService=n,this._coreBrowserService=h,this._renderer=this._register(new Ys),this._pausedResizeTask=new gC,this._observerDisposable=this._register(new Ys),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 z),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new z),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new z),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new hC((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new vC(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(xe(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=xe(()=>r.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,i,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),i=Math.max(i,s.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),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:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,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(i=>this.refreshRows(i.start,i.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(){var e,i;this._renderer.value&&((i=(e=this._renderer.value).clearTextureAtlas)==null||i.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,i)}):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,i,r){var s;this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,(s=this._renderer.value)==null||s.handleSelectionChanged(e,i,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};du=Be([H(2,Lt),H(3,Rl),H(4,ls),H(5,Co),H(6,Et),H(7,Zi),H(8,Js)],du);var vC=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,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 t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function mC(t,e,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return wC(s,n,t,e,i,r)+Pl(n,e,i,r)+xC(s,n,t,e,i,r);let o;if(n===e)return o=s>t?"D":"C",uo(Math.abs(s-t),co(o,r));o=n>e?"D":"C";let a=Math.abs(n-e),h=SC(n>e?t:s,i)+(a-1)*i.cols+1+yC(n>e?s:t);return uo(h,co(o,r))}function yC(t,e){return t-1}function SC(t,e){return e.cols-t}function wC(t,e,i,r,s,n){return Pl(e,r,s,n).length===0?"":uo(n0(t,e,t,e-ns(e,s),!1,s).length,co("D",n))}function Pl(t,e,i,r){let s=t-ns(t,i),n=e-ns(e,i),o=Math.abs(s-n)-CC(t,e,i);return uo(o,co(s0(t,e),r))}function xC(t,e,i,r,s,n){let o;Pl(e,r,s,n).length>0?o=r-ns(r,s):o=e;let a=r,h=bC(t,e,i,r,s,n);return uo(n0(t,o,i,a,h==="C",s).length,co(h,n))}function CC(t,e,i){var o;let r=0,s=t-ns(t,i),n=e-ns(e,i);for(let a=0;a<Math.abs(s-n);a++){let h=s0(t,e)==="A"?-1:1;(o=i.buffer.lines.get(s+h*a))!=null&&o.isWrapped&&r++}return r}function ns(t,e){let i=0,r=e.buffer.lines.get(t),s=r==null?void 0:r.isWrapped;for(;s&&t>=0&&t<e.rows;)i++,r=e.buffer.lines.get(--t),s=r==null?void 0:r.isWrapped;return i}function bC(t,e,i,r,s,n){let o;return Pl(i,r,s,n).length>0?o=r-ns(r,s):o=e,t<i&&o<=r||t>=i&&o<r?"C":"D"}function s0(t,e){return t>e?"A":"B"}function n0(t,e,i,r,s,n){let o=t,a=e,h="";for(;(o!==i||a!==r)&&a>=0&&a<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(a,!1,t,o),o=0,t=0,a++):!s&&o<0&&(h+=n.buffer.translateBufferLineToString(a,!1,0,t+1),o=n.cols-1,t=o,a--);return h+n.buffer.translateBufferLineToString(a,!1,t,o)}function co(t,e){let i=e?"O":"[";return $.ESC+i+t}function uo(t,e){t=Math.floor(t);let i="";for(let r=0;r<t;r++)i+=e;return i}var kC=class{constructor(t){this._bufferService=t,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 t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function j_(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var yh=50,EC=15,LC=50,MC=500,RC=" ",TC=new RegExp(RC,"g"),fu=class extends ee{constructor(e,i,r,s,n,o,a,h,l){super(),this._element=e,this._screenElement=i,this._linkifier=r,this._bufferService=s,this._coreService=n,this._mouseService=o,this._optionsService=a,this._renderService=h,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ri,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new z),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new z),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new kC(this._bufferService),this._activeSelectionMode=0,this._register(xe(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let n=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let a=e[1];a<=i[1];a++){let h=r.translateBufferLineToString(a,!0,n,o);s.push(h)}}else{let n=e[1]===i[1]?i[0]:void 0;s.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let o=e[1]+1;o<=i[1]-1;o++){let a=r.lines.get(o),h=r.translateBufferLineToString(o,!0);a!=null&&a.isWrapped?s[s.length-1]+=h:s.push(h)}if(e[1]!==i[1]){let o=r.lines.get(i[1]),a=r.translateBufferLineToString(i[1],!0,0,i[0]);o&&o.isWrapped?s[s.length-1]+=a:s.push(a)}}return s.map(n=>n.replace(TC," ")).join(t0?`\r
|
|
77
|
+
`,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))($||($={}));var wa;(t=>(t.PAD="",t.HOP="",t.BPH="",t.NBH="",t.IND="",t.NEL="
",t.SSA="",t.ESA="",t.HTS="",t.HTJ="",t.VTS="",t.PLD="",t.PLU="",t.RI="",t.SS2="",t.SS3="",t.DCS="",t.PU1="",t.PU2="",t.STS="",t.CCH="",t.MW="",t.SPA="",t.EPA="",t.SOS="",t.SGCI="",t.SCI="",t.CSI="",t.ST="",t.OSC="",t.PM="",t.APC=""))(wa||(wa={}));var Xm;(t=>t.ST=`${$.ESC}\\`)(Xm||(Xm={}));var au=class{constructor(e,i,r,s,n,o){this._textarea=e,this._compositionView=i,this._bufferService=r,this._optionsService=s,this._coreService=n,this._renderService=o,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 i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;i.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(i.start,this._compositionPosition.start):r=this._textarea.value.substring(i.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,r=i.replace(e,"");this._dataAlreadySent=r,i.length>e.length?this._coreService.triggerDataEvent(r,!0):i.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};au=Be([H(2,Et),H(3,Lt),H(4,ls),H(5,Ji)],au);var Ye=0,Xe=0,Qe=0,Te=0,I_={css:"#00000000",rgba:0},Ie;(t=>{function e(s,n,o,a){return a!==void 0?`#${Ar(s)}${Ar(n)}${Ar(o)}${Ar(a)}`:`#${Ar(s)}${Ar(n)}${Ar(o)}`}t.toCss=e;function i(s,n,o,a=255){return(s<<24|n<<16|o<<8|a)>>>0}t.toRgba=i;function r(s,n,o,a){return{css:t.toCss(s,n,o,a),rgba:t.toRgba(s,n,o,a)}}t.toColor=r})(Ie||(Ie={}));var me;(t=>{function e(h,l){if(Te=(l.rgba&255)/255,Te===1)return{css:l.css,rgba:l.rgba};let c=l.rgba>>24&255,u=l.rgba>>16&255,d=l.rgba>>8&255,f=h.rgba>>24&255,p=h.rgba>>16&255,m=h.rgba>>8&255;Ye=f+Math.round((c-f)*Te),Xe=p+Math.round((u-p)*Te),Qe=m+Math.round((d-m)*Te);let x=Ie.toCss(Ye,Xe,Qe),_=Ie.toRgba(Ye,Xe,Qe);return{css:x,rgba:_}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function r(h,l,c){let u=xa.ensureContrastRatio(h.rgba,l.rgba,c);if(u)return Ie.toColor(u>>24&255,u>>16&255,u>>8&255)}t.ensureContrastRatio=r;function s(h){let l=(h.rgba|255)>>>0;return[Ye,Xe,Qe]=xa.toChannels(l),{css:Ie.toCss(Ye,Xe,Qe),rgba:l}}t.opaque=s;function n(h,l){return Te=Math.round(l*255),[Ye,Xe,Qe]=xa.toChannels(h.rgba),{css:Ie.toCss(Ye,Xe,Qe,Te),rgba:Ie.toRgba(Ye,Xe,Qe,Te)}}t.opacity=n;function o(h,l){return Te=h.rgba&255,n(h,Te*l/255)}t.multiplyOpacity=o;function a(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=a})(me||(me={}));var be;(t=>{let e,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Ye=parseInt(s.slice(1,2).repeat(2),16),Xe=parseInt(s.slice(2,3).repeat(2),16),Qe=parseInt(s.slice(3,4).repeat(2),16),Ie.toColor(Ye,Xe,Qe);case 5:return Ye=parseInt(s.slice(1,2).repeat(2),16),Xe=parseInt(s.slice(2,3).repeat(2),16),Qe=parseInt(s.slice(3,4).repeat(2),16),Te=parseInt(s.slice(4,5).repeat(2),16),Ie.toColor(Ye,Xe,Qe,Te);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Ye=parseInt(n[1]),Xe=parseInt(n[2]),Qe=parseInt(n[3]),Te=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ie.toColor(Ye,Xe,Qe,Te);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ye,Xe,Qe,Te]=e.getImageData(0,0,1,1).data,Te!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ie.toRgba(Ye,Xe,Qe,Te),css:s}}t.toColor=r})(be||(be={}));var yt;(t=>{function e(r){return i(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=e;function i(r,s,n){let o=r/255,a=s/255,h=n/255,l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),u=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return l*.2126+c*.7152+u*.0722}t.relativeLuminance2=i})(yt||(yt={}));var xa;(t=>{function e(o,a){if(Te=(a&255)/255,Te===1)return a;let h=a>>24&255,l=a>>16&255,c=a>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return Ye=u+Math.round((h-u)*Te),Xe=d+Math.round((l-d)*Te),Qe=f+Math.round((c-f)*Te),Ie.toRgba(Ye,Xe,Qe)}t.blend=e;function i(o,a,h){let l=yt.relativeLuminance(o>>8),c=yt.relativeLuminance(a>>8);if(Ni(l,c)<h){if(c<l){let f=r(o,a,h),p=Ni(l,yt.relativeLuminance(f>>8));if(p<h){let m=s(o,a,h),x=Ni(l,yt.relativeLuminance(m>>8));return p>x?f:m}return f}let u=s(o,a,h),d=Ni(l,yt.relativeLuminance(u>>8));if(d<h){let f=r(o,a,h),p=Ni(l,yt.relativeLuminance(f>>8));return d>p?u:f}return u}}t.ensureContrastRatio=i;function r(o,a,h){let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,m=Ni(yt.relativeLuminance2(d,f,p),yt.relativeLuminance2(l,c,u));for(;m<h&&(d>0||f>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m=Ni(yt.relativeLuminance2(d,f,p),yt.relativeLuminance2(l,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.reduceLuminance=r;function s(o,a,h){let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,m=Ni(yt.relativeLuminance2(d,f,p),yt.relativeLuminance2(l,c,u));for(;m<h&&(d<255||f<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=Ni(yt.relativeLuminance2(d,f,p),yt.relativeLuminance2(l,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(xa||(xa={}));function Ar(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Ni(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var Gx=class extends xo{constructor(e,i,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=r}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()]}},sl=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ri}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let i=[],r=e.translateToString(!0),s=0,n=0,o=0,a=e.getFg(0),h=e.getBg(0);for(let l=0;l<e.getTrimmedLength();l++)if(e.loadCell(l,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==h){if(l-s>1){let c=this._getJoinedRanges(r,o,n,e,s);for(let u=0;u<c.length;u++)i.push(c[u])}s=l,o=n,a=this._workCell.fg,h=this._workCell.bg}n+=this._workCell.getChars().length||pr.length}if(this._bufferService.cols-s>1){let l=this._getJoinedRanges(r,o,n,e,s);for(let c=0;c<l.length;c++)i.push(l[c])}return i}_getJoinedRanges(t,e,i,r,s){let n=t.substring(e,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let h=this._characterJoiners[a].handler(n);for(let l=0;l<h.length;l++)sl._mergeRanges(o,h[l])}catch(h){console.error(h)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(t,e,i){let r=0,s=!1,n=0,o=t[r];if(o){for(let a=i;a<this._bufferService.cols;a++){let h=e.getWidth(a),l=e.getString(a).length||pr.length;if(h!==0){if(!s&&o[0]<=n&&(o[0]=a,s=!0),o[1]<=n){if(o[1]=a,o=t[++r],!o)break;o[0]<=n?(o[0]=a,s=!0):s=!1}n+=l}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let i=!1;for(let r=0;r<t.length;r++){let s=t[r];if(i){if(e[1]<=s[0])return t[r-1][1]=e[1],t;if(e[1]<=s[1])return t[r-1][1]=Math.max(e[1],s[1]),t.splice(r,1),t;t.splice(r,1),r--}else{if(e[1]<=s[0])return t.splice(r,0,e),t;if(e[1]<=s[1])return s[0]=Math.min(e[0],s[0]),t;e[0]<s[1]&&(s[0]=Math.min(e[0],s[0]),i=!0);continue}}return i?t[t.length-1][1]=e[1]:t.push(e),t}};sl=Be([H(0,Et)],sl);function Yx(t){return 57508<=t&&t<=57558}function Xx(t){return 9472<=t&&t<=9631}function Qx(t){return Yx(t)||Xx(t)}function Zx(){return{css:{canvas:Yo(),cell:Yo()},device:{canvas:Yo(),cell:Yo(),char:{width:0,height:0,left:0,top:0}}}}function Yo(){return{width:0,height:0}}var lu=class{constructor(e,i,r,s,n,o,a){this._document=e,this._characterJoinerService=i,this._optionsService=r,this._coreBrowserService=s,this._coreService=n,this._decorationService=o,this._themeService=a,this._workCell=new ri,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,r){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=r}createRow(e,i,r,s,n,o,a,h,l,c,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(i),p=this._themeService.colors,m=e.getNoBgTrimmedLength();r&&m<o+1&&(m=o+1);let x,_=0,g="",S=0,y=0,L=0,P=0,N=!1,B=0,U=!1,W=0,V=0,C=[],w=c!==-1&&u!==-1;for(let b=0;b<m;b++){e.loadCell(b,this._workCell);let k=this._workCell.getWidth();if(k===0)continue;let M=!1,T=b>=V,E=b,R=this._workCell;if(f.length>0&&b===f[0][0]&&T){let te=f.shift(),Dr=this._isCellInSelection(te[0],i);for(S=te[0]+1;S<te[1];S++)T&&(T=Dr===this._isCellInSelection(S,i));T&&(T=!r||o<te[0]||o>=te[1]),T?(M=!0,R=new Gx(this._workCell,e.translateToString(!0,te[0],te[1]),te[1]-te[0]),E=te[1]-1,k=R.getWidth()):V=te[1]}let D=this._isCellInSelection(b,i),j=r&&b===o,G=w&&b>=c&&b<=u,q=!1;this._decorationService.forEachDecorationAtCell(b,i,void 0,te=>{q=!0});let fe=R.getChars()||pr;if(fe===" "&&(R.isUnderline()||R.isOverline())&&(fe=" "),W=k*h-l.get(fe,R.isBold(),R.isItalic()),!x)x=this._document.createElement("span");else if(_&&(D&&U||!D&&!U&&R.bg===y)&&(D&&U&&p.selectionForeground||R.fg===L)&&R.extended.ext===P&&G===N&&W===B&&!j&&!M&&!q&&T){R.isInvisible()?g+=pr:g+=fe,_++;continue}else _&&(x.textContent=g),x=this._document.createElement("span"),_=0,g="";if(y=R.bg,L=R.fg,P=R.extended.ext,N=G,B=W,U=D,M&&o>=b&&o<=E&&(o=b),!this._coreService.isCursorHidden&&j&&this._coreService.isCursorInitialized){if(C.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&C.push("xterm-cursor-blink"),C.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":C.push("xterm-cursor-outline");break;case"block":C.push("xterm-cursor-block");break;case"bar":C.push("xterm-cursor-bar");break;case"underline":C.push("xterm-cursor-underline");break}}if(R.isBold()&&C.push("xterm-bold"),R.isItalic()&&C.push("xterm-italic"),R.isDim()&&C.push("xterm-dim"),R.isInvisible()?g=pr:g=R.getChars()||pr,R.isUnderline()&&(C.push(`xterm-underline-${R.extended.underlineStyle}`),g===" "&&(g=" "),!R.isUnderlineColorDefault()))if(R.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${xo.toColorRGB(R.getUnderlineColor()).join(",")})`;else{let te=R.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&R.isBold()&&te<8&&(te+=8),x.style.textDecorationColor=p.ansi[te].css}R.isOverline()&&(C.push("xterm-overline"),g===" "&&(g=" ")),R.isStrikethrough()&&C.push("xterm-strikethrough"),G&&(x.style.textDecoration="underline");let Q=R.getFgColor(),le=R.getFgColorMode(),Z=R.getBgColor(),re=R.getBgColorMode(),_e=!!R.isInverse();if(_e){let te=Q;Q=Z,Z=te;let Dr=le;le=re,re=Dr}let rt,oi,Ut=!1;this._decorationService.forEachDecorationAtCell(b,i,void 0,te=>{te.options.layer!=="top"&&Ut||(te.backgroundColorRGB&&(re=50331648,Z=te.backgroundColorRGB.rgba>>8&16777215,rt=te.backgroundColorRGB),te.foregroundColorRGB&&(le=50331648,Q=te.foregroundColorRGB.rgba>>8&16777215,oi=te.foregroundColorRGB),Ut=te.options.layer==="top")}),!Ut&&D&&(rt=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,Z=rt.rgba>>8&16777215,re=50331648,Ut=!0,p.selectionForeground&&(le=50331648,Q=p.selectionForeground.rgba>>8&16777215,oi=p.selectionForeground)),Ut&&C.push("xterm-decoration-top");let Nt;switch(re){case 16777216:case 33554432:Nt=p.ansi[Z],C.push(`xterm-bg-${Z}`);break;case 50331648:Nt=Ie.toColor(Z>>16,Z>>8&255,Z&255),this._addStyle(x,`background-color:#${z_((Z>>>0).toString(16),"0",6)}`);break;case 0:default:_e?(Nt=p.foreground,C.push("xterm-bg-257")):Nt=p.background}switch(rt||R.isDim()&&(rt=me.multiplyOpacity(Nt,.5)),le){case 16777216:case 33554432:R.isBold()&&Q<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Q+=8),this._applyMinimumContrast(x,Nt,p.ansi[Q],R,rt,void 0)||C.push(`xterm-fg-${Q}`);break;case 50331648:let te=Ie.toColor(Q>>16&255,Q>>8&255,Q&255);this._applyMinimumContrast(x,Nt,te,R,rt,oi)||this._addStyle(x,`color:#${z_(Q.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(x,Nt,p.foreground,R,rt,oi)||_e&&C.push("xterm-fg-257")}C.length&&(x.className=C.join(" "),C.length=0),!j&&!M&&!q&&T?_++:x.textContent=g,W!==this.defaultSpacing&&(x.style.letterSpacing=`${W}px`),d.push(x),b=E}return x&&_&&(x.textContent=g),d}_applyMinimumContrast(e,i,r,s,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Qx(s.getCode()))return!1;let a=this._getContrastCache(s),h;if(!n&&!o&&(h=a.getColor(i.rgba,r.rgba)),h===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);h=me.ensureContrastRatio(n||i,o||r,l),a.setColor((n||i).rgba,(o||r).rgba,h??null)}return h?(this._addStyle(e,`color:${h.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let r=this._selectionStart,s=this._selectionEnd;return!r||!s?!1:this._columnSelectMode?r[0]<=s[0]?e>=r[0]&&i>=r[1]&&e<s[0]&&i<=s[1]:e<r[0]&&i>=r[1]&&e>=s[0]&&i<=s[1]:i>r[1]&&i<s[1]||r[1]===s[1]&&i===r[1]&&e>=r[0]&&e<s[0]||r[1]<s[1]&&i===s[1]&&e<s[0]||r[1]<s[1]&&i===r[1]&&e>=r[0]}};lu=Be([H(1,Dm),H(2,Lt),H(3,Zi),H(4,ls),H(5,Co),H(6,Js)],lu);function z_(t,e,i){for(;t.length<i;)t=e+t;return t}var Jx=class{constructor(e,i){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 r=e.createElement("span");r.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[r,s,n,o],this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),this._container.appendChild(o),i.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,i,r,s){e===this._font&&i===this._fontSize&&r===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=i,this._weight=r,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,i,r){let s=0;if(!i&&!r&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let a=this._measure(e,0);return a>0&&(this._flat[s]=a),a}let n=e;i&&(n+="B"),r&&(n+="I");let o=this._holey.get(n);if(o===void 0){let a=0;i&&(a|=1),r&&(a|=2),o=this._measure(e,a),o>0&&this._holey.set(n,o)}return o}_measure(e,i){let r=this._measureElements[i];return r.textContent=e.repeat(32),r.offsetWidth/32}},eC=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,i,r,s=!1){if(this.selectionStart=i,this.selectionEnd=r,!i||!r||i[0]===r[0]&&i[1]===r[1]){this.clear();return}let n=e.buffers.active.ydisp,o=i[1]-n,a=r[1]-n,h=Math.max(o,0),l=Math.min(a,e.rows-1);if(h>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=o,this.viewportEndRow=a,this.viewportCappedStartRow=h,this.viewportCappedEndRow=l,this.startCol=i[0],this.endCol=r[0]}isCellSelected(e,i,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&r>=this.viewportCappedStartRow&&i<this.endCol&&r<=this.viewportCappedEndRow:i<this.startCol&&r>=this.viewportCappedStartRow&&i>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&i>=this.startCol):!1}};function tC(){return new eC}var mh="xterm-dom-renderer-owner-",Kt="xterm-rows",Xo="xterm-fg-",F_="xterm-bg-",pn="xterm-focus",Qo="xterm-selection",iC=1,hu=class extends ee{constructor(e,i,r,s,n,o,a,h,l,c,u,d,f,p){super(),this._terminal=e,this._document=i,this._element=r,this._screenElement=s,this._viewportElement=n,this._helperContainer=o,this._linkifier2=a,this._charSizeService=l,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=iC++,this._rowElements=[],this._selectionRenderModel=tC(),this.onRequestRedraw=this._register(new z).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Kt),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(Qo),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Zx(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(m=>this._injectCss(m))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(lu,document),this._element.classList.add(mh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(m=>this._handleLinkHover(m))),this._register(this._linkifier2.onHideLinkUnderline(m=>this._handleLinkLeave(m))),this._register(xe(()=>{this._element.classList.remove(mh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Jx(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 r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${Kt} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,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 i=`${this._terminalSelector} .${Kt} { 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}`;i+=`${this._terminalSelector} .${Kt} .xterm-dim { color: ${me.multiplyOpacity(e.foreground,.5).css};}`,i+=`${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 r=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;i+=`@keyframes ${r} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${s} { 50% { box-shadow: none; }}`,i+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${Kt}.${pn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Kt}.${pn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Kt}.${pn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Kt} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${Qo} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Qo} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Qo} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,a]of e.ansi.entries())i+=`${this._terminalSelector} .${Xo}${o} { color: ${a.css}; }${this._terminalSelector} .${Xo}${o}.xterm-dim { color: ${me.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${F_}${o} { background-color: ${a.css}; }`;i+=`${this._terminalSelector} .${Xo}257 { color: ${me.opaque(e.background).css}; }${this._terminalSelector} .${Xo}257.xterm-dim { color: ${me.multiplyOpacity(me.opaque(e.background),.5).css}; }${this._terminalSelector} .${F_}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_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,i){for(let r=this._rowElements.length;r<=i;r++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(pn),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(pn),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,r),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,r),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(r){let l=e[0]>i[0];h.appendChild(this._createSelectionElement(o,l?i[0]:e[0],l?e[0]:i[0],a-o+1))}else{let l=s===o?e[0]:0,c=o===n?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(o,l,c));let u=a-o-1;if(h.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,u)),o!==a){let d=n===a?i[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(a,0,d))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,i,r,s=1){let n=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(r-i);return o+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-o),n.style.height=`${s*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${a}px`,n}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,i){let r=this._bufferService.buffer,s=r.ybase+r.y,n=Math.min(r.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=i;l++){let c=l+r.ydisp,u=this._rowElements[l],d=r.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===s,a,h,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${mh}${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,i,r,s,n,o){r<0&&(e=0),s<0&&(i=0);let a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),s=Math.max(Math.min(s,a),0),n=Math.min(n,this._bufferService.cols);let h=this._bufferService.buffer,l=h.ybase+h.y,c=Math.min(h.x,n-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=r;p<=s;++p){let m=p+h.ydisp,x=this._rowElements[p],_=h.lines.get(m);if(!x||!_)break;x.replaceChildren(...this._rowFactory.createRow(_,m,m===l,d,f,c,u,this.dimensions.css.cell.width,this._widthCache,o?p===r?e:0:-1,o?(p===s?i:n)-1:-1))}}};hu=Be([H(7,Ad),H(8,Rl),H(9,Lt),H(10,Et),H(11,ls),H(12,Zi),H(13,Js)],hu);var cu=class extends ee{constructor(e,i,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new z),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new sC(this._optionsService))}catch{this._measureStrategy=this._register(new rC(e,i,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())}};cu=Be([H(2,Lt)],cu);var Qm=class extends ee{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},rC=class extends Qm{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},sC=class extends Qm{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))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}},nC=class extends ee{constructor(e,i,r){super(),this._textarea=e,this._window=i,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new oC(this._window)),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new z),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(ht.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Y(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Y(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}},oC=class extends ee{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ys),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(xe(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Y(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},aC=class extends ee{constructor(){super(),this.linkProviders=[],this._register(xe(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function Wd(t,e,i){let r=i.getBoundingClientRect(),s=t.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[e.clientX-r.left-n,e.clientY-r.top-o]}function lC(t,e,i,r,s,n,o,a,h){if(!n)return;let l=Wd(t,e,i);if(l)return l[0]=Math.ceil((l[0]+(h?o/2:0))/o),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),r+(h?1:0)),l[1]=Math.min(Math.max(l[1],1),s),l}var uu=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,r,s,n){return lC(window,e,i,r,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,i){let r=Wd(window,e,i);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};uu=Be([H(0,Ji),H(1,Rl)],uu);var hC=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,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,i,r){this._rowCount=r,e=e!==void 0?e:0,i=i!==void 0?i: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,i):i,!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),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},Zm={};yw(Zm,{getSafariVersion:()=>uC,isChromeOS:()=>i0,isFirefox:()=>Jm,isIpad:()=>dC,isIphone:()=>fC,isLegacyEdge:()=>cC,isLinux:()=>Hd,isMac:()=>nl,isNode:()=>Tl,isSafari:()=>e0,isWindows:()=>t0});var Tl=typeof process<"u"&&"title"in process,bo=Tl?"node":navigator.userAgent,ko=Tl?"node":navigator.platform,Jm=bo.includes("Firefox"),cC=bo.includes("Edge"),e0=/^((?!chrome|android).)*safari/i.test(bo);function uC(){if(!e0)return 0;let t=bo.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var nl=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(ko),dC=ko==="iPad",fC=ko==="iPhone",t0=["Windows","Win16","Win32","WinCE"].includes(ko),Hd=ko.indexOf("Linux")>=0,i0=/\bCrOS\b/.test(bo),r0=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,r=t.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),s=t.timeRemaining(),i*1.5>s){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=s}this.clear()}},_C=class extends r0{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},pC=class extends r0{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},ol=!Tl&&"requestIdleCallback"in window?pC:_C,gC=class{constructor(){this._queue=new ol}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},du=class extends ee{constructor(e,i,r,s,n,o,a,h,l){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=s,this._coreService=n,this._coreBrowserService=h,this._renderer=this._register(new Ys),this._pausedResizeTask=new gC,this._observerDisposable=this._register(new Ys),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 z),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new z),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new z),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new hC((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new vC(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(xe(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});r.observe(i),this._observerDisposable.value=xe(()=>r.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,i,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),i=Math.max(i,s.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),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:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,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(i=>this.refreshRows(i.start,i.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(){var e,i;this._renderer.value&&((i=(e=this._renderer.value).clearTextureAtlas)==null||i.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,i)}):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,i,r){var s;this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=r,(s=this._renderer.value)==null||s.handleSelectionChanged(e,i,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};du=Be([H(2,Lt),H(3,Rl),H(4,ls),H(5,Co),H(6,Et),H(7,Zi),H(8,Js)],du);var vC=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,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 t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function mC(t,e,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return wC(s,n,t,e,i,r)+Pl(n,e,i,r)+xC(s,n,t,e,i,r);let o;if(n===e)return o=s>t?"D":"C",uo(Math.abs(s-t),co(o,r));o=n>e?"D":"C";let a=Math.abs(n-e),h=SC(n>e?t:s,i)+(a-1)*i.cols+1+yC(n>e?s:t);return uo(h,co(o,r))}function yC(t,e){return t-1}function SC(t,e){return e.cols-t}function wC(t,e,i,r,s,n){return Pl(e,r,s,n).length===0?"":uo(n0(t,e,t,e-ns(e,s),!1,s).length,co("D",n))}function Pl(t,e,i,r){let s=t-ns(t,i),n=e-ns(e,i),o=Math.abs(s-n)-CC(t,e,i);return uo(o,co(s0(t,e),r))}function xC(t,e,i,r,s,n){let o;Pl(e,r,s,n).length>0?o=r-ns(r,s):o=e;let a=r,h=bC(t,e,i,r,s,n);return uo(n0(t,o,i,a,h==="C",s).length,co(h,n))}function CC(t,e,i){var o;let r=0,s=t-ns(t,i),n=e-ns(e,i);for(let a=0;a<Math.abs(s-n);a++){let h=s0(t,e)==="A"?-1:1;(o=i.buffer.lines.get(s+h*a))!=null&&o.isWrapped&&r++}return r}function ns(t,e){let i=0,r=e.buffer.lines.get(t),s=r==null?void 0:r.isWrapped;for(;s&&t>=0&&t<e.rows;)i++,r=e.buffer.lines.get(--t),s=r==null?void 0:r.isWrapped;return i}function bC(t,e,i,r,s,n){let o;return Pl(i,r,s,n).length>0?o=r-ns(r,s):o=e,t<i&&o<=r||t>=i&&o<r?"C":"D"}function s0(t,e){return t>e?"A":"B"}function n0(t,e,i,r,s,n){let o=t,a=e,h="";for(;(o!==i||a!==r)&&a>=0&&a<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(a,!1,t,o),o=0,t=0,a++):!s&&o<0&&(h+=n.buffer.translateBufferLineToString(a,!1,0,t+1),o=n.cols-1,t=o,a--);return h+n.buffer.translateBufferLineToString(a,!1,t,o)}function co(t,e){let i=e?"O":"[";return $.ESC+i+t}function uo(t,e){t=Math.floor(t);let i="";for(let r=0;r<t;r++)i+=e;return i}var kC=class{constructor(t){this._bufferService=t,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 t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function j_(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var yh=50,EC=15,LC=50,MC=500,RC=" ",TC=new RegExp(RC,"g"),fu=class extends ee{constructor(e,i,r,s,n,o,a,h,l){super(),this._element=e,this._screenElement=i,this._linkifier=r,this._bufferService=s,this._coreService=n,this._mouseService=o,this._optionsService=a,this._renderService=h,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ri,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new z),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new z),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new kC(this._bufferService),this._activeSelectionMode=0,this._register(xe(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let r=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let n=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let a=e[1];a<=i[1];a++){let h=r.translateBufferLineToString(a,!0,n,o);s.push(h)}}else{let n=e[1]===i[1]?i[0]:void 0;s.push(r.translateBufferLineToString(e[1],!0,e[0],n));for(let o=e[1]+1;o<=i[1]-1;o++){let a=r.lines.get(o),h=r.translateBufferLineToString(o,!0);a!=null&&a.isWrapped?s[s.length-1]+=h:s.push(h)}if(e[1]!==i[1]){let o=r.lines.get(i[1]),a=r.translateBufferLineToString(i[1],!0,0,i[0]);o&&o.isWrapped?s[s.length-1]+=a:s.push(a)}}return s.map(n=>n.replace(TC," ")).join(t0?`\r
|
|
78
78
|
`:`
|
|
79
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Hd&&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 i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s||!i?!1:this._areCoordsInSelection(i,r,s)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s?!1:this._areCoordsInSelection([e,i],r,s)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]<r[1]||i[1]===r[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<r[0]||i[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||i[1]<r[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){var n,o;let r=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=j_(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Wd(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),i=Math.min(Math.max(i,-yh),yh),i/=yh,i/Math.abs(i)+Math.round(i*(EC-1)))}shouldForceSelection(e){return nl?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(),LC)}_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 i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(nl&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=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 r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let s=r.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!i||i[0]!==this._model.selectionEnd[0]||i[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 i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<MC&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let s=mC(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,r=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,i,r);return}!e||!i||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||i[0]!==this._oldSelectionEnd[0]||i[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,i,r)}_fireOnSelectionChange(e,i,r){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(i=>this._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let s=0;i>=s;s++){let n=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:n>1&&i!==s&&(r+=n-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let a=n.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(o,e[0]),l=h,c=e[0]-h,u=0,d=0,f=0,p=0;if(a.charAt(h)===" "){for(;h>0&&a.charAt(h-1)===" ";)h--;for(;l<a.length&&a.charAt(l+1)===" ";)l++}else{let _=e[0],g=e[0];o.getWidth(_)===0&&(u++,_--),o.getWidth(g)===2&&(d++,g++);let S=o.getString(g).length;for(S>1&&(p+=S-1,l+=S-1);_>0&&h>0&&!this._isCharWordSeparator(o.loadCell(_-1,this._workCell));){o.loadCell(_-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,_--):y>1&&(f+=y-1,h-=y-1),h--,_--}for(;g<o.length&&l+1<a.length&&!this._isCharWordSeparator(o.loadCell(g+1,this._workCell));){o.loadCell(g+1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,g++):y>1&&(p+=y-1,l+=y-1),l++,g++}}l++;let m=h+c-u+f,x=Math.min(this._bufferService.cols,l-h+u+d-f-p);if(!(!i&&a.slice(h,l).trim()==="")){if(r&&m===0&&o.getCodePoint(0)!==32){let _=n.lines.get(e[1]-1);if(_&&o.isWrapped&&_.getCodePoint(this._bufferService.cols-1)!==32){let g=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(g){let S=this._bufferService.cols-g.start;m-=S,x+=S}}}if(s&&m+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let _=n.lines.get(e[1]+1);if(_!=null&&_.isWrapped&&_.getCodePoint(0)!==32){let g=this._getWordAt([0,e[1]+1],!1,!1,!0);g&&(x+=g.length)}}return{start:m,length:x}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=j_(r,this._bufferService.cols)}};fu=Be([H(3,Et),H(4,ls),H(5,Nd),H(6,Lt),H(7,Ji),H(8,Zi)],fu);var W_=class{constructor(){this._data={}}set(e,i,r){this._data[e]||(this._data[e]={}),this._data[e][i]=r}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},H_=class{constructor(){this._color=new W_,this._css=new W_}setCss(e,i,r){this._css.set(e,i,r)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,r){this._color.set(e,i,r)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},je=Object.freeze((()=>{let t=[be.toColor("#2e3436"),be.toColor("#cc0000"),be.toColor("#4e9a06"),be.toColor("#c4a000"),be.toColor("#3465a4"),be.toColor("#75507b"),be.toColor("#06989a"),be.toColor("#d3d7cf"),be.toColor("#555753"),be.toColor("#ef2929"),be.toColor("#8ae234"),be.toColor("#fce94f"),be.toColor("#729fcf"),be.toColor("#ad7fa8"),be.toColor("#34e2e2"),be.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=e[i/36%6|0],s=e[i/6%6|0],n=e[i%6];t.push({css:Ie.toCss(r,s,n),rgba:Ie.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;t.push({css:Ie.toCss(r,r,r),rgba:Ie.toRgba(r,r,r)})}return t})()),Ir=be.toColor("#ffffff"),Rn=be.toColor("#000000"),U_=be.toColor("#ffffff"),K_=Rn,gn={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},PC=Ir,_u=class extends ee{constructor(e){super(),this._optionsService=e,this._contrastCache=new H_,this._halfContrastCache=new H_,this._onChangeColors=this._register(new z),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ir,background:Rn,cursor:U_,cursorAccent:K_,selectionForeground:void 0,selectionBackgroundTransparent:gn,selectionBackgroundOpaque:ve.blend(Rn,gn),selectionInactiveBackgroundTransparent:gn,selectionInactiveBackgroundOpaque:ve.blend(Rn,gn),scrollbarSliderBackground:ve.opacity(Ir,.2),scrollbarSliderHoverBackground:ve.opacity(Ir,.4),scrollbarSliderActiveBackground:ve.opacity(Ir,.5),overviewRulerBorder:Ir,ansi:je.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 i=this._colors;if(i.foreground=ce(e.foreground,Ir),i.background=ce(e.background,Rn),i.cursor=ve.blend(i.background,ce(e.cursor,U_)),i.cursorAccent=ve.blend(i.background,ce(e.cursorAccent,K_)),i.selectionBackgroundTransparent=ce(e.selectionBackground,gn),i.selectionBackgroundOpaque=ve.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=ce(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=ve.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?ce(e.selectionForeground,I_):void 0,i.selectionForeground===I_&&(i.selectionForeground=void 0),ve.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=ve.opacity(i.selectionBackgroundTransparent,.3)),ve.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=ve.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=ce(e.scrollbarSliderBackground,ve.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=ce(e.scrollbarSliderHoverBackground,ve.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=ce(e.scrollbarSliderActiveBackground,ve.opacity(i.foreground,.5)),i.overviewRulerBorder=ce(e.overviewRulerBorder,PC),i.ansi=je.slice(),i.ansi[0]=ce(e.black,je[0]),i.ansi[1]=ce(e.red,je[1]),i.ansi[2]=ce(e.green,je[2]),i.ansi[3]=ce(e.yellow,je[3]),i.ansi[4]=ce(e.blue,je[4]),i.ansi[5]=ce(e.magenta,je[5]),i.ansi[6]=ce(e.cyan,je[6]),i.ansi[7]=ce(e.white,je[7]),i.ansi[8]=ce(e.brightBlack,je[8]),i.ansi[9]=ce(e.brightRed,je[9]),i.ansi[10]=ce(e.brightGreen,je[10]),i.ansi[11]=ce(e.brightYellow,je[11]),i.ansi[12]=ce(e.brightBlue,je[12]),i.ansi[13]=ce(e.brightMagenta,je[13]),i.ansi[14]=ce(e.brightCyan,je[14]),i.ansi[15]=ce(e.brightWhite,je[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<r;s++)i.ansi[s+16]=ce(e.extendedAnsi[s],je[s+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 i=0;i<this._restoreColors.ansi.length;++i)this._colors.ansi[i]=this._restoreColors.ansi[i];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()}}};_u=Be([H(0,Lt)],_u);function ce(t,e){if(t!==void 0)try{return be.toColor(t)}catch{}return e}var DC=class{constructor(...e){this._entries=new Map;for(let[i,r]of e)this.set(i,r)}set(e,i){let r=this._entries.get(e);return this._entries.set(e,i),r}forEach(e){for(let[i,r]of this._entries.entries())e(i,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},BC=class{constructor(){this._services=new DC,this._services.set(Ad,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=Ew(t).sort((n,o)=>n.index-o.index),r=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=i.length>0?i[0].index:e.length;if(e.length!==s)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${s+1} conflicts with ${e.length} static arguments`);return new t(...e,...r)}},AC={trace:0,debug:1,info:2,warn:3,error:4,off:5},NC="xterm.js: ",pu=class extends ee{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=AC[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":NC)+i,...r)}trace(e,...i){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,i)}};pu=Be([H(0,Lt)],pu);var V_=class extends ee{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new z),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new z),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new z),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 i=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)i[r]=this._array[this._getCyclicIndex(r)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}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,i,...r){if(i){for(let s=e;s<this._length-i;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+r.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<r.length;s++)this._array[this._getCyclicIndex(e+s)]=r[s];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let s=this._length+r.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,r){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let n=i-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let s=e+i+r-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<i;s++)this.set(e+s+r,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},J=3,$e=Object.freeze(new xo),Zo=0,Sh=2,Tn=class o0{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*J);let s=i||ri.fromCharData([0,km,1,0]);for(let n=0;n<e;++n)this.setCell(n,s);this.length=e}get(e){let i=this._data[e*J+0],r=i&2097151;return[this._data[e*J+1],i&2097152?this._combined[e]:r?cr(r):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[e*J+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*J+0]=e|2097152|i[2]<<22):this._data[e*J+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*J+0]>>22}hasWidth(e){return this._data[e*J+0]&12582912}getFg(e){return this._data[e*J+1]}getBg(e){return this._data[e*J+2]}hasContent(e){return this._data[e*J+0]&4194303}getCodePoint(e){let i=this._data[e*J+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*J+0]&2097152}getString(e){let i=this._data[e*J+0];return i&2097152?this._combined[e]:i&2097151?cr(i&2097151):""}isProtected(e){return this._data[e*J+2]&536870912}loadCell(e,i){return Zo=e*J,i.content=this._data[Zo+0],i.fg=this._data[Zo+1],i.bg=this._data[Zo+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*J+0]=i.content,this._data[e*J+1]=i.fg,this._data[e*J+2]=i.bg}setCellFromCodepoint(e,i,r,s){s.bg&268435456&&(this._extendedAttrs[e]=s.extended),this._data[e*J+0]=i|r<<22,this._data[e*J+1]=s.fg,this._data[e*J+2]=s.bg}addCodepointToCell(e,i,r){let s=this._data[e*J+0];s&2097152?this._combined[e]+=cr(i):s&2097151?(this._combined[e]=cr(s&2097151)+cr(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[e*J+0]=s}insertCells(e,i,r){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length-e){let s=new ri;for(let n=this.length-e-i-1;n>=0;--n)this.setCell(e+i+n,this.loadCell(e+n,s));for(let n=0;n<i;++n)this.setCell(e+n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,i,r){if(e%=this.length,i<this.length-e){let s=new ri;for(let n=0;n<this.length-e-i;++n)this.setCell(e+n,this.loadCell(e+i+n,s));for(let n=this.length-i;n<this.length;++n)this.setCell(n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,i,r,s=!1){if(s){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.setCell(e++,r)}resize(e,i){if(e===this.length)return this._data.length*4*Sh<this._data.buffer.byteLength;let r=e*J;if(e>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=e&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=e&&delete this._extendedAttrs[a]}}return this.length=e,r*4*Sh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Sh<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new o0(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*J+0]&4194303)return e+(this._data[e*J+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*J+0]&4194303||this._data[e*J+2]&50331648)return e+(this._data[e*J+0]>>22);return 0}copyCellsFrom(e,i,r,s,n){let o=e._data;if(n)for(let h=s-1;h>=0;h--){for(let l=0;l<J;l++)this._data[(r+h)*J+l]=o[(i+h)*J+l];o[(i+h)*J+2]&268435456&&(this._extendedAttrs[r+h]=e._extendedAttrs[i+h])}else for(let h=0;h<s;h++){for(let l=0;l<J;l++)this._data[(r+h)*J+l]=o[(i+h)*J+l];o[(i+h)*J+2]&268435456&&(this._extendedAttrs[r+h]=e._extendedAttrs[i+h])}let a=Object.keys(e._combined);for(let h=0;h<a.length;h++){let l=parseInt(a[h],10);l>=i&&(this._combined[l-i+r]=e._combined[l])}}translateToString(e,i,r,s){i=i??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let o=this._data[i*J+0],a=o&2097151,h=o&2097152?this._combined[i]:a?cr(a):pr;if(n+=h,s)for(let l=0;l<h.length;++l)s.push(i);i+=o>>22||1}return s&&s.push(i),n}};function $C(t,e,i,r,s,n){let o=[];for(let a=0;a<t.length-1;a++){let h=a,l=t.get(++h);if(!l.isWrapped)continue;let c=[t.get(a)];for(;h<t.length&&l.isWrapped;)c.push(l),l=t.get(++h);if(!n&&r>=a&&r<h){a+=c.length-1;continue}let u=0,d=fo(c,u,e),f=1,p=0;for(;f<c.length;){let x=fo(c,f,e),_=x-p,g=i-d,S=Math.min(_,g);c[u].copyCellsFrom(c[f],p,d,S,!1),d+=S,d===i&&(u++,d=0),p+=S,p===x&&(f++,p=0),d===0&&u!==0&&c[u-1].getWidth(i-1)===2&&(c[u].copyCellsFrom(c[u-1],i-1,d++,1,!1),c[u-1].setCell(i-1,s))}c[u].replaceCells(d,i,s);let m=0;for(let x=c.length-1;x>0&&(x>u||c[x].getTrimmedLength()===0);x--)m++;m>0&&(o.push(a+c.length-m),o.push(m)),a+=c.length-1}return o}function OC(t,e){let i=[],r=0,s=e[r],n=0;for(let o=0;o<t.length;o++)if(s===o){let a=e[++r];t.onDeleteEmitter.fire({index:o-n,amount:a}),o+=a-1,n+=a,s=e[++r]}else i.push(o);return{layout:i,countRemoved:n}}function IC(t,e){let i=[];for(let r=0;r<e.length;r++)i.push(t.get(e[r]));for(let r=0;r<i.length;r++)t.set(r,i[r]);t.length=e.length}function zC(t,e,i){let r=[],s=t.map((h,l)=>fo(t,l,e)).reduce((h,l)=>h+l),n=0,o=0,a=0;for(;a<s;){if(s-a<i){r.push(s-a);break}n+=i;let h=fo(t,o,e);n>h&&(n-=h,o++);let l=t[o].getWidth(n-1)===2;l&&n--;let c=l?i-1:i;r.push(c),a+=c}return r}function fo(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let r=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,s=t[e+1].getWidth(0)===2;return r&&s?i-1:i}var a0=class l0{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=l0._nextId++,this._onDispose=this.register(new z),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ss(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};a0._nextId=1;var FC=a0,Ke={},zr=Ke.B;Ke[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ke.A={"#":"£"};Ke.B=void 0;Ke[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ke.C=Ke[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ke.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ke.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ke.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ke.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ke.E=Ke[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ke.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ke.H=Ke[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ke["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var q_=4294967295,G_=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=$e.clone(),this.savedCharset=zr,this.markers=[],this._nullCell=ri.fromCharData([0,km,1,0]),this._whitespaceCell=ri.fromCharData([0,pr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ol,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new V_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new il),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new il),this._whitespaceCell}getBlankLine(t,e){return new Tn(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>q_?q_:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=$e);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new V_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell($e),r=0,s=this._getCorrectBufferLength(e);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<t)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(t,i);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Tn(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Tn(t,i)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=$C(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell($e),i);if(r.length>0){let s=OC(this.lines,r);IC(this.lines,s.layout),this._reflowLargerAdjustViewport(t,e,s.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let r=this.getNullCell($e),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new Tn(t,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell($e),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=t)continue;let h=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),h.unshift(a);if(!i){let S=this.ybase+this.y;if(S>=o&&S<o+h.length)continue}let l=h[h.length-1].getTrimmedLength(),c=zC(h,this._cols,t),u=c.length-h.length,d;this.ybase===0&&this.y!==this.lines.length-1?d=Math.max(0,this.y-this.lines.maxLength+u):d=Math.max(0,this.lines.length-this.lines.maxLength+u);let f=[];for(let S=0;S<u;S++){let y=this.getBlankLine($e,!0);f.push(y)}f.length>0&&(s.push({start:o+h.length+n,newLines:f}),n+=f.length),h.push(...f);let p=c.length-1,m=c[p];m===0&&(p--,m=c[p]);let x=h.length-u-1,_=l;for(;x>=0;){let S=Math.min(_,m);if(h[p]===void 0)break;if(h[p].copyCellsFrom(h[x],_-S,m-S,S,!0),m-=S,m===0&&(p--,m=c[p]),_-=S,_===0){x--;let y=Math.max(x,0);_=fo(h,y,this._cols)}}for(let S=0;S<h.length;S++)c[S]<t&&h[S].setCell(c[S],r);let g=u-d;for(;g-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+e-1)}if(s.length>0){let o=[],a=[];for(let m=0;m<this.lines.length;m++)a.push(this.lines.get(m));let h=this.lines.length,l=h-1,c=0,u=s[c];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let d=0;for(let m=Math.min(this.lines.maxLength-1,h+n-1);m>=0;m--)if(u&&u.start>l+d){for(let x=u.newLines.length-1;x>=0;x--)this.lines.set(m--,u.newLines[x]);m++,o.push({index:l+1,amount:u.newLines.length}),d+=u.newLines.length,u=s[++c]}else this.lines.set(m,a[l--]);let f=0;for(let m=o.length-1;m>=0;m--)o[m].index+=f,this.lines.onInsertEmitter.fire(o[m]),f+=o[m].amount;let p=Math.max(0,h+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(t,e,i=0,r){let s=this.lines.get(t);return s?s.translateToString(e,i,r):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new FC(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},jC=class extends ee{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new z),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 G_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new G_(!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,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},h0=2,c0=1,gu=class extends ee{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,h0),this.rows=Math.max(t.rawOptions.rows||0,c0),this.buffers=this._register(new jC(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,r=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==t.fg||r.getBg(0)!==t.bg)&&(r=i.getBlankLine(t,e),this._cachedBlankLine=r),r.isWrapped=e;let s=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(n+1,0,r.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-s+1;i.lines.shiftElements(s+1,o-1,-1),i.lines.set(n,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),r!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};gu=Be([H(0,Lt)],gu);var fs={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:nl,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},WC=["normal","bold","100","200","300","400","500","600","700","800","900"],HC=class extends ee{constructor(e){super(),this._onOptionChange=this._register(new z),this.onOptionChange=this._onOptionChange.event;let i={...fs};for(let r in e)if(r in i)try{let s=e[r];i[r]=this._sanitizeAndValidateOption(r,s)}catch(s){console.error(s)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(xe(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&i()})}_setupOptions(){let e=r=>{if(!(r in fs))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},i=(r,s)=>{if(!(r in fs))throw new Error(`No option with key "${r}"`);s=this._sanitizeAndValidateOption(r,s),this.rawOptions[r]!==s&&(this.rawOptions[r]=s,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=fs[e]),!UC(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=fs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=WC.includes(i)?i:fs[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function UC(t){return t==="block"||t==="underline"||t==="bar"}function Pn(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let r in t)i[r]=e<=1?t[r]:t[r]&&Pn(t[r],e-1);return i}var Y_=Object.freeze({insertMode:!1}),X_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),vu=class extends ee{constructor(e,i,r){super(),this._bufferService=e,this._logService=i,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new z),this.onData=this._onData.event,this._onUserInput=this._register(new z),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new z),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Pn(Y_),this.decPrivateModes=Pn(X_)}reset(){this.modes=Pn(Y_),this.decPrivateModes=Pn(X_)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};vu=Be([H(0,Et),H(1,Tm),H(2,Lt)],vu);var Q_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function wh(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var xh=String.fromCharCode,Z_={DEFAULT:t=>{let e=[wh(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${xh(e[0])}${xh(e[1])}${xh(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${wh(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${wh(t,!0)};${t.x};${t.y}${e}`}},mu=class extends ee{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new z),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Q_))this.addProtocol(r,Q_[r]);for(let r of Object.keys(Z_))this.addEncoding(r,Z_[r]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let r=e/i,s=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(t.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};mu=Be([H(0,Et),H(1,ls),H(2,Lt)],mu);var Ch=[[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]],KC=[[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]],We;function VC(t,e){let i=0,r=e.length-1,s;if(t<e[0][0]||t>e[r][1])return!1;for(;r>=i;)if(s=i+r>>1,t>e[s][1])i=s+1;else if(t<e[s][0])r=s-1;else return!0;return!1}var qC=class{constructor(){if(this.version="6",!We){We=new Uint8Array(65536),We.fill(1),We[0]=0,We.fill(0,1,32),We.fill(0,127,160),We.fill(2,4352,4448),We[9001]=2,We[9002]=2,We.fill(2,11904,42192),We[12351]=1,We.fill(2,44032,55204),We.fill(2,63744,64256),We.fill(2,65040,65050),We.fill(2,65072,65136),We.fill(2,65280,65377),We.fill(2,65504,65511);for(let e=0;e<Ch.length;++e)We.fill(0,Ch[e][0],Ch[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?We[e]:VC(e,KC)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let r=this.wcwidth(e),s=r===0&&i!==0;if(s){let n=Hr.extractWidth(i);n===0?s=!1:n>r&&(r=n)}return Hr.createPropertyValue(0,r,s)}},Hr=class Ca{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new z,this.onChange=this._onChange.event;let e=new qC;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,r=!1){return(e&16777215)<<3|(i&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,r=0,s=e.length;for(let n=0;n<s;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let l=e.charCodeAt(n);56320<=l&&l<=57343?o=(o-55296)*1024+l-56320+65536:i+=this.wcwidth(l)}let a=this.charProperties(o,r),h=Ca.extractWidth(a);Ca.extractShouldJoin(a)&&(h-=Ca.extractWidth(r)),i+=h,r=a}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},GC=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,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function J_(t){var r;let e=(r=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1))==null?void 0:r.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var vn=2147483647,YC=256,u0=class yu{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>YC)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new yu;if(!e.length)return i;for(let r=Array.isArray(e[0])?1:0;r<e.length;++r){let s=e[r];if(Array.isArray(s))for(let n=0;n<s.length;++n)i.addSubParam(s[n]);else i.addParam(s)}return i}clone(){let e=new yu(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>vn?vn:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>vn?vn:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,r=this._subParamsIdx[e]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&(e[i]=this._subParams.slice(r,s))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(s*10+e,vn):e}},mn=[],XC=class{constructor(){this._state=0,this._active=mn,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let s=r.indexOf(i);s!==-1&&r.splice(s,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=mn}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=mn,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||mn,!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,i,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Ml(e,i,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r)}start(){this.reset(),this._state=1}put(e,i,r){if(this._state!==3){if(this._state===1)for(;i<r;){let s=e[i++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&r-i>0&&this._put(e,i,r)}}end(e,i=!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 r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].end(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=mn,this._id=-1,this._state=0}}},Ot=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=Ml(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data),i instanceof Promise))return i.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,i}},yn=[],QC=class{constructor(){this._handlers=Object.create(null),this._active=yn,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=yn}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let s=r.indexOf(i);s!==-1&&r.splice(s,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=yn,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||yn,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(i)}put(e,i,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ml(e,i,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].unhook(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=yn,this._ident=0}},Dn=new u0;Dn.addParam(0);var ep=class{constructor(t){this._handler=t,this._data="",this._params=Dn,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Dn,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Ml(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=Dn,this._data="",this._hitLimit=!1,i));return this._params=Dn,this._data="",this._hitLimit=!1,e}},ZC=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,r,s){this.table[i<<8|e]=r<<4|s}addMany(e,i,r,s){for(let n=0;n<e.length;n++)this.table[i<<8|e[n]]=r<<4|s}},Qt=160,JC=function(){let t=new ZC(4095),e=Array.apply(null,Array(256)).map((a,h)=>h),i=(a,h)=>e.slice(a,h),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n=i(0,14),o;t.setDefault(1,0),t.addMany(r,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(i(128,144),o,3,0),t.addMany(i(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(s,0,3,0),t.addMany(s,1,3,1),t.add(127,1,0,1),t.addMany(s,8,0,8),t.addMany(s,3,3,3),t.add(127,3,0,3),t.addMany(s,4,3,4),t.add(127,4,0,4),t.addMany(s,6,3,6),t.addMany(s,5,3,5),t.add(127,5,0,5),t.addMany(s,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(r,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(r,7,0,7),t.addMany(s,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(s,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(s,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(s,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(s,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(s,13,13,13),t.addMany(r,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(Qt,0,2,0),t.add(Qt,8,5,8),t.add(Qt,6,0,6),t.add(Qt,11,0,11),t.add(Qt,13,13,13),t}(),e2=class extends ee{constructor(e=JC){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 u0,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,s)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(xe(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new XC),this._dcsParser=this._register(new QC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>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 n=0;n<e.intermediates.length;++n){let o=e.intermediates.charCodeAt(n);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(i[0]>s||s>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=s,r}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let s=this._escHandlers[r];return s.push(i),{dispose:()=>{let n=s.indexOf(i);n!==-1&&s.splice(n,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,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let s=this._csiHandlers[r];return s.push(i),{dispose:()=>{let n=s.indexOf(i);n!==-1&&s.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}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,i,r,s,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=s,this._parseStack.chunkPos=n}parse(e,i,r){let s=0,n=0,o=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&l>-1){for(;l>=0&&(a=h[l](this._params),a!==!0);l--)if(a instanceof Promise)return this._parseStack.handlerPos=l,a}this._parseStack.handlers=[];break;case 4:if(r===!1&&l>-1){for(;l>=0&&(a=h[l](),a!==!0);l--)if(a instanceof Promise)return this._parseStack.handlerPos=l,a}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(s!==24&&s!==26,r),a)return a;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],a=this._oscParser.end(s!==24&&s!==26,r),a)return a;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=o;h<i;++h){switch(s=e[h],n=this._transitions.table[this.currentState<<8|(s<160?s:Qt)],n>>4){case 2:for(let f=h+1;;++f){if(f>=i||(s=e[f])<32||s>126&&s<Qt){this._printHandler(e,h,f),h=f-1;break}if(++f>=i||(s=e[f])<32||s>126&&s<Qt){this._printHandler(e,h,f),h=f-1;break}if(++f>=i||(s=e[f])<32||s>126&&s<Qt){this._printHandler(e,h,f),h=f-1;break}if(++f>=i||(s=e[f])<32||s>126&&s<Qt){this._printHandler(e,h,f),h=f-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|s],c=l?l.length-1:-1;for(;c>=0&&(a=l[c](this._params),a!==!0);c--)if(a instanceof Promise)return this._preserveStack(3,l,c,n,h),a;c<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++h<i&&(s=e[h])>47&&s<60);h--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let u=this._escHandlers[this._collect<<8|s],d=u?u.length-1:-1;for(;d>=0&&(a=u[d](),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(4,u,d,n,h),a;d<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let f=h+1;;++f)if(f>=i||(s=e[f])===24||s===26||s===27||s>127&&s<Qt){this._dcsParser.put(e,h,f),h=f-1;break}break;case 14:if(a=this._dcsParser.unhook(s!==24&&s!==26),a)return this._preserveStack(6,[],0,n,h),a;s===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=h+1;;f++)if(f>=i||(s=e[f])<32||s>127&&s<Qt){this._oscParser.put(e,h,f),h=f-1;break}break;case 6:if(a=this._oscParser.end(s!==24&&s!==26),a)return this._preserveStack(5,[],0,n,h),a;s===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},t2=/^([\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})$/,i2=/^[\da-f]+$/;function tp(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=t2.exec(e);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),i2.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(e.slice(i*s,i*s+i),16);r[s]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return r}}function bh(t,e){let i=t.toString(16),r=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function r2(t,e=16){let[i,r,s]=t;return`rgb:${bh(i,e)}/${bh(r,e)}/${bh(s,e)}`}var s2={"(":0,")":1,"*":2,"+":3,"-":1,".":2},rr=131072,ip=10;function rp(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var sp=5e3,np=0,n2=class extends ee{constructor(t,e,i,r,s,n,o,a,h=new e2){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new bw,this._utf8Decoder=new kw,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=$e.clone(),this._eraseAttrDataInternal=$e.clone(),this._onRequestBell=this._register(new z),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new z),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new z),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new z),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new z),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new z),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new z),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new z),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new z),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 Su(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(l=>this._activeBuffer=l.activeBuffer)),this._parser.setCsiHandlerFallback((l,c)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(l),params:c.toArray()})}),this._parser.setEscHandlerFallback(l=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(l)})}),this._parser.setExecuteHandlerFallback(l=>{this._logService.debug("Unknown EXECUTE code: ",{code:l})}),this._parser.setOscHandlerFallback((l,c,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:l,action:c,data:u})}),this._parser.setDcsHandlerFallback((l,c,u)=>{c==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(l),action:c,payload:u})}),this._parser.setPrintHandler((l,c,u)=>this.print(l,c,u)),this._parser.registerCsiHandler({final:"@"},l=>this.insertChars(l)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},l=>this.scrollLeft(l)),this._parser.registerCsiHandler({final:"A"},l=>this.cursorUp(l)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},l=>this.scrollRight(l)),this._parser.registerCsiHandler({final:"B"},l=>this.cursorDown(l)),this._parser.registerCsiHandler({final:"C"},l=>this.cursorForward(l)),this._parser.registerCsiHandler({final:"D"},l=>this.cursorBackward(l)),this._parser.registerCsiHandler({final:"E"},l=>this.cursorNextLine(l)),this._parser.registerCsiHandler({final:"F"},l=>this.cursorPrecedingLine(l)),this._parser.registerCsiHandler({final:"G"},l=>this.cursorCharAbsolute(l)),this._parser.registerCsiHandler({final:"H"},l=>this.cursorPosition(l)),this._parser.registerCsiHandler({final:"I"},l=>this.cursorForwardTab(l)),this._parser.registerCsiHandler({final:"J"},l=>this.eraseInDisplay(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},l=>this.eraseInDisplay(l,!0)),this._parser.registerCsiHandler({final:"K"},l=>this.eraseInLine(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},l=>this.eraseInLine(l,!0)),this._parser.registerCsiHandler({final:"L"},l=>this.insertLines(l)),this._parser.registerCsiHandler({final:"M"},l=>this.deleteLines(l)),this._parser.registerCsiHandler({final:"P"},l=>this.deleteChars(l)),this._parser.registerCsiHandler({final:"S"},l=>this.scrollUp(l)),this._parser.registerCsiHandler({final:"T"},l=>this.scrollDown(l)),this._parser.registerCsiHandler({final:"X"},l=>this.eraseChars(l)),this._parser.registerCsiHandler({final:"Z"},l=>this.cursorBackwardTab(l)),this._parser.registerCsiHandler({final:"`"},l=>this.charPosAbsolute(l)),this._parser.registerCsiHandler({final:"a"},l=>this.hPositionRelative(l)),this._parser.registerCsiHandler({final:"b"},l=>this.repeatPrecedingCharacter(l)),this._parser.registerCsiHandler({final:"c"},l=>this.sendDeviceAttributesPrimary(l)),this._parser.registerCsiHandler({prefix:">",final:"c"},l=>this.sendDeviceAttributesSecondary(l)),this._parser.registerCsiHandler({final:"d"},l=>this.linePosAbsolute(l)),this._parser.registerCsiHandler({final:"e"},l=>this.vPositionRelative(l)),this._parser.registerCsiHandler({final:"f"},l=>this.hVPosition(l)),this._parser.registerCsiHandler({final:"g"},l=>this.tabClear(l)),this._parser.registerCsiHandler({final:"h"},l=>this.setMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"h"},l=>this.setModePrivate(l)),this._parser.registerCsiHandler({final:"l"},l=>this.resetMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"l"},l=>this.resetModePrivate(l)),this._parser.registerCsiHandler({final:"m"},l=>this.charAttributes(l)),this._parser.registerCsiHandler({final:"n"},l=>this.deviceStatus(l)),this._parser.registerCsiHandler({prefix:"?",final:"n"},l=>this.deviceStatusPrivate(l)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},l=>this.softReset(l)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},l=>this.setCursorStyle(l)),this._parser.registerCsiHandler({final:"r"},l=>this.setScrollRegion(l)),this._parser.registerCsiHandler({final:"s"},l=>this.saveCursor(l)),this._parser.registerCsiHandler({final:"t"},l=>this.windowOptions(l)),this._parser.registerCsiHandler({final:"u"},l=>this.restoreCursor(l)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},l=>this.insertColumns(l)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},l=>this.deleteColumns(l)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},l=>this.selectProtected(l)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},l=>this.requestMode(l,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},l=>this.requestMode(l,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(wa.IND,()=>this.index()),this._parser.setExecuteHandler(wa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(wa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ot(l=>(this.setTitle(l),this.setIconName(l),!0))),this._parser.registerOscHandler(1,new Ot(l=>this.setIconName(l))),this._parser.registerOscHandler(2,new Ot(l=>this.setTitle(l))),this._parser.registerOscHandler(4,new Ot(l=>this.setOrReportIndexedColor(l))),this._parser.registerOscHandler(8,new Ot(l=>this.setHyperlink(l))),this._parser.registerOscHandler(10,new Ot(l=>this.setOrReportFgColor(l))),this._parser.registerOscHandler(11,new Ot(l=>this.setOrReportBgColor(l))),this._parser.registerOscHandler(12,new Ot(l=>this.setOrReportCursorColor(l))),this._parser.registerOscHandler(104,new Ot(l=>this.restoreIndexedColor(l))),this._parser.registerOscHandler(110,new Ot(l=>this.restoreFgColor(l))),this._parser.registerOscHandler(111,new Ot(l=>this.restoreBgColor(l))),this._parser.registerOscHandler(112,new Ot(l=>this.restoreCursorColor(l))),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 l in Ke)this._parser.registerEscHandler({intermediates:"(",final:l},()=>this.selectCharset("("+l)),this._parser.registerEscHandler({intermediates:")",final:l},()=>this.selectCharset(")"+l)),this._parser.registerEscHandler({intermediates:"*",final:l},()=>this.selectCharset("*"+l)),this._parser.registerEscHandler({intermediates:"+",final:l},()=>this.selectCharset("+"+l)),this._parser.registerEscHandler({intermediates:"-",final:l},()=>this.selectCharset("-"+l)),this._parser.registerEscHandler({intermediates:".",final:l},()=>this.selectCharset("."+l)),this._parser.registerEscHandler({intermediates:"/",final:l},()=>this.selectCharset("/"+l));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(l=>(this._logService.error("Parsing error: ",l),l)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new ep((l,c)=>this.requestStatusString(l,c)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),sp))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${sp} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>rr&&(n=this._parseStack.position+rr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,l=>String.fromCharCode(l)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(l=>l.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<rr&&(this._parseBuffer=new Uint32Array(Math.min(t.length,rr))),o||this._dirtyRowTracker.clearRange(),t.length>rr)for(let l=n;l<t.length;l+=rr){let c=l+rr<t.length?l+rr:t.length,u=typeof t=="string"?this._stringDecoder.decode(t.substring(l,c),this._parseBuffer):this._utf8Decoder.decode(t.subarray(l,c),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,s,u,l),this._logSlowResolvingAsync(i),i}else if(!o){let l=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,l))return this._preserveStack(r,s,l,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(t,e,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,c=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let d=this._parser.precedingJoinState;for(let f=e;f<i;++f){if(r=t[f],r<127&&n){let _=n[String.fromCharCode(r)];_&&(r=_.charCodeAt(0))}let p=this._unicodeService.charProperties(r,d);s=Hr.extractWidth(p);let m=Hr.extractShouldJoin(p),x=m?Hr.extractWidth(d):0;if(d=p,o&&this._onA11yChar.fire(cr(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-x>a){if(h){let _=u,g=this._activeBuffer.x-x;for(this._activeBuffer.x=x,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),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),x>0&&u instanceof Tn&&u.copyCellsFrom(_,g,0,x,!1);g<a;)_.setCellFromCodepoint(g++,0,1,c)}else if(this._activeBuffer.x=a-1,s===2)continue}if(m&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,r,s);for(let g=s-x;--g>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(l&&(u.insertCells(this._activeBuffer.x,s-x,this._activeBuffer.getNullCell(c)),u.getWidth(a-1)===2&&u.setCellFromCodepoint(a-1,0,1,c)),u.setCellFromCodepoint(this._activeBuffer.x++,r,s,c),s>0)for(;--s;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&i-e>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>rp(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new ep(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Ot(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var t;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&&((t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&t.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 t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,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(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){var r;this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&r.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;e--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)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(t){let e=t.params[0]||1;for(;e--;)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($e));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,r=Hr.extractWidth(e),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),a=0;for(let l=0;l<n.length;){let c=n.codePointAt(l)||0;o[a++]=c,l+=c>65535?2:1}let h=a;for(let l=1;l<i;++l)o.copyWithin(h,0,a),h+=a;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent($.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent($.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent($.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent($.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent($.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,zr),this._charsetService.setgCharset(1,zr),this._charsetService.setgCharset(2,zr),this._charsetService.setgCharset(3,zr);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(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){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(),t.params[e]===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(t,e){(m=>(m[m.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",m[m.SET=1]="SET",m[m.RESET=2]="RESET",m[m.PERMANENTLY_SET=3]="PERMANENTLY_SET",m[m.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:h}=this._bufferService,{active:l,alt:c}=a,u=this._optionsService.rawOptions,d=(m,x)=>(o.triggerDataEvent(`${$.ESC}[${e?"":"?"}${m};${x}$y`),!0),f=m=>m?1:2,p=t.params[0];return e?p===2?d(p,4):p===4?d(p,f(o.modes.insertMode)):p===12?d(p,3):p===20?d(p,f(u.convertEol)):d(p,0):p===1?d(p,f(r.applicationCursorKeys)):p===3?d(p,u.windowOptions.setWinLines?h===80?2:h===132?1:0:0):p===6?d(p,f(r.origin)):p===7?d(p,f(r.wraparound)):p===8?d(p,3):p===9?d(p,f(s==="X10")):p===12?d(p,f(u.cursorBlink)):p===25?d(p,f(!o.isCursorHidden)):p===45?d(p,f(r.reverseWraparound)):p===66?d(p,f(r.applicationKeypad)):p===67?d(p,4):p===1e3?d(p,f(s==="VT200")):p===1002?d(p,f(s==="DRAG")):p===1003?d(p,f(s==="ANY")):p===1004?d(p,f(r.sendFocus)):p===1005?d(p,4):p===1006?d(p,f(n==="SGR")):p===1015?d(p,4):p===1016?d(p,f(n==="SGR_PIXELS")):p===1048?d(p,1):p===47||p===1047||p===1049?d(p,f(l===c)):p===2004?d(p,f(r.bracketedPasteMode)):p===2026?d(p,f(r.synchronizedOutput)):d(p,0)}_updateAttrColor(t,e,i,r,s){return e===2?(t|=50331648,t&=-16777216,t|=xo.fromColorRGB([i,r,s])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),a=0;do r[1]===5&&(s=1),r[n+a+1+s]=o[a];while(++a<o.length&&a+n+1+s<r.length);break}if(r[1]===5&&n+s>=2||r[1]===2&&n+s>=5)break;r[1]&&(s=1)}while(++n+e<t.length&&n+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return n}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=$e.fg,t.bg=$e.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,r=this._curAttrData;for(let s=0;s<e;s++)i=t.params[s],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(t.hasSubParams(s)?t.getSubParams(s)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=$e.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=$e.bg&16777215):i===38||i===48||i===58?s+=this._extractColor(t,s,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=$e.fg&16777215,r.bg&=-67108864,r.bg|=$e.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=$e.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(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){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 i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!rp(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>ip&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>ip&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){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(t){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(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let r=i.shift(),s=i.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(op(n))if(s==="?")e.push({type:0,index:n});else{let o=tp(s);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),r=t.slice(e+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),r,s=i.findIndex(n=>n.startsWith("id="));return s!==-1&&(r=i[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let r=0;r<i.length&&!(e>=this._specialColors.length);++r,++e)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let s=tp(i[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[e],color:s}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let s=parseInt(i[r]);op(s)&&e.push({type:2,index:s})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){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,zr),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(s2[t[0]],Ke[t[1]]||zr),!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 t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,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=$e.clone(),this._eraseAttrDataInternal=$e.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new ri;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,r=this._activeBuffer.lines.get(i);r&&(r.fill(t),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=o=>(this._coreService.triggerDataEvent(`${$.ESC}${o}${$.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},Su=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(np=t,t=e,e=np),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Su=Be([H(0,Et)],Su);function op(t){return 0<=t&&t<256}var o2=5e7,ap=12,a2=50,l2=class extends ee{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 z),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){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 r;for(;r=this._writeBuffer.shift();){this._action(r);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>o2)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(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],n=this._action(s,i);if(n){let a=h=>performance.now()-r>=ap?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(r,h);n.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(a);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-r>=ap)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>a2&&(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()}},wu=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let h=i.addMarker(i.ybase+i.y),l={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(l,h)),this._dataByLinkId.set(l.id,l),l.id}let r=e,s=this._getEntryIdKey(r),n=this._entriesWithId.get(s);if(n)return this.addLineToLink(n.id,i.ybase+i.y),n.id;let o=i.addMarker(i.ybase+i.y),a={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(a,o)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,i){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(s=>s.line!==i)){let s=this._bufferService.buffer.addMarker(i);r.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(r,s))}}getLinkData(e){var i;return(i=this._dataByLinkId.get(e))==null?void 0:i.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let r=e.lines.indexOf(i);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};wu=Be([H(0,Et)],wu);var lp=!1,h2=class extends ee{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ys),this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onData=this._register(new z),this.onData=this._onData.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new z),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new z),this._instantiationService=new BC,this.optionsService=this._register(new HC(e)),this._instantiationService.setService(Lt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(gu)),this._instantiationService.setService(Et,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(pu)),this._instantiationService.setService(Tm,this._logService),this.coreService=this._register(this._instantiationService.createInstance(vu)),this._instantiationService.setService(ls,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(mu)),this._instantiationService.setService(Rm,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Hr)),this._instantiationService.setService(Rw,this.unicodeService),this._charsetService=this._instantiationService.createInstance(GC),this._instantiationService.setService(Mw,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(wu),this._instantiationService.setService(Pm,this._oscLinkService),this._inputHandler=this._register(new n2(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ht.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ht.forward(this._bufferService.onResize,this._onResize)),this._register(ht.forward(this.coreService.onData,this._onData)),this._register(ht.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 l2((i,r)=>this._inputHandler.parse(i,r))),this._register(ht.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new z),this._onScroll.event(e=>{var i;(i=this._onScrollApi)==null||i.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 i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!lp&&(this._logService.warn("writeSync is unreliable and will be removed soon."),lp=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,h0),i=Math.max(i,c0),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}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 i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.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(J_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(J_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=xe(()=>{for(let i of e)i.dispose()})}}},c2={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 u2(t,e,i,r){var o;let s={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?s.key=$.ESC+"OA":s.key=$.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?s.key=$.ESC+"OD":s.key=$.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?s.key=$.ESC+"OC":s.key=$.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?s.key=$.ESC+"OB":s.key=$.ESC+"[B");break;case 8:s.key=t.ctrlKey?"\b":$.DEL,t.altKey&&(s.key=$.ESC+s.key);break;case 9:if(t.shiftKey){s.key=$.ESC+"[Z";break}s.key=$.HT,s.cancel=!0;break;case 13:s.key=t.altKey?$.ESC+$.CR:$.CR,s.cancel=!0;break;case 27:s.key=$.ESC,t.altKey&&(s.key=$.ESC+$.ESC),s.cancel=!0;break;case 37:if(t.metaKey)break;n?s.key=$.ESC+"[1;"+(n+1)+"D":e?s.key=$.ESC+"OD":s.key=$.ESC+"[D";break;case 39:if(t.metaKey)break;n?s.key=$.ESC+"[1;"+(n+1)+"C":e?s.key=$.ESC+"OC":s.key=$.ESC+"[C";break;case 38:if(t.metaKey)break;n?s.key=$.ESC+"[1;"+(n+1)+"A":e?s.key=$.ESC+"OA":s.key=$.ESC+"[A";break;case 40:if(t.metaKey)break;n?s.key=$.ESC+"[1;"+(n+1)+"B":e?s.key=$.ESC+"OB":s.key=$.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(s.key=$.ESC+"[2~");break;case 46:n?s.key=$.ESC+"[3;"+(n+1)+"~":s.key=$.ESC+"[3~";break;case 36:n?s.key=$.ESC+"[1;"+(n+1)+"H":e?s.key=$.ESC+"OH":s.key=$.ESC+"[H";break;case 35:n?s.key=$.ESC+"[1;"+(n+1)+"F":e?s.key=$.ESC+"OF":s.key=$.ESC+"[F";break;case 33:t.shiftKey?s.type=2:t.ctrlKey?s.key=$.ESC+"[5;"+(n+1)+"~":s.key=$.ESC+"[5~";break;case 34:t.shiftKey?s.type=3:t.ctrlKey?s.key=$.ESC+"[6;"+(n+1)+"~":s.key=$.ESC+"[6~";break;case 112:n?s.key=$.ESC+"[1;"+(n+1)+"P":s.key=$.ESC+"OP";break;case 113:n?s.key=$.ESC+"[1;"+(n+1)+"Q":s.key=$.ESC+"OQ";break;case 114:n?s.key=$.ESC+"[1;"+(n+1)+"R":s.key=$.ESC+"OR";break;case 115:n?s.key=$.ESC+"[1;"+(n+1)+"S":s.key=$.ESC+"OS";break;case 116:n?s.key=$.ESC+"[15;"+(n+1)+"~":s.key=$.ESC+"[15~";break;case 117:n?s.key=$.ESC+"[17;"+(n+1)+"~":s.key=$.ESC+"[17~";break;case 118:n?s.key=$.ESC+"[18;"+(n+1)+"~":s.key=$.ESC+"[18~";break;case 119:n?s.key=$.ESC+"[19;"+(n+1)+"~":s.key=$.ESC+"[19~";break;case 120:n?s.key=$.ESC+"[20;"+(n+1)+"~":s.key=$.ESC+"[20~";break;case 121:n?s.key=$.ESC+"[21;"+(n+1)+"~":s.key=$.ESC+"[21~";break;case 122:n?s.key=$.ESC+"[23;"+(n+1)+"~":s.key=$.ESC+"[23~";break;case 123:n?s.key=$.ESC+"[24;"+(n+1)+"~":s.key=$.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?s.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?s.key=$.NUL:t.keyCode>=51&&t.keyCode<=55?s.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?s.key=$.DEL:t.keyCode===219?s.key=$.ESC:t.keyCode===220?s.key=$.FS:t.keyCode===221&&(s.key=$.GS);else if((!i||r)&&t.altKey&&!t.metaKey){let a=(o=c2[t.keyCode])==null?void 0:o[t.shiftKey?1:0];if(a)s.key=$.ESC+a;else if(t.keyCode>=65&&t.keyCode<=90){let h=t.ctrlKey?t.keyCode-64:t.keyCode+32,l=String.fromCharCode(h);t.shiftKey&&(l=l.toUpperCase()),s.key=$.ESC+l}else if(t.keyCode===32)s.key=$.ESC+(t.ctrlKey?$.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let h=t.code.slice(3,4);t.shiftKey||(h=h.toLowerCase()),s.key=$.ESC+h,s.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(s.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?s.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(s.key=$.US),t.key==="@"&&(s.key=$.NUL));break}return s}var Ae=0,d2=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ol,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ol,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((n,o)=>this._getKey(n)-this._getKey(o)),i=0,r=0,s=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<s.length;n++)r>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[r])?(s[n]=e[i],i++):s[n]=this._array[r++];this._array=s,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 i=this._getKey(e);if(i===void 0||(Ae=this._search(i),Ae===-1)||this._getKey(this._array[Ae])!==i)return!1;do if(this._array[Ae]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ae),!0;while(++Ae<this._array.length&&this._getKey(this._array[Ae])===i);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,o)=>n-o),i=0,r=new Array(this._array.length-e.length),s=0;for(let n=0;n<this._array.length;n++)e[i]===n?i++:r[s++]=this._array[n];this._array=r,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&&(Ae=this._search(e),!(Ae<0||Ae>=this._array.length)&&this._getKey(this._array[Ae])===e))do yield this._array[Ae];while(++Ae<this._array.length&&this._getKey(this._array[Ae])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ae=this._search(e),!(Ae<0||Ae>=this._array.length)&&this._getKey(this._array[Ae])===e))do i(this._array[Ae]);while(++Ae<this._array.length&&this._getKey(this._array[Ae])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,r=this._array.length-1;for(;r>=i;){let s=i+r>>1,n=this._getKey(this._array[s]);if(n>e)r=s-1;else if(n<e)i=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return i}},kh=0,hp=0,f2=class extends ee{constructor(){super(),this._decorations=new d2(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this._register(new z),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new z),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(xe(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new _2(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),r=e.onDispose(()=>{r.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let r=0,s=0;for(let n of this._decorations.getKeyIterator(e))r=n.options.x??0,s=r+(n.options.width??1),t>=r&&t<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(t,e,i,r){this._decorations.forEachByKey(e,s=>{kh=s.options.x??0,hp=kh+(s.options.width??1),t>=kh&&t<hp&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},_2=class extends kr{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new z),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new z),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=be.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=be.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},p2=1e3,g2=class{constructor(e,i=p2){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,r){this._rowCount=r,e=e!==void 0?e:0,i=i!==void 0?i: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,i):i;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=s-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},cp=20,al=class extends ee{constructor(t,e,i,r){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new g2(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(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
79
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Hd&&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 i=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s||!i?!1:this._areCoordsInSelection(i,r,s)}isCellInSelection(e,i){let r=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!r||!s?!1:this._areCoordsInSelection([e,i],r,s)}_areCoordsInSelection(e,i,r){return e[1]>i[1]&&e[1]<r[1]||i[1]===r[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<r[0]||i[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||i[1]<r[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){var n,o;let r=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=j_(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Wd(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=r?0:(i>r&&(i-=r),i=Math.min(Math.max(i,-yh),yh),i/=yh,i/Math.abs(i)+Math.round(i*(EC-1)))}shouldForceSelection(e){return nl?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(),LC)}_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 i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(nl&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=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 r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let s=r.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!i||i[0]!==this._model.selectionEnd[0]||i[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 i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<MC&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let s=mC(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,r=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,i,r);return}!e||!i||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||i[0]!==this._oldSelectionEnd[0]||i[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,i,r)}_fireOnSelectionChange(e,i,r){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(i=>this._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let r=i;for(let s=0;i>=s;s++){let n=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:n>1&&i!==s&&(r+=n-1)}return r}setSelection(e,i,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,r=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let a=n.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(o,e[0]),l=h,c=e[0]-h,u=0,d=0,f=0,p=0;if(a.charAt(h)===" "){for(;h>0&&a.charAt(h-1)===" ";)h--;for(;l<a.length&&a.charAt(l+1)===" ";)l++}else{let _=e[0],g=e[0];o.getWidth(_)===0&&(u++,_--),o.getWidth(g)===2&&(d++,g++);let S=o.getString(g).length;for(S>1&&(p+=S-1,l+=S-1);_>0&&h>0&&!this._isCharWordSeparator(o.loadCell(_-1,this._workCell));){o.loadCell(_-1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,_--):y>1&&(f+=y-1,h-=y-1),h--,_--}for(;g<o.length&&l+1<a.length&&!this._isCharWordSeparator(o.loadCell(g+1,this._workCell));){o.loadCell(g+1,this._workCell);let y=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,g++):y>1&&(p+=y-1,l+=y-1),l++,g++}}l++;let m=h+c-u+f,x=Math.min(this._bufferService.cols,l-h+u+d-f-p);if(!(!i&&a.slice(h,l).trim()==="")){if(r&&m===0&&o.getCodePoint(0)!==32){let _=n.lines.get(e[1]-1);if(_&&o.isWrapped&&_.getCodePoint(this._bufferService.cols-1)!==32){let g=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(g){let S=this._bufferService.cols-g.start;m-=S,x+=S}}}if(s&&m+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let _=n.lines.get(e[1]+1);if(_!=null&&_.isWrapped&&_.getCodePoint(0)!==32){let g=this._getWordAt([0,e[1]+1],!1,!1,!0);g&&(x+=g.length)}}return{start:m,length:x}}}_selectWordAt(e,i){let r=this._getWordAt(e,i);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let r=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=j_(r,this._bufferService.cols)}};fu=Be([H(3,Et),H(4,ls),H(5,Nd),H(6,Lt),H(7,Ji),H(8,Zi)],fu);var W_=class{constructor(){this._data={}}set(e,i,r){this._data[e]||(this._data[e]={}),this._data[e][i]=r}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},H_=class{constructor(){this._color=new W_,this._css=new W_}setCss(e,i,r){this._css.set(e,i,r)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,r){this._color.set(e,i,r)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},je=Object.freeze((()=>{let t=[be.toColor("#2e3436"),be.toColor("#cc0000"),be.toColor("#4e9a06"),be.toColor("#c4a000"),be.toColor("#3465a4"),be.toColor("#75507b"),be.toColor("#06989a"),be.toColor("#d3d7cf"),be.toColor("#555753"),be.toColor("#ef2929"),be.toColor("#8ae234"),be.toColor("#fce94f"),be.toColor("#729fcf"),be.toColor("#ad7fa8"),be.toColor("#34e2e2"),be.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=e[i/36%6|0],s=e[i/6%6|0],n=e[i%6];t.push({css:Ie.toCss(r,s,n),rgba:Ie.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;t.push({css:Ie.toCss(r,r,r),rgba:Ie.toRgba(r,r,r)})}return t})()),Ir=be.toColor("#ffffff"),Rn=be.toColor("#000000"),U_=be.toColor("#ffffff"),K_=Rn,gn={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},PC=Ir,_u=class extends ee{constructor(e){super(),this._optionsService=e,this._contrastCache=new H_,this._halfContrastCache=new H_,this._onChangeColors=this._register(new z),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ir,background:Rn,cursor:U_,cursorAccent:K_,selectionForeground:void 0,selectionBackgroundTransparent:gn,selectionBackgroundOpaque:me.blend(Rn,gn),selectionInactiveBackgroundTransparent:gn,selectionInactiveBackgroundOpaque:me.blend(Rn,gn),scrollbarSliderBackground:me.opacity(Ir,.2),scrollbarSliderHoverBackground:me.opacity(Ir,.4),scrollbarSliderActiveBackground:me.opacity(Ir,.5),overviewRulerBorder:Ir,ansi:je.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 i=this._colors;if(i.foreground=ce(e.foreground,Ir),i.background=ce(e.background,Rn),i.cursor=me.blend(i.background,ce(e.cursor,U_)),i.cursorAccent=me.blend(i.background,ce(e.cursorAccent,K_)),i.selectionBackgroundTransparent=ce(e.selectionBackground,gn),i.selectionBackgroundOpaque=me.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=ce(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=me.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?ce(e.selectionForeground,I_):void 0,i.selectionForeground===I_&&(i.selectionForeground=void 0),me.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=me.opacity(i.selectionBackgroundTransparent,.3)),me.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=me.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=ce(e.scrollbarSliderBackground,me.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=ce(e.scrollbarSliderHoverBackground,me.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=ce(e.scrollbarSliderActiveBackground,me.opacity(i.foreground,.5)),i.overviewRulerBorder=ce(e.overviewRulerBorder,PC),i.ansi=je.slice(),i.ansi[0]=ce(e.black,je[0]),i.ansi[1]=ce(e.red,je[1]),i.ansi[2]=ce(e.green,je[2]),i.ansi[3]=ce(e.yellow,je[3]),i.ansi[4]=ce(e.blue,je[4]),i.ansi[5]=ce(e.magenta,je[5]),i.ansi[6]=ce(e.cyan,je[6]),i.ansi[7]=ce(e.white,je[7]),i.ansi[8]=ce(e.brightBlack,je[8]),i.ansi[9]=ce(e.brightRed,je[9]),i.ansi[10]=ce(e.brightGreen,je[10]),i.ansi[11]=ce(e.brightYellow,je[11]),i.ansi[12]=ce(e.brightBlue,je[12]),i.ansi[13]=ce(e.brightMagenta,je[13]),i.ansi[14]=ce(e.brightCyan,je[14]),i.ansi[15]=ce(e.brightWhite,je[15]),e.extendedAnsi){let r=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<r;s++)i.ansi[s+16]=ce(e.extendedAnsi[s],je[s+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 i=0;i<this._restoreColors.ansi.length;++i)this._colors.ansi[i]=this._restoreColors.ansi[i];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()}}};_u=Be([H(0,Lt)],_u);function ce(t,e){if(t!==void 0)try{return be.toColor(t)}catch{}return e}var DC=class{constructor(...e){this._entries=new Map;for(let[i,r]of e)this.set(i,r)}set(e,i){let r=this._entries.get(e);return this._entries.set(e,i),r}forEach(e){for(let[i,r]of this._entries.entries())e(i,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},BC=class{constructor(){this._services=new DC,this._services.set(Ad,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=Ew(t).sort((n,o)=>n.index-o.index),r=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=i.length>0?i[0].index:e.length;if(e.length!==s)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${s+1} conflicts with ${e.length} static arguments`);return new t(...e,...r)}},AC={trace:0,debug:1,info:2,warn:3,error:4,off:5},NC="xterm.js: ",pu=class extends ee{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=AC[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":NC)+i,...r)}trace(e,...i){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,i)}};pu=Be([H(0,Lt)],pu);var V_=class extends ee{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new z),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new z),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new z),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 i=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)i[r]=this._array[this._getCyclicIndex(r)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}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,i,...r){if(i){for(let s=e;s<this._length-i;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+r.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<r.length;s++)this._array[this._getCyclicIndex(e+s)]=r[s];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let s=this._length+r.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,r){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let n=i-1;n>=0;n--)this.set(e+n+r,this.get(e+n));let s=e+i+r-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<i;s++)this.set(e+s+r,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},J=3,$e=Object.freeze(new xo),Zo=0,Sh=2,Tn=class o0{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*J);let s=i||ri.fromCharData([0,km,1,0]);for(let n=0;n<e;++n)this.setCell(n,s);this.length=e}get(e){let i=this._data[e*J+0],r=i&2097151;return[this._data[e*J+1],i&2097152?this._combined[e]:r?cr(r):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[e*J+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*J+0]=e|2097152|i[2]<<22):this._data[e*J+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*J+0]>>22}hasWidth(e){return this._data[e*J+0]&12582912}getFg(e){return this._data[e*J+1]}getBg(e){return this._data[e*J+2]}hasContent(e){return this._data[e*J+0]&4194303}getCodePoint(e){let i=this._data[e*J+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*J+0]&2097152}getString(e){let i=this._data[e*J+0];return i&2097152?this._combined[e]:i&2097151?cr(i&2097151):""}isProtected(e){return this._data[e*J+2]&536870912}loadCell(e,i){return Zo=e*J,i.content=this._data[Zo+0],i.fg=this._data[Zo+1],i.bg=this._data[Zo+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*J+0]=i.content,this._data[e*J+1]=i.fg,this._data[e*J+2]=i.bg}setCellFromCodepoint(e,i,r,s){s.bg&268435456&&(this._extendedAttrs[e]=s.extended),this._data[e*J+0]=i|r<<22,this._data[e*J+1]=s.fg,this._data[e*J+2]=s.bg}addCodepointToCell(e,i,r){let s=this._data[e*J+0];s&2097152?this._combined[e]+=cr(i):s&2097151?(this._combined[e]=cr(s&2097151)+cr(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[e*J+0]=s}insertCells(e,i,r){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length-e){let s=new ri;for(let n=this.length-e-i-1;n>=0;--n)this.setCell(e+i+n,this.loadCell(e+n,s));for(let n=0;n<i;++n)this.setCell(e+n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,i,r){if(e%=this.length,i<this.length-e){let s=new ri;for(let n=0;n<this.length-e-i;++n)this.setCell(e+n,this.loadCell(e+i+n,s));for(let n=this.length-i;n<this.length;++n)this.setCell(n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,i,r,s=!1){if(s){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.setCell(e++,r)}resize(e,i){if(e===this.length)return this._data.length*4*Sh<this._data.buffer.byteLength;let r=e*J;if(e>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=e&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=e&&delete this._extendedAttrs[a]}}return this.length=e,r*4*Sh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Sh<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new o0(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*J+0]&4194303)return e+(this._data[e*J+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*J+0]&4194303||this._data[e*J+2]&50331648)return e+(this._data[e*J+0]>>22);return 0}copyCellsFrom(e,i,r,s,n){let o=e._data;if(n)for(let h=s-1;h>=0;h--){for(let l=0;l<J;l++)this._data[(r+h)*J+l]=o[(i+h)*J+l];o[(i+h)*J+2]&268435456&&(this._extendedAttrs[r+h]=e._extendedAttrs[i+h])}else for(let h=0;h<s;h++){for(let l=0;l<J;l++)this._data[(r+h)*J+l]=o[(i+h)*J+l];o[(i+h)*J+2]&268435456&&(this._extendedAttrs[r+h]=e._extendedAttrs[i+h])}let a=Object.keys(e._combined);for(let h=0;h<a.length;h++){let l=parseInt(a[h],10);l>=i&&(this._combined[l-i+r]=e._combined[l])}}translateToString(e,i,r,s){i=i??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let o=this._data[i*J+0],a=o&2097151,h=o&2097152?this._combined[i]:a?cr(a):pr;if(n+=h,s)for(let l=0;l<h.length;++l)s.push(i);i+=o>>22||1}return s&&s.push(i),n}};function $C(t,e,i,r,s,n){let o=[];for(let a=0;a<t.length-1;a++){let h=a,l=t.get(++h);if(!l.isWrapped)continue;let c=[t.get(a)];for(;h<t.length&&l.isWrapped;)c.push(l),l=t.get(++h);if(!n&&r>=a&&r<h){a+=c.length-1;continue}let u=0,d=fo(c,u,e),f=1,p=0;for(;f<c.length;){let x=fo(c,f,e),_=x-p,g=i-d,S=Math.min(_,g);c[u].copyCellsFrom(c[f],p,d,S,!1),d+=S,d===i&&(u++,d=0),p+=S,p===x&&(f++,p=0),d===0&&u!==0&&c[u-1].getWidth(i-1)===2&&(c[u].copyCellsFrom(c[u-1],i-1,d++,1,!1),c[u-1].setCell(i-1,s))}c[u].replaceCells(d,i,s);let m=0;for(let x=c.length-1;x>0&&(x>u||c[x].getTrimmedLength()===0);x--)m++;m>0&&(o.push(a+c.length-m),o.push(m)),a+=c.length-1}return o}function OC(t,e){let i=[],r=0,s=e[r],n=0;for(let o=0;o<t.length;o++)if(s===o){let a=e[++r];t.onDeleteEmitter.fire({index:o-n,amount:a}),o+=a-1,n+=a,s=e[++r]}else i.push(o);return{layout:i,countRemoved:n}}function IC(t,e){let i=[];for(let r=0;r<e.length;r++)i.push(t.get(e[r]));for(let r=0;r<i.length;r++)t.set(r,i[r]);t.length=e.length}function zC(t,e,i){let r=[],s=t.map((h,l)=>fo(t,l,e)).reduce((h,l)=>h+l),n=0,o=0,a=0;for(;a<s;){if(s-a<i){r.push(s-a);break}n+=i;let h=fo(t,o,e);n>h&&(n-=h,o++);let l=t[o].getWidth(n-1)===2;l&&n--;let c=l?i-1:i;r.push(c),a+=c}return r}function fo(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let r=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,s=t[e+1].getWidth(0)===2;return r&&s?i-1:i}var a0=class l0{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=l0._nextId++,this._onDispose=this.register(new z),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ss(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};a0._nextId=1;var FC=a0,Ke={},zr=Ke.B;Ke[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ke.A={"#":"£"};Ke.B=void 0;Ke[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ke.C=Ke[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ke.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ke.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ke.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ke.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ke.E=Ke[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ke.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ke.H=Ke[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ke["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var q_=4294967295,G_=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=$e.clone(),this.savedCharset=zr,this.markers=[],this._nullCell=ri.fromCharData([0,km,1,0]),this._whitespaceCell=ri.fromCharData([0,pr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ol,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new V_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new il),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new il),this._whitespaceCell}getBlankLine(t,e){return new Tn(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>q_?q_:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=$e);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new V_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell($e),r=0,s=this._getCorrectBufferLength(e);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<t)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(t,i);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Tn(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Tn(t,i)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=$C(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell($e),i);if(r.length>0){let s=OC(this.lines,r);IC(this.lines,s.layout),this._reflowLargerAdjustViewport(t,e,s.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let r=this.getNullCell($e),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new Tn(t,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell($e),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=t)continue;let h=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),h.unshift(a);if(!i){let S=this.ybase+this.y;if(S>=o&&S<o+h.length)continue}let l=h[h.length-1].getTrimmedLength(),c=zC(h,this._cols,t),u=c.length-h.length,d;this.ybase===0&&this.y!==this.lines.length-1?d=Math.max(0,this.y-this.lines.maxLength+u):d=Math.max(0,this.lines.length-this.lines.maxLength+u);let f=[];for(let S=0;S<u;S++){let y=this.getBlankLine($e,!0);f.push(y)}f.length>0&&(s.push({start:o+h.length+n,newLines:f}),n+=f.length),h.push(...f);let p=c.length-1,m=c[p];m===0&&(p--,m=c[p]);let x=h.length-u-1,_=l;for(;x>=0;){let S=Math.min(_,m);if(h[p]===void 0)break;if(h[p].copyCellsFrom(h[x],_-S,m-S,S,!0),m-=S,m===0&&(p--,m=c[p]),_-=S,_===0){x--;let y=Math.max(x,0);_=fo(h,y,this._cols)}}for(let S=0;S<h.length;S++)c[S]<t&&h[S].setCell(c[S],r);let g=u-d;for(;g-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+e-1)}if(s.length>0){let o=[],a=[];for(let m=0;m<this.lines.length;m++)a.push(this.lines.get(m));let h=this.lines.length,l=h-1,c=0,u=s[c];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let d=0;for(let m=Math.min(this.lines.maxLength-1,h+n-1);m>=0;m--)if(u&&u.start>l+d){for(let x=u.newLines.length-1;x>=0;x--)this.lines.set(m--,u.newLines[x]);m++,o.push({index:l+1,amount:u.newLines.length}),d+=u.newLines.length,u=s[++c]}else this.lines.set(m,a[l--]);let f=0;for(let m=o.length-1;m>=0;m--)o[m].index+=f,this.lines.onInsertEmitter.fire(o[m]),f+=o[m].amount;let p=Math.max(0,h+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(t,e,i=0,r){let s=this.lines.get(t);return s?s.translateToString(e,i,r):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new FC(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},jC=class extends ee{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new z),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 G_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new G_(!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,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},h0=2,c0=1,gu=class extends ee{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,h0),this.rows=Math.max(t.rawOptions.rows||0,c0),this.buffers=this._register(new jC(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,r=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==t.fg||r.getBg(0)!==t.bg)&&(r=i.getBlankLine(t,e),this._cachedBlankLine=r),r.isWrapped=e;let s=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(n+1,0,r.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-s+1;i.lines.shiftElements(s+1,o-1,-1),i.lines.set(n,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),r!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};gu=Be([H(0,Lt)],gu);var fs={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:nl,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},WC=["normal","bold","100","200","300","400","500","600","700","800","900"],HC=class extends ee{constructor(e){super(),this._onOptionChange=this._register(new z),this.onOptionChange=this._onOptionChange.event;let i={...fs};for(let r in e)if(r in i)try{let s=e[r];i[r]=this._sanitizeAndValidateOption(r,s)}catch(s){console.error(s)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(xe(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(r=>{r===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&i()})}_setupOptions(){let e=r=>{if(!(r in fs))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},i=(r,s)=>{if(!(r in fs))throw new Error(`No option with key "${r}"`);s=this._sanitizeAndValidateOption(r,s),this.rawOptions[r]!==s&&(this.rawOptions[r]=s,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this.options,r,s)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=fs[e]),!UC(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=fs[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=WC.includes(i)?i:fs[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function UC(t){return t==="block"||t==="underline"||t==="bar"}function Pn(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let r in t)i[r]=e<=1?t[r]:t[r]&&Pn(t[r],e-1);return i}var Y_=Object.freeze({insertMode:!1}),X_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),vu=class extends ee{constructor(e,i,r){super(),this._bufferService=e,this._logService=i,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new z),this.onData=this._onData.event,this._onUserInput=this._register(new z),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new z),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Pn(Y_),this.decPrivateModes=Pn(X_)}reset(){this.modes=Pn(Y_),this.decPrivateModes=Pn(X_)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};vu=Be([H(0,Et),H(1,Tm),H(2,Lt)],vu);var Q_={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function wh(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var xh=String.fromCharCode,Z_={DEFAULT:t=>{let e=[wh(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${xh(e[0])}${xh(e[1])}${xh(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${wh(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${wh(t,!0)};${t.x};${t.y}${e}`}},mu=class extends ee{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new z),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Q_))this.addProtocol(r,Q_[r]);for(let r of Object.keys(Z_))this.addEncoding(r,Z_[r]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let r=e/i,s=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(t.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};mu=Be([H(0,Et),H(1,ls),H(2,Lt)],mu);var Ch=[[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]],KC=[[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]],We;function VC(t,e){let i=0,r=e.length-1,s;if(t<e[0][0]||t>e[r][1])return!1;for(;r>=i;)if(s=i+r>>1,t>e[s][1])i=s+1;else if(t<e[s][0])r=s-1;else return!0;return!1}var qC=class{constructor(){if(this.version="6",!We){We=new Uint8Array(65536),We.fill(1),We[0]=0,We.fill(0,1,32),We.fill(0,127,160),We.fill(2,4352,4448),We[9001]=2,We[9002]=2,We.fill(2,11904,42192),We[12351]=1,We.fill(2,44032,55204),We.fill(2,63744,64256),We.fill(2,65040,65050),We.fill(2,65072,65136),We.fill(2,65280,65377),We.fill(2,65504,65511);for(let e=0;e<Ch.length;++e)We.fill(0,Ch[e][0],Ch[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?We[e]:VC(e,KC)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let r=this.wcwidth(e),s=r===0&&i!==0;if(s){let n=Hr.extractWidth(i);n===0?s=!1:n>r&&(r=n)}return Hr.createPropertyValue(0,r,s)}},Hr=class Ca{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new z,this.onChange=this._onChange.event;let e=new qC;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,r=!1){return(e&16777215)<<3|(i&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,r=0,s=e.length;for(let n=0;n<s;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let l=e.charCodeAt(n);56320<=l&&l<=57343?o=(o-55296)*1024+l-56320+65536:i+=this.wcwidth(l)}let a=this.charProperties(o,r),h=Ca.extractWidth(a);Ca.extractShouldJoin(a)&&(h-=Ca.extractWidth(r)),i+=h,r=a}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},GC=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,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function J_(t){var r;let e=(r=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1))==null?void 0:r.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var vn=2147483647,YC=256,u0=class yu{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>YC)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new yu;if(!e.length)return i;for(let r=Array.isArray(e[0])?1:0;r<e.length;++r){let s=e[r];if(Array.isArray(s))for(let n=0;n<s.length;++n)i.addSubParam(s[n]);else i.addParam(s)}return i}clone(){let e=new yu(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>vn?vn:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>vn?vn:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,r=this._subParamsIdx[e]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&(e[i]=this._subParams.slice(r,s))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(s*10+e,vn):e}},mn=[],XC=class{constructor(){this._state=0,this._active=mn,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let s=r.indexOf(i);s!==-1&&r.splice(s,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=mn}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=mn,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||mn,!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,i,r){if(!this._active.length)this._handlerFb(this._id,"PUT",Ml(e,i,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r)}start(){this.reset(),this._state=1}put(e,i,r){if(this._state!==3){if(this._state===1)for(;i<r;){let s=e[i++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&r-i>0&&this._put(e,i,r)}}end(e,i=!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 r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].end(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=mn,this._id=-1,this._state=0}}},Ot=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,r){this._hitLimit||(this._data+=Ml(e,i,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data),i instanceof Promise))return i.then(r=>(this._data="",this._hitLimit=!1,r));return this._data="",this._hitLimit=!1,i}},yn=[],QC=class{constructor(){this._handlers=Object.create(null),this._active=yn,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=yn}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(i),{dispose:()=>{let s=r.indexOf(i);s!==-1&&r.splice(s,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=yn,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||yn,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(i)}put(e,i,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",Ml(e,i,r));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,i,r)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,s=this._active.length-1,n=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,r=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&r===!1){for(;s>=0&&(r=this._active[s].unhook(e),r!==!0);s--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,r;s--}for(;s>=0;s--)if(r=this._active[s].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,r}this._active=yn,this._ident=0}},Dn=new u0;Dn.addParam(0);var ep=class{constructor(t){this._handler=t,this._data="",this._params=Dn,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Dn,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Ml(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=Dn,this._data="",this._hitLimit=!1,i));return this._params=Dn,this._data="",this._hitLimit=!1,e}},ZC=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,r,s){this.table[i<<8|e]=r<<4|s}addMany(e,i,r,s){for(let n=0;n<e.length;n++)this.table[i<<8|e[n]]=r<<4|s}},Qt=160,JC=function(){let t=new ZC(4095),e=Array.apply(null,Array(256)).map((a,h)=>h),i=(a,h)=>e.slice(a,h),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n=i(0,14),o;t.setDefault(1,0),t.addMany(r,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(i(128,144),o,3,0),t.addMany(i(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(s,0,3,0),t.addMany(s,1,3,1),t.add(127,1,0,1),t.addMany(s,8,0,8),t.addMany(s,3,3,3),t.add(127,3,0,3),t.addMany(s,4,3,4),t.add(127,4,0,4),t.addMany(s,6,3,6),t.addMany(s,5,3,5),t.add(127,5,0,5),t.addMany(s,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(r,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(r,7,0,7),t.addMany(s,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(s,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(s,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(s,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(s,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(s,13,13,13),t.addMany(r,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(Qt,0,2,0),t.add(Qt,8,5,8),t.add(Qt,6,0,6),t.add(Qt,11,0,11),t.add(Qt,13,13,13),t}(),eb=class extends ee{constructor(e=JC){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 u0,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,r,s)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,r)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(xe(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new XC),this._dcsParser=this._register(new QC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>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 n=0;n<e.intermediates.length;++n){let o=e.intermediates.charCodeAt(n);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(i[0]>s||s>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return r<<=8,r|=s,r}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let s=this._escHandlers[r];return s.push(i),{dispose:()=>{let n=s.indexOf(i);n!==-1&&s.splice(n,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,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let s=this._csiHandlers[r];return s.push(i),{dispose:()=>{let n=s.indexOf(i);n!==-1&&s.splice(n,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}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,i,r,s,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=r,this._parseStack.transition=s,this._parseStack.chunkPos=n}parse(e,i,r){let s=0,n=0,o=0,a;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let h=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&l>-1){for(;l>=0&&(a=h[l](this._params),a!==!0);l--)if(a instanceof Promise)return this._parseStack.handlerPos=l,a}this._parseStack.handlers=[];break;case 4:if(r===!1&&l>-1){for(;l>=0&&(a=h[l](),a!==!0);l--)if(a instanceof Promise)return this._parseStack.handlerPos=l,a}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(s!==24&&s!==26,r),a)return a;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],a=this._oscParser.end(s!==24&&s!==26,r),a)return a;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=o;h<i;++h){switch(s=e[h],n=this._transitions.table[this.currentState<<8|(s<160?s:Qt)],n>>4){case 2:for(let f=h+1;;++f){if(f>=i||(s=e[f])<32||s>126&&s<Qt){this._printHandler(e,h,f),h=f-1;break}if(++f>=i||(s=e[f])<32||s>126&&s<Qt){this._printHandler(e,h,f),h=f-1;break}if(++f>=i||(s=e[f])<32||s>126&&s<Qt){this._printHandler(e,h,f),h=f-1;break}if(++f>=i||(s=e[f])<32||s>126&&s<Qt){this._printHandler(e,h,f),h=f-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|s],c=l?l.length-1:-1;for(;c>=0&&(a=l[c](this._params),a!==!0);c--)if(a instanceof Promise)return this._preserveStack(3,l,c,n,h),a;c<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++h<i&&(s=e[h])>47&&s<60);h--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let u=this._escHandlers[this._collect<<8|s],d=u?u.length-1:-1;for(;d>=0&&(a=u[d](),a!==!0);d--)if(a instanceof Promise)return this._preserveStack(4,u,d,n,h),a;d<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let f=h+1;;++f)if(f>=i||(s=e[f])===24||s===26||s===27||s>127&&s<Qt){this._dcsParser.put(e,h,f),h=f-1;break}break;case 14:if(a=this._dcsParser.unhook(s!==24&&s!==26),a)return this._preserveStack(6,[],0,n,h),a;s===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let f=h+1;;f++)if(f>=i||(s=e[f])<32||s>127&&s<Qt){this._oscParser.put(e,h,f),h=f-1;break}break;case 6:if(a=this._oscParser.end(s!==24&&s!==26),a)return this._preserveStack(5,[],0,n,h),a;s===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},tb=/^([\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})$/,ib=/^[\da-f]+$/;function tp(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=tb.exec(e);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),ib.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(e.slice(i*s,i*s+i),16);r[s]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return r}}function bh(t,e){let i=t.toString(16),r=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function rb(t,e=16){let[i,r,s]=t;return`rgb:${bh(i,e)}/${bh(r,e)}/${bh(s,e)}`}var sb={"(":0,")":1,"*":2,"+":3,"-":1,".":2},rr=131072,ip=10;function rp(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var sp=5e3,np=0,nb=class extends ee{constructor(t,e,i,r,s,n,o,a,h=new eb){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new bw,this._utf8Decoder=new kw,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=$e.clone(),this._eraseAttrDataInternal=$e.clone(),this._onRequestBell=this._register(new z),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new z),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new z),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new z),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new z),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new z),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new z),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new z),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new z),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 Su(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(l=>this._activeBuffer=l.activeBuffer)),this._parser.setCsiHandlerFallback((l,c)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(l),params:c.toArray()})}),this._parser.setEscHandlerFallback(l=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(l)})}),this._parser.setExecuteHandlerFallback(l=>{this._logService.debug("Unknown EXECUTE code: ",{code:l})}),this._parser.setOscHandlerFallback((l,c,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:l,action:c,data:u})}),this._parser.setDcsHandlerFallback((l,c,u)=>{c==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(l),action:c,payload:u})}),this._parser.setPrintHandler((l,c,u)=>this.print(l,c,u)),this._parser.registerCsiHandler({final:"@"},l=>this.insertChars(l)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},l=>this.scrollLeft(l)),this._parser.registerCsiHandler({final:"A"},l=>this.cursorUp(l)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},l=>this.scrollRight(l)),this._parser.registerCsiHandler({final:"B"},l=>this.cursorDown(l)),this._parser.registerCsiHandler({final:"C"},l=>this.cursorForward(l)),this._parser.registerCsiHandler({final:"D"},l=>this.cursorBackward(l)),this._parser.registerCsiHandler({final:"E"},l=>this.cursorNextLine(l)),this._parser.registerCsiHandler({final:"F"},l=>this.cursorPrecedingLine(l)),this._parser.registerCsiHandler({final:"G"},l=>this.cursorCharAbsolute(l)),this._parser.registerCsiHandler({final:"H"},l=>this.cursorPosition(l)),this._parser.registerCsiHandler({final:"I"},l=>this.cursorForwardTab(l)),this._parser.registerCsiHandler({final:"J"},l=>this.eraseInDisplay(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},l=>this.eraseInDisplay(l,!0)),this._parser.registerCsiHandler({final:"K"},l=>this.eraseInLine(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},l=>this.eraseInLine(l,!0)),this._parser.registerCsiHandler({final:"L"},l=>this.insertLines(l)),this._parser.registerCsiHandler({final:"M"},l=>this.deleteLines(l)),this._parser.registerCsiHandler({final:"P"},l=>this.deleteChars(l)),this._parser.registerCsiHandler({final:"S"},l=>this.scrollUp(l)),this._parser.registerCsiHandler({final:"T"},l=>this.scrollDown(l)),this._parser.registerCsiHandler({final:"X"},l=>this.eraseChars(l)),this._parser.registerCsiHandler({final:"Z"},l=>this.cursorBackwardTab(l)),this._parser.registerCsiHandler({final:"`"},l=>this.charPosAbsolute(l)),this._parser.registerCsiHandler({final:"a"},l=>this.hPositionRelative(l)),this._parser.registerCsiHandler({final:"b"},l=>this.repeatPrecedingCharacter(l)),this._parser.registerCsiHandler({final:"c"},l=>this.sendDeviceAttributesPrimary(l)),this._parser.registerCsiHandler({prefix:">",final:"c"},l=>this.sendDeviceAttributesSecondary(l)),this._parser.registerCsiHandler({final:"d"},l=>this.linePosAbsolute(l)),this._parser.registerCsiHandler({final:"e"},l=>this.vPositionRelative(l)),this._parser.registerCsiHandler({final:"f"},l=>this.hVPosition(l)),this._parser.registerCsiHandler({final:"g"},l=>this.tabClear(l)),this._parser.registerCsiHandler({final:"h"},l=>this.setMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"h"},l=>this.setModePrivate(l)),this._parser.registerCsiHandler({final:"l"},l=>this.resetMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"l"},l=>this.resetModePrivate(l)),this._parser.registerCsiHandler({final:"m"},l=>this.charAttributes(l)),this._parser.registerCsiHandler({final:"n"},l=>this.deviceStatus(l)),this._parser.registerCsiHandler({prefix:"?",final:"n"},l=>this.deviceStatusPrivate(l)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},l=>this.softReset(l)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},l=>this.setCursorStyle(l)),this._parser.registerCsiHandler({final:"r"},l=>this.setScrollRegion(l)),this._parser.registerCsiHandler({final:"s"},l=>this.saveCursor(l)),this._parser.registerCsiHandler({final:"t"},l=>this.windowOptions(l)),this._parser.registerCsiHandler({final:"u"},l=>this.restoreCursor(l)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},l=>this.insertColumns(l)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},l=>this.deleteColumns(l)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},l=>this.selectProtected(l)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},l=>this.requestMode(l,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},l=>this.requestMode(l,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(wa.IND,()=>this.index()),this._parser.setExecuteHandler(wa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(wa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ot(l=>(this.setTitle(l),this.setIconName(l),!0))),this._parser.registerOscHandler(1,new Ot(l=>this.setIconName(l))),this._parser.registerOscHandler(2,new Ot(l=>this.setTitle(l))),this._parser.registerOscHandler(4,new Ot(l=>this.setOrReportIndexedColor(l))),this._parser.registerOscHandler(8,new Ot(l=>this.setHyperlink(l))),this._parser.registerOscHandler(10,new Ot(l=>this.setOrReportFgColor(l))),this._parser.registerOscHandler(11,new Ot(l=>this.setOrReportBgColor(l))),this._parser.registerOscHandler(12,new Ot(l=>this.setOrReportCursorColor(l))),this._parser.registerOscHandler(104,new Ot(l=>this.restoreIndexedColor(l))),this._parser.registerOscHandler(110,new Ot(l=>this.restoreFgColor(l))),this._parser.registerOscHandler(111,new Ot(l=>this.restoreBgColor(l))),this._parser.registerOscHandler(112,new Ot(l=>this.restoreCursorColor(l))),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 l in Ke)this._parser.registerEscHandler({intermediates:"(",final:l},()=>this.selectCharset("("+l)),this._parser.registerEscHandler({intermediates:")",final:l},()=>this.selectCharset(")"+l)),this._parser.registerEscHandler({intermediates:"*",final:l},()=>this.selectCharset("*"+l)),this._parser.registerEscHandler({intermediates:"+",final:l},()=>this.selectCharset("+"+l)),this._parser.registerEscHandler({intermediates:"-",final:l},()=>this.selectCharset("-"+l)),this._parser.registerEscHandler({intermediates:".",final:l},()=>this.selectCharset("."+l)),this._parser.registerEscHandler({intermediates:"/",final:l},()=>this.selectCharset("/"+l));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(l=>(this._logService.error("Parsing error: ",l),l)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new ep((l,c)=>this.requestStatusString(l,c)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),sp))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${sp} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>rr&&(n=this._parseStack.position+rr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,l=>String.fromCharCode(l)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(l=>l.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<rr&&(this._parseBuffer=new Uint32Array(Math.min(t.length,rr))),o||this._dirtyRowTracker.clearRange(),t.length>rr)for(let l=n;l<t.length;l+=rr){let c=l+rr<t.length?l+rr:t.length,u=typeof t=="string"?this._stringDecoder.decode(t.substring(l,c),this._parseBuffer):this._utf8Decoder.decode(t.subarray(l,c),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,s,u,l),this._logSlowResolvingAsync(i),i}else if(!o){let l=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,l))return this._preserveStack(r,s,l,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(t,e,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,c=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let d=this._parser.precedingJoinState;for(let f=e;f<i;++f){if(r=t[f],r<127&&n){let _=n[String.fromCharCode(r)];_&&(r=_.charCodeAt(0))}let p=this._unicodeService.charProperties(r,d);s=Hr.extractWidth(p);let m=Hr.extractShouldJoin(p),x=m?Hr.extractWidth(d):0;if(d=p,o&&this._onA11yChar.fire(cr(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-x>a){if(h){let _=u,g=this._activeBuffer.x-x;for(this._activeBuffer.x=x,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),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),x>0&&u instanceof Tn&&u.copyCellsFrom(_,g,0,x,!1);g<a;)_.setCellFromCodepoint(g++,0,1,c)}else if(this._activeBuffer.x=a-1,s===2)continue}if(m&&this._activeBuffer.x){let _=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-_,r,s);for(let g=s-x;--g>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(l&&(u.insertCells(this._activeBuffer.x,s-x,this._activeBuffer.getNullCell(c)),u.getWidth(a-1)===2&&u.setCellFromCodepoint(a-1,0,1,c)),u.setCellFromCodepoint(this._activeBuffer.x++,r,s,c),s>0)for(;--s;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&i-e>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>rp(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new ep(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Ot(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var t;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&&((t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&t.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 t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,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(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){var r;this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&r.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;e--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)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(t){let e=t.params[0]||1;for(;e--;)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($e));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,r=Hr.extractWidth(e),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),a=0;for(let l=0;l<n.length;){let c=n.codePointAt(l)||0;o[a++]=c,l+=c>65535?2:1}let h=a;for(let l=1;l<i;++l)o.copyWithin(h,0,a),h+=a;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent($.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent($.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent($.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent($.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent($.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,zr),this._charsetService.setgCharset(1,zr),this._charsetService.setgCharset(2,zr),this._charsetService.setgCharset(3,zr);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(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){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(),t.params[e]===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(t,e){(m=>(m[m.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",m[m.SET=1]="SET",m[m.RESET=2]="RESET",m[m.PERMANENTLY_SET=3]="PERMANENTLY_SET",m[m.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:h}=this._bufferService,{active:l,alt:c}=a,u=this._optionsService.rawOptions,d=(m,x)=>(o.triggerDataEvent(`${$.ESC}[${e?"":"?"}${m};${x}$y`),!0),f=m=>m?1:2,p=t.params[0];return e?p===2?d(p,4):p===4?d(p,f(o.modes.insertMode)):p===12?d(p,3):p===20?d(p,f(u.convertEol)):d(p,0):p===1?d(p,f(r.applicationCursorKeys)):p===3?d(p,u.windowOptions.setWinLines?h===80?2:h===132?1:0:0):p===6?d(p,f(r.origin)):p===7?d(p,f(r.wraparound)):p===8?d(p,3):p===9?d(p,f(s==="X10")):p===12?d(p,f(u.cursorBlink)):p===25?d(p,f(!o.isCursorHidden)):p===45?d(p,f(r.reverseWraparound)):p===66?d(p,f(r.applicationKeypad)):p===67?d(p,4):p===1e3?d(p,f(s==="VT200")):p===1002?d(p,f(s==="DRAG")):p===1003?d(p,f(s==="ANY")):p===1004?d(p,f(r.sendFocus)):p===1005?d(p,4):p===1006?d(p,f(n==="SGR")):p===1015?d(p,4):p===1016?d(p,f(n==="SGR_PIXELS")):p===1048?d(p,1):p===47||p===1047||p===1049?d(p,f(l===c)):p===2004?d(p,f(r.bracketedPasteMode)):p===2026?d(p,f(r.synchronizedOutput)):d(p,0)}_updateAttrColor(t,e,i,r,s){return e===2?(t|=50331648,t&=-16777216,t|=xo.fromColorRGB([i,r,s])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),a=0;do r[1]===5&&(s=1),r[n+a+1+s]=o[a];while(++a<o.length&&a+n+1+s<r.length);break}if(r[1]===5&&n+s>=2||r[1]===2&&n+s>=5)break;r[1]&&(s=1)}while(++n+e<t.length&&n+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return n}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=$e.fg,t.bg=$e.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,r=this._curAttrData;for(let s=0;s<e;s++)i=t.params[s],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(t.hasSubParams(s)?t.getSubParams(s)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=$e.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=$e.bg&16777215):i===38||i===48||i===58?s+=this._extractColor(t,s,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=$e.fg&16777215,r.bg&=-67108864,r.bg|=$e.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=$e.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(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){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 i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!rp(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>ip&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>ip&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){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(t){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(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let r=i.shift(),s=i.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(op(n))if(s==="?")e.push({type:0,index:n});else{let o=tp(s);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),r=t.slice(e+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),r,s=i.findIndex(n=>n.startsWith("id="));return s!==-1&&(r=i[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let r=0;r<i.length&&!(e>=this._specialColors.length);++r,++e)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let s=tp(i[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[e],color:s}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let s=parseInt(i[r]);op(s)&&e.push({type:2,index:s})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){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,zr),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(sb[t[0]],Ke[t[1]]||zr),!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 t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,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=$e.clone(),this._eraseAttrDataInternal=$e.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new ri;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,r=this._activeBuffer.lines.get(i);r&&(r.fill(t),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=o=>(this._coreService.triggerDataEvent(`${$.ESC}${o}${$.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},Su=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(np=t,t=e,e=np),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Su=Be([H(0,Et)],Su);function op(t){return 0<=t&&t<256}var ob=5e7,ap=12,ab=50,lb=class extends ee{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 z),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){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 r;for(;r=this._writeBuffer.shift();){this._action(r);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>ob)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(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],n=this._action(s,i);if(n){let a=h=>performance.now()-r>=ap?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(r,h);n.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(a);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-r>=ap)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>ab&&(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()}},wu=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let h=i.addMarker(i.ybase+i.y),l={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(l,h)),this._dataByLinkId.set(l.id,l),l.id}let r=e,s=this._getEntryIdKey(r),n=this._entriesWithId.get(s);if(n)return this.addLineToLink(n.id,i.ybase+i.y),n.id;let o=i.addMarker(i.ybase+i.y),a={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(a,o)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,i){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(s=>s.line!==i)){let s=this._bufferService.buffer.addMarker(i);r.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(r,s))}}getLinkData(e){var i;return(i=this._dataByLinkId.get(e))==null?void 0:i.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let r=e.lines.indexOf(i);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};wu=Be([H(0,Et)],wu);var lp=!1,hb=class extends ee{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ys),this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onData=this._register(new z),this.onData=this._onData.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new z),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new z),this._instantiationService=new BC,this.optionsService=this._register(new HC(e)),this._instantiationService.setService(Lt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(gu)),this._instantiationService.setService(Et,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(pu)),this._instantiationService.setService(Tm,this._logService),this.coreService=this._register(this._instantiationService.createInstance(vu)),this._instantiationService.setService(ls,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(mu)),this._instantiationService.setService(Rm,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Hr)),this._instantiationService.setService(Rw,this.unicodeService),this._charsetService=this._instantiationService.createInstance(GC),this._instantiationService.setService(Mw,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(wu),this._instantiationService.setService(Pm,this._oscLinkService),this._inputHandler=this._register(new nb(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ht.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ht.forward(this._bufferService.onResize,this._onResize)),this._register(ht.forward(this.coreService.onData,this._onData)),this._register(ht.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 lb((i,r)=>this._inputHandler.parse(i,r))),this._register(ht.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new z),this._onScroll.event(e=>{var i;(i=this._onScrollApi)==null||i.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 i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!lp&&(this._logService.warn("writeSync is unreliable and will be removed soon."),lp=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,h0),i=Math.max(i,c0),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}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 i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.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(J_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(J_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=xe(()=>{for(let i of e)i.dispose()})}}},cb={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 ub(t,e,i,r){var o;let s={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?s.key=$.ESC+"OA":s.key=$.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?s.key=$.ESC+"OD":s.key=$.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?s.key=$.ESC+"OC":s.key=$.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?s.key=$.ESC+"OB":s.key=$.ESC+"[B");break;case 8:s.key=t.ctrlKey?"\b":$.DEL,t.altKey&&(s.key=$.ESC+s.key);break;case 9:if(t.shiftKey){s.key=$.ESC+"[Z";break}s.key=$.HT,s.cancel=!0;break;case 13:s.key=t.altKey?$.ESC+$.CR:$.CR,s.cancel=!0;break;case 27:s.key=$.ESC,t.altKey&&(s.key=$.ESC+$.ESC),s.cancel=!0;break;case 37:if(t.metaKey)break;n?s.key=$.ESC+"[1;"+(n+1)+"D":e?s.key=$.ESC+"OD":s.key=$.ESC+"[D";break;case 39:if(t.metaKey)break;n?s.key=$.ESC+"[1;"+(n+1)+"C":e?s.key=$.ESC+"OC":s.key=$.ESC+"[C";break;case 38:if(t.metaKey)break;n?s.key=$.ESC+"[1;"+(n+1)+"A":e?s.key=$.ESC+"OA":s.key=$.ESC+"[A";break;case 40:if(t.metaKey)break;n?s.key=$.ESC+"[1;"+(n+1)+"B":e?s.key=$.ESC+"OB":s.key=$.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(s.key=$.ESC+"[2~");break;case 46:n?s.key=$.ESC+"[3;"+(n+1)+"~":s.key=$.ESC+"[3~";break;case 36:n?s.key=$.ESC+"[1;"+(n+1)+"H":e?s.key=$.ESC+"OH":s.key=$.ESC+"[H";break;case 35:n?s.key=$.ESC+"[1;"+(n+1)+"F":e?s.key=$.ESC+"OF":s.key=$.ESC+"[F";break;case 33:t.shiftKey?s.type=2:t.ctrlKey?s.key=$.ESC+"[5;"+(n+1)+"~":s.key=$.ESC+"[5~";break;case 34:t.shiftKey?s.type=3:t.ctrlKey?s.key=$.ESC+"[6;"+(n+1)+"~":s.key=$.ESC+"[6~";break;case 112:n?s.key=$.ESC+"[1;"+(n+1)+"P":s.key=$.ESC+"OP";break;case 113:n?s.key=$.ESC+"[1;"+(n+1)+"Q":s.key=$.ESC+"OQ";break;case 114:n?s.key=$.ESC+"[1;"+(n+1)+"R":s.key=$.ESC+"OR";break;case 115:n?s.key=$.ESC+"[1;"+(n+1)+"S":s.key=$.ESC+"OS";break;case 116:n?s.key=$.ESC+"[15;"+(n+1)+"~":s.key=$.ESC+"[15~";break;case 117:n?s.key=$.ESC+"[17;"+(n+1)+"~":s.key=$.ESC+"[17~";break;case 118:n?s.key=$.ESC+"[18;"+(n+1)+"~":s.key=$.ESC+"[18~";break;case 119:n?s.key=$.ESC+"[19;"+(n+1)+"~":s.key=$.ESC+"[19~";break;case 120:n?s.key=$.ESC+"[20;"+(n+1)+"~":s.key=$.ESC+"[20~";break;case 121:n?s.key=$.ESC+"[21;"+(n+1)+"~":s.key=$.ESC+"[21~";break;case 122:n?s.key=$.ESC+"[23;"+(n+1)+"~":s.key=$.ESC+"[23~";break;case 123:n?s.key=$.ESC+"[24;"+(n+1)+"~":s.key=$.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?s.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?s.key=$.NUL:t.keyCode>=51&&t.keyCode<=55?s.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?s.key=$.DEL:t.keyCode===219?s.key=$.ESC:t.keyCode===220?s.key=$.FS:t.keyCode===221&&(s.key=$.GS);else if((!i||r)&&t.altKey&&!t.metaKey){let a=(o=cb[t.keyCode])==null?void 0:o[t.shiftKey?1:0];if(a)s.key=$.ESC+a;else if(t.keyCode>=65&&t.keyCode<=90){let h=t.ctrlKey?t.keyCode-64:t.keyCode+32,l=String.fromCharCode(h);t.shiftKey&&(l=l.toUpperCase()),s.key=$.ESC+l}else if(t.keyCode===32)s.key=$.ESC+(t.ctrlKey?$.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let h=t.code.slice(3,4);t.shiftKey||(h=h.toLowerCase()),s.key=$.ESC+h,s.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(s.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?s.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(s.key=$.US),t.key==="@"&&(s.key=$.NUL));break}return s}var Ae=0,db=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ol,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ol,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((n,o)=>this._getKey(n)-this._getKey(o)),i=0,r=0,s=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<s.length;n++)r>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[r])?(s[n]=e[i],i++):s[n]=this._array[r++];this._array=s,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 i=this._getKey(e);if(i===void 0||(Ae=this._search(i),Ae===-1)||this._getKey(this._array[Ae])!==i)return!1;do if(this._array[Ae]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ae),!0;while(++Ae<this._array.length&&this._getKey(this._array[Ae])===i);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,o)=>n-o),i=0,r=new Array(this._array.length-e.length),s=0;for(let n=0;n<this._array.length;n++)e[i]===n?i++:r[s++]=this._array[n];this._array=r,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&&(Ae=this._search(e),!(Ae<0||Ae>=this._array.length)&&this._getKey(this._array[Ae])===e))do yield this._array[Ae];while(++Ae<this._array.length&&this._getKey(this._array[Ae])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ae=this._search(e),!(Ae<0||Ae>=this._array.length)&&this._getKey(this._array[Ae])===e))do i(this._array[Ae]);while(++Ae<this._array.length&&this._getKey(this._array[Ae])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,r=this._array.length-1;for(;r>=i;){let s=i+r>>1,n=this._getKey(this._array[s]);if(n>e)r=s-1;else if(n<e)i=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return i}},kh=0,hp=0,fb=class extends ee{constructor(){super(),this._decorations=new db(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this._register(new z),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new z),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(xe(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new _b(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),r=e.onDispose(()=>{r.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let r=0,s=0;for(let n of this._decorations.getKeyIterator(e))r=n.options.x??0,s=r+(n.options.width??1),t>=r&&t<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(t,e,i,r){this._decorations.forEachByKey(e,s=>{kh=s.options.x??0,hp=kh+(s.options.width??1),t>=kh&&t<hp&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},_b=class extends kr{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new z),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new z),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=be.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=be.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},pb=1e3,gb=class{constructor(e,i=pb){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,r){this._rowCount=r,e=e!==void 0?e:0,i=i!==void 0?i: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,i):i;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=s-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},cp=20,al=class extends ee{constructor(t,e,i,r){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new gb(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(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
80
80
|
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Y(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(xe(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e<t;e++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<cp+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
|
|
81
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===cp+1&&(this._liveRegion.textContent+=jc.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,r=i.lines.length.toString();for(let s=t;s<=e;s++){let n=i.lines.get(i.ydisp+s),o=[],a=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",h=(i.ydisp+s+1).toString(),l=this._rowElements[s];l&&(a.length===0?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=a,this._rowColumns.set(l,o)),l.setAttribute("aria-posinset",h),l.setAttribute("aria-setsize",r),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,r=this._rowElements[e===0?1:this._rowElements.length-2],s=i.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||t.relatedTarget!==r)return;let o,a;if(e===0?(o=i,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((a=r.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(i.node))return;let s=({node:h,offset:l})=>{let c=h instanceof Text?h.parentNode:h,u=parseInt(c==null?void 0:c.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(c);if(!d)return console.warn("columns is null. Race condition?"),null;let f=l<d.length?d[l]:d.slice(-1)[0]+1;return f>=this._terminal.cols&&(++u,f=0),{row:u,column:f}},n=s(e),o=s(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_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 t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){var s,n;t.style.transform="";let e=t.getBoundingClientRect().width,i=(n=(s=this._rowColumns.get(t))==null?void 0:s.slice(-1))==null?void 0:n[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${r/e})`}};al=Be([H(1,Ad),H(2,Zi),H(3,Ji)],al);var xu=class extends ee{constructor(t,e,i,r,s){super(),this._element=t,this._mouseService=e,this._renderService=i,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new z),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new z),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(xe(()=>{var n;ss(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Y(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Y(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Y(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Y(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let r=0;r<i.length;r++){let s=i[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){var r,s;(!this._activeProviderReplies||!e)&&((r=this._activeProviderReplies)==null||r.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())e?(s=this._activeProviderReplies)!=null&&s.get(n)&&(i=this._checkLinkProviderResult(n,t,i)):o.provideLinks(t.y,a=>{var l,c;if(this._isMouseOut)return;let h=a==null?void 0:a.map(u=>({link:u}));(l=this._activeProviderReplies)==null||l.set(n,h),i=this._checkLinkProviderResult(n,t,i),((c=this._activeProviderReplies)==null?void 0:c.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let r=0;r<e.size;r++){let s=e.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],a=o.link.range.start.y<t?0:o.link.range.start.x,h=o.link.range.end.y>t?this._bufferService.cols:o.link.range.end.x;for(let l=a;l<=h;l++){if(i.has(l)){s.splice(n--,1);break}i.add(l)}}}}_checkLinkProviderResult(t,e,i){var n;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(t),s=!1;for(let o=0;o<t;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(a=>this._linkAtPosition(a.link,e));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(h=>this._linkAtPosition(h.link,e));if(a){i=!0,this._handleNewLink(a);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&v2(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ss(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.pointerCursor},set:i=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.underline},set:i=>{var r,s,n;(r=this._currentLink)!=null&&r.state&&((n=(s=this._currentLink)==null?void 0:s.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(t,e,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,r=t.range.end.y*this._bufferService.cols+t.range.end.x,s=e.y*this._bufferService.cols+e.x;return i<=s&&s<=r}_positionFromMouseEvent(t,e,i){let r=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,r,s){return{x1:t,y1:e,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};xu=Be([H(1,Nd),H(2,Ji),H(3,Et),H(4,Bm)],xu);function v2(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var m2=class extends h2{constructor(e={}){super(e),this._linkifier=this._register(new Ys),this.browser=Zm,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ys),this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new z),this.onKey=this._onKey.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new z),this.onBell=this._onBell.event,this._onFocus=this._register(new z),this._onBlur=this._register(new z),this._onA11yCharEmitter=this._register(new z),this._onA11yTabEmitter=this._register(new z),this._onWillOpen=this._register(new z),this._setup(),this._decorationService=this._instantiationService.createInstance(f2),this._instantiationService.setService(Co,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(aC),this._instantiationService.setService(Bm,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Hc)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh((i==null?void 0:i.start)??0,(i==null?void 0:i.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(ht.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ht.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ht.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ht.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(xe(()=>{var i,r;this._customKeyEventHandler=void 0,(r=(i=this.element)==null?void 0:i.parentNode)==null||r.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 i of e){let r,s="";switch(i.index){case 256:r="foreground",s="10";break;case 257:r="background",s="11";break;case 258:r="cursor",s="12";break;default:r="ansi",s="4;"+i.index}switch(i.type){case 0:let n=ve.toColorRGB(r==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${$.ESC}]${s};${r2(n)}${Xm.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(o=>o.ansi[i.index]=Ie.toColor(...i.color));else{let o=r;this._themeService.modifyColors(a=>a[o]=Ie.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.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(al,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,n=i.getWidth(r),o=this._renderService.dimensions.css.cell.width*n,a=this.buffer.y*this._renderService.dimensions.css.cell.height,h=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=a+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Y(this.element,"copy",i=>{this.hasSelection()&&xw(i,this._selectionService)}));let e=i=>Cw(i,this.textarea,this.coreService,this.optionsService);this._register(Y(this.textarea,"paste",e)),this._register(Y(this.element,"paste",e)),Jm?this._register(Y(this.element,"mousedown",i=>{i.button===2&&S_(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Y(this.element,"contextmenu",i=>{S_(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Hd&&this._register(Y(this.element,"auxclick",i=>{i.button===1&&bm(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Y(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Y(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Y(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Y(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Y(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Y(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Y(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;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"),((n=this.element)==null?void 0:n.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 i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Y(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Fc.get()),i0||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",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(nC,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Zi,this._coreBrowserService),this._register(Y(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Y(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(cu,this._document,this._helperContainer),this._instantiationService.setService(Rl,this._charSizeService),this._themeService=this._instantiationService.createInstance(_u),this._instantiationService.setService(Js,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(sl),this._instantiationService.setService(Dm,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(du,this.rows,this.screenElement)),this._instantiationService.setService(Ji,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(au,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(uu),this._instantiationService.setService(Nd,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(xu,this.screenElement));this.element.appendChild(i);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(nu,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(fu,this.element,this.screenElement,s)),this._instantiationService.setService(Pw,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(ht.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(ou,this.screenElement)),this._register(Y(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(al,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(rl,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(rl,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(hu,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(o){var c,u,d,f,p;let a=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!a)return!1;let h,l;switch(o.overrideType||o.type){case"mousemove":l=32,o.buttons===void 0?(h=3,o.button!==void 0&&(h=o.button<3?o.button:3)):h=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":l=0,h=o.button<3?o.button:3;break;case"mousedown":l=1,h=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let m=o.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(o,(f=(d=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:d.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;l=m<0?0:1,h=4;break;default:return!1}return l===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:h,action:l,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(r(o),o.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(o)),wheel:o=>(r(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&r(o)},mousemove:o=>{o.buttons||r(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?s.mousemove||(i.addEventListener("mousemove",n.mousemove),s.mousemove=n.mousemove):(i.removeEventListener("mousemove",s.mousemove),s.mousemove=null),o&16?s.wheel||(i.addEventListener("wheel",n.wheel,{passive:!1}),s.wheel=n.wheel):(i.removeEventListener("wheel",s.wheel),s.wheel=null),o&2?s.mouseup||(s.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),o&4?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Y(i,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return r(o),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(o)})),this._register(Y(i,"wheel",o=>{var a,h,l,c,u;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(c=(l=(h=(a=e._renderService)==null?void 0:a.dimensions)==null?void 0:h.device)==null?void 0:l.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(o,!0);let d=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,i){var r;(r=this._renderService)==null||r.refreshRows(e,i)}updateCursorStyle(e){var i;(i=this._selectionService)!=null&&i.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,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),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 i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){Cm(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 i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}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,i,r){this._selectionService.setSelection(e,i,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,i){var r;(r=this._selectionService)==null||r.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=u2(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let s=this.rows-1;return this.scrollLines(r.type===2?-s:s),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.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((r.key===$.ETX||r.key===$.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(y2(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!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 i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){var r;(r=this._charSizeService)==null||r.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($e));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var i;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(i=this._selectionService)==null||i.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent($.ESC+"[I"):this.coreService.triggerDataEvent($.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${r};${i}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${n};${s}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}};function y2(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var S2=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let r={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(r),i.dispose=()=>this._wrappedAddonDispose(r),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){i=r;break}if(i===-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(i,1)}},w2=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new ri)}translateToString(e,i,r){return this._line.translateToString(e,i,r)}},up=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,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(t){let e=this._buffer.lines.get(t);if(e)return new w2(e)}getNullCell(){return new ri}},x2=class extends ee{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new z),this.onBufferChange=this._onBufferChange.event,this._normal=new up(this._core.buffers.normal,"normal"),this._alternate=new up(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)}},C2=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,r)=>e(i,r.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},b2=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}},k2=["cols","rows"],wi=0,E2=class extends ee{constructor(t){super(),this._core=this._register(new m2(t)),this._addonManager=this._register(new S2),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],i=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(t){if(k2.includes(t))throw new Error(`Option "${t}" 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 C2(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new b2(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 x2(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
81
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===cp+1&&(this._liveRegion.textContent+=jc.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,r=i.lines.length.toString();for(let s=t;s<=e;s++){let n=i.lines.get(i.ydisp+s),o=[],a=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",h=(i.ydisp+s+1).toString(),l=this._rowElements[s];l&&(a.length===0?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=a,this._rowColumns.set(l,o)),l.setAttribute("aria-posinset",h),l.setAttribute("aria-setsize",r),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,r=this._rowElements[e===0?1:this._rowElements.length-2],s=i.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||t.relatedTarget!==r)return;let o,a;if(e===0?(o=i,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((a=r.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(i.node))return;let s=({node:h,offset:l})=>{let c=h instanceof Text?h.parentNode:h,u=parseInt(c==null?void 0:c.getAttribute("aria-posinset"),10)-1;if(isNaN(u))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(c);if(!d)return console.warn("columns is null. Race condition?"),null;let f=l<d.length?d[l]:d.slice(-1)[0]+1;return f>=this._terminal.cols&&(++u,f=0),{row:u,column:f}},n=s(e),o=s(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_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 t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){var s,n;t.style.transform="";let e=t.getBoundingClientRect().width,i=(n=(s=this._rowColumns.get(t))==null?void 0:s.slice(-1))==null?void 0:n[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${r/e})`}};al=Be([H(1,Ad),H(2,Zi),H(3,Ji)],al);var xu=class extends ee{constructor(t,e,i,r,s){super(),this._element=t,this._mouseService=e,this._renderService=i,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new z),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new z),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(xe(()=>{var n;ss(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Y(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Y(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Y(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Y(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let r=0;r<i.length;r++){let s=i[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){var r,s;(!this._activeProviderReplies||!e)&&((r=this._activeProviderReplies)==null||r.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())e?(s=this._activeProviderReplies)!=null&&s.get(n)&&(i=this._checkLinkProviderResult(n,t,i)):o.provideLinks(t.y,a=>{var l,c;if(this._isMouseOut)return;let h=a==null?void 0:a.map(u=>({link:u}));(l=this._activeProviderReplies)==null||l.set(n,h),i=this._checkLinkProviderResult(n,t,i),((c=this._activeProviderReplies)==null?void 0:c.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let r=0;r<e.size;r++){let s=e.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],a=o.link.range.start.y<t?0:o.link.range.start.x,h=o.link.range.end.y>t?this._bufferService.cols:o.link.range.end.x;for(let l=a;l<=h;l++){if(i.has(l)){s.splice(n--,1);break}i.add(l)}}}}_checkLinkProviderResult(t,e,i){var n;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(t),s=!1;for(let o=0;o<t;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(a=>this._linkAtPosition(a.link,e));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(h=>this._linkAtPosition(h.link,e));if(a){i=!0,this._handleNewLink(a);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&vb(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ss(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.pointerCursor},set:i=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.underline},set:i=>{var r,s,n;(r=this._currentLink)!=null&&r.state&&((n=(s=this._currentLink)==null?void 0:s.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(t,e,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,r=t.range.end.y*this._bufferService.cols+t.range.end.x,s=e.y*this._bufferService.cols+e.x;return i<=s&&s<=r}_positionFromMouseEvent(t,e,i){let r=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,r,s){return{x1:t,y1:e,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};xu=Be([H(1,Nd),H(2,Ji),H(3,Et),H(4,Bm)],xu);function vb(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var mb=class extends hb{constructor(e={}){super(e),this._linkifier=this._register(new Ys),this.browser=Zm,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ys),this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new z),this.onKey=this._onKey.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new z),this.onBell=this._onBell.event,this._onFocus=this._register(new z),this._onBlur=this._register(new z),this._onA11yCharEmitter=this._register(new z),this._onA11yTabEmitter=this._register(new z),this._onWillOpen=this._register(new z),this._setup(),this._decorationService=this._instantiationService.createInstance(fb),this._instantiationService.setService(Co,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(aC),this._instantiationService.setService(Bm,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Hc)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh((i==null?void 0:i.start)??0,(i==null?void 0:i.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(ht.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ht.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ht.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ht.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(xe(()=>{var i,r;this._customKeyEventHandler=void 0,(r=(i=this.element)==null?void 0:i.parentNode)==null||r.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 i of e){let r,s="";switch(i.index){case 256:r="foreground",s="10";break;case 257:r="background",s="11";break;case 258:r="cursor",s="12";break;default:r="ansi",s="4;"+i.index}switch(i.type){case 0:let n=me.toColorRGB(r==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${$.ESC}]${s};${rb(n)}${Xm.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(o=>o.ansi[i.index]=Ie.toColor(...i.color));else{let o=r;this._themeService.modifyColors(a=>a[o]=Ie.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.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(al,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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,i=this.buffer.lines.get(e);if(!i)return;let r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,n=i.getWidth(r),o=this._renderService.dimensions.css.cell.width*n,a=this.buffer.y*this._renderService.dimensions.css.cell.height,h=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=a+"px",this.textarea.style.width=o+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Y(this.element,"copy",i=>{this.hasSelection()&&xw(i,this._selectionService)}));let e=i=>Cw(i,this.textarea,this.coreService,this.optionsService);this._register(Y(this.textarea,"paste",e)),this._register(Y(this.element,"paste",e)),Jm?this._register(Y(this.element,"mousedown",i=>{i.button===2&&S_(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Y(this.element,"contextmenu",i=>{S_(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Hd&&this._register(Y(this.element,"auxclick",i=>{i.button===1&&bm(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Y(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Y(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Y(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Y(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Y(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Y(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Y(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;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"),((n=this.element)==null?void 0:n.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 i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Y(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Fc.get()),i0||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",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(nC,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Zi,this._coreBrowserService),this._register(Y(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Y(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(cu,this._document,this._helperContainer),this._instantiationService.setService(Rl,this._charSizeService),this._themeService=this._instantiationService.createInstance(_u),this._instantiationService.setService(Js,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(sl),this._instantiationService.setService(Dm,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(du,this.rows,this.screenElement)),this._instantiationService.setService(Ji,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(au,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(uu),this._instantiationService.setService(Nd,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(xu,this.screenElement));this.element.appendChild(i);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(nu,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(fu,this.element,this.screenElement,s)),this._instantiationService.setService(Pw,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(ht.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(ou,this.screenElement)),this._register(Y(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(al,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(rl,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(rl,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(hu,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(o){var c,u,d,f,p;let a=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!a)return!1;let h,l;switch(o.overrideType||o.type){case"mousemove":l=32,o.buttons===void 0?(h=3,o.button!==void 0&&(h=o.button<3?o.button:3)):h=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":l=0,h=o.button<3?o.button:3;break;case"mousedown":l=1,h=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let m=o.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(o,(f=(d=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:d.cell)==null?void 0:f.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return!1;l=m<0?0:1,h=4;break;default:return!1}return l===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:a.col,row:a.row,x:a.x,y:a.y,button:h,action:l,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(r(o),o.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(o)),wheel:o=>(r(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&r(o)},mousemove:o=>{o.buttons||r(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?s.mousemove||(i.addEventListener("mousemove",n.mousemove),s.mousemove=n.mousemove):(i.removeEventListener("mousemove",s.mousemove),s.mousemove=null),o&16?s.wheel||(i.addEventListener("wheel",n.wheel,{passive:!1}),s.wheel=n.wheel):(i.removeEventListener("wheel",s.wheel),s.wheel=null),o&2?s.mouseup||(s.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),o&4?s.mousedrag||(s.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Y(i,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return r(o),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(o)})),this._register(Y(i,"wheel",o=>{var a,h,l,c,u;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(c=(l=(h=(a=e._renderService)==null?void 0:a.dimensions)==null?void 0:h.device)==null?void 0:l.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(o,!0);let d=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,i){var r;(r=this._renderService)==null||r.refreshRows(e,i)}updateCursorStyle(e){var i;(i=this._selectionService)!=null&&i.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,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),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 i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){Cm(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 i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}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,i,r){this._selectionService.setSelection(e,i,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,i){var r;(r=this._selectionService)==null||r.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=ub(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let s=this.rows-1;return this.scrollLines(r.type===2?-s:s),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.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((r.key===$.ETX||r.key===$.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let r=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?r:r&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(yb(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!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 i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){var r;(r=this._charSizeService)==null||r.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($e));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var i;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(i=this._selectionService)==null||i.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent($.ESC+"[I"):this.coreService.triggerDataEvent($.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[4;${r};${i}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${$.ESC}[6;${n};${s}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}};function yb(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var Sb=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let r={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(r),i.dispose=()=>this._wrappedAddonDispose(r),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){i=r;break}if(i===-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(i,1)}},wb=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new ri)}translateToString(e,i,r){return this._line.translateToString(e,i,r)}},up=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,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(t){let e=this._buffer.lines.get(t);if(e)return new wb(e)}getNullCell(){return new ri}},xb=class extends ee{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new z),this.onBufferChange=this._onBufferChange.event,this._normal=new up(this._core.buffers.normal,"normal"),this._alternate=new up(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)}},Cb=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,r)=>e(i,r.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},bb=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}},kb=["cols","rows"],wi=0,Eb=class extends ee{constructor(t){super(),this._core=this._register(new mb(t)),this._addonManager=this._register(new Sb),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],i=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(t){if(kb.includes(t))throw new Error(`Option "${t}" 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 Cb(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new bb(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 xb(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
|
|
82
82
|
`,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return Fc.get()},set promptLabel(t){Fc.set(t)},get tooMuchOutput(){return jc.get()},set tooMuchOutput(t){jc.set(t)}}}_verifyIntegers(...t){for(wi of t)if(wi===1/0||isNaN(wi)||wi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(wi of t)if(wi&&(wi===1/0||isNaN(wi)||wi%1!==0||wi<0))throw new Error("This API only accepts positive integers")}};/**
|
|
83
83
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
84
84
|
* @license MIT
|
|
@@ -90,7 +90,7 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
90
90
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
91
91
|
* http://bellard.org/jslinux/
|
|
92
92
|
* Copyright (c) 2011 Fabrice Bellard
|
|
93
|
-
*/var
|
|
93
|
+
*/var Lb=2,Mb=1,dp=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var u;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:((u=this._terminal.options.overviewRuler)==null?void 0:u.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,h=o.right+o.left,l=r-a,c=s-h-e;return{cols:Math.max(Lb,Math.floor(c/t.css.cell.width)),rows:Math.max(Mb,Math.floor(l/t.css.cell.height))}}};/**
|
|
94
94
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
95
95
|
* @license MIT
|
|
96
96
|
*
|
|
@@ -101,7 +101,7 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
101
101
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
102
102
|
* http://bellard.org/jslinux/
|
|
103
103
|
* Copyright (c) 2011 Fabrice Bellard
|
|
104
|
-
*/var
|
|
104
|
+
*/var Rb=class{constructor(t,e,i,r={}){this._terminal=t,this._regex=e,this._handler=i,this._options=r}provideLinks(t,e){let i=Pb.computeLink(t,this._regex,this._terminal,this._handler);e(this._addCallbacks(i))}_addCallbacks(t){return t.map(e=>(e.leave=this._options.leave,e.hover=(i,r)=>{if(this._options.hover){let{range:s}=e;this._options.hover(i,r,s)}},e))}};function Tb(t){try{let e=new URL(t),i=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return t.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var Pb=class ba{static computeLink(e,i,r,s){let n=new RegExp(i.source,(i.flags||"")+"g"),[o,a]=ba._getWindowedLineStrings(e-1,r),h=o.join(""),l,c=[];for(;l=n.exec(h);){let u=l[0];if(!Tb(u))continue;let[d,f]=ba._mapStrIdx(r,a,0,l.index),[p,m]=ba._mapStrIdx(r,d,f,u.length);if(d===-1||f===-1||p===-1||m===-1)continue;let x={start:{x:f+1,y:d+1},end:{x:m,y:p+1}};c.push({range:x,text:u,activate:s})}return c}static _getWindowedLineStrings(e,i){let r,s=e,n=e,o=0,a="",h=[];if(r=i.buffer.active.getLine(e)){let l=r.translateToString(!0);if(r.isWrapped&&l[0]!==" "){for(o=0;(r=i.buffer.active.getLine(--s))&&o<2048&&(a=r.translateToString(!0),o+=a.length,h.push(a),!(!r.isWrapped||a.indexOf(" ")!==-1)););h.reverse()}for(h.push(l),o=0;(r=i.buffer.active.getLine(++n))&&r.isWrapped&&o<2048&&(a=r.translateToString(!0),o+=a.length,h.push(a),a.indexOf(" ")===-1););}return[h,s]}static _mapStrIdx(e,i,r,s){let n=e.buffer.active,o=n.getNullCell(),a=r;for(;s;){let h=n.getLine(i);if(!h)return[-1,-1];for(let l=a;l<h.length;++l){h.getCell(l,o);let c=o.getChars();if(o.getWidth()&&(s-=c.length||1,l===h.length-1&&c==="")){let u=n.getLine(i+1);u&&u.isWrapped&&(u.getCell(0,o),o.getWidth()===2&&(s+=1))}if(s<0)return[i,l]}i++,a=0}return[i,a]}},Db=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Bb(t,e){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}var Ab=class{constructor(t=Bb,e={}){this._handler=t,this._options=e}activate(t){this._terminal=t;let e=this._options,i=e.urlRegex||Db;this._linkProvider=this._terminal.registerLinkProvider(new Rb(this._terminal,i,this._handler,e))}dispose(){var t;(t=this._linkProvider)==null||t.dispose()}};/**
|
|
105
105
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
106
106
|
* @license MIT
|
|
107
107
|
*
|
|
@@ -112,13 +112,13 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
112
112
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
113
113
|
* http://bellard.org/jslinux/
|
|
114
114
|
* Copyright (c) 2011 Fabrice Bellard
|
|
115
|
-
*/var
|
|
115
|
+
*/var Nb=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?fp.isErrorNoTelemetry(t)?new fp(t.message+`
|
|
116
116
|
|
|
117
117
|
`+t.stack):new Error(t.message+`
|
|
118
118
|
|
|
119
|
-
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},$2=new N2;function Eh(t){O2(t)||$2.onUnexpectedError(t)}var Cu="Canceled";function O2(t){return t instanceof I2?!0:t instanceof Error&&t.name===Cu&&t.message===Cu}var I2=class extends Error{constructor(){super(Cu),this.name=this.message}},fp=class bu extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof bu)return e;let i=new bu;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},z2;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(z2||(z2={}));function F2(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var d0;(t=>{function e(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(y){yield y}t.single=s;function n(y){return e(y)?y:s(y)}t.wrap=n;function o(y){return y||i}t.from=o;function*a(y){for(let L=y.length-1;L>=0;L--)yield y[L]}t.reverse=a;function h(y){return!y||y[Symbol.iterator]().next().done===!0}t.isEmpty=h;function l(y){return y[Symbol.iterator]().next().value}t.first=l;function c(y,L){let P=0;for(let N of y)if(L(N,P++))return!0;return!1}t.some=c;function u(y,L){for(let P of y)if(L(P))return P}t.find=u;function*d(y,L){for(let P of y)L(P)&&(yield P)}t.filter=d;function*f(y,L){let P=0;for(let N of y)yield L(N,P++)}t.map=f;function*p(y,L){let P=0;for(let N of y)yield*L(N,P++)}t.flatMap=p;function*m(...y){for(let L of y)yield*L}t.concat=m;function x(y,L,P){let N=P;for(let B of y)N=L(N,B);return N}t.reduce=x;function*_(y,L,P=y.length){for(L<0&&(L+=y.length),P<0?P+=y.length:P>y.length&&(P=y.length);L<P;L++)yield y[L]}t.slice=_;function g(y,L=Number.POSITIVE_INFINITY){let P=[];if(L===0)return[P,y];let N=y[Symbol.iterator]();for(let B=0;B<L;B++){let U=N.next();if(U.done)return[P,t.empty()];P.push(U.value)}return[P,{[Symbol.iterator](){return N}}]}t.consume=g;async function S(y){let L=[];for await(let P of y)L.push(P);return Promise.resolve(L)}t.asyncToArray=S})(d0||(d0={}));function Kn(t){if(d0.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function f0(...t){return tn(()=>Kn(t))}function tn(t){return{dispose:F2(()=>{t()})}}var _0=class p0{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{Kn(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?p0.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};_0.DISABLE_DISPOSED_WARNING=!1;var Ud=_0,Mr=class{constructor(){this._store=new Ud,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)}};Mr.None=Object.freeze({dispose(){}});var ll=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var i;this._isDisposed||e===this._value||((i=this._value)==null||i.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},j2=globalThis.performance&&typeof globalThis.performance.now=="function",W2=class g0{static create(e){return new g0(e)}constructor(e){this._now=j2&&e===!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}},Kd;(t=>{t.None=()=>Mr.None;function e(C,w){return u(C,()=>{},0,void 0,!0,void 0,w)}t.defer=e;function i(C){return(w,b=null,k)=>{let M=!1,T;return T=C(E=>{if(!M)return T?T.dispose():M=!0,w.call(b,E)},null,k),M&&T.dispose(),T}}t.once=i;function r(C,w,b){return l((k,M=null,T)=>C(E=>k.call(M,w(E)),null,T),b)}t.map=r;function s(C,w,b){return l((k,M=null,T)=>C(E=>{w(E),k.call(M,E)},null,T),b)}t.forEach=s;function n(C,w,b){return l((k,M=null,T)=>C(E=>w(E)&&k.call(M,E),null,T),b)}t.filter=n;function o(C){return C}t.signal=o;function a(...C){return(w,b=null,k)=>{let M=f0(...C.map(T=>T(E=>w.call(b,E))));return c(M,k)}}t.any=a;function h(C,w,b,k){let M=b;return r(C,T=>(M=w(M,T),M),k)}t.reduce=h;function l(C,w){let b,k={onWillAddFirstListener(){b=C(M.fire,M)},onDidRemoveLastListener(){b==null||b.dispose()}},M=new ki(k);return w==null||w.add(M),M.event}function c(C,w){return w instanceof Array?w.push(C):w&&w.add(C),C}function u(C,w,b=100,k=!1,M=!1,T,E){let R,D,j,G=0,q,de={leakWarningThreshold:T,onWillAddFirstListener(){R=C(le=>{G++,D=w(D,le),k&&!j&&(Q.fire(D),D=void 0),q=()=>{let Z=D;D=void 0,j=void 0,(!k||G>1)&&Q.fire(Z),G=0},typeof b=="number"?(clearTimeout(j),j=setTimeout(q,b)):j===void 0&&(j=0,queueMicrotask(q))})},onWillRemoveListener(){M&&G>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,R.dispose()}},Q=new ki(de);return E==null||E.add(Q),Q.event}t.debounce=u;function d(C,w=0,b){return t.debounce(C,(k,M)=>k?(k.push(M),k):[M],w,void 0,!0,void 0,b)}t.accumulate=d;function f(C,w=(k,M)=>k===M,b){let k=!0,M;return n(C,T=>{let E=k||!w(T,M);return k=!1,M=T,E},b)}t.latch=f;function p(C,w,b){return[t.filter(C,w,b),t.filter(C,k=>!w(k),b)]}t.split=p;function m(C,w=!1,b=[],k){let M=b.slice(),T=C(D=>{M?M.push(D):R.fire(D)});k&&k.add(T);let E=()=>{M==null||M.forEach(D=>R.fire(D)),M=null},R=new ki({onWillAddFirstListener(){T||(T=C(D=>R.fire(D)),k&&k.add(T))},onDidAddFirstListener(){M&&(w?setTimeout(E):E())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return k&&k.add(R),R.event}t.buffer=m;function x(C,w){return(b,k,M)=>{let T=w(new g);return C(function(E){let R=T.evaluate(E);R!==_&&b.call(k,R)},void 0,M)}}t.chain=x;let _=Symbol("HaltChainable");class g{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(b=>(w(b),b)),this}filter(w){return this.steps.push(b=>w(b)?b:_),this}reduce(w,b){let k=b;return this.steps.push(M=>(k=w(k,M),k)),this}latch(w=(b,k)=>b===k){let b=!0,k;return this.steps.push(M=>{let T=b||!w(M,k);return b=!1,k=M,T?M:_}),this}evaluate(w){for(let b of this.steps)if(w=b(w),w===_)break;return w}}function S(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.on(w,k),T=()=>C.removeListener(w,k),E=new ki({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromNodeEventEmitter=S;function y(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.addEventListener(w,k),T=()=>C.removeEventListener(w,k),E=new ki({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromDOMEventEmitter=y;function L(C){return new Promise(w=>i(C)(w))}t.toPromise=L;function P(C){let w=new ki;return C.then(b=>{w.fire(b)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}t.fromPromise=P;function N(C,w){return C(b=>w.fire(b))}t.forward=N;function B(C,w,b){return w(b),C(k=>w(k))}t.runAndSubscribe=B;class U{constructor(w,b){this._observable=w,this._counter=0,this._hasChanged=!1;let k={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};this.emitter=new ki(k),b&&b.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,b){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function W(C,w){return new U(C,w).emitter.event}t.fromObservable=W;function V(C){return(w,b,k)=>{let M=0,T=!1,E={beginUpdate(){M++},endUpdate(){M--,M===0&&(C.reportChanges(),T&&(T=!1,w.call(b)))},handlePossibleChange(){},handleChange(){T=!0}};C.addObserver(E),C.reportChanges();let R={dispose(){C.removeObserver(E)}};return k instanceof Ud?k.add(R):Array.isArray(k)&&k.push(R),R}}t.fromObservableLight=V})(Kd||(Kd={}));var ku=class Eu{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Eu._idPool++}`,Eu.all.add(this)}start(e){this._stopWatch=new W2,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};ku.all=new Set,ku._idPool=0;var H2=ku,U2=-1,v0=class m0{constructor(e,i,r=(m0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new q2(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};v0._idPool=1;var K2=v0,V2=class y0{constructor(e){this.value=e}static create(){let e=new Error;return new y0(e.stack??"")}print(){console.warn(this.value.split(`
|
|
119
|
+
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},$b=new Nb;function Eh(t){Ob(t)||$b.onUnexpectedError(t)}var Cu="Canceled";function Ob(t){return t instanceof Ib?!0:t instanceof Error&&t.name===Cu&&t.message===Cu}var Ib=class extends Error{constructor(){super(Cu),this.name=this.message}},fp=class bu extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof bu)return e;let i=new bu;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},zb;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(zb||(zb={}));function Fb(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var d0;(t=>{function e(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(y){yield y}t.single=s;function n(y){return e(y)?y:s(y)}t.wrap=n;function o(y){return y||i}t.from=o;function*a(y){for(let L=y.length-1;L>=0;L--)yield y[L]}t.reverse=a;function h(y){return!y||y[Symbol.iterator]().next().done===!0}t.isEmpty=h;function l(y){return y[Symbol.iterator]().next().value}t.first=l;function c(y,L){let P=0;for(let N of y)if(L(N,P++))return!0;return!1}t.some=c;function u(y,L){for(let P of y)if(L(P))return P}t.find=u;function*d(y,L){for(let P of y)L(P)&&(yield P)}t.filter=d;function*f(y,L){let P=0;for(let N of y)yield L(N,P++)}t.map=f;function*p(y,L){let P=0;for(let N of y)yield*L(N,P++)}t.flatMap=p;function*m(...y){for(let L of y)yield*L}t.concat=m;function x(y,L,P){let N=P;for(let B of y)N=L(N,B);return N}t.reduce=x;function*_(y,L,P=y.length){for(L<0&&(L+=y.length),P<0?P+=y.length:P>y.length&&(P=y.length);L<P;L++)yield y[L]}t.slice=_;function g(y,L=Number.POSITIVE_INFINITY){let P=[];if(L===0)return[P,y];let N=y[Symbol.iterator]();for(let B=0;B<L;B++){let U=N.next();if(U.done)return[P,t.empty()];P.push(U.value)}return[P,{[Symbol.iterator](){return N}}]}t.consume=g;async function S(y){let L=[];for await(let P of y)L.push(P);return Promise.resolve(L)}t.asyncToArray=S})(d0||(d0={}));function Kn(t){if(d0.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function f0(...t){return tn(()=>Kn(t))}function tn(t){return{dispose:Fb(()=>{t()})}}var _0=class p0{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{Kn(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?p0.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};_0.DISABLE_DISPOSED_WARNING=!1;var Ud=_0,Mr=class{constructor(){this._store=new Ud,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)}};Mr.None=Object.freeze({dispose(){}});var ll=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var i;this._isDisposed||e===this._value||((i=this._value)==null||i.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},jb=globalThis.performance&&typeof globalThis.performance.now=="function",Wb=class g0{static create(e){return new g0(e)}constructor(e){this._now=jb&&e===!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}},Kd;(t=>{t.None=()=>Mr.None;function e(C,w){return u(C,()=>{},0,void 0,!0,void 0,w)}t.defer=e;function i(C){return(w,b=null,k)=>{let M=!1,T;return T=C(E=>{if(!M)return T?T.dispose():M=!0,w.call(b,E)},null,k),M&&T.dispose(),T}}t.once=i;function r(C,w,b){return l((k,M=null,T)=>C(E=>k.call(M,w(E)),null,T),b)}t.map=r;function s(C,w,b){return l((k,M=null,T)=>C(E=>{w(E),k.call(M,E)},null,T),b)}t.forEach=s;function n(C,w,b){return l((k,M=null,T)=>C(E=>w(E)&&k.call(M,E),null,T),b)}t.filter=n;function o(C){return C}t.signal=o;function a(...C){return(w,b=null,k)=>{let M=f0(...C.map(T=>T(E=>w.call(b,E))));return c(M,k)}}t.any=a;function h(C,w,b,k){let M=b;return r(C,T=>(M=w(M,T),M),k)}t.reduce=h;function l(C,w){let b,k={onWillAddFirstListener(){b=C(M.fire,M)},onDidRemoveLastListener(){b==null||b.dispose()}},M=new ki(k);return w==null||w.add(M),M.event}function c(C,w){return w instanceof Array?w.push(C):w&&w.add(C),C}function u(C,w,b=100,k=!1,M=!1,T,E){let R,D,j,G=0,q,fe={leakWarningThreshold:T,onWillAddFirstListener(){R=C(le=>{G++,D=w(D,le),k&&!j&&(Q.fire(D),D=void 0),q=()=>{let Z=D;D=void 0,j=void 0,(!k||G>1)&&Q.fire(Z),G=0},typeof b=="number"?(clearTimeout(j),j=setTimeout(q,b)):j===void 0&&(j=0,queueMicrotask(q))})},onWillRemoveListener(){M&&G>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,R.dispose()}},Q=new ki(fe);return E==null||E.add(Q),Q.event}t.debounce=u;function d(C,w=0,b){return t.debounce(C,(k,M)=>k?(k.push(M),k):[M],w,void 0,!0,void 0,b)}t.accumulate=d;function f(C,w=(k,M)=>k===M,b){let k=!0,M;return n(C,T=>{let E=k||!w(T,M);return k=!1,M=T,E},b)}t.latch=f;function p(C,w,b){return[t.filter(C,w,b),t.filter(C,k=>!w(k),b)]}t.split=p;function m(C,w=!1,b=[],k){let M=b.slice(),T=C(D=>{M?M.push(D):R.fire(D)});k&&k.add(T);let E=()=>{M==null||M.forEach(D=>R.fire(D)),M=null},R=new ki({onWillAddFirstListener(){T||(T=C(D=>R.fire(D)),k&&k.add(T))},onDidAddFirstListener(){M&&(w?setTimeout(E):E())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return k&&k.add(R),R.event}t.buffer=m;function x(C,w){return(b,k,M)=>{let T=w(new g);return C(function(E){let R=T.evaluate(E);R!==_&&b.call(k,R)},void 0,M)}}t.chain=x;let _=Symbol("HaltChainable");class g{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(b=>(w(b),b)),this}filter(w){return this.steps.push(b=>w(b)?b:_),this}reduce(w,b){let k=b;return this.steps.push(M=>(k=w(k,M),k)),this}latch(w=(b,k)=>b===k){let b=!0,k;return this.steps.push(M=>{let T=b||!w(M,k);return b=!1,k=M,T?M:_}),this}evaluate(w){for(let b of this.steps)if(w=b(w),w===_)break;return w}}function S(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.on(w,k),T=()=>C.removeListener(w,k),E=new ki({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromNodeEventEmitter=S;function y(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.addEventListener(w,k),T=()=>C.removeEventListener(w,k),E=new ki({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromDOMEventEmitter=y;function L(C){return new Promise(w=>i(C)(w))}t.toPromise=L;function P(C){let w=new ki;return C.then(b=>{w.fire(b)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}t.fromPromise=P;function N(C,w){return C(b=>w.fire(b))}t.forward=N;function B(C,w,b){return w(b),C(k=>w(k))}t.runAndSubscribe=B;class U{constructor(w,b){this._observable=w,this._counter=0,this._hasChanged=!1;let k={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};this.emitter=new ki(k),b&&b.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,b){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function W(C,w){return new U(C,w).emitter.event}t.fromObservable=W;function V(C){return(w,b,k)=>{let M=0,T=!1,E={beginUpdate(){M++},endUpdate(){M--,M===0&&(C.reportChanges(),T&&(T=!1,w.call(b)))},handlePossibleChange(){},handleChange(){T=!0}};C.addObserver(E),C.reportChanges();let R={dispose(){C.removeObserver(E)}};return k instanceof Ud?k.add(R):Array.isArray(k)&&k.push(R),R}}t.fromObservableLight=V})(Kd||(Kd={}));var ku=class Eu{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Eu._idPool++}`,Eu.all.add(this)}start(e){this._stopWatch=new Wb,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};ku.all=new Set,ku._idPool=0;var Hb=ku,Ub=-1,v0=class m0{constructor(e,i,r=(m0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new qb(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};v0._idPool=1;var Kb=v0,Vb=class y0{constructor(e){this.value=e}static create(){let e=new Error;return new y0(e.stack??"")}print(){console.warn(this.value.split(`
|
|
120
120
|
`).slice(2).join(`
|
|
121
|
-
`))}},q2=class extends Error{constructor(e,i){super(e),this.name="ListenerLeakError",this.stack=i}},G2=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},Y2=0,Lh=class{constructor(t){this.value=t,this.id=Y2++}},X2=2,Q2,ki=class{constructor(e){var i,r,s,n;this._size=0,this._options=e,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new K2((e==null?void 0:e.onListenerError)??Eh,((r=this._options)==null?void 0:r.leakWarningThreshold)??U2):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new H2(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,i,r,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||r.call(i),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,i,r)=>{var a,h,l,c,u;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 f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new G2(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||Eh)(p),Mr.None}if(this._disposed)return Mr.None;i&&(e=e.bind(i));let s=new Lh(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=V2.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Lh?(this._deliveryQueue??(this._deliveryQueue=new Z2),this._listeners=[this._listeners,s]):this._listeners.push(s):((l=(h=this._options)==null?void 0:h.onWillAddFirstListener)==null||l.call(h,this),this._listeners=s,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let o=tn(()=>{n==null||n(),this._removeListener(s)});return r instanceof Ud?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var n,o,a,h;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(h=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null||h.call(a,this),this._size=0;return}let i=this._listeners,r=i.indexOf(e);if(r===-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--,i[r]=void 0;let s=this._deliveryQueue.current===this;if(this._size*X2<=i.length){let l=0;for(let c=0;c<i.length;c++)i[c]?i[l++]=i[c]:s&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=l}}_deliver(e,i){var s;if(!e)return;let r=((s=this._options)==null?void 0:s.onListenerError)||Eh;if(!r){e.value(i);return}try{e.value(i)}catch(n){r(n)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){var i,r,s,n;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof Lh)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},Z2=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},S0=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),J2;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof eb?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Kd.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:S0})})(J2||(J2={}));var eb=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?S0:(this._emitter||(this._emitter=new ki),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ts="en",Mh=!1,Jo,ka=Ts,_p=Ts,tb,ci,Yr=globalThis,at,Qp;typeof Yr.vscode<"u"&&typeof Yr.vscode.process<"u"?at=Yr.vscode.process:typeof process<"u"&&typeof((Qp=process==null?void 0:process.versions)==null?void 0:Qp.node)=="string"&&(at=process);var Zp,ib=typeof((Zp=at==null?void 0:at.versions)==null?void 0:Zp.electron)=="string",rb=ib&&(at==null?void 0:at.type)==="renderer",Jp;if(typeof at=="object"){at.platform,at.platform,Mh=at.platform==="linux",Mh&&at.env.SNAP&&at.env.SNAP_REVISION,at.env.CI||at.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Jo=Ts,ka=Ts;let t=at.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);Jo=e.userLocale,_p=e.osLocale,ka=e.resolvedLanguage||Ts,tb=(Jp=e.languagePack)==null?void 0:Jp.translationsConfigFile}catch{}}else typeof navigator=="object"&&!rb?(ci=navigator.userAgent,ci.indexOf("Windows")>=0,ci.indexOf("Macintosh")>=0,(ci.indexOf("Macintosh")>=0||ci.indexOf("iPad")>=0||ci.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Mh=ci.indexOf("Linux")>=0,(ci==null?void 0:ci.indexOf("Mobi"))>=0,ka=globalThis._VSCODE_NLS_LANGUAGE||Ts,Jo=navigator.language.toLowerCase(),_p=Jo):console.error("Unable to resolve platform.");var Di=ci,sr=ka,sb;(t=>{function e(){return sr}t.value=e;function i(){return sr.length===2?sr==="en":sr.length>=3?sr[0]==="e"&&sr[1]==="n"&&sr[2]==="-":!1}t.isDefaultVariant=i;function r(){return sr==="en"}t.isDefault=r})(sb||(sb={}));var nb=typeof Yr.postMessage=="function"&&!Yr.importScripts;(()=>{if(nb){let t=[];Yr.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r<s;r++){let n=t[r];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(r,1),n.callback();return}}});let e=0;return i=>{let r=++e;t.push({id:r,callback:i}),Yr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var ob=!!(Di&&Di.indexOf("Chrome")>=0);Di&&Di.indexOf("Firefox")>=0;!ob&&Di&&Di.indexOf("Safari")>=0;Di&&Di.indexOf("Edg/")>=0;Di&&Di.indexOf("Android")>=0;function w0(t,e=0,i){let r=setTimeout(()=>{t()},e);return tn(()=>{clearTimeout(r)})}var ab;(t=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(ab||(ab={}));var pp=class qt{static fromArray(e){return new qt(i=>{i.emitMany(e)})}static fromPromise(e){return new qt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new qt(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new qt(async i=>{await Promise.all(e.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ki,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Kd.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new qt(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return qt.map(this,e)}static filter(e,i){return new qt(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return qt.filter(this,e)}static coalesce(e){return qt.filter(e,i=>!!i)}coalesce(){return qt.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return qt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};pp.EMPTY=pp.fromArray([]);var lb=class extends Mr{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new ll),this._linesCacheDisposables=this._register(new ll),this._register(tn(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=f0(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=w0(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){var i;return(i=this._linesCache)==null?void 0:i[e]}setLineInCache(e,i){this._linesCache&&(this._linesCache[e]=i)}translateBufferLineToStringWithWrap(e,i){var o;let r=[],s=[0],n=this._terminal.buffer.active.getLine(e);for(;n;){let a=this._terminal.buffer.active.getLine(e+1),h=a?a.isWrapped:!1,l=n.translateToString(!h&&i);if(h&&a){let c=n.getCell(n.length-1);c&&c.getCode()===0&&c.getWidth()===1&&((o=a.getCell(0))==null?void 0:o.getWidth())===2&&(l=l.slice(0,-1))}if(r.push(l),h)s.push(s[s.length-1]+l.length);else break;e++,n=a}return[r.join(""),s]}},hb=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,i){return i!=null&&i.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(i):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},cb=class{constructor(e,i){this._terminal=e,this._lineCache=i}find(e,i,r,s){if(!e||e.length===0){this._terminal.clearSelection();return}if(r>this._terminal.cols)throw new Error(`Invalid col: ${r} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let n={startRow:i,startCol:r},o=this._findInLine(e,n,s);if(!o)for(let a=i+1;a<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=a,n.startCol=0,o=this._findInLine(e,n,s),!o);a++);return o}findNextWithSelection(e,i,r){if(!e||e.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let n=0,o=0;s&&(r===e?(n=s.end.x,o=s.end.y):(n=s.start.x,o=s.start.y)),this._lineCache.initLinesCache();let a={startRow:o,startCol:n},h=this._findInLine(e,a,i);if(!h)for(let l=o+1;l<this._terminal.buffer.active.baseY+this._terminal.rows&&(a.startRow=l,a.startCol=0,h=this._findInLine(e,a,i),!h);l++);if(!h&&o!==0)for(let l=0;l<o&&(a.startRow=l,a.startCol=0,h=this._findInLine(e,a,i),!h);l++);return!h&&s&&(a.startRow=s.start.y,a.startCol=0,h=this._findInLine(e,a,i)),h}findPreviousWithSelection(e,i,r){if(!e||e.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let n=this._terminal.buffer.active.baseY+this._terminal.rows-1,o=this._terminal.cols,a=!0;this._lineCache.initLinesCache();let h={startRow:n,startCol:o},l;if(s&&(h.startRow=n=s.start.y,h.startCol=o=s.start.x,r!==e&&(l=this._findInLine(e,h,i,!1),l||(h.startRow=n=s.end.y,h.startCol=o=s.end.x))),l||(l=this._findInLine(e,h,i,a)),!l){h.startCol=Math.max(h.startCol,this._terminal.cols);for(let c=n-1;c>=0&&(h.startRow=c,l=this._findInLine(e,h,i,a),!l);c--);}if(!l&&n!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let c=this._terminal.buffer.active.baseY+this._terminal.rows-1;c>=n&&(h.startRow=c,l=this._findInLine(e,h,i,a),!l);c--);return l}_isWholeWord(e,i,r){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(i[e-1]))&&(e+r.length===i.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(i[e+r.length]))}_findInLine(e,i,r={},s=!1){var p;let n=i.startRow,o=i.startCol;if((p=this._terminal.buffer.active.getLine(n))!=null&&p.isWrapped){if(s){i.startCol+=this._terminal.cols;return}return i.startRow--,i.startCol+=this._terminal.cols,this._findInLine(e,i,r)}let a=this._lineCache.getLineFromCache(n);a||(a=this._lineCache.translateBufferLineToStringWithWrap(n,!0),this._lineCache.setLineInCache(n,a));let[h,l]=a,c=this._bufferColsToStringOffset(n,o),u=e,d=h;r.regex||(u=r.caseSensitive?e:e.toLowerCase(),d=r.caseSensitive?h:h.toLowerCase());let f=-1;if(r.regex){let m=RegExp(u,r.caseSensitive?"g":"gi"),x;if(s)for(;x=m.exec(d.slice(0,c));)f=m.lastIndex-x[0].length,e=x[0],m.lastIndex-=e.length-1;else x=m.exec(d.slice(c)),x&&x[0].length>0&&(f=c+(m.lastIndex-x[0].length),e=x[0])}else s?c-u.length>=0&&(f=d.lastIndexOf(u,c-u.length)):f=d.indexOf(u,c);if(f>=0){if(r.wholeWord&&!this._isWholeWord(f,d,e))return;let m=0;for(;m<l.length-1&&f>=l[m+1];)m++;let x=m;for(;x<l.length-1&&f+e.length>=l[x+1];)x++;let _=f-l[m],g=f+e.length-l[x],S=this._stringLengthToBufferSize(n+m,_),y=this._stringLengthToBufferSize(n+x,g)-S+this._terminal.cols*(x-m);return{term:e,col:S,row:n+m,size:y}}}_stringLengthToBufferSize(e,i){let r=this._terminal.buffer.active.getLine(e);if(!r)return 0;for(let s=0;s<i;s++){let n=r.getCell(s);if(!n)break;let o=n.getChars();o.length>1&&(i-=o.length-1);let a=r.getCell(s+1);a&&a.getWidth()===0&&i++}return i}_bufferColsToStringOffset(e,i){let r=e,s=0,n=this._terminal.buffer.active.getLine(r);for(;i>0&&n;){for(let o=0;o<i&&o<this._terminal.cols;o++){let a=n.getCell(o);if(!a)break;a.getWidth()&&(s+=a.getCode()===0?1:a.getChars().length)}if(r++,n=this._terminal.buffer.active.getLine(r),n&&!n.isWrapped)break;i-=this._terminal.cols}return s}},ub=class extends Mr{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(tn(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,e){this.clearHighlightDecorations();for(let i of t){let r=this._createResultDecorations(i,e,!1);if(r)for(let s of r)this._storeDecoration(s,i)}}createActiveDecoration(t,e){let i=this._createResultDecorations(t,e,!0);if(i)return{decorations:i,match:t,dispose(){Kn(i)}}}clearHighlightDecorations(){Kn(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,e){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:e,dispose(){t.dispose()}})}_applyStyles(t,e,i){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),e&&(t.style.outline=`1px solid ${e}`)),i&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,e,i){let r=[],s=t.col,n=t.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;n>0;){let h=Math.min(this._terminal.cols-s,n);r.push([o,s,h]),s=0,n-=h,o++}let a=[];for(let h of r){let l=this._terminal.registerMarker(h[0]),c=this._terminal.registerDecoration({marker:l,x:h[1],width:h[2],backgroundColor:i?e.activeMatchBackground:e.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:i?e.activeMatchColorOverviewRuler:e.matchOverviewRuler,position:"center"}});if(c){let u=[];u.push(l),u.push(c.onRender(d=>this._applyStyles(d,i?e.activeMatchBorder:e.matchBorder,!1))),u.push(c.onDispose(()=>Kn(u))),a.push(c)}}return a.length===0?void 0:a}},db=class extends Mr{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new ki)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,e){this._searchResults=t.slice(0,e)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let e=0;e<this._searchResults.length;e++){let i=this._searchResults[e];if(i.row===t.row&&i.col===t.col&&i.size===t.size)return e}return-1}fireResultsChanged(t){if(!t)return;let e=-1;this._selectedDecoration&&(e=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:e,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},fb=class extends Mr{constructor(t){super(),this._highlightTimeout=this._register(new ll),this._lineCache=this._register(new ll),this._state=new hb,this._resultTracker=this._register(new db),this._highlightLimit=(t==null?void 0:t.highlightLimit)??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(t){this._terminal=t,this._lineCache.value=new lb(t),this._engine=new cb(t,this._lineCache.value),this._decorationManager=new ub(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(tn(()=>this.clearDecorations()))}_updateMatches(){var t;this._highlightTimeout.clear(),this._state.cachedSearchTerm&&((t=this._state.lastSearchOptions)!=null&&t.decorations)&&(this._highlightTimeout.value=w0(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){var e;this._resultTracker.clearSelectedDecoration(),(e=this._decorationManager)==null||e.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let r=this._findNextAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,r}_highlightAllMatches(t,e){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],r,s=this._engine.find(t,0,0,e);for(;s&&((r==null?void 0:r.row)!==s.row||(r==null?void 0:r.col)!==s.col)&&!(i.length>=this._highlightLimit);)r=s,i.push(r),s=this._engine.find(t,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,e);this._resultTracker.updateResults(i,this._highlightLimit),e.decorations&&this._decorationManager.createHighlightDecorations(i,e.decorations)}_findNextAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(r,e==null?void 0:e.decorations,i==null?void 0:i.noScroll)}findPrevious(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let r=this._findPreviousAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,r}_fireResults(t){this._resultTracker.fireResultsChanged(!!(t!=null&&t.decorations))}_findPreviousAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(r,e==null?void 0:e.decorations,i==null?void 0:i.noScroll)}_selectResult(t,e,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),e){let r=this._decorationManager.createActiveDecoration(t,e);r&&(this._resultTracker.selectedDecoration=r)}if(!i&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let r=t.row-this._terminal.buffer.active.viewportY;r-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(r)}return!0}};/**
|
|
121
|
+
`))}},qb=class extends Error{constructor(e,i){super(e),this.name="ListenerLeakError",this.stack=i}},Gb=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},Yb=0,Lh=class{constructor(t){this.value=t,this.id=Yb++}},Xb=2,Qb,ki=class{constructor(e){var i,r,s,n;this._size=0,this._options=e,this._leakageMon=(i=this._options)!=null&&i.leakWarningThreshold?new Kb((e==null?void 0:e.onListenerError)??Eh,((r=this._options)==null?void 0:r.leakWarningThreshold)??Ub):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new Hb(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,i,r,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(i=this._options)==null?void 0:i.onDidRemoveLastListener)==null||r.call(i),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,i,r)=>{var a,h,l,c,u;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 f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],p=new Gb(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||Eh)(p),Mr.None}if(this._disposed)return Mr.None;i&&(e=e.bind(i));let s=new Lh(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=Vb.create(),n=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Lh?(this._deliveryQueue??(this._deliveryQueue=new Zb),this._listeners=[this._listeners,s]):this._listeners.push(s):((l=(h=this._options)==null?void 0:h.onWillAddFirstListener)==null||l.call(h,this),this._listeners=s,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let o=tn(()=>{n==null||n(),this._removeListener(s)});return r instanceof Ud?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(e){var n,o,a,h;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(h=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null||h.call(a,this),this._size=0;return}let i=this._listeners,r=i.indexOf(e);if(r===-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--,i[r]=void 0;let s=this._deliveryQueue.current===this;if(this._size*Xb<=i.length){let l=0;for(let c=0;c<i.length;c++)i[c]?i[l++]=i[c]:s&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=l}}_deliver(e,i){var s;if(!e)return;let r=((s=this._options)==null?void 0:s.onListenerError)||Eh;if(!r){e.value(i);return}try{e.value(i)}catch(n){r(n)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){var i,r,s,n;if((i=this._deliveryQueue)!=null&&i.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof Lh)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},Zb=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},S0=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),Jb;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof e2?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Kd.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:S0})})(Jb||(Jb={}));var e2=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?S0:(this._emitter||(this._emitter=new ki),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ts="en",Mh=!1,Jo,ka=Ts,_p=Ts,t2,ci,Yr=globalThis,at,Qp;typeof Yr.vscode<"u"&&typeof Yr.vscode.process<"u"?at=Yr.vscode.process:typeof process<"u"&&typeof((Qp=process==null?void 0:process.versions)==null?void 0:Qp.node)=="string"&&(at=process);var Zp,i2=typeof((Zp=at==null?void 0:at.versions)==null?void 0:Zp.electron)=="string",r2=i2&&(at==null?void 0:at.type)==="renderer",Jp;if(typeof at=="object"){at.platform,at.platform,Mh=at.platform==="linux",Mh&&at.env.SNAP&&at.env.SNAP_REVISION,at.env.CI||at.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Jo=Ts,ka=Ts;let t=at.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);Jo=e.userLocale,_p=e.osLocale,ka=e.resolvedLanguage||Ts,t2=(Jp=e.languagePack)==null?void 0:Jp.translationsConfigFile}catch{}}else typeof navigator=="object"&&!r2?(ci=navigator.userAgent,ci.indexOf("Windows")>=0,ci.indexOf("Macintosh")>=0,(ci.indexOf("Macintosh")>=0||ci.indexOf("iPad")>=0||ci.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Mh=ci.indexOf("Linux")>=0,(ci==null?void 0:ci.indexOf("Mobi"))>=0,ka=globalThis._VSCODE_NLS_LANGUAGE||Ts,Jo=navigator.language.toLowerCase(),_p=Jo):console.error("Unable to resolve platform.");var Di=ci,sr=ka,s2;(t=>{function e(){return sr}t.value=e;function i(){return sr.length===2?sr==="en":sr.length>=3?sr[0]==="e"&&sr[1]==="n"&&sr[2]==="-":!1}t.isDefaultVariant=i;function r(){return sr==="en"}t.isDefault=r})(s2||(s2={}));var n2=typeof Yr.postMessage=="function"&&!Yr.importScripts;(()=>{if(n2){let t=[];Yr.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r<s;r++){let n=t[r];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(r,1),n.callback();return}}});let e=0;return i=>{let r=++e;t.push({id:r,callback:i}),Yr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var o2=!!(Di&&Di.indexOf("Chrome")>=0);Di&&Di.indexOf("Firefox")>=0;!o2&&Di&&Di.indexOf("Safari")>=0;Di&&Di.indexOf("Edg/")>=0;Di&&Di.indexOf("Android")>=0;function w0(t,e=0,i){let r=setTimeout(()=>{t()},e);return tn(()=>{clearTimeout(r)})}var a2;(t=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(a2||(a2={}));var pp=class qt{static fromArray(e){return new qt(i=>{i.emitMany(e)})}static fromPromise(e){return new qt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new qt(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new qt(async i=>{await Promise.all(e.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ki,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Kd.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new qt(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return qt.map(this,e)}static filter(e,i){return new qt(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return qt.filter(this,e)}static coalesce(e){return qt.filter(e,i=>!!i)}coalesce(){return qt.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return qt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};pp.EMPTY=pp.fromArray([]);var l2=class extends Mr{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new ll),this._linesCacheDisposables=this._register(new ll),this._register(tn(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=new Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=f0(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=w0(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){var i;return(i=this._linesCache)==null?void 0:i[e]}setLineInCache(e,i){this._linesCache&&(this._linesCache[e]=i)}translateBufferLineToStringWithWrap(e,i){var o;let r=[],s=[0],n=this._terminal.buffer.active.getLine(e);for(;n;){let a=this._terminal.buffer.active.getLine(e+1),h=a?a.isWrapped:!1,l=n.translateToString(!h&&i);if(h&&a){let c=n.getCell(n.length-1);c&&c.getCode()===0&&c.getWidth()===1&&((o=a.getCell(0))==null?void 0:o.getWidth())===2&&(l=l.slice(0,-1))}if(r.push(l),h)s.push(s[s.length-1]+l.length);else break;e++,n=a}return[r.join(""),s]}},h2=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,i){return i!=null&&i.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(i):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},c2=class{constructor(e,i){this._terminal=e,this._lineCache=i}find(e,i,r,s){if(!e||e.length===0){this._terminal.clearSelection();return}if(r>this._terminal.cols)throw new Error(`Invalid col: ${r} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let n={startRow:i,startCol:r},o=this._findInLine(e,n,s);if(!o)for(let a=i+1;a<this._terminal.buffer.active.baseY+this._terminal.rows&&(n.startRow=a,n.startCol=0,o=this._findInLine(e,n,s),!o);a++);return o}findNextWithSelection(e,i,r){if(!e||e.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let n=0,o=0;s&&(r===e?(n=s.end.x,o=s.end.y):(n=s.start.x,o=s.start.y)),this._lineCache.initLinesCache();let a={startRow:o,startCol:n},h=this._findInLine(e,a,i);if(!h)for(let l=o+1;l<this._terminal.buffer.active.baseY+this._terminal.rows&&(a.startRow=l,a.startCol=0,h=this._findInLine(e,a,i),!h);l++);if(!h&&o!==0)for(let l=0;l<o&&(a.startRow=l,a.startCol=0,h=this._findInLine(e,a,i),!h);l++);return!h&&s&&(a.startRow=s.start.y,a.startCol=0,h=this._findInLine(e,a,i)),h}findPreviousWithSelection(e,i,r){if(!e||e.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let n=this._terminal.buffer.active.baseY+this._terminal.rows-1,o=this._terminal.cols,a=!0;this._lineCache.initLinesCache();let h={startRow:n,startCol:o},l;if(s&&(h.startRow=n=s.start.y,h.startCol=o=s.start.x,r!==e&&(l=this._findInLine(e,h,i,!1),l||(h.startRow=n=s.end.y,h.startCol=o=s.end.x))),l||(l=this._findInLine(e,h,i,a)),!l){h.startCol=Math.max(h.startCol,this._terminal.cols);for(let c=n-1;c>=0&&(h.startRow=c,l=this._findInLine(e,h,i,a),!l);c--);}if(!l&&n!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let c=this._terminal.buffer.active.baseY+this._terminal.rows-1;c>=n&&(h.startRow=c,l=this._findInLine(e,h,i,a),!l);c--);return l}_isWholeWord(e,i,r){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(i[e-1]))&&(e+r.length===i.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(i[e+r.length]))}_findInLine(e,i,r={},s=!1){var p;let n=i.startRow,o=i.startCol;if((p=this._terminal.buffer.active.getLine(n))!=null&&p.isWrapped){if(s){i.startCol+=this._terminal.cols;return}return i.startRow--,i.startCol+=this._terminal.cols,this._findInLine(e,i,r)}let a=this._lineCache.getLineFromCache(n);a||(a=this._lineCache.translateBufferLineToStringWithWrap(n,!0),this._lineCache.setLineInCache(n,a));let[h,l]=a,c=this._bufferColsToStringOffset(n,o),u=e,d=h;r.regex||(u=r.caseSensitive?e:e.toLowerCase(),d=r.caseSensitive?h:h.toLowerCase());let f=-1;if(r.regex){let m=RegExp(u,r.caseSensitive?"g":"gi"),x;if(s)for(;x=m.exec(d.slice(0,c));)f=m.lastIndex-x[0].length,e=x[0],m.lastIndex-=e.length-1;else x=m.exec(d.slice(c)),x&&x[0].length>0&&(f=c+(m.lastIndex-x[0].length),e=x[0])}else s?c-u.length>=0&&(f=d.lastIndexOf(u,c-u.length)):f=d.indexOf(u,c);if(f>=0){if(r.wholeWord&&!this._isWholeWord(f,d,e))return;let m=0;for(;m<l.length-1&&f>=l[m+1];)m++;let x=m;for(;x<l.length-1&&f+e.length>=l[x+1];)x++;let _=f-l[m],g=f+e.length-l[x],S=this._stringLengthToBufferSize(n+m,_),y=this._stringLengthToBufferSize(n+x,g)-S+this._terminal.cols*(x-m);return{term:e,col:S,row:n+m,size:y}}}_stringLengthToBufferSize(e,i){let r=this._terminal.buffer.active.getLine(e);if(!r)return 0;for(let s=0;s<i;s++){let n=r.getCell(s);if(!n)break;let o=n.getChars();o.length>1&&(i-=o.length-1);let a=r.getCell(s+1);a&&a.getWidth()===0&&i++}return i}_bufferColsToStringOffset(e,i){let r=e,s=0,n=this._terminal.buffer.active.getLine(r);for(;i>0&&n;){for(let o=0;o<i&&o<this._terminal.cols;o++){let a=n.getCell(o);if(!a)break;a.getWidth()&&(s+=a.getCode()===0?1:a.getChars().length)}if(r++,n=this._terminal.buffer.active.getLine(r),n&&!n.isWrapped)break;i-=this._terminal.cols}return s}},u2=class extends Mr{constructor(t){super(),this._terminal=t,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(tn(()=>this.clearHighlightDecorations()))}createHighlightDecorations(t,e){this.clearHighlightDecorations();for(let i of t){let r=this._createResultDecorations(i,e,!1);if(r)for(let s of r)this._storeDecoration(s,i)}}createActiveDecoration(t,e){let i=this._createResultDecorations(t,e,!0);if(i)return{decorations:i,match:t,dispose(){Kn(i)}}}clearHighlightDecorations(){Kn(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(t,e){this._highlightedLines.add(t.marker.line),this._highlightDecorations.push({decoration:t,match:e,dispose(){t.dispose()}})}_applyStyles(t,e,i){t.classList.contains("xterm-find-result-decoration")||(t.classList.add("xterm-find-result-decoration"),e&&(t.style.outline=`1px solid ${e}`)),i&&t.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(t,e,i){let r=[],s=t.col,n=t.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+t.row;for(;n>0;){let h=Math.min(this._terminal.cols-s,n);r.push([o,s,h]),s=0,n-=h,o++}let a=[];for(let h of r){let l=this._terminal.registerMarker(h[0]),c=this._terminal.registerDecoration({marker:l,x:h[1],width:h[2],backgroundColor:i?e.activeMatchBackground:e.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:i?e.activeMatchColorOverviewRuler:e.matchOverviewRuler,position:"center"}});if(c){let u=[];u.push(l),u.push(c.onRender(d=>this._applyStyles(d,i?e.activeMatchBorder:e.matchBorder,!1))),u.push(c.onDispose(()=>Kn(u))),a.push(c)}}return a.length===0?void 0:a}},d2=class extends Mr{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new ki)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(t){this._selectedDecoration=t}updateResults(t,e){this._searchResults=t.slice(0,e)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(t){for(let e=0;e<this._searchResults.length;e++){let i=this._searchResults[e];if(i.row===t.row&&i.col===t.col&&i.size===t.size)return e}return-1}fireResultsChanged(t){if(!t)return;let e=-1;this._selectedDecoration&&(e=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:e,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},f2=class extends Mr{constructor(t){super(),this._highlightTimeout=this._register(new ll),this._lineCache=this._register(new ll),this._state=new h2,this._resultTracker=this._register(new d2),this._highlightLimit=(t==null?void 0:t.highlightLimit)??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(t){this._terminal=t,this._lineCache.value=new l2(t),this._engine=new c2(t,this._lineCache.value),this._decorationManager=new u2(t),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(tn(()=>this.clearDecorations()))}_updateMatches(){var t;this._highlightTimeout.clear(),this._state.cachedSearchTerm&&((t=this._state.lastSearchOptions)!=null&&t.decorations)&&(this._highlightTimeout.value=w0(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(t){var e;this._resultTracker.clearSelectedDecoration(),(e=this._decorationManager)==null||e.clearHighlightDecorations(),this._resultTracker.clearResults(),t||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let r=this._findNextAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,r}_highlightAllMatches(t,e){if(!this._terminal||!this._engine||!this._decorationManager)throw new Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(t)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],r,s=this._engine.find(t,0,0,e);for(;s&&((r==null?void 0:r.row)!==s.row||(r==null?void 0:r.col)!==s.col)&&!(i.length>=this._highlightLimit);)r=s,i.push(r),s=this._engine.find(t,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,e);this._resultTracker.updateResults(i,this._highlightLimit),e.decorations&&this._decorationManager.createHighlightDecorations(i,e.decorations)}_findNextAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(r,e==null?void 0:e.decorations,i==null?void 0:i.noScroll)}findPrevious(t,e,i){if(!this._terminal||!this._engine)throw new Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=e,this._state.shouldUpdateHighlighting(t,e)&&this._highlightAllMatches(t,e);let r=this._findPreviousAndSelect(t,e,i);return this._fireResults(e),this._state.cachedSearchTerm=t,r}_fireResults(t){this._resultTracker.fireResultsChanged(!!(t!=null&&t.decorations))}_findPreviousAndSelect(t,e,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(t))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(t,e,this._state.cachedSearchTerm);return this._selectResult(r,e==null?void 0:e.decorations,i==null?void 0:i.noScroll)}_selectResult(t,e,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!t)return this._terminal.clearSelection(),!1;if(this._terminal.select(t.col,t.row,t.size),e){let r=this._decorationManager.createActiveDecoration(t,e);r&&(this._resultTracker.selectedDecoration=r)}if(!i&&(t.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||t.row<this._terminal.buffer.active.viewportY)){let r=t.row-this._terminal.buffer.active.viewportY;r-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(r)}return!0}};/**
|
|
122
122
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
123
123
|
* @license MIT
|
|
124
124
|
*
|
|
@@ -129,13 +129,13 @@ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){t
|
|
|
129
129
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
130
130
|
* http://bellard.org/jslinux/
|
|
131
131
|
* Copyright (c) 2011 Fabrice Bellard
|
|
132
|
-
*/var
|
|
132
|
+
*/var _2=(t,e,i,r)=>{for(var s=e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(s=o(s)||s);return s},p2=(t,e)=>(i,r)=>e(i,r,t),g2=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?gp.isErrorNoTelemetry(t)?new gp(t.message+`
|
|
133
133
|
|
|
134
134
|
`+t.stack):new Error(t.message+`
|
|
135
135
|
|
|
136
|
-
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},vb=new gb;function Rh(t){mb(t)||vb.onUnexpectedError(t)}var Lu="Canceled";function mb(t){return t instanceof yb?!0:t instanceof Error&&t.name===Lu&&t.message===Lu}var yb=class extends Error{constructor(){super(Lu),this.name=this.message}},gp=class Mu extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Mu)return e;let i=new Mu;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Sb;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(Sb||(Sb={}));function wb(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var x0;(t=>{function e(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(y){yield y}t.single=s;function n(y){return e(y)?y:s(y)}t.wrap=n;function o(y){return y||i}t.from=o;function*a(y){for(let L=y.length-1;L>=0;L--)yield y[L]}t.reverse=a;function h(y){return!y||y[Symbol.iterator]().next().done===!0}t.isEmpty=h;function l(y){return y[Symbol.iterator]().next().value}t.first=l;function c(y,L){let P=0;for(let N of y)if(L(N,P++))return!0;return!1}t.some=c;function u(y,L){for(let P of y)if(L(P))return P}t.find=u;function*d(y,L){for(let P of y)L(P)&&(yield P)}t.filter=d;function*f(y,L){let P=0;for(let N of y)yield L(N,P++)}t.map=f;function*p(y,L){let P=0;for(let N of y)yield*L(N,P++)}t.flatMap=p;function*m(...y){for(let L of y)yield*L}t.concat=m;function x(y,L,P){let N=P;for(let B of y)N=L(N,B);return N}t.reduce=x;function*_(y,L,P=y.length){for(L<0&&(L+=y.length),P<0?P+=y.length:P>y.length&&(P=y.length);L<P;L++)yield y[L]}t.slice=_;function g(y,L=Number.POSITIVE_INFINITY){let P=[];if(L===0)return[P,y];let N=y[Symbol.iterator]();for(let B=0;B<L;B++){let U=N.next();if(U.done)return[P,t.empty()];P.push(U.value)}return[P,{[Symbol.iterator](){return N}}]}t.consume=g;async function S(y){let L=[];for await(let P of y)L.push(P);return Promise.resolve(L)}t.asyncToArray=S})(x0||(x0={}));function C0(t){if(x0.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function b0(...t){return vt(()=>C0(t))}function vt(t){return{dispose:wb(()=>{t()})}}var k0=class E0{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{C0(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?E0.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};k0.DISABLE_DISPOSED_WARNING=!1;var Fs=k0,mi=class{constructor(){this._store=new Fs,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};mi.None=Object.freeze({dispose(){}});var Sn=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var e;this._isDisposed||t===this._value||((e=this._value)==null||e.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Vd=typeof process<"u"&&"title"in process,Dl=Vd?"node":navigator.userAgent,xb=Vd?"node":navigator.platform,Cb=Dl.includes("Firefox"),bb=Dl.includes("Edge"),L0=/^((?!chrome|android).)*safari/i.test(Dl);function kb(){if(!L0)return 0;let t=Dl.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}xb.indexOf("Linux")>=0;var Eb="",Ze=0,Je=0,et=0,Pe=0,Gt={css:"#00000000",rgba:0},xt;(t=>{function e(s,n,o,a){return a!==void 0?`#${Nr(s)}${Nr(n)}${Nr(o)}${Nr(a)}`:`#${Nr(s)}${Nr(n)}${Nr(o)}`}t.toCss=e;function i(s,n,o,a=255){return(s<<24|n<<16|o<<8|a)>>>0}t.toRgba=i;function r(s,n,o,a){return{css:t.toCss(s,n,o,a),rgba:t.toRgba(s,n,o,a)}}t.toColor=r})(xt||(xt={}));var Bn;(t=>{function e(h,l){if(Pe=(l.rgba&255)/255,Pe===1)return{css:l.css,rgba:l.rgba};let c=l.rgba>>24&255,u=l.rgba>>16&255,d=l.rgba>>8&255,f=h.rgba>>24&255,p=h.rgba>>16&255,m=h.rgba>>8&255;Ze=f+Math.round((c-f)*Pe),Je=p+Math.round((u-p)*Pe),et=m+Math.round((d-m)*Pe);let x=xt.toCss(Ze,Je,et),_=xt.toRgba(Ze,Je,et);return{css:x,rgba:_}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function r(h,l,c){let u=Xr.ensureContrastRatio(h.rgba,l.rgba,c);if(u)return xt.toColor(u>>24&255,u>>16&255,u>>8&255)}t.ensureContrastRatio=r;function s(h){let l=(h.rgba|255)>>>0;return[Ze,Je,et]=Xr.toChannels(l),{css:xt.toCss(Ze,Je,et),rgba:l}}t.opaque=s;function n(h,l){return Pe=Math.round(l*255),[Ze,Je,et]=Xr.toChannels(h.rgba),{css:xt.toCss(Ze,Je,et,Pe),rgba:xt.toRgba(Ze,Je,et,Pe)}}t.opacity=n;function o(h,l){return Pe=h.rgba&255,n(h,Pe*l/255)}t.multiplyOpacity=o;function a(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=a})(Bn||(Bn={}));var Lb;(t=>{let e,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Ze=parseInt(s.slice(1,2).repeat(2),16),Je=parseInt(s.slice(2,3).repeat(2),16),et=parseInt(s.slice(3,4).repeat(2),16),xt.toColor(Ze,Je,et);case 5:return Ze=parseInt(s.slice(1,2).repeat(2),16),Je=parseInt(s.slice(2,3).repeat(2),16),et=parseInt(s.slice(3,4).repeat(2),16),Pe=parseInt(s.slice(4,5).repeat(2),16),xt.toColor(Ze,Je,et,Pe);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Ze=parseInt(n[1]),Je=parseInt(n[2]),et=parseInt(n[3]),Pe=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),xt.toColor(Ze,Je,et,Pe);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ze,Je,et,Pe]=e.getImageData(0,0,1,1).data,Pe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:xt.toRgba(Ze,Je,et,Pe),css:s}}t.toColor=r})(Lb||(Lb={}));var St;(t=>{function e(r){return i(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=e;function i(r,s,n){let o=r/255,a=s/255,h=n/255,l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),u=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return l*.2126+c*.7152+u*.0722}t.relativeLuminance2=i})(St||(St={}));var Xr;(t=>{function e(o,a){if(Pe=(a&255)/255,Pe===1)return a;let h=a>>24&255,l=a>>16&255,c=a>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return Ze=u+Math.round((h-u)*Pe),Je=d+Math.round((l-d)*Pe),et=f+Math.round((c-f)*Pe),xt.toRgba(Ze,Je,et)}t.blend=e;function i(o,a,h){let l=St.relativeLuminance(o>>8),c=St.relativeLuminance(a>>8);if($i(l,c)<h){if(c<l){let f=r(o,a,h),p=$i(l,St.relativeLuminance(f>>8));if(p<h){let m=s(o,a,h),x=$i(l,St.relativeLuminance(m>>8));return p>x?f:m}return f}let u=s(o,a,h),d=$i(l,St.relativeLuminance(u>>8));if(d<h){let f=r(o,a,h),p=$i(l,St.relativeLuminance(f>>8));return d>p?u:f}return u}}t.ensureContrastRatio=i;function r(o,a,h){let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,m=$i(St.relativeLuminance2(d,f,p),St.relativeLuminance2(l,c,u));for(;m<h&&(d>0||f>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m=$i(St.relativeLuminance2(d,f,p),St.relativeLuminance2(l,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.reduceLuminance=r;function s(o,a,h){let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,m=$i(St.relativeLuminance2(d,f,p),St.relativeLuminance2(l,c,u));for(;m<h&&(d<255||f<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=$i(St.relativeLuminance2(d,f,p),St.relativeLuminance2(l,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(Xr||(Xr={}));function Nr(t){let e=t.toString(16);return e.length<2?"0"+e:e}function $i(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}function Oe(t){if(!t)throw new Error("value must not be falsy");return t}function qd(t){return 57508<=t&&t<=57558}function Mb(t){return 57520<=t&&t<=57527}function Rb(t){return 57344<=t&&t<=63743}function Tb(t){return 9472<=t&&t<=9631}function Pb(t){return t>=128512&&t<=128591||t>=127744&&t<=128511||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=65024&&t<=65039||t>=129280&&t<=129535||t>=127462&&t<=127487}function Db(t,e,i,r){return e===1&&i>Math.ceil(r*1.5)&&t!==void 0&&t>255&&!Pb(t)&&!qd(t)&&!Rb(t)}function M0(t){return qd(t)||Tb(t)}function Bb(){return{css:{canvas:ea(),cell:ea()},device:{canvas:ea(),cell:ea(),char:{width:0,height:0,left:0,top:0}}}}function ea(){return{width:0,height:0}}function Ab(t,e,i=0){return(t-(Math.round(e)*2-i))%(Math.round(e)*2)}var st=0,Ve=0,xi=!1,Oi=!1,ta=!1,Rt,Th=0,Nb=class{constructor(t,e,i,r,s,n){this._terminal=t,this._optionService=e,this._selectionRenderModel=i,this._decorationService=r,this._coreBrowserService=s,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(t,e,i,r){if(this.result.bg=t.bg,this.result.fg=t.fg,this.result.ext=t.bg&268435456?t.extended.ext:0,Ve=0,st=0,Oi=!1,xi=!1,ta=!1,Rt=this._themeService.colors,Th=0,t.getCode()!==0&&t.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Th=e*r%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(e,i,"bottom",s=>{s.backgroundColorRGB&&(Ve=s.backgroundColorRGB.rgba>>8&16777215,Oi=!0),s.foregroundColorRGB&&(st=s.foregroundColorRGB.rgba>>8&16777215,xi=!0)}),ta=this._selectionRenderModel.isCellSelected(this._terminal,e,i),ta){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ve=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ve=(this.result.fg&16777215)<<8|255;break;case 0:default:Ve=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ve=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ve=(this.result.bg&16777215)<<8|255;break}Ve=Xr.blend(Ve,(this._coreBrowserService.isFocused?Rt.selectionBackgroundOpaque:Rt.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ve=(this._coreBrowserService.isFocused?Rt.selectionBackgroundOpaque:Rt.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Oi=!0,Rt.selectionForeground&&(st=Rt.selectionForeground.rgba>>8&16777215,xi=!0),M0(t.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))st=(this._coreBrowserService.isFocused?Rt.selectionBackgroundOpaque:Rt.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:st=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:st=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:st=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:st=(this.result.fg&16777215)<<8|255;break;case 0:default:st=this._themeService.colors.foreground.rgba}st=Xr.blend(st,(this._coreBrowserService.isFocused?Rt.selectionBackgroundOpaque:Rt.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}xi=!0}}this._decorationService.forEachDecorationAtCell(e,i,"top",s=>{s.backgroundColorRGB&&(Ve=s.backgroundColorRGB.rgba>>8&16777215,Oi=!0),s.foregroundColorRGB&&(st=s.foregroundColorRGB.rgba>>8&16777215,xi=!0)}),Oi&&(ta?Ve=t.bg&-16777216&-134217729|Ve|50331648:Ve=t.bg&-16777216|Ve|50331648),xi&&(st=t.fg&-16777216&-67108865|st|50331648),this.result.fg&67108864&&(Oi&&!xi&&(this.result.bg&50331648?st=this.result.fg&-134217728|this.result.bg&67108863:st=this.result.fg&-134217728|Rt.background.rgba>>8&16777215&16777215|50331648,xi=!0),!Oi&&xi&&(this.result.fg&50331648?Ve=this.result.bg&-67108864|this.result.fg&67108863:Ve=this.result.bg&-67108864|Rt.foreground.rgba>>8&16777215&16777215|50331648,Oi=!0)),Rt=void 0,this.result.bg=Oi?Ve:this.result.bg,this.result.fg=xi?st:this.result.fg,this.result.ext&=536870911,this.result.ext|=Th<<29&3758096384}},$b=.5,R0=Cb||bb?"bottom":"ideographic",Ob={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Ib={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},zb={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╒":{1:(t,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(t,e)=>`M${.5-t},1 L${.5-t},.5 L1,.5 M${.5+t},.5 L${.5+t},1`},"╔":{1:(t,e)=>`M1,${.5-e} L${.5-t},${.5-e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╕":{1:(t,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(t,e)=>`M${.5+t},1 L${.5+t},.5 L0,.5 M${.5-t},.5 L${.5-t},1`},"╗":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5+t},${.5-e} L${.5+t},1`},"╘":{1:(t,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(t,e)=>`M1,.5 L${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╚":{1:(t,e)=>`M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0 M1,${.5+e} L${.5-t},${.5+e} L${.5-t},0`},"╛":{1:(t,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(t,e)=>`M0,.5 L${.5+t},.5 L${.5+t},0 M${.5-t},.5 L${.5-t},0`},"╝":{1:(t,e)=>`M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M0,${.5+e} L${.5+t},${.5+e} L${.5+t},0`},"╞":{1:(t,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1 M${.5+t},.5 L1,.5`},"╠":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╡":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(t,e)=>`M0,.5 L${.5-t},.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╣":{1:(t,e)=>`M${.5+t},0 L${.5+t},1 M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0`},"╤":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},1 M${.5+t},.5 L${.5+t},1`},"╦":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╧":{1:(t,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╩":{1:(t,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╪":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╬":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},_o={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};_o[""]=_o[""];_o[""]=_o[""];function Fb(t,e,i,r,s,n,o,a){let h=Ob[e];if(h)return jb(t,h,i,r,s,n),!0;let l=Ib[e];if(l)return Wb(t,l,i,r,s,n),!0;let c=zb[e];if(c)return Hb(t,c,i,r,s,n,a),!0;let u=_o[e];return u?(Ub(t,u,i,r,s,n,o,a),!0):!1}function jb(t,e,i,r,s,n){for(let o=0;o<e.length;o++){let a=e[o],h=s/8,l=n/8;t.fillRect(i+a.x*h,r+a.y*l,a.w*h,a.h*l)}}var vp=new Map;function Wb(t,e,i,r,s,n){let o=vp.get(e);o||(o=new Map,vp.set(e,o));let a=t.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let h=o.get(a);if(!h){let l=e[0].length,c=e.length,u=t.canvas.ownerDocument.createElement("canvas");u.width=l,u.height=c;let d=Oe(u.getContext("2d")),f=new ImageData(l,c),p,m,x,_;if(a.startsWith("#"))p=parseInt(a.slice(1,3),16),m=parseInt(a.slice(3,5),16),x=parseInt(a.slice(5,7),16),_=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[p,m,x,_]=a.substring(5,a.length-1).split(",").map(g=>parseFloat(g));else throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let g=0;g<c;g++)for(let S=0;S<l;S++)f.data[(g*l+S)*4]=p,f.data[(g*l+S)*4+1]=m,f.data[(g*l+S)*4+2]=x,f.data[(g*l+S)*4+3]=e[g][S]*(_*255);d.putImageData(f,0,0),h=Oe(t.createPattern(u,null)),o.set(a,h)}t.fillStyle=h,t.fillRect(i,r,s,n)}function Hb(t,e,i,r,s,n,o){t.strokeStyle=t.fillStyle;for(let[a,h]of Object.entries(e)){t.beginPath(),t.lineWidth=o*Number.parseInt(a);let l;if(typeof h=="function"){let c=.15/n*s;l=h(.15,c)}else l=h;for(let c of l.split(" ")){let u=c[0],d=T0[u];if(!d){console.error(`Could not find drawing instructions for "${u}"`);continue}let f=c.substring(1).split(",");!f[0]||!f[1]||d(t,P0(f,s,n,i,r,!0,o))}t.stroke(),t.closePath()}}function Ub(t,e,i,r,s,n,o,a){let h=new Path2D;h.rect(i,r,s,n),t.clip(h),t.beginPath();let l=o/12;t.lineWidth=a*l;for(let c of e.d.split(" ")){let u=c[0],d=T0[u];if(!d){console.error(`Could not find drawing instructions for "${u}"`);continue}let f=c.substring(1).split(",");!f[0]||!f[1]||d(t,P0(f,s,n,i,r,!1,a,(e.leftPadding??0)*(l/2),(e.rightPadding??0)*(l/2)))}e.type===1?(t.strokeStyle=t.fillStyle,t.stroke()):t.fill(),t.closePath()}function mp(t,e,i=0){return Math.max(Math.min(t,e),i)}var T0={C:(t,e)=>t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(t,e)=>t.lineTo(e[0],e[1]),M:(t,e)=>t.moveTo(e[0],e[1])};function P0(t,e,i,r,s,n,o,a=0,h=0){let l=t.map(c=>parseFloat(c)||parseInt(c));if(l.length<2)throw new Error("Too few arguments for instruction");for(let c=0;c<l.length;c+=2)l[c]*=e-a*o-h*o,n&&l[c]!==0&&(l[c]=mp(Math.round(l[c]+.5)-.5,e,0)),l[c]+=r+a*o;for(let c=1;c<l.length;c+=2)l[c]*=i,n&&l[c]!==0&&(l[c]=mp(Math.round(l[c]+.5)-.5,i,0)),l[c]+=s;return l}var yp=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},Sp=class{constructor(){this._data=new yp}set(t,e,i,r,s){this._data.get(t,e)||this._data.set(t,e,new yp),this._data.get(t,e).set(i,r,s)}get(t,e,i,r){var s;return(s=this._data.get(t,e))==null?void 0:s.get(i,r)}clear(){this._data.clear()}},D0=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,r=t.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),s=t.timeRemaining(),i*1.5>s){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=s}this.clear()}},Kb=class extends D0{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},Vb=class extends D0{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},qb=!Vd&&"requestIdleCallback"in window?Vb:Kb,Ps=class B0{constructor(){this.fg=0,this.bg=0,this.extended=new A0}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new B0;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},A0=class N0{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new N0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Gb=globalThis.performance&&typeof globalThis.performance.now=="function",Yb=class $0{static create(e){return new $0(e)}constructor(e){this._now=Gb&&e===!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}},Ki;(t=>{t.None=()=>mi.None;function e(C,w){return u(C,()=>{},0,void 0,!0,void 0,w)}t.defer=e;function i(C){return(w,b=null,k)=>{let M=!1,T;return T=C(E=>{if(!M)return T?T.dispose():M=!0,w.call(b,E)},null,k),M&&T.dispose(),T}}t.once=i;function r(C,w,b){return l((k,M=null,T)=>C(E=>k.call(M,w(E)),null,T),b)}t.map=r;function s(C,w,b){return l((k,M=null,T)=>C(E=>{w(E),k.call(M,E)},null,T),b)}t.forEach=s;function n(C,w,b){return l((k,M=null,T)=>C(E=>w(E)&&k.call(M,E),null,T),b)}t.filter=n;function o(C){return C}t.signal=o;function a(...C){return(w,b=null,k)=>{let M=b0(...C.map(T=>T(E=>w.call(b,E))));return c(M,k)}}t.any=a;function h(C,w,b,k){let M=b;return r(C,T=>(M=w(M,T),M),k)}t.reduce=h;function l(C,w){let b,k={onWillAddFirstListener(){b=C(M.fire,M)},onDidRemoveLastListener(){b==null||b.dispose()}},M=new ye(k);return w==null||w.add(M),M.event}function c(C,w){return w instanceof Array?w.push(C):w&&w.add(C),C}function u(C,w,b=100,k=!1,M=!1,T,E){let R,D,j,G=0,q,de={leakWarningThreshold:T,onWillAddFirstListener(){R=C(le=>{G++,D=w(D,le),k&&!j&&(Q.fire(D),D=void 0),q=()=>{let Z=D;D=void 0,j=void 0,(!k||G>1)&&Q.fire(Z),G=0},typeof b=="number"?(clearTimeout(j),j=setTimeout(q,b)):j===void 0&&(j=0,queueMicrotask(q))})},onWillRemoveListener(){M&&G>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,R.dispose()}},Q=new ye(de);return E==null||E.add(Q),Q.event}t.debounce=u;function d(C,w=0,b){return t.debounce(C,(k,M)=>k?(k.push(M),k):[M],w,void 0,!0,void 0,b)}t.accumulate=d;function f(C,w=(k,M)=>k===M,b){let k=!0,M;return n(C,T=>{let E=k||!w(T,M);return k=!1,M=T,E},b)}t.latch=f;function p(C,w,b){return[t.filter(C,w,b),t.filter(C,k=>!w(k),b)]}t.split=p;function m(C,w=!1,b=[],k){let M=b.slice(),T=C(D=>{M?M.push(D):R.fire(D)});k&&k.add(T);let E=()=>{M==null||M.forEach(D=>R.fire(D)),M=null},R=new ye({onWillAddFirstListener(){T||(T=C(D=>R.fire(D)),k&&k.add(T))},onDidAddFirstListener(){M&&(w?setTimeout(E):E())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return k&&k.add(R),R.event}t.buffer=m;function x(C,w){return(b,k,M)=>{let T=w(new g);return C(function(E){let R=T.evaluate(E);R!==_&&b.call(k,R)},void 0,M)}}t.chain=x;let _=Symbol("HaltChainable");class g{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(b=>(w(b),b)),this}filter(w){return this.steps.push(b=>w(b)?b:_),this}reduce(w,b){let k=b;return this.steps.push(M=>(k=w(k,M),k)),this}latch(w=(b,k)=>b===k){let b=!0,k;return this.steps.push(M=>{let T=b||!w(M,k);return b=!1,k=M,T?M:_}),this}evaluate(w){for(let b of this.steps)if(w=b(w),w===_)break;return w}}function S(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.on(w,k),T=()=>C.removeListener(w,k),E=new ye({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromNodeEventEmitter=S;function y(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.addEventListener(w,k),T=()=>C.removeEventListener(w,k),E=new ye({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromDOMEventEmitter=y;function L(C){return new Promise(w=>i(C)(w))}t.toPromise=L;function P(C){let w=new ye;return C.then(b=>{w.fire(b)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}t.fromPromise=P;function N(C,w){return C(b=>w.fire(b))}t.forward=N;function B(C,w,b){return w(b),C(k=>w(k))}t.runAndSubscribe=B;class U{constructor(w,b){this._observable=w,this._counter=0,this._hasChanged=!1;let k={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};this.emitter=new ye(k),b&&b.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,b){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function W(C,w){return new U(C,w).emitter.event}t.fromObservable=W;function V(C){return(w,b,k)=>{let M=0,T=!1,E={beginUpdate(){M++},endUpdate(){M--,M===0&&(C.reportChanges(),T&&(T=!1,w.call(b)))},handlePossibleChange(){},handleChange(){T=!0}};C.addObserver(E),C.reportChanges();let R={dispose(){C.removeObserver(E)}};return k instanceof Fs?k.add(R):Array.isArray(k)&&k.push(R),R}}t.fromObservableLight=V})(Ki||(Ki={}));var Ru=class Tu{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Tu._idPool++}`,Tu.all.add(this)}start(e){this._stopWatch=new Yb,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Ru.all=new Set,Ru._idPool=0;var Xb=Ru,Qb=-1,O0=class I0{constructor(e,i,r=(I0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new e5(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};O0._idPool=1;var Zb=O0,Jb=class z0{constructor(e){this.value=e}static create(){let e=new Error;return new z0(e.stack??"")}print(){console.warn(this.value.split(`
|
|
136
|
+
`+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},v2=new g2;function Rh(t){m2(t)||v2.onUnexpectedError(t)}var Lu="Canceled";function m2(t){return t instanceof y2?!0:t instanceof Error&&t.name===Lu&&t.message===Lu}var y2=class extends Error{constructor(){super(Lu),this.name=this.message}},gp=class Mu extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Mu)return e;let i=new Mu;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},S2;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(S2||(S2={}));function w2(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var x0;(t=>{function e(y){return y&&typeof y=="object"&&typeof y[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(y){yield y}t.single=s;function n(y){return e(y)?y:s(y)}t.wrap=n;function o(y){return y||i}t.from=o;function*a(y){for(let L=y.length-1;L>=0;L--)yield y[L]}t.reverse=a;function h(y){return!y||y[Symbol.iterator]().next().done===!0}t.isEmpty=h;function l(y){return y[Symbol.iterator]().next().value}t.first=l;function c(y,L){let P=0;for(let N of y)if(L(N,P++))return!0;return!1}t.some=c;function u(y,L){for(let P of y)if(L(P))return P}t.find=u;function*d(y,L){for(let P of y)L(P)&&(yield P)}t.filter=d;function*f(y,L){let P=0;for(let N of y)yield L(N,P++)}t.map=f;function*p(y,L){let P=0;for(let N of y)yield*L(N,P++)}t.flatMap=p;function*m(...y){for(let L of y)yield*L}t.concat=m;function x(y,L,P){let N=P;for(let B of y)N=L(N,B);return N}t.reduce=x;function*_(y,L,P=y.length){for(L<0&&(L+=y.length),P<0?P+=y.length:P>y.length&&(P=y.length);L<P;L++)yield y[L]}t.slice=_;function g(y,L=Number.POSITIVE_INFINITY){let P=[];if(L===0)return[P,y];let N=y[Symbol.iterator]();for(let B=0;B<L;B++){let U=N.next();if(U.done)return[P,t.empty()];P.push(U.value)}return[P,{[Symbol.iterator](){return N}}]}t.consume=g;async function S(y){let L=[];for await(let P of y)L.push(P);return Promise.resolve(L)}t.asyncToArray=S})(x0||(x0={}));function C0(t){if(x0.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function b0(...t){return vt(()=>C0(t))}function vt(t){return{dispose:w2(()=>{t()})}}var k0=class E0{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{C0(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?E0.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};k0.DISABLE_DISPOSED_WARNING=!1;var Fs=k0,mi=class{constructor(){this._store=new Fs,this._store}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};mi.None=Object.freeze({dispose(){}});var Sn=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var e;this._isDisposed||t===this._value||((e=this._value)==null||e.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Vd=typeof process<"u"&&"title"in process,Dl=Vd?"node":navigator.userAgent,x2=Vd?"node":navigator.platform,C2=Dl.includes("Firefox"),b2=Dl.includes("Edge"),L0=/^((?!chrome|android).)*safari/i.test(Dl);function k2(){if(!L0)return 0;let t=Dl.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}x2.indexOf("Linux")>=0;var E2="",Ze=0,Je=0,et=0,Pe=0,Gt={css:"#00000000",rgba:0},xt;(t=>{function e(s,n,o,a){return a!==void 0?`#${Nr(s)}${Nr(n)}${Nr(o)}${Nr(a)}`:`#${Nr(s)}${Nr(n)}${Nr(o)}`}t.toCss=e;function i(s,n,o,a=255){return(s<<24|n<<16|o<<8|a)>>>0}t.toRgba=i;function r(s,n,o,a){return{css:t.toCss(s,n,o,a),rgba:t.toRgba(s,n,o,a)}}t.toColor=r})(xt||(xt={}));var Bn;(t=>{function e(h,l){if(Pe=(l.rgba&255)/255,Pe===1)return{css:l.css,rgba:l.rgba};let c=l.rgba>>24&255,u=l.rgba>>16&255,d=l.rgba>>8&255,f=h.rgba>>24&255,p=h.rgba>>16&255,m=h.rgba>>8&255;Ze=f+Math.round((c-f)*Pe),Je=p+Math.round((u-p)*Pe),et=m+Math.round((d-m)*Pe);let x=xt.toCss(Ze,Je,et),_=xt.toRgba(Ze,Je,et);return{css:x,rgba:_}}t.blend=e;function i(h){return(h.rgba&255)===255}t.isOpaque=i;function r(h,l,c){let u=Xr.ensureContrastRatio(h.rgba,l.rgba,c);if(u)return xt.toColor(u>>24&255,u>>16&255,u>>8&255)}t.ensureContrastRatio=r;function s(h){let l=(h.rgba|255)>>>0;return[Ze,Je,et]=Xr.toChannels(l),{css:xt.toCss(Ze,Je,et),rgba:l}}t.opaque=s;function n(h,l){return Pe=Math.round(l*255),[Ze,Je,et]=Xr.toChannels(h.rgba),{css:xt.toCss(Ze,Je,et,Pe),rgba:xt.toRgba(Ze,Je,et,Pe)}}t.opacity=n;function o(h,l){return Pe=h.rgba&255,n(h,Pe*l/255)}t.multiplyOpacity=o;function a(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}t.toColorRGB=a})(Bn||(Bn={}));var L2;(t=>{let e,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Ze=parseInt(s.slice(1,2).repeat(2),16),Je=parseInt(s.slice(2,3).repeat(2),16),et=parseInt(s.slice(3,4).repeat(2),16),xt.toColor(Ze,Je,et);case 5:return Ze=parseInt(s.slice(1,2).repeat(2),16),Je=parseInt(s.slice(2,3).repeat(2),16),et=parseInt(s.slice(3,4).repeat(2),16),Pe=parseInt(s.slice(4,5).repeat(2),16),xt.toColor(Ze,Je,et,Pe);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Ze=parseInt(n[1]),Je=parseInt(n[2]),et=parseInt(n[3]),Pe=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),xt.toColor(Ze,Je,et,Pe);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Ze,Je,et,Pe]=e.getImageData(0,0,1,1).data,Pe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:xt.toRgba(Ze,Je,et,Pe),css:s}}t.toColor=r})(L2||(L2={}));var St;(t=>{function e(r){return i(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=e;function i(r,s,n){let o=r/255,a=s/255,h=n/255,l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),u=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return l*.2126+c*.7152+u*.0722}t.relativeLuminance2=i})(St||(St={}));var Xr;(t=>{function e(o,a){if(Pe=(a&255)/255,Pe===1)return a;let h=a>>24&255,l=a>>16&255,c=a>>8&255,u=o>>24&255,d=o>>16&255,f=o>>8&255;return Ze=u+Math.round((h-u)*Pe),Je=d+Math.round((l-d)*Pe),et=f+Math.round((c-f)*Pe),xt.toRgba(Ze,Je,et)}t.blend=e;function i(o,a,h){let l=St.relativeLuminance(o>>8),c=St.relativeLuminance(a>>8);if($i(l,c)<h){if(c<l){let f=r(o,a,h),p=$i(l,St.relativeLuminance(f>>8));if(p<h){let m=s(o,a,h),x=$i(l,St.relativeLuminance(m>>8));return p>x?f:m}return f}let u=s(o,a,h),d=$i(l,St.relativeLuminance(u>>8));if(d<h){let f=r(o,a,h),p=$i(l,St.relativeLuminance(f>>8));return d>p?u:f}return u}}t.ensureContrastRatio=i;function r(o,a,h){let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,m=$i(St.relativeLuminance2(d,f,p),St.relativeLuminance2(l,c,u));for(;m<h&&(d>0||f>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),m=$i(St.relativeLuminance2(d,f,p),St.relativeLuminance2(l,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.reduceLuminance=r;function s(o,a,h){let l=o>>24&255,c=o>>16&255,u=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,m=$i(St.relativeLuminance2(d,f,p),St.relativeLuminance2(l,c,u));for(;m<h&&(d<255||f<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),m=$i(St.relativeLuminance2(d,f,p),St.relativeLuminance2(l,c,u));return(d<<24|f<<16|p<<8|255)>>>0}t.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(Xr||(Xr={}));function Nr(t){let e=t.toString(16);return e.length<2?"0"+e:e}function $i(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}function Oe(t){if(!t)throw new Error("value must not be falsy");return t}function qd(t){return 57508<=t&&t<=57558}function M2(t){return 57520<=t&&t<=57527}function R2(t){return 57344<=t&&t<=63743}function T2(t){return 9472<=t&&t<=9631}function P2(t){return t>=128512&&t<=128591||t>=127744&&t<=128511||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=65024&&t<=65039||t>=129280&&t<=129535||t>=127462&&t<=127487}function D2(t,e,i,r){return e===1&&i>Math.ceil(r*1.5)&&t!==void 0&&t>255&&!P2(t)&&!qd(t)&&!R2(t)}function M0(t){return qd(t)||T2(t)}function B2(){return{css:{canvas:ea(),cell:ea()},device:{canvas:ea(),cell:ea(),char:{width:0,height:0,left:0,top:0}}}}function ea(){return{width:0,height:0}}function A2(t,e,i=0){return(t-(Math.round(e)*2-i))%(Math.round(e)*2)}var st=0,Ve=0,xi=!1,Oi=!1,ta=!1,Rt,Th=0,N2=class{constructor(t,e,i,r,s,n){this._terminal=t,this._optionService=e,this._selectionRenderModel=i,this._decorationService=r,this._coreBrowserService=s,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(t,e,i,r){if(this.result.bg=t.bg,this.result.fg=t.fg,this.result.ext=t.bg&268435456?t.extended.ext:0,Ve=0,st=0,Oi=!1,xi=!1,ta=!1,Rt=this._themeService.colors,Th=0,t.getCode()!==0&&t.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Th=e*r%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(e,i,"bottom",s=>{s.backgroundColorRGB&&(Ve=s.backgroundColorRGB.rgba>>8&16777215,Oi=!0),s.foregroundColorRGB&&(st=s.foregroundColorRGB.rgba>>8&16777215,xi=!0)}),ta=this._selectionRenderModel.isCellSelected(this._terminal,e,i),ta){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Ve=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ve=(this.result.fg&16777215)<<8|255;break;case 0:default:Ve=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Ve=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ve=(this.result.bg&16777215)<<8|255;break}Ve=Xr.blend(Ve,(this._coreBrowserService.isFocused?Rt.selectionBackgroundOpaque:Rt.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Ve=(this._coreBrowserService.isFocused?Rt.selectionBackgroundOpaque:Rt.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Oi=!0,Rt.selectionForeground&&(st=Rt.selectionForeground.rgba>>8&16777215,xi=!0),M0(t.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))st=(this._coreBrowserService.isFocused?Rt.selectionBackgroundOpaque:Rt.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:st=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:st=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:st=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:st=(this.result.fg&16777215)<<8|255;break;case 0:default:st=this._themeService.colors.foreground.rgba}st=Xr.blend(st,(this._coreBrowserService.isFocused?Rt.selectionBackgroundOpaque:Rt.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}xi=!0}}this._decorationService.forEachDecorationAtCell(e,i,"top",s=>{s.backgroundColorRGB&&(Ve=s.backgroundColorRGB.rgba>>8&16777215,Oi=!0),s.foregroundColorRGB&&(st=s.foregroundColorRGB.rgba>>8&16777215,xi=!0)}),Oi&&(ta?Ve=t.bg&-16777216&-134217729|Ve|50331648:Ve=t.bg&-16777216|Ve|50331648),xi&&(st=t.fg&-16777216&-67108865|st|50331648),this.result.fg&67108864&&(Oi&&!xi&&(this.result.bg&50331648?st=this.result.fg&-134217728|this.result.bg&67108863:st=this.result.fg&-134217728|Rt.background.rgba>>8&16777215&16777215|50331648,xi=!0),!Oi&&xi&&(this.result.fg&50331648?Ve=this.result.bg&-67108864|this.result.fg&67108863:Ve=this.result.bg&-67108864|Rt.foreground.rgba>>8&16777215&16777215|50331648,Oi=!0)),Rt=void 0,this.result.bg=Oi?Ve:this.result.bg,this.result.fg=xi?st:this.result.fg,this.result.ext&=536870911,this.result.ext|=Th<<29&3758096384}},$2=.5,R0=C2||b2?"bottom":"ideographic",O2={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},I2={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},z2={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╒":{1:(t,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(t,e)=>`M${.5-t},1 L${.5-t},.5 L1,.5 M${.5+t},.5 L${.5+t},1`},"╔":{1:(t,e)=>`M1,${.5-e} L${.5-t},${.5-e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╕":{1:(t,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(t,e)=>`M${.5+t},1 L${.5+t},.5 L0,.5 M${.5-t},.5 L${.5-t},1`},"╗":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5+t},${.5-e} L${.5+t},1`},"╘":{1:(t,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(t,e)=>`M1,.5 L${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╚":{1:(t,e)=>`M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0 M1,${.5+e} L${.5-t},${.5+e} L${.5-t},0`},"╛":{1:(t,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(t,e)=>`M0,.5 L${.5+t},.5 L${.5+t},0 M${.5-t},.5 L${.5-t},0`},"╝":{1:(t,e)=>`M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M0,${.5+e} L${.5+t},${.5+e} L${.5+t},0`},"╞":{1:(t,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1 M${.5+t},.5 L1,.5`},"╠":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╡":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(t,e)=>`M0,.5 L${.5-t},.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╣":{1:(t,e)=>`M${.5+t},0 L${.5+t},1 M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0`},"╤":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},1 M${.5+t},.5 L${.5+t},1`},"╦":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╧":{1:(t,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╩":{1:(t,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╪":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╬":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},_o={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};_o[""]=_o[""];_o[""]=_o[""];function F2(t,e,i,r,s,n,o,a){let h=O2[e];if(h)return j2(t,h,i,r,s,n),!0;let l=I2[e];if(l)return W2(t,l,i,r,s,n),!0;let c=z2[e];if(c)return H2(t,c,i,r,s,n,a),!0;let u=_o[e];return u?(U2(t,u,i,r,s,n,o,a),!0):!1}function j2(t,e,i,r,s,n){for(let o=0;o<e.length;o++){let a=e[o],h=s/8,l=n/8;t.fillRect(i+a.x*h,r+a.y*l,a.w*h,a.h*l)}}var vp=new Map;function W2(t,e,i,r,s,n){let o=vp.get(e);o||(o=new Map,vp.set(e,o));let a=t.fillStyle;if(typeof a!="string")throw new Error(`Unexpected fillStyle type "${a}"`);let h=o.get(a);if(!h){let l=e[0].length,c=e.length,u=t.canvas.ownerDocument.createElement("canvas");u.width=l,u.height=c;let d=Oe(u.getContext("2d")),f=new ImageData(l,c),p,m,x,_;if(a.startsWith("#"))p=parseInt(a.slice(1,3),16),m=parseInt(a.slice(3,5),16),x=parseInt(a.slice(5,7),16),_=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[p,m,x,_]=a.substring(5,a.length-1).split(",").map(g=>parseFloat(g));else throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let g=0;g<c;g++)for(let S=0;S<l;S++)f.data[(g*l+S)*4]=p,f.data[(g*l+S)*4+1]=m,f.data[(g*l+S)*4+2]=x,f.data[(g*l+S)*4+3]=e[g][S]*(_*255);d.putImageData(f,0,0),h=Oe(t.createPattern(u,null)),o.set(a,h)}t.fillStyle=h,t.fillRect(i,r,s,n)}function H2(t,e,i,r,s,n,o){t.strokeStyle=t.fillStyle;for(let[a,h]of Object.entries(e)){t.beginPath(),t.lineWidth=o*Number.parseInt(a);let l;if(typeof h=="function"){let c=.15/n*s;l=h(.15,c)}else l=h;for(let c of l.split(" ")){let u=c[0],d=T0[u];if(!d){console.error(`Could not find drawing instructions for "${u}"`);continue}let f=c.substring(1).split(",");!f[0]||!f[1]||d(t,P0(f,s,n,i,r,!0,o))}t.stroke(),t.closePath()}}function U2(t,e,i,r,s,n,o,a){let h=new Path2D;h.rect(i,r,s,n),t.clip(h),t.beginPath();let l=o/12;t.lineWidth=a*l;for(let c of e.d.split(" ")){let u=c[0],d=T0[u];if(!d){console.error(`Could not find drawing instructions for "${u}"`);continue}let f=c.substring(1).split(",");!f[0]||!f[1]||d(t,P0(f,s,n,i,r,!1,a,(e.leftPadding??0)*(l/2),(e.rightPadding??0)*(l/2)))}e.type===1?(t.strokeStyle=t.fillStyle,t.stroke()):t.fill(),t.closePath()}function mp(t,e,i=0){return Math.max(Math.min(t,e),i)}var T0={C:(t,e)=>t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(t,e)=>t.lineTo(e[0],e[1]),M:(t,e)=>t.moveTo(e[0],e[1])};function P0(t,e,i,r,s,n,o,a=0,h=0){let l=t.map(c=>parseFloat(c)||parseInt(c));if(l.length<2)throw new Error("Too few arguments for instruction");for(let c=0;c<l.length;c+=2)l[c]*=e-a*o-h*o,n&&l[c]!==0&&(l[c]=mp(Math.round(l[c]+.5)-.5,e,0)),l[c]+=r+a*o;for(let c=1;c<l.length;c+=2)l[c]*=i,n&&l[c]!==0&&(l[c]=mp(Math.round(l[c]+.5)-.5,i,0)),l[c]+=s;return l}var yp=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},Sp=class{constructor(){this._data=new yp}set(t,e,i,r,s){this._data.get(t,e)||this._data.set(t,e,new yp),this._data.get(t,e).set(i,r,s)}get(t,e,i,r){var s;return(s=this._data.get(t,e))==null?void 0:s.get(i,r)}clear(){this._data.clear()}},D0=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),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(t){this._idleCallback=void 0;let e=0,i=0,r=t.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),s=t.timeRemaining(),i*1.5>s){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=s}this.clear()}},K2=class extends D0{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},V2=class extends D0{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},q2=!Vd&&"requestIdleCallback"in window?V2:K2,Ps=class B0{constructor(){this.fg=0,this.bg=0,this.extended=new A0}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new B0;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},A0=class N0{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new N0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},G2=globalThis.performance&&typeof globalThis.performance.now=="function",Y2=class $0{static create(e){return new $0(e)}constructor(e){this._now=G2&&e===!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}},Ki;(t=>{t.None=()=>mi.None;function e(C,w){return u(C,()=>{},0,void 0,!0,void 0,w)}t.defer=e;function i(C){return(w,b=null,k)=>{let M=!1,T;return T=C(E=>{if(!M)return T?T.dispose():M=!0,w.call(b,E)},null,k),M&&T.dispose(),T}}t.once=i;function r(C,w,b){return l((k,M=null,T)=>C(E=>k.call(M,w(E)),null,T),b)}t.map=r;function s(C,w,b){return l((k,M=null,T)=>C(E=>{w(E),k.call(M,E)},null,T),b)}t.forEach=s;function n(C,w,b){return l((k,M=null,T)=>C(E=>w(E)&&k.call(M,E),null,T),b)}t.filter=n;function o(C){return C}t.signal=o;function a(...C){return(w,b=null,k)=>{let M=b0(...C.map(T=>T(E=>w.call(b,E))));return c(M,k)}}t.any=a;function h(C,w,b,k){let M=b;return r(C,T=>(M=w(M,T),M),k)}t.reduce=h;function l(C,w){let b,k={onWillAddFirstListener(){b=C(M.fire,M)},onDidRemoveLastListener(){b==null||b.dispose()}},M=new ye(k);return w==null||w.add(M),M.event}function c(C,w){return w instanceof Array?w.push(C):w&&w.add(C),C}function u(C,w,b=100,k=!1,M=!1,T,E){let R,D,j,G=0,q,fe={leakWarningThreshold:T,onWillAddFirstListener(){R=C(le=>{G++,D=w(D,le),k&&!j&&(Q.fire(D),D=void 0),q=()=>{let Z=D;D=void 0,j=void 0,(!k||G>1)&&Q.fire(Z),G=0},typeof b=="number"?(clearTimeout(j),j=setTimeout(q,b)):j===void 0&&(j=0,queueMicrotask(q))})},onWillRemoveListener(){M&&G>0&&(q==null||q())},onDidRemoveLastListener(){q=void 0,R.dispose()}},Q=new ye(fe);return E==null||E.add(Q),Q.event}t.debounce=u;function d(C,w=0,b){return t.debounce(C,(k,M)=>k?(k.push(M),k):[M],w,void 0,!0,void 0,b)}t.accumulate=d;function f(C,w=(k,M)=>k===M,b){let k=!0,M;return n(C,T=>{let E=k||!w(T,M);return k=!1,M=T,E},b)}t.latch=f;function p(C,w,b){return[t.filter(C,w,b),t.filter(C,k=>!w(k),b)]}t.split=p;function m(C,w=!1,b=[],k){let M=b.slice(),T=C(D=>{M?M.push(D):R.fire(D)});k&&k.add(T);let E=()=>{M==null||M.forEach(D=>R.fire(D)),M=null},R=new ye({onWillAddFirstListener(){T||(T=C(D=>R.fire(D)),k&&k.add(T))},onDidAddFirstListener(){M&&(w?setTimeout(E):E())},onDidRemoveLastListener(){T&&T.dispose(),T=null}});return k&&k.add(R),R.event}t.buffer=m;function x(C,w){return(b,k,M)=>{let T=w(new g);return C(function(E){let R=T.evaluate(E);R!==_&&b.call(k,R)},void 0,M)}}t.chain=x;let _=Symbol("HaltChainable");class g{constructor(){this.steps=[]}map(w){return this.steps.push(w),this}forEach(w){return this.steps.push(b=>(w(b),b)),this}filter(w){return this.steps.push(b=>w(b)?b:_),this}reduce(w,b){let k=b;return this.steps.push(M=>(k=w(k,M),k)),this}latch(w=(b,k)=>b===k){let b=!0,k;return this.steps.push(M=>{let T=b||!w(M,k);return b=!1,k=M,T?M:_}),this}evaluate(w){for(let b of this.steps)if(w=b(w),w===_)break;return w}}function S(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.on(w,k),T=()=>C.removeListener(w,k),E=new ye({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromNodeEventEmitter=S;function y(C,w,b=k=>k){let k=(...R)=>E.fire(b(...R)),M=()=>C.addEventListener(w,k),T=()=>C.removeEventListener(w,k),E=new ye({onWillAddFirstListener:M,onDidRemoveLastListener:T});return E.event}t.fromDOMEventEmitter=y;function L(C){return new Promise(w=>i(C)(w))}t.toPromise=L;function P(C){let w=new ye;return C.then(b=>{w.fire(b)},()=>{w.fire(void 0)}).finally(()=>{w.dispose()}),w.event}t.fromPromise=P;function N(C,w){return C(b=>w.fire(b))}t.forward=N;function B(C,w,b){return w(b),C(k=>w(k))}t.runAndSubscribe=B;class U{constructor(w,b){this._observable=w,this._counter=0,this._hasChanged=!1;let k={onWillAddFirstListener:()=>{w.addObserver(this)},onDidRemoveLastListener:()=>{w.removeObserver(this)}};this.emitter=new ye(k),b&&b.add(this.emitter)}beginUpdate(w){this._counter++}handlePossibleChange(w){}handleChange(w,b){this._hasChanged=!0}endUpdate(w){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function W(C,w){return new U(C,w).emitter.event}t.fromObservable=W;function V(C){return(w,b,k)=>{let M=0,T=!1,E={beginUpdate(){M++},endUpdate(){M--,M===0&&(C.reportChanges(),T&&(T=!1,w.call(b)))},handlePossibleChange(){},handleChange(){T=!0}};C.addObserver(E),C.reportChanges();let R={dispose(){C.removeObserver(E)}};return k instanceof Fs?k.add(R):Array.isArray(k)&&k.push(R),R}}t.fromObservableLight=V})(Ki||(Ki={}));var Ru=class Tu{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Tu._idPool++}`,Tu.all.add(this)}start(e){this._stopWatch=new Y2,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Ru.all=new Set,Ru._idPool=0;var X2=Ru,Q2=-1,O0=class I0{constructor(e,i,r=(I0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new e5(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};O0._idPool=1;var Z2=O0,J2=class z0{constructor(e){this.value=e}static create(){let e=new Error;return new z0(e.stack??"")}print(){console.warn(this.value.split(`
|
|
137
137
|
`).slice(2).join(`
|
|
138
|
-
`))}},e5=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},t5=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},i5=0,Ph=class{constructor(t){this.value=t,this.id=i5++}},r5=2,s5,ye=class{constructor(t){var e,i,r,s;this._size=0,this._options=t,this._leakageMon=(e=this._options)!=null&&e.leakWarningThreshold?new Zb((t==null?void 0:t.onListenerError)??Rh,((i=this._options)==null?void 0:i.leakWarningThreshold)??Qb):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new Xb(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,e,i,r;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(e=this._options)==null?void 0:e.onDidRemoveLastListener)==null||i.call(e),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(t,e,i)=>{var o,a,h,l,c;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new t5(`${u}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Rh)(f),mi.None}if(this._disposed)return mi.None;e&&(t=t.bind(e));let r=new Ph(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Jb.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Ph?(this._deliveryQueue??(this._deliveryQueue=new n5),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||h.call(a,this),this._listeners=r,(c=(l=this._options)==null?void 0:l.onDidAddFirstListener)==null||c.call(l,this)),this._size++;let n=vt(()=>{s==null||s(),this._removeListener(r)});return i instanceof Fs?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(t){var s,n,o,a;if((n=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||n.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||a.call(o,this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-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--,e[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*r5<=e.length){let h=0;for(let l=0;l<e.length;l++)e[l]?e[h++]=e[l]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=h}}_deliver(t,e){var r;if(!t)return;let i=((r=this._options)==null?void 0:r.onListenerError)||Rh;if(!i){t.value(e);return}try{t.value(e)}catch(s){i(s)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){var e,i,r,s;if((e=this._deliveryQueue)!=null&&e.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof Ph)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},n5=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},wp={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},wn=2,xn,or=class gs{constructor(e,i,r){this._document=e,this._config=i,this._unicodeService=r,this._didWarmUp=!1,this._cacheMap=new Sp,this._cacheMapCombined=new Sp,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ps,this._textureSize=512,this._onAddTextureAtlasCanvas=new ye,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ye,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=F0(e,this._config.deviceCellWidth*4+wn*2,this._config.deviceCellHeight+wn*2),this._tmpCtx=Oe(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new qb;for(let i=33;i<126;i++)e.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let r=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,r)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(gs.maxAtlasPages&&this._pages.length>=Math.max(4,gs.maxAtlasPages)){let i=this._pages.filter(l=>l.canvas.width*2<=(gs.maxTextureSize||4096)).sort((l,c)=>c.canvas.width!==l.canvas.width?c.canvas.width-l.canvas.width:c.percentageUsed-l.percentageUsed),r=-1,s=0;for(let l=0;l<i.length;l++)if(i[l].canvas.width!==s)r=l,s=i[l].canvas.width;else if(l-r===3)break;let n=i.slice(r,r+4),o=n.map(l=>l.glyphs[0].texturePage).sort((l,c)=>l>c?1:-1),a=this.pages.length-n.length,h=this._mergePages(n,a);h.version++;for(let l=o.length-1;l>=0;l--)this._deletePage(o[l]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let e=new Dh(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,i){let r=e[0].canvas.width*2,s=new Dh(this._document,r,e);for(let[n,o]of e.entries()){let a=n*o.canvas.width%r,h=Math.floor(n/2)*o.canvas.height;s.ctx.drawImage(o.canvas,a,h);for(let c of o.glyphs)c.texturePage=i,c.sizeClipSpace.x=c.size.x/r,c.sizeClipSpace.y=c.size.y/r,c.texturePosition.x+=a,c.texturePosition.y+=h,c.texturePositionClipSpace.x=c.texturePosition.x/r,c.texturePositionClipSpace.y=c.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let l=this._activePages.indexOf(o);l!==-1&&this._activePages.splice(l,1)}return s}_deletePage(e){this._pages.splice(e,1);for(let i=e;i<this._pages.length;i++){let r=this._pages[i];for(let s of r.glyphs)s.texturePage--;r.version++}}getRasterizedGlyphCombinedChar(e,i,r,s,n,o){return this._getFromCacheMap(this._cacheMapCombined,e,i,r,s,n,o)}getRasterizedGlyph(e,i,r,s,n,o){return this._getFromCacheMap(this._cacheMap,e,i,r,s,n,o)}_getFromCacheMap(e,i,r,s,n,o,a){return xn=e.get(i,r,s,n),xn||(xn=this._drawToCache(i,r,s,n,o,a),e.set(i,r,s,n,xn)),xn}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,i,r,s){if(this._config.allowTransparency)return Gt;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(i);break;case 50331648:let o=Ps.toColorRGB(i);n=xt.toColor(o[0],o[1],o[2]);break;case 0:default:r?n=Bn.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=Bn.opaque(n)),n}_getForegroundColor(e,i,r,s,n,o,a,h,l,c){let u=this._getMinimumContrastColor(e,i,r,s,n,o,a,l,h,c);if(u)return u;let d;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&o<8&&(o+=8),d=this._getColorFromAnsiIndex(o);break;case 50331648:let f=Ps.toColorRGB(o);d=xt.toColor(f[0],f[1],f[2]);break;case 0:default:a?d=this._config.colors.background:d=this._config.colors.foreground}return this._config.allowTransparency&&(d=Bn.opaque(d)),h&&(d=Bn.multiplyOpacity(d,$b)),d}_resolveBackgroundRgba(e,i,r){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,i,r,s){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,i,r,s,n,o,a,h,l,c){if(this._config.minimumContrastRatio===1||c)return;let u=this._getContrastCache(l),d=u.getColor(e,s);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(i,r,a),p=this._resolveForegroundRgba(n,o,a,h),m=Xr.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(l?2:1));if(!m){u.setColor(e,s,null);return}let x=xt.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,s,x),x}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,i,r,s,n,o){let a=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+wn*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let l=Math.min(this._config.deviceCellHeight+wn*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return wp;let c=!!this._workAttributeData.isBold(),u=!!this._workAttributeData.isInverse(),d=!!this._workAttributeData.isDim(),f=!!this._workAttributeData.isItalic(),p=!!this._workAttributeData.isUnderline(),m=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),_=this._workAttributeData.getFgColor(),g=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),y=this._workAttributeData.getBgColorMode();if(u){let D=_;_=S,S=D;let j=g;g=y,y=j}let L=this._getBackgroundColor(y,S,u,d);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let P=c?this._config.fontWeightBold:this._config.fontWeight,N=f?"italic":"";this._tmpCtx.font=`${N} ${P} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=R0;let B=a.length===1&&qd(a.charCodeAt(0)),U=a.length===1&&Mb(a.charCodeAt(0)),W=this._getForegroundColor(i,y,S,r,g,_,u,d,c,M0(a.charCodeAt(0)));this._tmpCtx.fillStyle=W.css;let V=U?0:wn*2,C=!1;this._config.customGlyphs!==!1&&(C=Fb(this._tmpCtx,a,V,V,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let w=!B,b;if(typeof e=="number"?b=this._unicodeService.wcwidth(e):b=this._unicodeService.getStringCellWidth(e),p){this._tmpCtx.save();let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),j=D%2===1?.5:0;if(this._tmpCtx.lineWidth=D,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())w=!1,this._tmpCtx.strokeStyle=`rgb(${Ps.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{w=!1;let Z=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Z<8&&(Z+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Z).css}this._tmpCtx.beginPath();let G=V,q=Math.ceil(V+this._config.deviceCharHeight)-j-(n?D*2:0),de=q+D,Q=q+D*2,le=this._workAttributeData.getUnderlineVariantOffset();for(let Z=0;Z<b;Z++){this._tmpCtx.save();let re=G+Z*this._config.deviceCellWidth,fe=G+(Z+1)*this._config.deviceCellWidth,rt=re+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(re,q),this._tmpCtx.lineTo(fe,q),this._tmpCtx.moveTo(re,Q),this._tmpCtx.lineTo(fe,Q);break;case 3:let oi=D<=1?Q:Math.ceil(V+this._config.deviceCharHeight-D/2)-j,Ut=D<=1?q:Math.ceil(V+this._config.deviceCharHeight+D/2)-j,Nt=new Path2D;Nt.rect(re,q,this._config.deviceCellWidth,Q-q),this._tmpCtx.clip(Nt),this._tmpCtx.moveTo(re-this._config.deviceCellWidth/2,de),this._tmpCtx.bezierCurveTo(re-this._config.deviceCellWidth/2,Ut,re,Ut,re,de),this._tmpCtx.bezierCurveTo(re,oi,rt,oi,rt,de),this._tmpCtx.bezierCurveTo(rt,Ut,fe,Ut,fe,de),this._tmpCtx.bezierCurveTo(fe,oi,fe+this._config.deviceCellWidth/2,oi,fe+this._config.deviceCellWidth/2,de);break;case 4:let te=le===0?0:le>=D?D*2-le:D-le;le>=D||te===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(re+te,q),this._tmpCtx.lineTo(fe,q)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(re,q),this._tmpCtx.lineTo(re+te,q),this._tmpCtx.moveTo(re+te+D,q),this._tmpCtx.lineTo(fe,q)),le=Ab(fe-re,D,le);break;case 5:let Dr=.6,$l=.3,Br=fe-re,cs=Math.floor(Dr*Br),Mo=Math.floor($l*Br),Ol=Br-cs-Mo;this._tmpCtx.setLineDash([cs,Mo,Ol]),this._tmpCtx.moveTo(re,q),this._tmpCtx.lineTo(fe,q);break;case 1:default:this._tmpCtx.moveTo(re,q),this._tmpCtx.lineTo(fe,q);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!C&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Z=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Z&&Z.actualBoundingBoxDescent>0){this._tmpCtx.save();let re=new Path2D;re.rect(G,q-Math.ceil(D/2),this._config.deviceCellWidth*b,Q-q+Math.ceil(D/2)),this._tmpCtx.clip(re),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(a,V,V+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),j=D%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+j),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*b,V+j),this._tmpCtx.stroke()}if(C||this._tmpCtx.fillText(a,V,V+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let D=Bh(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),L,W,w);if(D)for(let j=1;j<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,V,V+this._config.deviceCharHeight-j),D=Bh(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),L,W,w),!!D);j++);}if(m){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),j=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+Math.floor(this._config.deviceCharHeight/2)-j),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*b,V+Math.floor(this._config.deviceCharHeight/2)-j),this._tmpCtx.stroke()}this._tmpCtx.restore();let k=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),M;if(this._config.allowTransparency?M=o5(k):M=Bh(k,L,W,w),M)return wp;let T=this._findGlyphBoundingBox(k,this._workBoundingBox,h,U,C,V),E,R;for(;;){if(this._activePages.length===0){let D=this._createNewPage();E=D,R=D.currentRow,R.height=T.size.y;break}E=this._activePages[this._activePages.length-1],R=E.currentRow;for(let D of this._activePages)T.size.y<=D.currentRow.height&&(E=D,R=D.currentRow);for(let D=this._activePages.length-1;D>=0;D--)for(let j of this._activePages[D].fixedRows)j.height<=R.height&&T.size.y<=j.height&&(E=this._activePages[D],R=j);if(T.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Dh(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,R=this._overflowSizePage.currentRow,R.x+T.size.x>=E.canvas.width&&(R.x=0,R.y+=R.height,R.height=0);break}if(R.y+T.size.y>=E.canvas.height||R.height>T.size.y+2){let D=!1;if(E.currentRow.y+E.currentRow.height+T.size.y>=E.canvas.height){let j;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+T.size.y<G.canvas.height){j=G;break}if(j)E=j;else if(gs.maxAtlasPages&&this._pages.length>=gs.maxAtlasPages&&R.y+T.size.y<=E.canvas.height&&R.height>=T.size.y&&R.x+T.size.x<=E.canvas.width)D=!0;else{let G=this._createNewPage();E=G,R=G.currentRow,R.height=T.size.y,D=!0}}D||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),R={x:0,y:E.currentRow.y+E.currentRow.height,height:T.size.y},E.fixedRows.push(R),E.currentRow={x:0,y:R.y+R.height,height:0})}if(R.x+T.size.x<=E.canvas.width)break;R===E.currentRow?(R.x=0,R.y+=R.height,R.height=0):E.fixedRows.splice(E.fixedRows.indexOf(R),1)}return T.texturePage=this._pages.indexOf(E),T.texturePosition.x=R.x,T.texturePosition.y=R.y,T.texturePositionClipSpace.x=R.x/E.canvas.width,T.texturePositionClipSpace.y=R.y/E.canvas.height,T.sizeClipSpace.x/=E.canvas.width,T.sizeClipSpace.y/=E.canvas.height,R.height=Math.max(R.height,T.size.y),R.x+=T.size.x,E.ctx.putImageData(k,T.texturePosition.x-this._workBoundingBox.left,T.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,T.size.x,T.size.y),E.addGlyph(T),E.version++,T}_findGlyphBoundingBox(e,i,r,s,n,o){i.top=0;let a=s?this._config.deviceCellHeight:this._tmpCanvas.height,h=s?this._config.deviceCellWidth:r,l=!1;for(let c=0;c<a;c++){for(let u=0;u<h;u++){let d=c*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){i.top=c,l=!0;break}}if(l)break}i.left=0,l=!1;for(let c=0;c<o+h;c++){for(let u=0;u<a;u++){let d=u*this._tmpCanvas.width*4+c*4+3;if(e.data[d]!==0){i.left=c,l=!0;break}}if(l)break}i.right=h,l=!1;for(let c=o+h-1;c>=o;c--){for(let u=0;u<a;u++){let d=u*this._tmpCanvas.width*4+c*4+3;if(e.data[d]!==0){i.right=c,l=!0;break}}if(l)break}i.bottom=a,l=!1;for(let c=a-1;c>=0;c--){for(let u=0;u<h;u++){let d=c*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){i.bottom=c,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+o+(s||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+o+(s||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Dh=class{constructor(t,e,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=F0(t,e,e),this.ctx=Oe(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Bh(t,e,i,r){let s=e.rgba>>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,a=i.rgba>>>24,h=i.rgba>>>16&255,l=i.rgba>>>8&255,c=Math.floor((Math.abs(s-a)+Math.abs(n-h)+Math.abs(o-l))/12),u=!0;for(let d=0;d<t.data.length;d+=4)t.data[d]===s&&t.data[d+1]===n&&t.data[d+2]===o||r&&Math.abs(t.data[d]-s)+Math.abs(t.data[d+1]-n)+Math.abs(t.data[d+2]-o)<c?t.data[d+3]=0:u=!1;return u}function o5(t){for(let e=0;e<t.data.length;e+=4)if(t.data[e+3]>0)return!1;return!0}function F0(t,e,i){let r=t.createElement("canvas");return r.width=e,r.height=i,r}function a5(t,e,i,r,s,n,o,a){let h={foreground:n.foreground,background:n.background,cursor:Gt,cursorAccent:Gt,selectionForeground:Gt,selectionBackgroundTransparent:Gt,selectionBackgroundOpaque:Gt,selectionInactiveBackgroundTransparent:Gt,selectionInactiveBackgroundOpaque:Gt,overviewRulerBorder:Gt,scrollbarSliderBackground:Gt,scrollbarSliderHoverBackground:Gt,scrollbarSliderActiveBackground:Gt,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:t,deviceCellHeight:e,deviceCharWidth:i,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:h}}function xp(t,e){for(let i=0;i<t.colors.ansi.length;i++)if(t.colors.ansi[i].rgba!==e.colors.ansi[i].rgba)return!1;return t.devicePixelRatio===e.devicePixelRatio&&t.customGlyphs===e.customGlyphs&&t.lineHeight===e.lineHeight&&t.letterSpacing===e.letterSpacing&&t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize&&t.fontWeight===e.fontWeight&&t.fontWeightBold===e.fontWeightBold&&t.allowTransparency===e.allowTransparency&&t.deviceCharWidth===e.deviceCharWidth&&t.deviceCharHeight===e.deviceCharHeight&&t.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&t.minimumContrastRatio===e.minimumContrastRatio&&t.colors.foreground.rgba===e.colors.foreground.rgba&&t.colors.background.rgba===e.colors.background.rgba}function l5(t){return(t&50331648)===16777216||(t&50331648)===33554432}var ei=[];function j0(t,e,i,r,s,n,o,a,h){let l=a5(r,s,n,o,e,i,a,h);for(let d=0;d<ei.length;d++){let f=ei[d],p=f.ownedBy.indexOf(t);if(p>=0){if(xp(f.config,l))return f.atlas;f.ownedBy.length===1?(f.atlas.dispose(),ei.splice(d,1)):f.ownedBy.splice(p,1);break}}for(let d=0;d<ei.length;d++){let f=ei[d];if(xp(f.config,l))return f.ownedBy.push(t),f.atlas}let c=t._core,u={atlas:new or(document,l,c.unicodeService),config:l,ownedBy:[t]};return ei.push(u),u.atlas}function Cp(t){for(let e=0;e<ei.length;e++){let i=ei[e].ownedBy.indexOf(t);if(i!==-1){ei[e].ownedBy.length===1?(ei[e].atlas.dispose(),ei.splice(e,1)):ei[e].ownedBy.splice(i,1);break}}}var ia=600,h5=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(t=ia){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=ia-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=ia-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},ia)},t)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function bp(t,e,i){let r=new e.ResizeObserver(s=>{let n=s.find(h=>h.target===t);if(!n)return;if(!("devicePixelContentBoxSize"in n)){r==null||r.disconnect(),r=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,a=n.devicePixelContentBoxSize[0].blockSize;o>0&&a>0&&i(o,a)});try{r.observe(t,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return vt(()=>r==null?void 0:r.disconnect())}function c5(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}var kp=class W0 extends Ps{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new A0,this.combinedData=""}static fromCharData(e){let i=new W0;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?c5(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},H0=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function U0(t,e,i){let r=Oe(t.createProgram());if(t.attachShader(r,Oe(Ep(t,t.VERTEX_SHADER,e))),t.attachShader(r,Oe(Ep(t,t.FRAGMENT_SHADER,i))),t.linkProgram(r),t.getProgramParameter(r,t.LINK_STATUS))return r;console.error(t.getProgramInfoLog(r)),t.deleteProgram(r)}function Ep(t,e,i){let r=Oe(t.createShader(e));if(t.shaderSource(r,i),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS))return r;console.error(t.getShaderInfoLog(r)),t.deleteShader(r)}function u5(t,e){let i=Math.min(t.length*2,e),r=new Float32Array(i);for(let s=0;s<t.length;s++)r[s]=t[s];return r}var d5=class{constructor(t){this.texture=t,this.version=-1}},f5=`#version 300 es
|
|
138
|
+
`))}},e5=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},t5=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},i5=0,Ph=class{constructor(t){this.value=t,this.id=i5++}},r5=2,s5,ye=class{constructor(t){var e,i,r,s;this._size=0,this._options=t,this._leakageMon=(e=this._options)!=null&&e.leakWarningThreshold?new Z2((t==null?void 0:t.onListenerError)??Rh,((i=this._options)==null?void 0:i.leakWarningThreshold)??Q2):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new X2(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,e,i,r;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(e=this._options)==null?void 0:e.onDidRemoveLastListener)==null||i.call(e),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(t,e,i)=>{var o,a,h,l,c;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let u=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(u);let d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new t5(`${u}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Rh)(f),mi.None}if(this._disposed)return mi.None;e&&(t=t.bind(e));let r=new Ph(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=J2.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Ph?(this._deliveryQueue??(this._deliveryQueue=new n5),this._listeners=[this._listeners,r]):this._listeners.push(r):((h=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||h.call(a,this),this._listeners=r,(c=(l=this._options)==null?void 0:l.onDidAddFirstListener)==null||c.call(l,this)),this._size++;let n=vt(()=>{s==null||s(),this._removeListener(r)});return i instanceof Fs?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(t){var s,n,o,a;if((n=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||n.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||a.call(o,this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-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--,e[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*r5<=e.length){let h=0;for(let l=0;l<e.length;l++)e[l]?e[h++]=e[l]:r&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=h}}_deliver(t,e){var r;if(!t)return;let i=((r=this._options)==null?void 0:r.onListenerError)||Rh;if(!i){t.value(e);return}try{t.value(e)}catch(s){i(s)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){var e,i,r,s;if((e=this._deliveryQueue)!=null&&e.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof Ph)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},n5=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},wp={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},wn=2,xn,or=class gs{constructor(e,i,r){this._document=e,this._config=i,this._unicodeService=r,this._didWarmUp=!1,this._cacheMap=new Sp,this._cacheMapCombined=new Sp,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ps,this._textureSize=512,this._onAddTextureAtlasCanvas=new ye,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ye,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=F0(e,this._config.deviceCellWidth*4+wn*2,this._config.deviceCellHeight+wn*2),this._tmpCtx=Oe(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new q2;for(let i=33;i<126;i++)e.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let r=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,r)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(gs.maxAtlasPages&&this._pages.length>=Math.max(4,gs.maxAtlasPages)){let i=this._pages.filter(l=>l.canvas.width*2<=(gs.maxTextureSize||4096)).sort((l,c)=>c.canvas.width!==l.canvas.width?c.canvas.width-l.canvas.width:c.percentageUsed-l.percentageUsed),r=-1,s=0;for(let l=0;l<i.length;l++)if(i[l].canvas.width!==s)r=l,s=i[l].canvas.width;else if(l-r===3)break;let n=i.slice(r,r+4),o=n.map(l=>l.glyphs[0].texturePage).sort((l,c)=>l>c?1:-1),a=this.pages.length-n.length,h=this._mergePages(n,a);h.version++;for(let l=o.length-1;l>=0;l--)this._deletePage(o[l]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let e=new Dh(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,i){let r=e[0].canvas.width*2,s=new Dh(this._document,r,e);for(let[n,o]of e.entries()){let a=n*o.canvas.width%r,h=Math.floor(n/2)*o.canvas.height;s.ctx.drawImage(o.canvas,a,h);for(let c of o.glyphs)c.texturePage=i,c.sizeClipSpace.x=c.size.x/r,c.sizeClipSpace.y=c.size.y/r,c.texturePosition.x+=a,c.texturePosition.y+=h,c.texturePositionClipSpace.x=c.texturePosition.x/r,c.texturePositionClipSpace.y=c.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let l=this._activePages.indexOf(o);l!==-1&&this._activePages.splice(l,1)}return s}_deletePage(e){this._pages.splice(e,1);for(let i=e;i<this._pages.length;i++){let r=this._pages[i];for(let s of r.glyphs)s.texturePage--;r.version++}}getRasterizedGlyphCombinedChar(e,i,r,s,n,o){return this._getFromCacheMap(this._cacheMapCombined,e,i,r,s,n,o)}getRasterizedGlyph(e,i,r,s,n,o){return this._getFromCacheMap(this._cacheMap,e,i,r,s,n,o)}_getFromCacheMap(e,i,r,s,n,o,a){return xn=e.get(i,r,s,n),xn||(xn=this._drawToCache(i,r,s,n,o,a),e.set(i,r,s,n,xn)),xn}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,i,r,s){if(this._config.allowTransparency)return Gt;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(i);break;case 50331648:let o=Ps.toColorRGB(i);n=xt.toColor(o[0],o[1],o[2]);break;case 0:default:r?n=Bn.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=Bn.opaque(n)),n}_getForegroundColor(e,i,r,s,n,o,a,h,l,c){let u=this._getMinimumContrastColor(e,i,r,s,n,o,a,l,h,c);if(u)return u;let d;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&o<8&&(o+=8),d=this._getColorFromAnsiIndex(o);break;case 50331648:let f=Ps.toColorRGB(o);d=xt.toColor(f[0],f[1],f[2]);break;case 0:default:a?d=this._config.colors.background:d=this._config.colors.foreground}return this._config.allowTransparency&&(d=Bn.opaque(d)),h&&(d=Bn.multiplyOpacity(d,$2)),d}_resolveBackgroundRgba(e,i,r){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,i,r,s){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,i,r,s,n,o,a,h,l,c){if(this._config.minimumContrastRatio===1||c)return;let u=this._getContrastCache(l),d=u.getColor(e,s);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(i,r,a),p=this._resolveForegroundRgba(n,o,a,h),m=Xr.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(l?2:1));if(!m){u.setColor(e,s,null);return}let x=xt.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,s,x),x}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,i,r,s,n,o){let a=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+wn*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let l=Math.min(this._config.deviceCellHeight+wn*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return wp;let c=!!this._workAttributeData.isBold(),u=!!this._workAttributeData.isInverse(),d=!!this._workAttributeData.isDim(),f=!!this._workAttributeData.isItalic(),p=!!this._workAttributeData.isUnderline(),m=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),_=this._workAttributeData.getFgColor(),g=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),y=this._workAttributeData.getBgColorMode();if(u){let D=_;_=S,S=D;let j=g;g=y,y=j}let L=this._getBackgroundColor(y,S,u,d);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let P=c?this._config.fontWeightBold:this._config.fontWeight,N=f?"italic":"";this._tmpCtx.font=`${N} ${P} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=R0;let B=a.length===1&&qd(a.charCodeAt(0)),U=a.length===1&&M2(a.charCodeAt(0)),W=this._getForegroundColor(i,y,S,r,g,_,u,d,c,M0(a.charCodeAt(0)));this._tmpCtx.fillStyle=W.css;let V=U?0:wn*2,C=!1;this._config.customGlyphs!==!1&&(C=F2(this._tmpCtx,a,V,V,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let w=!B,b;if(typeof e=="number"?b=this._unicodeService.wcwidth(e):b=this._unicodeService.getStringCellWidth(e),p){this._tmpCtx.save();let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),j=D%2===1?.5:0;if(this._tmpCtx.lineWidth=D,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())w=!1,this._tmpCtx.strokeStyle=`rgb(${Ps.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{w=!1;let Z=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Z<8&&(Z+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Z).css}this._tmpCtx.beginPath();let G=V,q=Math.ceil(V+this._config.deviceCharHeight)-j-(n?D*2:0),fe=q+D,Q=q+D*2,le=this._workAttributeData.getUnderlineVariantOffset();for(let Z=0;Z<b;Z++){this._tmpCtx.save();let re=G+Z*this._config.deviceCellWidth,_e=G+(Z+1)*this._config.deviceCellWidth,rt=re+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(re,q),this._tmpCtx.lineTo(_e,q),this._tmpCtx.moveTo(re,Q),this._tmpCtx.lineTo(_e,Q);break;case 3:let oi=D<=1?Q:Math.ceil(V+this._config.deviceCharHeight-D/2)-j,Ut=D<=1?q:Math.ceil(V+this._config.deviceCharHeight+D/2)-j,Nt=new Path2D;Nt.rect(re,q,this._config.deviceCellWidth,Q-q),this._tmpCtx.clip(Nt),this._tmpCtx.moveTo(re-this._config.deviceCellWidth/2,fe),this._tmpCtx.bezierCurveTo(re-this._config.deviceCellWidth/2,Ut,re,Ut,re,fe),this._tmpCtx.bezierCurveTo(re,oi,rt,oi,rt,fe),this._tmpCtx.bezierCurveTo(rt,Ut,_e,Ut,_e,fe),this._tmpCtx.bezierCurveTo(_e,oi,_e+this._config.deviceCellWidth/2,oi,_e+this._config.deviceCellWidth/2,fe);break;case 4:let te=le===0?0:le>=D?D*2-le:D-le;le>=D||te===0?(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(re+te,q),this._tmpCtx.lineTo(_e,q)):(this._tmpCtx.setLineDash([Math.round(D),Math.round(D)]),this._tmpCtx.moveTo(re,q),this._tmpCtx.lineTo(re+te,q),this._tmpCtx.moveTo(re+te+D,q),this._tmpCtx.lineTo(_e,q)),le=A2(_e-re,D,le);break;case 5:let Dr=.6,$l=.3,Br=_e-re,cs=Math.floor(Dr*Br),Mo=Math.floor($l*Br),Ol=Br-cs-Mo;this._tmpCtx.setLineDash([cs,Mo,Ol]),this._tmpCtx.moveTo(re,q),this._tmpCtx.lineTo(_e,q);break;case 1:default:this._tmpCtx.moveTo(re,q),this._tmpCtx.lineTo(_e,q);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!C&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Z=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Z&&Z.actualBoundingBoxDescent>0){this._tmpCtx.save();let re=new Path2D;re.rect(G,q-Math.ceil(D/2),this._config.deviceCellWidth*b,Q-q+Math.ceil(D/2)),this._tmpCtx.clip(re),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(a,V,V+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),j=D%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+j),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*b,V+j),this._tmpCtx.stroke()}if(C||this._tmpCtx.fillText(a,V,V+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let D=Bh(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),L,W,w);if(D)for(let j=1;j<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,V,V+this._config.deviceCharHeight-j),D=Bh(this._tmpCtx.getImageData(V,V,this._config.deviceCellWidth,this._config.deviceCellHeight),L,W,w),!!D);j++);}if(m){let D=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),j=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=D,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(V,V+Math.floor(this._config.deviceCharHeight/2)-j),this._tmpCtx.lineTo(V+this._config.deviceCharWidth*b,V+Math.floor(this._config.deviceCharHeight/2)-j),this._tmpCtx.stroke()}this._tmpCtx.restore();let k=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),M;if(this._config.allowTransparency?M=o5(k):M=Bh(k,L,W,w),M)return wp;let T=this._findGlyphBoundingBox(k,this._workBoundingBox,h,U,C,V),E,R;for(;;){if(this._activePages.length===0){let D=this._createNewPage();E=D,R=D.currentRow,R.height=T.size.y;break}E=this._activePages[this._activePages.length-1],R=E.currentRow;for(let D of this._activePages)T.size.y<=D.currentRow.height&&(E=D,R=D.currentRow);for(let D=this._activePages.length-1;D>=0;D--)for(let j of this._activePages[D].fixedRows)j.height<=R.height&&T.size.y<=j.height&&(E=this._activePages[D],R=j);if(T.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Dh(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),E=this._overflowSizePage,R=this._overflowSizePage.currentRow,R.x+T.size.x>=E.canvas.width&&(R.x=0,R.y+=R.height,R.height=0);break}if(R.y+T.size.y>=E.canvas.height||R.height>T.size.y+2){let D=!1;if(E.currentRow.y+E.currentRow.height+T.size.y>=E.canvas.height){let j;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+T.size.y<G.canvas.height){j=G;break}if(j)E=j;else if(gs.maxAtlasPages&&this._pages.length>=gs.maxAtlasPages&&R.y+T.size.y<=E.canvas.height&&R.height>=T.size.y&&R.x+T.size.x<=E.canvas.width)D=!0;else{let G=this._createNewPage();E=G,R=G.currentRow,R.height=T.size.y,D=!0}}D||(E.currentRow.height>0&&E.fixedRows.push(E.currentRow),R={x:0,y:E.currentRow.y+E.currentRow.height,height:T.size.y},E.fixedRows.push(R),E.currentRow={x:0,y:R.y+R.height,height:0})}if(R.x+T.size.x<=E.canvas.width)break;R===E.currentRow?(R.x=0,R.y+=R.height,R.height=0):E.fixedRows.splice(E.fixedRows.indexOf(R),1)}return T.texturePage=this._pages.indexOf(E),T.texturePosition.x=R.x,T.texturePosition.y=R.y,T.texturePositionClipSpace.x=R.x/E.canvas.width,T.texturePositionClipSpace.y=R.y/E.canvas.height,T.sizeClipSpace.x/=E.canvas.width,T.sizeClipSpace.y/=E.canvas.height,R.height=Math.max(R.height,T.size.y),R.x+=T.size.x,E.ctx.putImageData(k,T.texturePosition.x-this._workBoundingBox.left,T.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,T.size.x,T.size.y),E.addGlyph(T),E.version++,T}_findGlyphBoundingBox(e,i,r,s,n,o){i.top=0;let a=s?this._config.deviceCellHeight:this._tmpCanvas.height,h=s?this._config.deviceCellWidth:r,l=!1;for(let c=0;c<a;c++){for(let u=0;u<h;u++){let d=c*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){i.top=c,l=!0;break}}if(l)break}i.left=0,l=!1;for(let c=0;c<o+h;c++){for(let u=0;u<a;u++){let d=u*this._tmpCanvas.width*4+c*4+3;if(e.data[d]!==0){i.left=c,l=!0;break}}if(l)break}i.right=h,l=!1;for(let c=o+h-1;c>=o;c--){for(let u=0;u<a;u++){let d=u*this._tmpCanvas.width*4+c*4+3;if(e.data[d]!==0){i.right=c,l=!0;break}}if(l)break}i.bottom=a,l=!1;for(let c=a-1;c>=0;c--){for(let u=0;u<h;u++){let d=c*this._tmpCanvas.width*4+u*4+3;if(e.data[d]!==0){i.bottom=c,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+o+(s||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+o+(s||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Dh=class{constructor(t,e,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=F0(t,e,e),this.ctx=Oe(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Bh(t,e,i,r){let s=e.rgba>>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,a=i.rgba>>>24,h=i.rgba>>>16&255,l=i.rgba>>>8&255,c=Math.floor((Math.abs(s-a)+Math.abs(n-h)+Math.abs(o-l))/12),u=!0;for(let d=0;d<t.data.length;d+=4)t.data[d]===s&&t.data[d+1]===n&&t.data[d+2]===o||r&&Math.abs(t.data[d]-s)+Math.abs(t.data[d+1]-n)+Math.abs(t.data[d+2]-o)<c?t.data[d+3]=0:u=!1;return u}function o5(t){for(let e=0;e<t.data.length;e+=4)if(t.data[e+3]>0)return!1;return!0}function F0(t,e,i){let r=t.createElement("canvas");return r.width=e,r.height=i,r}function a5(t,e,i,r,s,n,o,a){let h={foreground:n.foreground,background:n.background,cursor:Gt,cursorAccent:Gt,selectionForeground:Gt,selectionBackgroundTransparent:Gt,selectionBackgroundOpaque:Gt,selectionInactiveBackgroundTransparent:Gt,selectionInactiveBackgroundOpaque:Gt,overviewRulerBorder:Gt,scrollbarSliderBackground:Gt,scrollbarSliderHoverBackground:Gt,scrollbarSliderActiveBackground:Gt,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:t,deviceCellHeight:e,deviceCharWidth:i,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:h}}function xp(t,e){for(let i=0;i<t.colors.ansi.length;i++)if(t.colors.ansi[i].rgba!==e.colors.ansi[i].rgba)return!1;return t.devicePixelRatio===e.devicePixelRatio&&t.customGlyphs===e.customGlyphs&&t.lineHeight===e.lineHeight&&t.letterSpacing===e.letterSpacing&&t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize&&t.fontWeight===e.fontWeight&&t.fontWeightBold===e.fontWeightBold&&t.allowTransparency===e.allowTransparency&&t.deviceCharWidth===e.deviceCharWidth&&t.deviceCharHeight===e.deviceCharHeight&&t.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&t.minimumContrastRatio===e.minimumContrastRatio&&t.colors.foreground.rgba===e.colors.foreground.rgba&&t.colors.background.rgba===e.colors.background.rgba}function l5(t){return(t&50331648)===16777216||(t&50331648)===33554432}var ei=[];function j0(t,e,i,r,s,n,o,a,h){let l=a5(r,s,n,o,e,i,a,h);for(let d=0;d<ei.length;d++){let f=ei[d],p=f.ownedBy.indexOf(t);if(p>=0){if(xp(f.config,l))return f.atlas;f.ownedBy.length===1?(f.atlas.dispose(),ei.splice(d,1)):f.ownedBy.splice(p,1);break}}for(let d=0;d<ei.length;d++){let f=ei[d];if(xp(f.config,l))return f.ownedBy.push(t),f.atlas}let c=t._core,u={atlas:new or(document,l,c.unicodeService),config:l,ownedBy:[t]};return ei.push(u),u.atlas}function Cp(t){for(let e=0;e<ei.length;e++){let i=ei[e].ownedBy.indexOf(t);if(i!==-1){ei[e].ownedBy.length===1?(ei[e].atlas.dispose(),ei.splice(e,1)):ei[e].ownedBy.splice(i,1);break}}}var ia=600,h5=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(t=ia){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=ia-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=ia-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},ia)},t)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function bp(t,e,i){let r=new e.ResizeObserver(s=>{let n=s.find(h=>h.target===t);if(!n)return;if(!("devicePixelContentBoxSize"in n)){r==null||r.disconnect(),r=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,a=n.devicePixelContentBoxSize[0].blockSize;o>0&&a>0&&i(o,a)});try{r.observe(t,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return vt(()=>r==null?void 0:r.disconnect())}function c5(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}var kp=class W0 extends Ps{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new A0,this.combinedData=""}static fromCharData(e){let i=new W0;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?c5(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},H0=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function U0(t,e,i){let r=Oe(t.createProgram());if(t.attachShader(r,Oe(Ep(t,t.VERTEX_SHADER,e))),t.attachShader(r,Oe(Ep(t,t.FRAGMENT_SHADER,i))),t.linkProgram(r),t.getProgramParameter(r,t.LINK_STATUS))return r;console.error(t.getProgramInfoLog(r)),t.deleteProgram(r)}function Ep(t,e,i){let r=Oe(t.createShader(e));if(t.shaderSource(r,i),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS))return r;console.error(t.getShaderInfoLog(r)),t.deleteShader(r)}function u5(t,e){let i=Math.min(t.length*2,e),r=new Float32Array(i);for(let s=0;s<t.length;s++)r[s]=t[s];return r}var d5=class{constructor(t){this.texture=t,this.version=-1}},f5=`#version 300 es
|
|
139
139
|
layout (location = 0) in vec2 a_unitquad;
|
|
140
140
|
layout (location = 1) in vec2 a_cellpos;
|
|
141
141
|
layout (location = 2) in vec2 a_offset;
|
|
@@ -169,7 +169,7 @@ void main() {
|
|
|
169
169
|
if (v_texpage == 0) {
|
|
170
170
|
outColor = texture(u_texture[0], v_texcoord);
|
|
171
171
|
} ${e}
|
|
172
|
-
}`}var ar=11,_s=ar*Float32Array.BYTES_PER_ELEMENT,p5=2,Re=0,
|
|
172
|
+
}`}var ar=11,_s=ar*Float32Array.BYTES_PER_ELEMENT,p5=2,Re=0,ge,Ah=0,Cn=0,g5=class extends mi{constructor(t,e,i,r){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let s=this._gl;or.maxAtlasPages===void 0&&(or.maxAtlasPages=Math.min(32,Oe(s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS))),or.maxTextureSize=Oe(s.getParameter(s.MAX_TEXTURE_SIZE))),this._program=Oe(U0(s,f5,_5(or.maxAtlasPages))),this._register(vt(()=>s.deleteProgram(this._program))),this._projectionLocation=Oe(s.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Oe(s.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Oe(s.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(vt(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=s.createBuffer();this._register(vt(()=>s.deleteBuffer(h))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,h),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=Oe(s.createBuffer()),this._register(vt(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,2,s.FLOAT,!1,_s,0),s.vertexAttribDivisor(2,1),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,s.FLOAT,!1,_s,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(3,1),s.enableVertexAttribArray(4),s.vertexAttribPointer(4,1,s.FLOAT,!1,_s,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(4,1),s.enableVertexAttribArray(5),s.vertexAttribPointer(5,2,s.FLOAT,!1,_s,5*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(5,1),s.enableVertexAttribArray(6),s.vertexAttribPointer(6,2,s.FLOAT,!1,_s,7*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(6,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,_s,9*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.useProgram(this._program);let l=new Int32Array(or.maxAtlasPages);for(let c=0;c<or.maxAtlasPages;c++)l[c]=c;s.uniform1iv(this._textureLocation,l),s.uniformMatrix4fv(this._projectionLocation,!1,H0),this._atlasTextures=[];for(let c=0;c<or.maxAtlasPages;c++){let u=new d5(Oe(s.createTexture()));this._register(vt(()=>s.deleteTexture(u.texture))),s.activeTexture(s.TEXTURE0+c),s.bindTexture(s.TEXTURE_2D,u.texture),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[c]=u}s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,e,i,r,s,n,o,a,h){this._updateCell(this._vertices.attributes,t,e,i,r,s,n,o,a,h)}_updateCell(t,e,i,r,s,n,o,a,h,l){if(Re=(i*this._terminal.cols+e)*ar,r===0||r===void 0){t.fill(0,Re,Re+ar-1-p5);return}this._atlas&&(a&&a.length>1?ge=this._atlas.getRasterizedGlyphCombinedChar(a,s,n,o,!1,this._terminal.element):ge=this._atlas.getRasterizedGlyph(r,s,n,o,!1,this._terminal.element),Ah=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),s!==l&&ge.offset.x>Ah?(Cn=ge.offset.x-Ah,t[Re]=-(ge.offset.x-Cn)+this._dimensions.device.char.left,t[Re+1]=-ge.offset.y+this._dimensions.device.char.top,t[Re+2]=(ge.size.x-Cn)/this._dimensions.device.canvas.width,t[Re+3]=ge.size.y/this._dimensions.device.canvas.height,t[Re+4]=ge.texturePage,t[Re+5]=ge.texturePositionClipSpace.x+Cn/this._atlas.pages[ge.texturePage].canvas.width,t[Re+6]=ge.texturePositionClipSpace.y,t[Re+7]=ge.sizeClipSpace.x-Cn/this._atlas.pages[ge.texturePage].canvas.width,t[Re+8]=ge.sizeClipSpace.y):(t[Re]=-ge.offset.x+this._dimensions.device.char.left,t[Re+1]=-ge.offset.y+this._dimensions.device.char.top,t[Re+2]=ge.size.x/this._dimensions.device.canvas.width,t[Re+3]=ge.size.y/this._dimensions.device.canvas.height,t[Re+4]=ge.texturePage,t[Re+5]=ge.texturePositionClipSpace.x,t[Re+6]=ge.texturePositionClipSpace.y,t[Re+7]=ge.sizeClipSpace.x,t[Re+8]=ge.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&D2(r,h,ge.size.x,this._dimensions.device.cell.width)&&(t[Re+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,e=t.cols*t.rows*ar;this._vertices.count!==e?this._vertices.attributes=new Float32Array(e):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==e?this._vertices.attributesBuffers[i]=new Float32Array(e):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=e,i=0;for(let r=0;r<t.rows;r++)for(let s=0;s<t.cols;s++)this._vertices.attributes[i+9]=s/t.cols,this._vertices.attributes[i+10]=r/t.rows,i+=ar}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let s=0;s<t.lineLengths.length;s++){let n=s*this._terminal.cols*ar,o=this._vertices.attributes.subarray(n,n+t.lineLengths[s]*ar);i.set(o,r),r+=o.length}e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,i.subarray(0,r),e.STREAM_DRAW);for(let s=0;s<this._atlas.pages.length;s++)this._atlas.pages[s].version!==this._atlasTextures[s].version&&this._bindAtlasPageTexture(e,this._atlas,s);e.drawElementsInstanced(e.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,r/ar)}setAtlas(t){this._atlas=t;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(t,e,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=e.pages[i].version}setDimensions(t){this._dimensions=t}},v5=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(t,e,i,r=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let s=t.buffers.active.ydisp,n=e[1]-s,o=i[1]-s,a=Math.max(n,0),h=Math.min(o,t.rows-1);if(a>=t.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=h,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e<this.endCol&&i<=this.viewportCappedEndRow:e<this.startCol&&i>=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol):!1}};function m5(){return new v5}var hl=4,Ea=1,La=2,Nh=3,y5=2147483648,S5=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=m5()}resize(t,e){let i=t*e*hl;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(e))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},w5=`#version 300 es
|
|
173
173
|
layout (location = 0) in vec2 a_position;
|
|
174
174
|
layout (location = 1) in vec2 a_size;
|
|
175
175
|
layout (location = 2) in vec4 a_color;
|
|
@@ -192,10 +192,10 @@ out vec4 outColor;
|
|
|
192
192
|
|
|
193
193
|
void main() {
|
|
194
194
|
outColor = v_color;
|
|
195
|
-
}`,Fi=8,$h=Fi*Float32Array.BYTES_PER_ELEMENT,C5=20*Fi,Lp=class{constructor(){this.attributes=new Float32Array(C5),this.count=0}},Ii=0,Mp=0,Rp=0,Tp=0,Pp=0,Dp=0,Bp=0,b5=class extends mi{constructor(t,e,i,r){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._themeService=r,this._vertices=new Lp,this._verticesCursor=new Lp;let s=this._gl;this._program=Oe(U0(s,w5,x5)),this._register(vt(()=>s.deleteProgram(this._program))),this._projectionLocation=Oe(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(vt(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=s.createBuffer();this._register(vt(()=>s.deleteBuffer(h))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,h),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=Oe(s.createBuffer()),this._register(vt(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,$h,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,$h,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,$h,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(l=>{this._updateCachedColors(l),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,H0),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let e=this._terminal,i=this._vertices,r=1,s,n,o,a,h,l,c,u,d,f,p;for(s=0;s<e.rows;s++){for(o=-1,a=0,h=0,l=!1,n=0;n<e.cols;n++)c=(s*e.cols+n)*hl,u=t.cells[c+Ea],d=t.cells[c+La],f=!!(d&67108864),(u!==a||d!==h&&(l||f))&&((a!==0||l&&h!==0)&&(p=r++*Fi,this._updateRectangle(i,p,h,a,o,n,s)),o=n,a=u,h=d,l=f);(a!==0||l&&h!==0)&&(p=r++*Fi,this._updateRectangle(i,p,h,a,o,e.cols,s))}i.count=r}updateCursor(t){let e=this._verticesCursor,i=t.cursor;if(!i||i.style==="block"){e.count=0;return}let r,s=0;(i.style==="bar"||i.style==="outline")&&(r=s++*Fi,this._addRectangleFloat(e.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(r=s++*Fi,this._addRectangleFloat(e.attributes,r,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(r=s++*Fi,this._addRectangleFloat(e.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),r=s++*Fi,this._addRectangleFloat(e.attributes,r,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=s}_updateRectangle(t,e,i,r,s,n,o){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Ii=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Ii=(i&16777215)<<8;break;case 0:default:Ii=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:Ii=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Ii=(r&16777215)<<8;break;case 0:default:Ii=this._themeService.colors.background.rgba}t.attributes.length<e+4&&(t.attributes=u5(t.attributes,this._terminal.rows*this._terminal.cols*Fi)),Mp=s*this._dimensions.device.cell.width,Rp=o*this._dimensions.device.cell.height,Tp=(Ii>>24&255)/255,Pp=(Ii>>16&255)/255,Dp=(Ii>>8&255)/255,Bp=1,this._addRectangle(t.attributes,e,Mp,Rp,(n-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Tp,Pp,Dp,Bp)}_addRectangle(t,e,i,r,s,n,o,a,h,l){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=r/this._dimensions.device.canvas.height,t[e+2]=s/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o,t[e+5]=a,t[e+6]=h,t[e+7]=l}_addRectangleFloat(t,e,i,r,s,n,o){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=r/this._dimensions.device.canvas.height,t[e+2]=s/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o[0],t[e+5]=o[1],t[e+6]=o[2],t[e+7]=o[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},k5=class extends mi{constructor(t,e,i,r,s,n,o,a){super(),this._container=e,this._alpha=s,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(vt(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Oe(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,e,i){}handleSelectionChanged(t,e,i,r=!1){}_setTransparency(t,e){if(e===this._alpha)return;let i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=j0(t,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,e,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,e,i,r){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(t,e,i,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=R0,this._clipCell(i,r,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,e,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,e,i){let r=e?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${r} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},E5=class extends k5{constructor(t,e,i,r,s,n,o){super(i,t,"link",e,!0,s,n,o),this._register(r.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(r.onHideLinkUnderline(a=>this._handleHideLinkUnderline(a)))}resize(t,e){super.resize(t,e),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&l5(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let e=t.y1+1;e<t.y2;e++)this._fillBottomLineAtCells(0,e,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Ur=typeof window=="object"?window:globalThis,Pu=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ye,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ye,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Pu.INSTANCE=new Pu;var K0=Pu;function L5(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}K0.INSTANCE.onDidChangeZoomLevel;K0.INSTANCE.onDidChangeFullscreen;var rn=typeof navigator=="object"?navigator.userAgent:"";rn.indexOf("Firefox")>=0;rn.indexOf("AppleWebKit")>=0;var M5=rn.indexOf("Chrome")>=0;!M5&&rn.indexOf("Safari")>=0;rn.indexOf("Electron/")>=0;rn.indexOf("Android")>=0;var Oh=!1;if(typeof Ur.matchMedia=="function"){let t=Ur.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Ur.matchMedia("(display-mode: fullscreen)");Oh=t.matches,L5(Ur,t,({matches:i})=>{Oh&&e.matches||(Oh=i)})}var Ds="en",Ih=!1,V0=!1,ra,Ma=Ds,Ap=Ds,R5,ui,Qr=globalThis,lt,eg;typeof Qr.vscode<"u"&&typeof Qr.vscode.process<"u"?lt=Qr.vscode.process:typeof process<"u"&&typeof((eg=process==null?void 0:process.versions)==null?void 0:eg.node)=="string"&&(lt=process);var tg,T5=typeof((tg=lt==null?void 0:lt.versions)==null?void 0:tg.electron)=="string",P5=T5&&(lt==null?void 0:lt.type)==="renderer",ig;if(typeof lt=="object"){lt.platform,lt.platform,Ih=lt.platform==="linux",Ih&<.env.SNAP&<.env.SNAP_REVISION,lt.env.CI||lt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ra=Ds,Ma=Ds;let t=lt.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);ra=e.userLocale,Ap=e.osLocale,Ma=e.resolvedLanguage||Ds,R5=(ig=e.languagePack)==null?void 0:ig.translationsConfigFile}catch{}V0=!0}else typeof navigator=="object"&&!P5?(ui=navigator.userAgent,ui.indexOf("Windows")>=0,ui.indexOf("Macintosh")>=0,(ui.indexOf("Macintosh")>=0||ui.indexOf("iPad")>=0||ui.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ih=ui.indexOf("Linux")>=0,(ui==null?void 0:ui.indexOf("Mobi"))>=0,Ma=globalThis._VSCODE_NLS_LANGUAGE||Ds,ra=navigator.language.toLowerCase(),Ap=ra):console.error("Unable to resolve platform.");var Np=V0,Bi=ui,nr=Ma,D5;(t=>{function e(){return nr}t.value=e;function i(){return nr.length===2?nr==="en":nr.length>=3?nr[0]==="e"&&nr[1]==="n"&&nr[2]==="-":!1}t.isDefaultVariant=i;function r(){return nr==="en"}t.isDefault=r})(D5||(D5={}));var B5=typeof Qr.postMessage=="function"&&!Qr.importScripts;(()=>{if(B5){let t=[];Qr.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r<s;r++){let n=t[r];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(r,1),n.callback();return}}});let e=0;return i=>{let r=++e;t.push({id:r,callback:i}),Qr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var A5=!!(Bi&&Bi.indexOf("Chrome")>=0);Bi&&Bi.indexOf("Firefox")>=0;!A5&&Bi&&Bi.indexOf("Safari")>=0;Bi&&Bi.indexOf("Edg/")>=0;Bi&&Bi.indexOf("Android")>=0;var ps=typeof navigator=="object"?navigator:{};Np||document.queryCommandSupported&&document.queryCommandSupported("copy")||ps&&ps.clipboard&&ps.clipboard.writeText,Np||ps&&ps.clipboard&&ps.clipboard.readText;var Gd=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},zh=new Gd,$p=new Gd,Op=new Gd;new Array(230);var N5;(t=>{function e(a){return zh.keyCodeToStr(a)}t.toString=e;function i(a){return zh.strToKeyCode(a)}t.fromString=i;function r(a){return $p.keyCodeToStr(a)}t.toUserSettingsUS=r;function s(a){return Op.keyCodeToStr(a)}t.toUserSettingsGeneral=s;function n(a){return $p.strToKeyCode(a)||Op.strToKeyCode(a)}t.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return zh.keyCodeToStr(a)}t.toElectronAccelerator=o})(N5||(N5={}));var q0=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),$5;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof O5?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ki.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:q0})})($5||($5={}));var O5=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?q0:(this._emitter||(this._emitter=new ye),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},I5;(t=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(I5||(I5={}));var Ip=class Yt{static fromArray(e){return new Yt(i=>{i.emitMany(e)})}static fromPromise(e){return new Yt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new Yt(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new Yt(async i=>{await Promise.all(e.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ye,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Ki.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new Yt(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return Yt.map(this,e)}static filter(e,i){return new Yt(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return Yt.filter(this,e)}static coalesce(e){return Yt.filter(e,i=>!!i)}coalesce(){return Yt.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return Yt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Ip.EMPTY=Ip.fromArray([]);var{getWindow:z5}=function(){let t=new Map,e={window:Ur,disposables:new Fs};t.set(Ur.vscodeWindowId,e);let i=new ye,r=new ye,s=new ye;function n(o,a){return(typeof o=="number"?t.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(t.has(o.vscodeWindowId))return mi.None;let a=new Fs,h={window:o,disposables:a.add(new Fs)};return t.set(o.vscodeWindowId,h),a.add(vt(()=>{t.delete(o.vscodeWindowId),r.fire(o)})),a.add(Du(o,j5.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(h),a},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var l;let a=o;if((l=a==null?void 0:a.ownerDocument)!=null&&l.defaultView)return a.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:Ur},getDocument(o){return z5(o).document}}}(),F5=class{constructor(t,e,i,r){this._node=t,this._type=e,this._handler=i,this._options=r||!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 Du(t,e,i,r){return new F5(t,e,i,r)}var j5={BEFORE_UNLOAD:"beforeunload"},W5=class extends mi{constructor(t,e,i,r,s,n,o,a,h){super(),this._terminal=t,this._characterJoinerService=e,this._charSizeService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new Sn,this._charAtlasDisposable=this._register(new Sn),this._observerDisposable=this._register(new Sn),this._model=new S5,this._workCell=new kp,this._workCell2=new kp,this._rectangleRenderer=this._register(new Sn),this._glyphRenderer=this._register(new Sn),this._onChangeTextureAtlas=this._register(new ye),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ye),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ye),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ye),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ye),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",l),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Nb(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new E5(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Bb(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Du(this._canvas,"webglcontextlost",c=>{console.log("webglcontextlost event received"),c.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(c)},3e3)})),this._register(Du(this._canvas,"webglcontextrestored",c=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Cp(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=bp(this._canvas,this._coreBrowserService.window,(c,u)=>this._setCanvasDevicePixelDimensions(c,u)),this._register(this._coreBrowserService.onWindowChange(c=>{this._observerDisposable.value=bp(this._canvas,c,(u,d)=>this._setCanvasDevicePixelDimensions(u,d))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(vt(()=>{var c;for(let u of this._renderLayers)u.dispose();(c=this._canvas.parentElement)==null||c.removeChild(this._canvas),Cp(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,e){var i,r,s,n;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let o of this._renderLayers)o.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(i=this._rectangleRenderer.value)==null||i.setDimensions(this.dimensions),(r=this._rectangleRenderer.value)==null||r.handleResize(),(s=this._glyphRenderer.value)==null||s.setDimensions(this.dimensions),(n=this._glyphRenderer.value)==null||n.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let e of this._renderLayers)e.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let e of this._renderLayers)e.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,e,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,t,e,i);this._model.selection.update(this._core,t,e,i),this._requestRedrawViewport()}handleCursorMove(){var t;for(let e of this._renderLayers)e.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new b5(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new g5(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=j0(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=b0(Ki.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ki.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(e=this._glyphRenderer.value)==null||e.setAtlas(this._charAtlas)}_clearModel(t){var e;this._model.clear(),t&&((e=this._glyphRenderer.value)==null||e.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,e){var i;if(!this._isAttached)if((i=this._core.screenElement)!=null&&i.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let r of this._renderLayers)r.handleGridChanged(this._terminal,t,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new h5(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,e){let i=this._core,r=this._workCell,s,n,o,a,h,l,c=0,u=!0,d,f,p,m,x,_,g,S,y;t=zp(t,i.rows-1,0),e=zp(e,i.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",P=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,N=P-i.buffer.ydisp,B=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),U=-1,W=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let V=!1;for(n=t;n<=e;n++)for(o=n+i.buffer.ydisp,a=i.buffer.lines.get(o),this._model.lineLengths[n]=0,p=P===o,c=0,h=this._characterJoinerService.getJoinedCharacters(o),S=0;S<i.cols;S++){if(s=this._cellColorResolver.result.bg,a.loadCell(S,r),S===0&&(s=this._cellColorResolver.result.bg),l=!1,u=S>=c,d=S,h.length>0&&S===h[0][0]&&u){f=h.shift();let C=this._model.selection.isCellSelected(this._terminal,f[0],o);for(g=f[0]+1;g<f[1];g++)u&&(u=C===this._model.selection.isCellSelected(this._terminal,g,o));u&&(u=!p||B<f[0]||B>=f[1]),u?(l=!0,r=new H5(r,a.translateToString(!0,f[0],f[1]),f[1]-f[0]),d=f[1]-1):c=f[1]}if(m=r.getChars(),x=r.getCode(),g=(n*i.cols+S)*hl,this._cellColorResolver.resolve(r,S,o,this.dimensions.device.cell.width),W&&o===P&&(S===B&&(this._model.cursor={x:B,y:N,width:r.getWidth(),style:this._coreBrowserService.isFocused?L:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},U=B+r.getWidth()-1),S>=B&&S<=U&&(this._coreBrowserService.isFocused&&L==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),x!==0&&(this._model.lineLengths[n]=S+1),!(this._model.cells[g]===x&&this._model.cells[g+Ea]===this._cellColorResolver.result.bg&&this._model.cells[g+La]===this._cellColorResolver.result.fg&&this._model.cells[g+Nh]===this._cellColorResolver.result.ext)&&(V=!0,m.length>1&&(x|=y5),this._model.cells[g]=x,this._model.cells[g+Ea]=this._cellColorResolver.result.bg,this._model.cells[g+La]=this._cellColorResolver.result.fg,this._model.cells[g+Nh]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(S,n,x,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,m,_,s),l)){for(r=this._workCell,S++;S<=d;S++)y=(n*i.cols+S)*hl,this._glyphRenderer.value.updateCell(S,n,0,0,0,0,Eb,0,0),this._model.cells[y]=0,this._model.cells[y+Ea]=this._cellColorResolver.result.bg,this._model.cells[y+La]=this._cellColorResolver.result.fg,this._model.cells[y+Nh]=this._cellColorResolver.result.ext;S--}}V&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,e){this._canvas.width===t&&this._canvas.height===e||(this._canvas.width=t,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},H5=class extends Ps{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function zp(t,e,i=0){return Math.max(Math.min(t,e),i)}var Fp="di$target",jp="di$dependencies",Fh=new Map;function Ai(t){if(Fh.has(t))return Fh.get(t);let e=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");U5(e,i,s)};return e._id=t,Fh.set(t,e),e}function U5(t,e,i){e[Fp]===e?e[jp].push({id:t,index:i}):(e[jp]=[{id:t,index:i}],e[Fp]=e)}Ai("BufferService");Ai("CoreMouseService");Ai("CoreService");Ai("CharsetService");Ai("InstantiationService");Ai("LogService");var K5=Ai("OptionsService");Ai("OscLinkService");Ai("UnicodeService");Ai("DecorationService");var V5={trace:0,debug:1,info:2,warn:3,error:4,off:5},q5="xterm.js: ",Wp=class extends mi{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=V5[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":q5)+e,...i)}trace(t,...e){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,e)}debug(t,...e){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,e)}info(t,...e){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,e)}warn(t,...e){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,e)}error(t,...e){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,e)}};Wp=_b([pb(0,K5)],Wp);var G5=class extends mi{constructor(t){if(L0&&kb()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new ye),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ye),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ye),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ye),this.onContextLoss=this._onContextLoss.event}activate(t){let e=t._core;if(!t.element){this._register(e.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=e.coreService,r=e.optionsService,s=e,n=s._renderService,o=s._characterJoinerService,a=s._charSizeService,h=s._coreBrowserService,l=s._decorationService;s._logService;let c=s._themeService;this._renderer=this._register(new W5(t,o,a,h,i,l,r,c,this._preserveDrawingBuffer)),this._register(Ki.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ki.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ki.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ki.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(vt(()=>{if(this._terminal._core._store._isDisposed)return;let u=this._terminal._core._renderService;u.setRenderer(this._terminal._core._createRenderer()),u.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};function G0(){const t=F.getState().theme;return Bd(t)==="light"?fw:dw}const Bu=new Set,Au=new Map,Yd=new Map,Ra=new Map,Vn=new Map,Eo=new Map;function Nu(t){const e=Bd(F.getState().theme)==="light";t.options.theme=G0(),t.options.minimumContrastRatio=e?7:1}let Hp=F.getState().theme;F.subscribe(t=>{if(t.theme!==Hp){Hp=t.theme;for(const e of Eo.values())Nu(e)}});function Y0(t,e){if(!Vn.has(t))try{const i=new G5;i.onContextLoss(()=>{i.dispose(),Vn.delete(t)}),e.loadAddon(i),Vn.set(t,i)}catch{}}function X0(t){const e=Vn.get(t);e&&(e.dispose(),Vn.delete(t))}let Up=F.getState().gpuRendering;F.subscribe(t=>{if(t.gpuRendering!==Up){Up=t.gpuRendering;for(const[e,i]of Eo)t.gpuRendering?Y0(e,i):X0(e)}});function Y5(t,e){Eo.set(t,e)}function X5(t){Eo.delete(t)}function sa(t){return Yd.get(t)}const $u=new Map;function Q5(t,e){$u.set(t,e)}function Z5(t){const e=$u.get(t);return e!==void 0?($u.delete(t),e):null}function J5({terminalId:t,projectId:e,cwd:i}){const r=O.useRef(null),s=O.useRef(null),n=O.useRef(null),o=O.useRef(null),a=oe(d=>d.setTerminalInstance),h=oe(d=>d.createSession),l=F(d=>d.setFocusedTerminal);O.useEffect(()=>{var P,N;const d=r.current;if(!d)return;d.innerHTML="";const f=oe.getState().sessions[t],p=Au.get(t);if(f!=null&&f.terminal&&p){const B=f.terminal;s.current=B,d.appendChild(p);let U=Ra.get(t);return U||(U=new dp,B.loadAddon(U),Ra.set(t,U)),n.current=U,requestAnimationFrame(()=>{try{U.fit(),B.scrollToBottom();const{cols:W,rows:V}=B;o.current={cols:W,rows:V},me({type:"pty:resize",terminalId:t,cols:W,rows:V})}catch{}}),()=>{}}const m=G0(),x=Bd(F.getState().theme)==="light",_=new E2({theme:m,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",allowProposedApi:!0,scrollback:1e4,minimumContrastRatio:x?7:1}),g=new dp,S=new A2((B,U)=>{(B.ctrlKey||B.metaKey)&&me({type:"open:url",url:U})}),y=new fb;_.loadAddon(g),_.loadAddon(S),_.loadAddon(y),_.open(d),Ra.set(t,g),Yd.set(t,y),s.current=_,n.current=g,_.element&&Au.set(t,_.element),F.getState().gpuRendering&&Y0(t,_);const L=(P=_.element)==null?void 0:P.querySelector(".xterm-screen");return L&&L.addEventListener("mouseup",B=>{const U=B;U.ctrlKey||U.metaKey||setTimeout(()=>{if(_.hasSelection())return;const W=_.buffer.active;if(W.viewportY!==W.baseY)return;const V=L.getBoundingClientRect(),C=Math.floor((U.clientX-V.left)/(V.width/_.cols));if(Math.floor((U.clientY-V.top)/(V.height/_.rows))!==W.cursorY)return;const b=W.getLine(W.baseY+W.cursorY);if(!b)return;const k=b.translateToString().trimEnd().length,T=Math.min(C,k)-W.cursorX;if(T===0)return;const E=T>0?"\x1B[C":"\x1B[D";me({type:"pty:input",terminalId:t,data:E.repeat(Math.abs(T))})},0)}),(N=_.element)==null||N.addEventListener("copy",B=>{var W;const U=_.getSelection();if(U){const V=U.split(`
|
|
195
|
+
}`,Fi=8,$h=Fi*Float32Array.BYTES_PER_ELEMENT,C5=20*Fi,Lp=class{constructor(){this.attributes=new Float32Array(C5),this.count=0}},Ii=0,Mp=0,Rp=0,Tp=0,Pp=0,Dp=0,Bp=0,b5=class extends mi{constructor(t,e,i,r){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._themeService=r,this._vertices=new Lp,this._verticesCursor=new Lp;let s=this._gl;this._program=Oe(U0(s,w5,x5)),this._register(vt(()=>s.deleteProgram(this._program))),this._projectionLocation=Oe(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=s.createBuffer();this._register(vt(()=>s.deleteBuffer(o))),s.bindBuffer(s.ARRAY_BUFFER,o),s.bufferData(s.ARRAY_BUFFER,n,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=s.createBuffer();this._register(vt(()=>s.deleteBuffer(h))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,h),s.bufferData(s.ELEMENT_ARRAY_BUFFER,a,s.STATIC_DRAW),this._attributesBuffer=Oe(s.createBuffer()),this._register(vt(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,$h,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,$h,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,$h,4*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(l=>{this._updateCachedColors(l),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,H0),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let e=this._terminal,i=this._vertices,r=1,s,n,o,a,h,l,c,u,d,f,p;for(s=0;s<e.rows;s++){for(o=-1,a=0,h=0,l=!1,n=0;n<e.cols;n++)c=(s*e.cols+n)*hl,u=t.cells[c+Ea],d=t.cells[c+La],f=!!(d&67108864),(u!==a||d!==h&&(l||f))&&((a!==0||l&&h!==0)&&(p=r++*Fi,this._updateRectangle(i,p,h,a,o,n,s)),o=n,a=u,h=d,l=f);(a!==0||l&&h!==0)&&(p=r++*Fi,this._updateRectangle(i,p,h,a,o,e.cols,s))}i.count=r}updateCursor(t){let e=this._verticesCursor,i=t.cursor;if(!i||i.style==="block"){e.count=0;return}let r,s=0;(i.style==="bar"||i.style==="outline")&&(r=s++*Fi,this._addRectangleFloat(e.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(r=s++*Fi,this._addRectangleFloat(e.attributes,r,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(r=s++*Fi,this._addRectangleFloat(e.attributes,r,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),r=s++*Fi,this._addRectangleFloat(e.attributes,r,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=s}_updateRectangle(t,e,i,r,s,n,o){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Ii=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Ii=(i&16777215)<<8;break;case 0:default:Ii=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:Ii=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Ii=(r&16777215)<<8;break;case 0:default:Ii=this._themeService.colors.background.rgba}t.attributes.length<e+4&&(t.attributes=u5(t.attributes,this._terminal.rows*this._terminal.cols*Fi)),Mp=s*this._dimensions.device.cell.width,Rp=o*this._dimensions.device.cell.height,Tp=(Ii>>24&255)/255,Pp=(Ii>>16&255)/255,Dp=(Ii>>8&255)/255,Bp=1,this._addRectangle(t.attributes,e,Mp,Rp,(n-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Tp,Pp,Dp,Bp)}_addRectangle(t,e,i,r,s,n,o,a,h,l){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=r/this._dimensions.device.canvas.height,t[e+2]=s/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o,t[e+5]=a,t[e+6]=h,t[e+7]=l}_addRectangleFloat(t,e,i,r,s,n,o){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=r/this._dimensions.device.canvas.height,t[e+2]=s/this._dimensions.device.canvas.width,t[e+3]=n/this._dimensions.device.canvas.height,t[e+4]=o[0],t[e+5]=o[1],t[e+6]=o[2],t[e+7]=o[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},k5=class extends mi{constructor(t,e,i,r,s,n,o,a){super(),this._container=e,this._alpha=s,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this._register(vt(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Oe(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,e,i){}handleSelectionChanged(t,e,i,r=!1){}_setTransparency(t,e){if(e===this._alpha)return;let i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=j0(t,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,e,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,e,i,r){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(t,e,i,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=R0,this._clipCell(i,r,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,e,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,e,i){let r=e?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${r} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},E5=class extends k5{constructor(t,e,i,r,s,n,o){super(i,t,"link",e,!0,s,n,o),this._register(r.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(r.onHideLinkUnderline(a=>this._handleHideLinkUnderline(a)))}resize(t,e){super.resize(t,e),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&l5(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let e=t.y1+1;e<t.y2;e++)this._fillBottomLineAtCells(0,e,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Ur=typeof window=="object"?window:globalThis,Pu=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ye,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ye,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Pu.INSTANCE=new Pu;var K0=Pu;function L5(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}K0.INSTANCE.onDidChangeZoomLevel;K0.INSTANCE.onDidChangeFullscreen;var rn=typeof navigator=="object"?navigator.userAgent:"";rn.indexOf("Firefox")>=0;rn.indexOf("AppleWebKit")>=0;var M5=rn.indexOf("Chrome")>=0;!M5&&rn.indexOf("Safari")>=0;rn.indexOf("Electron/")>=0;rn.indexOf("Android")>=0;var Oh=!1;if(typeof Ur.matchMedia=="function"){let t=Ur.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Ur.matchMedia("(display-mode: fullscreen)");Oh=t.matches,L5(Ur,t,({matches:i})=>{Oh&&e.matches||(Oh=i)})}var Ds="en",Ih=!1,V0=!1,ra,Ma=Ds,Ap=Ds,R5,ui,Qr=globalThis,lt,eg;typeof Qr.vscode<"u"&&typeof Qr.vscode.process<"u"?lt=Qr.vscode.process:typeof process<"u"&&typeof((eg=process==null?void 0:process.versions)==null?void 0:eg.node)=="string"&&(lt=process);var tg,T5=typeof((tg=lt==null?void 0:lt.versions)==null?void 0:tg.electron)=="string",P5=T5&&(lt==null?void 0:lt.type)==="renderer",ig;if(typeof lt=="object"){lt.platform,lt.platform,Ih=lt.platform==="linux",Ih&<.env.SNAP&<.env.SNAP_REVISION,lt.env.CI||lt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ra=Ds,Ma=Ds;let t=lt.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);ra=e.userLocale,Ap=e.osLocale,Ma=e.resolvedLanguage||Ds,R5=(ig=e.languagePack)==null?void 0:ig.translationsConfigFile}catch{}V0=!0}else typeof navigator=="object"&&!P5?(ui=navigator.userAgent,ui.indexOf("Windows")>=0,ui.indexOf("Macintosh")>=0,(ui.indexOf("Macintosh")>=0||ui.indexOf("iPad")>=0||ui.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ih=ui.indexOf("Linux")>=0,(ui==null?void 0:ui.indexOf("Mobi"))>=0,Ma=globalThis._VSCODE_NLS_LANGUAGE||Ds,ra=navigator.language.toLowerCase(),Ap=ra):console.error("Unable to resolve platform.");var Np=V0,Bi=ui,nr=Ma,D5;(t=>{function e(){return nr}t.value=e;function i(){return nr.length===2?nr==="en":nr.length>=3?nr[0]==="e"&&nr[1]==="n"&&nr[2]==="-":!1}t.isDefaultVariant=i;function r(){return nr==="en"}t.isDefault=r})(D5||(D5={}));var B5=typeof Qr.postMessage=="function"&&!Qr.importScripts;(()=>{if(B5){let t=[];Qr.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r<s;r++){let n=t[r];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(r,1),n.callback();return}}});let e=0;return i=>{let r=++e;t.push({id:r,callback:i}),Qr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var A5=!!(Bi&&Bi.indexOf("Chrome")>=0);Bi&&Bi.indexOf("Firefox")>=0;!A5&&Bi&&Bi.indexOf("Safari")>=0;Bi&&Bi.indexOf("Edg/")>=0;Bi&&Bi.indexOf("Android")>=0;var ps=typeof navigator=="object"?navigator:{};Np||document.queryCommandSupported&&document.queryCommandSupported("copy")||ps&&ps.clipboard&&ps.clipboard.writeText,Np||ps&&ps.clipboard&&ps.clipboard.readText;var Gd=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},zh=new Gd,$p=new Gd,Op=new Gd;new Array(230);var N5;(t=>{function e(a){return zh.keyCodeToStr(a)}t.toString=e;function i(a){return zh.strToKeyCode(a)}t.fromString=i;function r(a){return $p.keyCodeToStr(a)}t.toUserSettingsUS=r;function s(a){return Op.keyCodeToStr(a)}t.toUserSettingsGeneral=s;function n(a){return $p.strToKeyCode(a)||Op.strToKeyCode(a)}t.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return zh.keyCodeToStr(a)}t.toElectronAccelerator=o})(N5||(N5={}));var q0=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),$5;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof O5?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ki.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:q0})})($5||($5={}));var O5=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?q0:(this._emitter||(this._emitter=new ye),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},I5;(t=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(I5||(I5={}));var Ip=class Yt{static fromArray(e){return new Yt(i=>{i.emitMany(e)})}static fromPromise(e){return new Yt(async i=>{i.emitMany(await e)})}static fromPromises(e){return new Yt(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new Yt(async i=>{await Promise.all(e.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ye,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Ki.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new Yt(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return Yt.map(this,e)}static filter(e,i){return new Yt(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return Yt.filter(this,e)}static coalesce(e){return Yt.filter(e,i=>!!i)}coalesce(){return Yt.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return Yt.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Ip.EMPTY=Ip.fromArray([]);var{getWindow:z5}=function(){let t=new Map,e={window:Ur,disposables:new Fs};t.set(Ur.vscodeWindowId,e);let i=new ye,r=new ye,s=new ye;function n(o,a){return(typeof o=="number"?t.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(t.has(o.vscodeWindowId))return mi.None;let a=new Fs,h={window:o,disposables:a.add(new Fs)};return t.set(o.vscodeWindowId,h),a.add(vt(()=>{t.delete(o.vscodeWindowId),r.fire(o)})),a.add(Du(o,j5.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(h),a},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var l;let a=o;if((l=a==null?void 0:a.ownerDocument)!=null&&l.defaultView)return a.ownerDocument.defaultView.window;let h=o;return h!=null&&h.view?h.view.window:Ur},getDocument(o){return z5(o).document}}}(),F5=class{constructor(t,e,i,r){this._node=t,this._type=e,this._handler=i,this._options=r||!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 Du(t,e,i,r){return new F5(t,e,i,r)}var j5={BEFORE_UNLOAD:"beforeunload"},W5=class extends mi{constructor(t,e,i,r,s,n,o,a,h){super(),this._terminal=t,this._characterJoinerService=e,this._charSizeService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new Sn,this._charAtlasDisposable=this._register(new Sn),this._observerDisposable=this._register(new Sn),this._model=new S5,this._workCell=new kp,this._workCell2=new kp,this._rectangleRenderer=this._register(new Sn),this._glyphRenderer=this._register(new Sn),this._onChangeTextureAtlas=this._register(new ye),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ye),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ye),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ye),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ye),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",l),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new N2(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new E5(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=B2(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Du(this._canvas,"webglcontextlost",c=>{console.log("webglcontextlost event received"),c.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(c)},3e3)})),this._register(Du(this._canvas,"webglcontextrestored",c=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Cp(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=bp(this._canvas,this._coreBrowserService.window,(c,u)=>this._setCanvasDevicePixelDimensions(c,u)),this._register(this._coreBrowserService.onWindowChange(c=>{this._observerDisposable.value=bp(this._canvas,c,(u,d)=>this._setCanvasDevicePixelDimensions(u,d))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(vt(()=>{var c;for(let u of this._renderLayers)u.dispose();(c=this._canvas.parentElement)==null||c.removeChild(this._canvas),Cp(this._terminal)}))}get textureAtlas(){var t;return(t=this._charAtlas)==null?void 0:t.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,e){var i,r,s,n;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let o of this._renderLayers)o.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(i=this._rectangleRenderer.value)==null||i.setDimensions(this.dimensions),(r=this._rectangleRenderer.value)==null||r.handleResize(),(s=this._glyphRenderer.value)==null||s.setDimensions(this.dimensions),(n=this._glyphRenderer.value)==null||n.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var t;for(let e of this._renderLayers)e.handleBlur(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.pause(),this._requestRedrawViewport()}handleFocus(){var t;for(let e of this._renderLayers)e.handleFocus(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,e,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,t,e,i);this._model.selection.update(this._core,t,e,i),this._requestRedrawViewport()}handleCursorMove(){var t;for(let e of this._renderLayers)e.handleCursorMove(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new b5(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new g5(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=j0(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=b0(Ki.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ki.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),(e=this._glyphRenderer.value)==null||e.setAtlas(this._charAtlas)}_clearModel(t){var e;this._model.clear(),t&&((e=this._glyphRenderer.value)==null||e.clear())}clearTextureAtlas(){var t;(t=this._charAtlas)==null||t.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var t;this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);(t=this._cursorBlinkStateManager.value)==null||t.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,e){var i;if(!this._isAttached)if((i=this._core.screenElement)!=null&&i.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let r of this._renderLayers)r.handleGridChanged(this._terminal,t,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new h5(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,e){let i=this._core,r=this._workCell,s,n,o,a,h,l,c=0,u=!0,d,f,p,m,x,_,g,S,y;t=zp(t,i.rows-1,0),e=zp(e,i.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",P=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,N=P-i.buffer.ydisp,B=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),U=-1,W=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let V=!1;for(n=t;n<=e;n++)for(o=n+i.buffer.ydisp,a=i.buffer.lines.get(o),this._model.lineLengths[n]=0,p=P===o,c=0,h=this._characterJoinerService.getJoinedCharacters(o),S=0;S<i.cols;S++){if(s=this._cellColorResolver.result.bg,a.loadCell(S,r),S===0&&(s=this._cellColorResolver.result.bg),l=!1,u=S>=c,d=S,h.length>0&&S===h[0][0]&&u){f=h.shift();let C=this._model.selection.isCellSelected(this._terminal,f[0],o);for(g=f[0]+1;g<f[1];g++)u&&(u=C===this._model.selection.isCellSelected(this._terminal,g,o));u&&(u=!p||B<f[0]||B>=f[1]),u?(l=!0,r=new H5(r,a.translateToString(!0,f[0],f[1]),f[1]-f[0]),d=f[1]-1):c=f[1]}if(m=r.getChars(),x=r.getCode(),g=(n*i.cols+S)*hl,this._cellColorResolver.resolve(r,S,o,this.dimensions.device.cell.width),W&&o===P&&(S===B&&(this._model.cursor={x:B,y:N,width:r.getWidth(),style:this._coreBrowserService.isFocused?L:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},U=B+r.getWidth()-1),S>=B&&S<=U&&(this._coreBrowserService.isFocused&&L==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),x!==0&&(this._model.lineLengths[n]=S+1),!(this._model.cells[g]===x&&this._model.cells[g+Ea]===this._cellColorResolver.result.bg&&this._model.cells[g+La]===this._cellColorResolver.result.fg&&this._model.cells[g+Nh]===this._cellColorResolver.result.ext)&&(V=!0,m.length>1&&(x|=y5),this._model.cells[g]=x,this._model.cells[g+Ea]=this._cellColorResolver.result.bg,this._model.cells[g+La]=this._cellColorResolver.result.fg,this._model.cells[g+Nh]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(S,n,x,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,m,_,s),l)){for(r=this._workCell,S++;S<=d;S++)y=(n*i.cols+S)*hl,this._glyphRenderer.value.updateCell(S,n,0,0,0,0,E2,0,0),this._model.cells[y]=0,this._model.cells[y+Ea]=this._cellColorResolver.result.bg,this._model.cells[y+La]=this._cellColorResolver.result.fg,this._model.cells[y+Nh]=this._cellColorResolver.result.ext;S--}}V&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,e){this._canvas.width===t&&this._canvas.height===e||(this._canvas.width=t,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},H5=class extends Ps{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function zp(t,e,i=0){return Math.max(Math.min(t,e),i)}var Fp="di$target",jp="di$dependencies",Fh=new Map;function Ai(t){if(Fh.has(t))return Fh.get(t);let e=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");U5(e,i,s)};return e._id=t,Fh.set(t,e),e}function U5(t,e,i){e[Fp]===e?e[jp].push({id:t,index:i}):(e[jp]=[{id:t,index:i}],e[Fp]=e)}Ai("BufferService");Ai("CoreMouseService");Ai("CoreService");Ai("CharsetService");Ai("InstantiationService");Ai("LogService");var K5=Ai("OptionsService");Ai("OscLinkService");Ai("UnicodeService");Ai("DecorationService");var V5={trace:0,debug:1,info:2,warn:3,error:4,off:5},q5="xterm.js: ",Wp=class extends mi{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=V5[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":q5)+e,...i)}trace(t,...e){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,e)}debug(t,...e){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,e)}info(t,...e){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,e)}warn(t,...e){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,e)}error(t,...e){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,e)}};Wp=_2([p2(0,K5)],Wp);var G5=class extends mi{constructor(t){if(L0&&k2()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new ye),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ye),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ye),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ye),this.onContextLoss=this._onContextLoss.event}activate(t){let e=t._core;if(!t.element){this._register(e.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=e.coreService,r=e.optionsService,s=e,n=s._renderService,o=s._characterJoinerService,a=s._charSizeService,h=s._coreBrowserService,l=s._decorationService;s._logService;let c=s._themeService;this._renderer=this._register(new W5(t,o,a,h,i,l,r,c,this._preserveDrawingBuffer)),this._register(Ki.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ki.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ki.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ki.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(vt(()=>{if(this._terminal._core._store._isDisposed)return;let u=this._terminal._core._renderService;u.setRenderer(this._terminal._core._createRenderer()),u.handleResize(t.cols,t.rows)}))}get textureAtlas(){var t;return(t=this._renderer)==null?void 0:t.textureAtlas}clearTextureAtlas(){var t;(t=this._renderer)==null||t.clearTextureAtlas()}};function G0(){const t=F.getState().theme;return Bd(t)==="light"?fw:dw}const Bu=new Set,Au=new Map,Yd=new Map,Ra=new Map,Vn=new Map,Eo=new Map;function Nu(t){const e=Bd(F.getState().theme)==="light";t.options.theme=G0(),t.options.minimumContrastRatio=e?7:1}let Hp=F.getState().theme;F.subscribe(t=>{if(t.theme!==Hp){Hp=t.theme;for(const e of Eo.values())Nu(e)}});function Y0(t,e){if(!Vn.has(t))try{const i=new G5;i.onContextLoss(()=>{i.dispose(),Vn.delete(t)}),e.loadAddon(i),Vn.set(t,i)}catch{}}function X0(t){const e=Vn.get(t);e&&(e.dispose(),Vn.delete(t))}let Up=F.getState().gpuRendering;F.subscribe(t=>{if(t.gpuRendering!==Up){Up=t.gpuRendering;for(const[e,i]of Eo)t.gpuRendering?Y0(e,i):X0(e)}});function Y5(t,e){Eo.set(t,e)}function X5(t){Eo.delete(t)}function sa(t){return Yd.get(t)}const $u=new Map;function Q5(t,e){$u.set(t,e)}function Z5(t){const e=$u.get(t);return e!==void 0?($u.delete(t),e):null}function J5({terminalId:t,projectId:e,cwd:i}){const r=O.useRef(null),s=O.useRef(null),n=O.useRef(null),o=O.useRef(null),a=oe(d=>d.setTerminalInstance),h=oe(d=>d.createSession),l=F(d=>d.setFocusedTerminal);O.useEffect(()=>{var P,N;const d=r.current;if(!d)return;d.innerHTML="";const f=oe.getState().sessions[t],p=Au.get(t);if(f!=null&&f.terminal&&p){const B=f.terminal;s.current=B,d.appendChild(p);let U=Ra.get(t);return U||(U=new dp,B.loadAddon(U),Ra.set(t,U)),n.current=U,requestAnimationFrame(()=>{try{U.fit(),B.scrollToBottom();const{cols:W,rows:V}=B;o.current={cols:W,rows:V},ue({type:"pty:resize",terminalId:t,cols:W,rows:V})}catch{}}),()=>{}}const m=G0(),x=Bd(F.getState().theme)==="light",_=new Eb({theme:m,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontSize:13,lineHeight:1.2,cursorBlink:!0,cursorStyle:"bar",allowProposedApi:!0,scrollback:1e4,minimumContrastRatio:x?7:1}),g=new dp,S=new Ab((B,U)=>{(B.ctrlKey||B.metaKey)&&ue({type:"open:url",url:U})}),y=new f2;_.loadAddon(g),_.loadAddon(S),_.loadAddon(y),_.open(d),Ra.set(t,g),Yd.set(t,y),s.current=_,n.current=g,_.element&&Au.set(t,_.element),F.getState().gpuRendering&&Y0(t,_);const L=(P=_.element)==null?void 0:P.querySelector(".xterm-screen");return L&&L.addEventListener("mouseup",B=>{const U=B;U.ctrlKey||U.metaKey||setTimeout(()=>{if(_.hasSelection())return;const W=_.buffer.active;if(W.viewportY!==W.baseY)return;const V=L.getBoundingClientRect(),C=Math.floor((U.clientX-V.left)/(V.width/_.cols));if(Math.floor((U.clientY-V.top)/(V.height/_.rows))!==W.cursorY)return;const b=W.getLine(W.baseY+W.cursorY);if(!b)return;const k=b.translateToString().trimEnd().length,T=Math.min(C,k)-W.cursorX;if(T===0)return;const E=T>0?"\x1B[C":"\x1B[D";ue({type:"pty:input",terminalId:t,data:E.repeat(Math.abs(T))})},0)}),(N=_.element)==null||N.addEventListener("copy",B=>{var W;const U=_.getSelection();if(U){const V=U.split(`
|
|
196
196
|
`).map(C=>C.trimEnd()).join(`
|
|
197
|
-
`);(W=B.clipboardData)==null||W.setData("text/plain",V),B.preventDefault()}}),h(t,e),a(t,_),_.attachCustomKeyEventHandler(B=>{if(B.key==="Enter"&&B.shiftKey)return B.type==="keydown"&&
|
|
198
|
-
`}),!1;if(B.metaKey&&!B.altKey&&!B.ctrlKey&&!B.shiftKey&&B.type==="keydown"){if(B.key==="ArrowLeft")return
|
|
197
|
+
`);(W=B.clipboardData)==null||W.setData("text/plain",V),B.preventDefault()}}),h(t,e),a(t,_),_.attachCustomKeyEventHandler(B=>{if(B.key==="Enter"&&B.shiftKey)return B.type==="keydown"&&ue({type:"pty:input",terminalId:t,data:`
|
|
198
|
+
`}),!1;if(B.metaKey&&!B.altKey&&!B.ctrlKey&&!B.shiftKey&&B.type==="keydown"){if(B.key==="ArrowLeft")return ue({type:"pty:input",terminalId:t,data:""}),!1;if(B.key==="ArrowRight")return ue({type:"pty:input",terminalId:t,data:""}),!1;if(B.key==="Backspace")return ue({type:"pty:input",terminalId:t,data:""}),!1}return!(B.metaKey&&B.key==="f"&&!B.altKey&&!B.ctrlKey||B.metaKey&&B.key==="p"&&!B.altKey&&!B.ctrlKey||["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(B.key)&&B.shiftKey&&!B.metaKey&&!B.altKey)}),_.onData(B=>{ue({type:"pty:input",terminalId:t,data:B})}),_.onTitleChange(B=>{oe.getState().setTitle(t,B)}),Bu.has(t)||(Bu.add(t),requestAnimationFrame(()=>{try{g.fit()}catch{}ue({type:"pty:spawn",terminalId:t,projectId:e,cwd:i}),ue({type:"pty:resize",terminalId:t,cols:_.cols,rows:_.rows}),o.current={cols:_.cols,rows:_.rows},_.focus(),l(t)})),()=>{}},[t,e,i,h,a]),O.useEffect(()=>{const d=s.current;d&&(Nu(d),Y5(t,d));const f=window.matchMedia("(prefers-color-scheme: light)"),p=()=>{d&&F.getState().theme==="system"&&Nu(d)};return f.addEventListener("change",p),()=>{X5(t),f.removeEventListener("change",p)}},[t]);const c=O.useCallback(()=>{const d=n.current,f=s.current;if(!(!d||!f))try{d.fit(),f.scrollToBottom();const{cols:p,rows:m}=f,x=o.current;(!x||x.cols!==p||x.rows!==m)&&(o.current={cols:p,rows:m},ue({type:"pty:resize",terminalId:t,cols:p,rows:m}))}catch{}},[t]),u=O.useCallback(()=>{var d;(d=s.current)==null||d.focus(),l(t)},[t,l]);return{containerRef:r,fit:c,focus:u,terminalRef:s}}function Lo(t){Bu.delete(t),Au.delete(t),Ra.delete(t),Yd.delete(t),X0(t),Eo.delete(t)}let Xt=null;function ek(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function ue(t){(Xt==null?void 0:Xt.readyState)===WebSocket.OPEN&&Xt.send(JSON.stringify(t))}function tk(){const t=F(n=>n.setConnectionStatus),e=ae(n=>n.addProject),i=ae(n=>n.setActiveProject),r=O.useRef(),s=O.useCallback(()=>{if((Xt==null?void 0:Xt.readyState)===WebSocket.OPEN||(Xt==null?void 0:Xt.readyState)===WebSocket.CONNECTING)return;t("connecting");const n=new WebSocket(ek());Xt=n,n.onopen=()=>{t("connected"),ue({type:"editor:sync",enabled:F.getState().editorSyncEnabled})},n.onmessage=o=>{var a,h,l;try{const c=JSON.parse(o.data);if(c.type==="pty:output"){const u=oe.getState().sessions[c.terminalId];(a=u==null?void 0:u.terminal)==null||a.write(c.data);const d=Z5(c.terminalId);d&&ue({type:"pty:input",terminalId:c.terminalId,data:d});return}if(c.type==="pty:exit"){const u=c.terminalId,d=oe.getState().sessions[u],f=d==null?void 0:d.projectId;if((h=d==null?void 0:d.terminal)==null||h.dispose(),oe.getState().removeSession(u),Lo(u),f){X.getState().removePaneFromProject(f,u),ae.getState().removeTerminalFromProject(f,u);const p=de(X.getState().getLayout(f)),m=F.getState().focusedTerminalId;if(m===u&&p.length>0){const x=p[0];F.getState().setFocusedTerminal(x);const _=oe.getState().sessions[x];(l=_==null?void 0:_.terminal)==null||l.focus()}else m===u&&F.getState().setFocusedTerminal(null)}return}if(c.type==="project:spawned"){const u=Object.values(ae.getState().projects).find(d=>d.cwd===c.cwd);u?i(u.id):(e({id:c.projectId,name:c.name,cwd:c.cwd,terminalIds:[]}),i(c.projectId));return}if(c.type==="port:status"){oe.getState().setActivePorts(c.ports);return}if(c.type==="claude:status"){oe.getState().setClaudeStatus(c.statuses);return}if(c.type==="git:branch"){oe.getState().setGitBranches(c.branches);return}if(c.type==="inbox:paste"){const u=F.getState().focusedTerminalId;if(u&&c.files.length>0){const d=c.files.map(f=>"'"+f.replace(/'/g,"'\\''")+"'").join(" ");ue({type:"pty:input",terminalId:u,data:d})}return}if(c.type==="editor:status"){oe.getState().setEditorNeedsAccessibility(c.needsAccessibility);return}if(c.type==="editor:active"){if(!F.getState().editorSyncEnabled)return;const{projects:u,activeProjectId:d}=ae.getState(),f=Object.values(u).find(p=>{const m=p.cwd.replace(/\/$/,"").split("/").pop();return p.name===c.projectName||m===c.projectName});f&&f.id!==d&&(F.getState().showSyncToast(f.name),i(f.id))}}catch{}},n.onclose=()=>{t("disconnected"),oe.getState().setActivePorts({}),oe.getState().setClaudeStatus({}),oe.getState().setGitBranches({}),oe.getState().setEditorNeedsAccessibility(!1),Xt=null,r.current=setTimeout(s,2e3)},n.onerror=()=>{n.close()}},[t,e,i]);O.useEffect(()=>(s(),()=>{clearTimeout(r.current)}),[s])}const ik=new Set(["n","w","t","d","r","f","p"]);function rk(){const t=F(i=>i.toggleSidebar),e=F(i=>i.setFocusedTerminal);O.useEffect(()=>{const i=r=>{var d,f,p;const s=r.key.toLowerCase();if(r.ctrlKey&&r.shiftKey&&!r.metaKey&&!r.altKey&&["arrowleft","arrowright","arrowup","arrowdown"].includes(s)){r.preventDefault(),r.stopPropagation();const m=ae.getState().activeProjectId;if(!m)return;const x=X.getState().getLayout(m),_=F.getState().focusedTerminalId;if(!_||!x)return;const S=v_(x,_,s==="arrowleft"?"left":s==="arrowright"?"right":s==="arrowup"?"up":"down");if(S){e(S);const y=oe.getState().sessions[S];(d=y==null?void 0:y.terminal)==null||d.focus()}return}if(r.shiftKey&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&["arrowleft","arrowright","arrowup","arrowdown"].includes(s)){r.preventDefault(),r.stopPropagation();const m=ae.getState().activeProjectId;if(!m)return;const x=X.getState().getLayout(m),_=F.getState().focusedTerminalId;if(!_||!x)return;const S=v_(x,_,s==="arrowleft"?"left":s==="arrowright"?"right":s==="arrowup"?"up":"down");S&&(X.getState().swapPanesInProject(m,_,S),requestAnimationFrame(()=>{var L;e(_);const y=oe.getState().sessions[_];(L=y==null?void 0:y.terminal)==null||L.focus()}));return}if(!(navigator.platform.startsWith("Mac")?r.metaKey:r.ctrlKey))return;if((s==="="||s==="+"||s==="-"||s==="0")&&!r.shiftKey&&!("chrome"in window)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent)){r.preventDefault(),r.stopPropagation();const x=parseFloat(document.documentElement.style.zoom||"1");s==="="||s==="+"?document.documentElement.style.zoom=String(Math.min(x+.1,2)):s==="-"?document.documentElement.style.zoom=String(Math.max(x-.1,.5)):document.documentElement.style.zoom="1",window.dispatchEvent(new Event("resize"));return}(ik.has(s)||s>="1"&&s<="9")&&(r.preventDefault(),r.stopPropagation());const a=ae.getState().activeProjectId;if(!a)return;const h=X.getState().getLayout(a),l=F.getState().focusedTerminalId,c=ae.getState().projects[a];if(s==="p"&&!r.shiftKey){F.getState().toggleCommandPalette();return}if(s==="f"&&!r.shiftKey){l&&F.getState().openSearch(l);return}if(s==="d"&&!r.shiftKey){t();return}if(s==="n"){if(!c)return;const m=crypto.randomUUID(),x=de(h);if(x.length>0){const _=l??x[x.length-1],g=r.shiftKey?"horizontal":"vertical";X.getState().addPaneToProject(a,_,m,g)}else X.getState().setLayout(a,{type:"leaf",terminalId:m});ae.getState().addTerminalToProject(a,m),e(m);return}if(s==="w"&&!r.shiftKey){if(!l||!h)return;ue({type:"pty:kill",terminalId:l}),X.getState().removePaneFromProject(a,l),ae.getState().removeTerminalFromProject(a,l);const m=oe.getState().sessions[l];(f=m==null?void 0:m.terminal)==null||f.dispose(),oe.getState().removeSession(l),Lo(l);const x=de(X.getState().getLayout(a));e(x[0]??null);return}if(s==="t"&&!r.shiftKey){if(!c)return;const m=de(h);m.length>0&&X.getState().cyclePreset(a,m);return}if(s==="r"&&!r.shiftKey){const m=de(h);if(m.length===0)return;let x;m.length<=2?x="even-vertical":m.length===3?x="main-left":x="grid";const _=rs(m,x);_&&X.getState().setLayout(a,_);return}const u=parseInt(s);if(u>=1&&u<=9){const x=de(h)[u-1];if(x){e(x);const _=oe.getState().sessions[x];(p=_==null?void 0:_.terminal)==null||p.focus()}return}};return window.addEventListener("keydown",i,{capture:!0}),()=>window.removeEventListener("keydown",i,{capture:!0})},[t,e])}const gr=wo()((t,e)=>({favourites:{},addFavourite:i=>{t(r=>({favourites:{...r.favourites,[i.id]:i}})),Hn({favourites:{...e().favourites}})},updateFavourite:(i,r)=>{t(s=>{const n=s.favourites[i];return n?{favourites:{...s.favourites,[i]:{...n,...r}}}:s}),Hn({favourites:{...e().favourites}})},removeFavourite:i=>{t(r=>{const{[i]:s,...n}=r.favourites;return{favourites:n}}),Hn({favourites:{...e().favourites}})},hydrateFromServer:async()=>{try{const r=await(await fetch("/api/settings")).json();r.favourites&&t({favourites:r.favourites})}catch{}}}));/**
|
|
199
199
|
* @license lucide-react v0.400.0 - ISC
|
|
200
200
|
*
|
|
201
201
|
* This source code is licensed under the ISC license.
|
|
@@ -380,7 +380,7 @@ void main() {
|
|
|
380
380
|
*
|
|
381
381
|
* This source code is licensed under the ISC license.
|
|
382
382
|
* See the LICENSE file in the root directory of this source tree.
|
|
383
|
-
*/const r1=ne("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Kp(t){const e=X.getState().getLayout(t);
|
|
383
|
+
*/const r1=ne("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Kp(t){const e=X.getState().getLayout(t);de(e).forEach(r=>{var n;const s=oe.getState().sessions[r];(n=s==null?void 0:s.terminal)==null||n.dispose(),oe.getState().removeSession(r),Lo(r)}),ue({type:"project:kill",projectId:t}),X.getState().setLayout(t,null),ae.getState().clearProjectTerminals(t)}function s1(){const t=window.__panefulDropPaths;return Array.isArray(t)&&t.length>0?(window.__panefulDropPaths=null,t):null}function Ta(t){return/[ ()'"]/.test(t)?`'${t.replace(/'/g,"'\\''")}'`:t}function Ck(t){const e=t.getData("codefiles");if(e)try{const s=JSON.parse(e);if(Array.isArray(s)&&s.length>0)return s}catch{}const i=t.getData("text/uri-list").trim();if(i){const s=Vp(i);if(s.length>0)return s}const r=t.getData("text/plain").trim();if(r){const s=Vp(r);if(s.length>0)return s;if(r.startsWith("/")){const n=r.split(`
|
|
384
384
|
`).map(o=>o.trim()).filter(Boolean);if(n.length>0)return n}}return[]}function Vp(t){return t.split(/[\r\n]+/).map(e=>e.trim()).filter(e=>e.startsWith("file://")).map(e=>{try{return decodeURIComponent(new URL(e).pathname)}catch{return null}}).filter(e=>e!==null&&e.length>0)}const bk=Wu.memo(function({project:e,isActive:i,hasActivePorts:r,claudeStatus:s,gitStatus:n,onClick:o,onKill:a,onRemove:h}){const l=e.terminalIds.length,c=O.useRef(null);return O.useEffect(()=>{i&&c.current&&c.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[i]),v.jsxs("div",{ref:c,onClick:o,className:`
|
|
385
385
|
group flex items-center gap-2 px-3 py-2 mx-2 mb-1 rounded-lg cursor-pointer scroll-my-8
|
|
386
386
|
transition-colors duration-100
|
|
@@ -458,14 +458,14 @@ void main() {
|
|
|
458
458
|
px-3 py-1.5 text-xs font-medium
|
|
459
459
|
bg-accent hover:bg-accent/80
|
|
460
460
|
text-white rounded-lg transition-colors
|
|
461
|
-
`,children:"Launch"})]})]})]})}):null}function Pk(){const[t,e]=O.useState(!1),[i,r]=O.useState(!1),[s,n]=O.useState(!1),[o,a]=O.useState(null),[h,l]=O.useState(null),[c,u]=O.useState(null),[d,f]=O.useState(!1),[p,m]=O.useState(null);O.useEffect(()=>{fetch("/api/version").then(A=>A.json()).then(A=>{A.latest&&Dk(A.latest,A.current)&&m({current:A.current,latest:A.latest})}).catch(()=>{})},[]);const x=ae(A=>A.projects),_=ae(A=>A.activeProjectId),g=ae(A=>A.setActiveProject),S=ae(A=>A.addProject),y=ae(A=>A.removeProject),L=ae(A=>A.addTerminalToProject),P=F(A=>A.sidebarOpen),N=F(A=>A.sidebarWidth),B=F(A=>A.setSidebarWidth),U=F(A=>A.toggleSidebar),W=F(A=>A.connectionStatus),V=O.useRef(!1),C=F(A=>A.editorSyncEnabled),w=F(A=>A.toggleEditorSync),b=F(A=>A.gpuRendering),k=F(A=>A.toggleGpuRendering),M=F(A=>A.theme),T=F(A=>A.cycleTheme),E=oe(A=>A.activePorts),R=oe(A=>A.claudeStatus),D=oe(A=>A.gitBranches),j=oe(A=>A.editorNeedsAccessibility),G=gr(A=>A.favourites);gr(A=>A.addFavourite);const q=gr(A=>A.updateFavourite),
|
|
462
|
-
`)});const dt=rs(Fe,A.preset);X.getState().setLayout(_,dt),Fe.forEach(ai=>{L(_,ai)}),Fe.length>0&&F.getState().setFocusedTerminal(Fe[0])},[_,x,L]),cs=O.useCallback(A=>{if(!_)return;const Me=X.getState().getLayout(_);
|
|
461
|
+
`,children:"Launch"})]})]})]})}):null}function Pk(){const[t,e]=O.useState(!1),[i,r]=O.useState(!1),[s,n]=O.useState(!1),[o,a]=O.useState(null),[h,l]=O.useState(null),[c,u]=O.useState(null),[d,f]=O.useState(!1),[p,m]=O.useState(null);O.useEffect(()=>{fetch("/api/version").then(A=>A.json()).then(A=>{A.latest&&Dk(A.latest,A.current)&&m({current:A.current,latest:A.latest})}).catch(()=>{})},[]);const x=ae(A=>A.projects),_=ae(A=>A.activeProjectId),g=ae(A=>A.setActiveProject),S=ae(A=>A.addProject),y=ae(A=>A.removeProject),L=ae(A=>A.addTerminalToProject),P=F(A=>A.sidebarOpen),N=F(A=>A.sidebarWidth),B=F(A=>A.setSidebarWidth),U=F(A=>A.toggleSidebar),W=F(A=>A.connectionStatus),V=O.useRef(!1),C=F(A=>A.editorSyncEnabled),w=F(A=>A.toggleEditorSync),b=F(A=>A.gpuRendering),k=F(A=>A.toggleGpuRendering),M=F(A=>A.theme),T=F(A=>A.cycleTheme),E=oe(A=>A.activePorts),R=oe(A=>A.claudeStatus),D=oe(A=>A.gitBranches),j=oe(A=>A.editorNeedsAccessibility),G=gr(A=>A.favourites);gr(A=>A.addFavourite);const q=gr(A=>A.updateFavourite),fe=gr(A=>A.removeFavourite),Q=F(A=>A.pendingFavouriteLaunchId),le=F(A=>A.clearPendingFavouriteLaunch),[Z,re]=O.useState(null),[_e,rt]=O.useState(null),oi=O.useCallback(()=>{fetch("/api/cleanup-projects").then(A=>A.json()).then(A=>{A.stale.length===0?(re([]),setTimeout(()=>re(null),2e3)):re(A.stale)}).catch(()=>{})},[]),Ut=O.useCallback(()=>{fetch("/api/cleanup-projects",{method:"POST"}).then(A=>A.json()).then(A=>{for(const Me of Object.values(x))A.removed.includes(Me.name)&&(X.getState().removeProjectLayout(Me.id),y(Me.id));re(null)}).catch(()=>{})},[x,y]),Nt=(A,Me)=>{const Fe=Object.values(x).find(ai=>ai.cwd===Me);if(Fe){g(Fe.id);return}const dt=crypto.randomUUID();S({id:dt,name:A,cwd:Me,terminalIds:[]}),ue({type:"project:create",projectId:dt,name:A,cwd:Me}),g(dt)},te=A=>{Kp(A)},Dr=A=>{rt(A)},$l=()=>{_e&&(te(_e),ue({type:"project:remove",projectId:_e}),X.getState().removeProjectLayout(_e),y(_e),rt(null))},Br=O.useCallback(A=>{if(!_||!x[_])return;Kp(_);const Fe=A.slots.map(()=>crypto.randomUUID());A.slots.forEach((ai,Il)=>{ai.command.trim()&&Q5(Fe[Il],ai.command+`
|
|
462
|
+
`)});const dt=rs(Fe,A.preset);X.getState().setLayout(_,dt),Fe.forEach(ai=>{L(_,ai)}),Fe.length>0&&F.getState().setFocusedTerminal(Fe[0])},[_,x,L]),cs=O.useCallback(A=>{if(!_)return;const Me=X.getState().getLayout(_);de(Me).length>0?(l(A),n(!0)):Br(A)},[_,Br]);O.useEffect(()=>{if(!Q)return;const A=G[Q];le(),A&&cs(A)},[Q,G,le,cs]);const Mo=A=>{a(A),r(!0)},Ol=(A,Me,Fe)=>{o&&q(o.id,{name:A,preset:Me,slots:Fe}),a(null)},o1=O.useCallback(A=>{A.dataTransfer.types.includes("Files")&&(A.preventDefault(),A.dataTransfer.dropEffect="copy",f(!0))},[]),a1=O.useCallback(A=>{A.currentTarget.contains(A.relatedTarget)||f(!1)},[]),l1=O.useCallback(A=>{A.preventDefault(),V.current=!0;const Me=dt=>{requestAnimationFrame(()=>B(dt.clientX))},Fe=()=>{V.current=!1,window.removeEventListener("mousemove",Me),window.removeEventListener("mouseup",Fe),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",Me),window.addEventListener("mouseup",Fe)},[B]),h1=O.useCallback(A=>{if(f(!1),!A.dataTransfer.types.includes("Files")||A.dataTransfer.files.length===0)return;A.preventDefault(),A.stopPropagation();const Me=s1();if(Me&&Me.length>0){const dt=Me[0],ai=dt.split("/").pop()||A.dataTransfer.files[0].name;u({name:ai,cwd:dt}),e(!0);return}const Fe=A.dataTransfer.files[0];fetch("/api/resolve-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Fe.name,size:Fe.size,lastModified:Fe.lastModified})}).then(dt=>dt.json()).then(dt=>{if(!dt.path||!dt.isDirectory)return;const ai=dt.path,Il=ai.split("/").pop()||Fe.name;u({name:Il,cwd:ai}),e(!0)}).catch(()=>{})},[]);if(!P)return null;const tf=Object.values(x),rf=Object.values(G),c1=(_?x[_]:null)?de(X.getState().getLayout(_)).length:0;return v.jsxs("div",{className:`relative flex-shrink-0 bg-[var(--surface-1)] border-r border-[var(--border)] flex flex-col h-full ${d?"ring-2 ring-inset ring-[var(--accent)]":""}`,style:{width:N},onDragOver:o1,onDragLeave:a1,onDrop:h1,children:[v.jsx("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize z-10 hover:bg-[var(--accent)] active:bg-[var(--accent)] opacity-0 hover:opacity-40 active:opacity-60 transition-opacity",onMouseDown:l1}),v.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"text-sm font-semibold tracking-tight text-[var(--text-primary)]",children:"Paneful"}),v.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${W==="connected"?"bg-[var(--success)]":W==="connecting"?"bg-yellow-500 animate-pulse":"bg-[var(--danger)]"}`,title:W})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("button",{onClick:T,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:`Theme: ${M}. Click to cycle.`,children:M==="light"?v.jsx(wk,{size:14}):M==="dark"?v.jsx(vk,{size:14}):v.jsx(gk,{size:14})}),v.jsxs("button",{onClick:()=>{w(),ue({type:"editor:sync",enabled:!C})},className:`relative p-1 rounded transition-colors ${C?"text-[var(--accent)] hover:bg-[var(--surface-3)]":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]"}`,title:C&&j?"Editor sync needs Accessibility permission. Go to System Settings → Privacy & Security → Accessibility and add the app you launched paneful from (e.g. Paneful, Terminal, iTerm, VS Code, Cursor). If already listed, try toggling it off and on, or removing and re-adding it.":C?"Editor sync ON — auto-switches project based on your active editor. Click to disable.":"Editor sync OFF — click to enable. Requires Accessibility permission for the app you launched paneful from (e.g. Paneful, Terminal, VS Code, Cursor) in System Settings → Privacy & Security → Accessibility. After updating, you may need to remove and re-add it.",children:[v.jsx(cl,{size:14}),C&&j&&v.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-yellow-500"})]}),v.jsx("button",{onClick:k,className:`p-1 rounded transition-colors ${b?"text-[var(--accent)] hover:bg-[var(--surface-3)]":"text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)]"}`,title:b?"GPU rendering ON — terminals use WebGL. Click to switch to DOM renderer.":"GPU rendering OFF — terminals use DOM renderer. Click to enable WebGL.",children:v.jsx(r1,{size:14})}),v.jsx("button",{onClick:oi,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Clean up stale projects",children:v.jsx(ak,{size:14})}),v.jsx("button",{onClick:U,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Hide sidebar",children:v.jsx(t1,{size:14})})]})]}),v.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:tf.length===0&&rf.length===0?v.jsx("div",{className:"px-4 py-8 text-center",children:v.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"No projects yet"})}):v.jsxs(v.Fragment,{children:[tf.map(A=>{var Me;return v.jsx(bk,{project:A,isActive:A.id===_,hasActivePorts:(((Me=E[A.id])==null?void 0:Me.length)??0)>0,claudeStatus:R[A.id]??null,gitStatus:D[A.id]??null,onClick:()=>g(A.id),onKill:()=>te(A.id),onRemove:()=>Dr(A.id)},A.id)}),v.jsx(Mk,{favourites:rf,onLaunch:cs,onEdit:Mo,onDelete:fe})]})}),v.jsxs("div",{className:"mx-3 mb-2 px-3 py-2.5 rounded-lg bg-[var(--surface-2)] text-[10px] text-[var(--text-muted)] leading-relaxed flex flex-col items-center gap-1.5 text-center",children:[v.jsx(pk,{size:12,className:"text-yellow-500"}),"Drag a folder into this sidebar to create a project"]}),v.jsx("div",{className:"p-2 border-t border-[var(--border)]",children:v.jsxs("button",{onClick:()=>e(!0),className:`
|
|
463
463
|
w-full flex items-center justify-center gap-1.5
|
|
464
464
|
px-3 py-2 text-xs
|
|
465
465
|
text-[var(--text-secondary)] hover:text-[var(--text-primary)]
|
|
466
466
|
bg-[var(--surface-2)] hover:bg-[var(--surface-3)]
|
|
467
467
|
rounded-lg transition-colors
|
|
468
|
-
`,children:[v.jsx(po,{size:14}),"New Project"]})}),p&&v.jsxs("div",{className:"px-4 py-3 border-t border-[var(--border)]",children:[v.jsxs("a",{href:"https://www.npmjs.com/package/paneful",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-xs text-[var(--accent)] hover:underline",children:[v.jsx(ck,{size:14}),v.jsxs("span",{children:["v",p.latest," available (current: v",p.current,")"]})]}),v.jsx("p",{className:"text-[10px] text-[var(--text-muted)] mt-1",children:"paneful update"})]}),v.jsx(kk,{open:t,onClose:()=>{e(!1),u(null)},onCreate:Nt,initialName:c==null?void 0:c.name,initialCwd:c==null?void 0:c.cwd}),v.jsx(n1,{open:i,onClose:()=>{r(!1),a(null)},onSave:Ol,editingFavourite:o}),v.jsx(Tk,{open:s,onClose:()=>{n(!1),l(null)},onConfirm:()=>{h&&Br(h)},terminalCount:c1,favouriteName:(h==null?void 0:h.name)??""}),Z!==null&&v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>re(null),children:v.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:A=>A.stopPropagation(),children:[v.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Clean Up Projects"}),Z.length===0?v.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"All projects have valid directories."}):v.jsxs(v.Fragment,{children:[v.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-3",children:[Z.length," project",Z.length>1?"s":""," with missing directories:"]}),v.jsx("div",{className:"space-y-1.5 mb-4 max-h-40 overflow-y-auto",children:Z.map(A=>v.jsxs("div",{className:"text-xs px-2 py-1.5 rounded bg-[var(--surface-2)]",children:[v.jsx("div",{className:"font-medium text-[var(--text-primary)]",children:A.name}),v.jsx("div",{className:"text-[10px] text-[var(--text-muted)] font-mono truncate",children:A.cwd})]},A.id))}),v.jsxs("div",{className:"flex gap-2 justify-end",children:[v.jsx("button",{onClick:()=>re(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),v.jsxs("button",{onClick:Ut,className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:["Remove ",Z.length," project",Z.length>1?"s":""]})]})]})]})}),fe&&x[fe]&&v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>rt(null),children:v.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:A=>A.stopPropagation(),children:[v.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Remove Project"}),v.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-4",children:["Remove ",v.jsx("strong",{children:x[fe].name}),"? This will kill all its terminals."]}),v.jsxs("div",{className:"flex gap-2 justify-end",children:[v.jsx("button",{onClick:()=>rt(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),v.jsx("button",{onClick:$l,className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:"Remove"})]})]})})]})}function Dk(t,e){const i=t.split(".").map(Number),r=e.split(".").map(Number);for(let s=0;s<3;s++){if((i[s]||0)>(r[s]||0))return!0;if((i[s]||0)<(r[s]||0))return!1}return!1}const Bk="border border-[var(--border)] rounded-md px-1.5 py-0.5 bg-[var(--surface-0)] text-[11px] font-mono min-w-[24px] text-center inline-flex items-center justify-center shadow-[0_1px_0_var(--border)]",Ak=[{keys:["⌘","P"],action:"Command palette"},{keys:["⌘","F"],action:"Search terminal"},{keys:["⌘","N"],action:"New pane (vertical)"},{keys:["⌘","⇧","N"],action:"New pane (horizontal)"},{keys:["⌘","W"],action:"Close pane"},{keys:["⌘","D"],action:"Toggle sidebar"},{keys:["⌘","T"],action:"Cycle layout"},{keys:["⌘","R"],action:"Auto reorganize"},{keys:["⌘","1-9"],action:"Focus pane by number"},{keys:["⌘","←→↑↓"],action:"Move focus"},{keys:["⌘","⇧","←→↑↓"],action:"Swap panes"},{keys:["⌥","←→↑↓"],action:"Swap panes"},{keys:["Shift","Enter"],action:"Insert new line"}];function Nk({open:t,onClose:e}){return t?v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:e,children:v.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[440px] shadow-2xl animate-fade-in",onClick:i=>i.stopPropagation(),children:[v.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[v.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Keyboard Shortcuts"}),v.jsx("button",{onClick:e,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:v.jsx(hs,{size:14})})]}),v.jsx("div",{className:"p-4 space-y-2",children:Ak.map((i,r)=>v.jsxs("div",{className:"flex items-center justify-between py-1",children:[v.jsx("div",{className:"flex items-center gap-1",children:i.keys.map((s,n)=>v.jsx("kbd",{className:Bk,children:s},n))}),v.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:i.action})]},r))})]})}):null}const $k={"even-horizontal":v.jsx(Al,{size:14}),"even-vertical":v.jsx(Bl,{size:14}),"main-left":v.jsx(Qd,{size:14}),"main-top":v.jsx(Zd,{size:14}),grid:v.jsx(Xd,{size:14})},Ok={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function Ik({onNewPane:t}){const[e,i]=O.useState(!1),[r,s]=O.useState(!1),n=F(x=>x.sidebarOpen),o=F(x=>x.toggleSidebar),a=ae(x=>x.activeProjectId),h=X(x=>x.currentPresetIndex),l=X(x=>x.cyclePreset),c=gr(x=>x.addFavourite),u=()=>{if(!a)return;const x=X.getState().getLayout(a),_=ue(x);_.length>0&&l(a,_)},d=()=>{if(!a)return;const x=X.getState().getLayout(a),_=ue(x);if(_.length===0)return;let g;_.length<=2?g="even-vertical":_.length===3?g="main-left":g="grid";const S=rs(_,g);S&&X.getState().setLayout(a,S)},f=(x,_,g)=>{c({id:crypto.randomUUID(),name:x,preset:_,slots:g})},p=zs[h],m=a?ue(X.getState().getLayout(a)).length:0;return v.jsxs("div",{className:"h-9 flex-shrink-0 flex items-center px-2 gap-1 bg-[var(--surface-1)] border-b border-[var(--border)]",children:[!n&&v.jsx("button",{onClick:o,className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Show sidebar (Cmd+D)",children:v.jsx(mk,{size:14})}),v.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),v.jsx("button",{onClick:()=>t("vertical"),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Split vertical (Cmd+N)",children:v.jsx(Bl,{size:14})}),v.jsx("button",{onClick:()=>t("horizontal"),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Split horizontal (Cmd+Shift+N)",children:v.jsx(Al,{size:14})}),v.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),v.jsxs("button",{onClick:u,className:"flex items-center gap-1.5 px-2 py-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors text-xs",title:"Cycle layout (Cmd+T)",children:[$k[p],v.jsx("span",{className:"hidden sm:inline",children:Ok[p]})]}),v.jsx("button",{onClick:d,className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Auto reorganize (Cmd+R)",children:v.jsx(e1,{size:14})}),v.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),v.jsx("button",{onClick:()=>i(!0),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-yellow-400 hover:bg-[var(--surface-3)] transition-colors",title:"Save as favourite",children:v.jsx(Nl,{size:14})}),v.jsx("div",{className:"flex-1"}),v.jsx("button",{onClick:()=>s(!0),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Keyboard shortcuts",children:v.jsx(_k,{size:14})}),v.jsx(n1,{open:e,onClose:()=>i(!1),onSave:f,defaultPreset:p,defaultSlotCount:Math.max(m,1)}),v.jsx(Nk,{open:r,onClose:()=>s(!1)})]})}function zk(t,e){const i=O.useRef();O.useEffect(()=>{const r=t.current;if(!r)return;const s=new ResizeObserver(()=>{clearTimeout(i.current),i.current=setTimeout(e,uw)});return s.observe(r),()=>{s.disconnect(),clearTimeout(i.current)}},[t,e])}function Fk(t,e){const i=F(d=>d.setDragging),r=F(d=>d.setDropTarget),s=F(d=>d.draggingTerminalId),n=X(d=>d.movePaneInProject),o=X(d=>d.swapPanesInProject),a=O.useCallback(d=>{d.dataTransfer.setData("text/plain",t),d.dataTransfer.effectAllowed="move",i(t)},[t,i]),h=O.useCallback(()=>{i(null),r(null)},[i,r]),l=O.useCallback(d=>{if(d.preventDefault(),d.dataTransfer.dropEffect="move",!s||s===t){r(null);return}const f=d.currentTarget.getBoundingClientRect(),p=(d.clientX-f.left)/f.width,m=(d.clientY-f.top)/f.height;let x="center";const _=.2;p<_?x="left":p>1-_?x="right":m<_?x="top":m>1-_&&(x="bottom"),r({terminalId:t,edge:x})},[t,s,r]),c=O.useCallback(()=>{r(null)},[r]),u=O.useCallback(d=>{d.preventDefault();const f=d.dataTransfer.getData("text/plain");if(!f||f===t)return;const p=F.getState().dropTarget;p&&(p.edge==="center"?o(e,f,t):n(e,f,t,p.edge),i(null),r(null))},[t,e,n,o,i,r]);return{onDragStart:a,onDragEnd:h,onDragOver:l,onDragLeave:c,onDrop:u}}function jk({terminalId:t,projectId:e,isFocused:i,onClose:r,dragProps:s}){const n=oe(u=>u.sessions[t]),o=(n==null?void 0:n.title)??"Terminal",a=(n==null?void 0:n.alive)??!0,h=X(u=>u.getLayout(e)),c=ue(h).indexOf(t)+1;return v.jsxs("div",{draggable:!0,onDragStart:s.onDragStart,onDragEnd:s.onDragEnd,className:`
|
|
468
|
+
`,children:[v.jsx(po,{size:14}),"New Project"]})}),p&&v.jsxs("div",{className:"px-4 py-3 border-t border-[var(--border)]",children:[v.jsxs("a",{href:"https://www.npmjs.com/package/paneful",onClick:A=>{A.preventDefault(),ue({type:"open:url",url:"https://www.npmjs.com/package/paneful"})},className:"flex items-center gap-2 text-xs text-[var(--accent)] hover:underline cursor-pointer",children:[v.jsx(ck,{size:14}),v.jsxs("span",{children:["v",p.latest," available (current: v",p.current,")"]})]}),v.jsxs("p",{className:"text-[10px] text-[var(--text-muted)] mt-1",children:["paneful update · ",v.jsx("a",{href:"https://github.com/kplates/paneful/blob/master/CHANGELOG.md",onClick:A=>{A.preventDefault(),ue({type:"open:url",url:"https://github.com/kplates/paneful/blob/master/CHANGELOG.md"})},className:"underline cursor-pointer hover:text-[var(--text-secondary)]",children:"changelog"})]})]}),v.jsx(kk,{open:t,onClose:()=>{e(!1),u(null)},onCreate:Nt,initialName:c==null?void 0:c.name,initialCwd:c==null?void 0:c.cwd}),v.jsx(n1,{open:i,onClose:()=>{r(!1),a(null)},onSave:Ol,editingFavourite:o}),v.jsx(Tk,{open:s,onClose:()=>{n(!1),l(null)},onConfirm:()=>{h&&Br(h)},terminalCount:c1,favouriteName:(h==null?void 0:h.name)??""}),Z!==null&&v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>re(null),children:v.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:A=>A.stopPropagation(),children:[v.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Clean Up Projects"}),Z.length===0?v.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"All projects have valid directories."}):v.jsxs(v.Fragment,{children:[v.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-3",children:[Z.length," project",Z.length>1?"s":""," with missing directories:"]}),v.jsx("div",{className:"space-y-1.5 mb-4 max-h-40 overflow-y-auto",children:Z.map(A=>v.jsxs("div",{className:"text-xs px-2 py-1.5 rounded bg-[var(--surface-2)]",children:[v.jsx("div",{className:"font-medium text-[var(--text-primary)]",children:A.name}),v.jsx("div",{className:"text-[10px] text-[var(--text-muted)] font-mono truncate",children:A.cwd})]},A.id))}),v.jsxs("div",{className:"flex gap-2 justify-end",children:[v.jsx("button",{onClick:()=>re(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),v.jsxs("button",{onClick:Ut,className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:["Remove ",Z.length," project",Z.length>1?"s":""]})]})]})]})}),_e&&x[_e]&&v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>rt(null),children:v.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl p-5 w-80 shadow-xl",onClick:A=>A.stopPropagation(),children:[v.jsx("h3",{className:"text-sm font-semibold text-[var(--text-primary)] mb-3",children:"Remove Project"}),v.jsxs("p",{className:"text-xs text-[var(--text-secondary)] mb-4",children:["Remove ",v.jsx("strong",{children:x[_e].name}),"? This will kill all its terminals."]}),v.jsxs("div",{className:"flex gap-2 justify-end",children:[v.jsx("button",{onClick:()=>rt(null),className:"px-3 py-1.5 text-xs rounded-lg text-[var(--text-secondary)] hover:bg-[var(--surface-2)] transition-colors",children:"Cancel"}),v.jsx("button",{onClick:$l,className:"px-3 py-1.5 text-xs rounded-lg bg-[var(--danger)] text-white hover:opacity-90 transition-opacity",children:"Remove"})]})]})})]})}function Dk(t,e){const i=t.split(".").map(Number),r=e.split(".").map(Number);for(let s=0;s<3;s++){if((i[s]||0)>(r[s]||0))return!0;if((i[s]||0)<(r[s]||0))return!1}return!1}const Bk="border border-[var(--border)] rounded-md px-1.5 py-0.5 bg-[var(--surface-0)] text-[11px] font-mono min-w-[24px] text-center inline-flex items-center justify-center shadow-[0_1px_0_var(--border)]",Ak=[{keys:["⌘","P"],action:"Command palette"},{keys:["⌘","F"],action:"Search terminal"},{keys:["⌘","N"],action:"New pane (vertical)"},{keys:["⌘","⇧","N"],action:"New pane (horizontal)"},{keys:["⌘","W"],action:"Close pane"},{keys:["⌘","D"],action:"Toggle sidebar"},{keys:["⌘","T"],action:"Cycle layout"},{keys:["⌘","R"],action:"Auto reorganize"},{keys:["⌘","1-9"],action:"Focus pane by number"},{keys:["⌘","←→↑↓"],action:"Move focus"},{keys:["⌘","⇧","←→↑↓"],action:"Swap panes"},{keys:["⌥","←→↑↓"],action:"Swap panes"},{keys:["Shift","Enter"],action:"Insert new line"}];function Nk({open:t,onClose:e}){return t?v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:e,children:v.jsxs("div",{className:"bg-[var(--surface-1)] border border-[var(--border)] rounded-xl w-[440px] shadow-2xl animate-fade-in",onClick:i=>i.stopPropagation(),children:[v.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border)]",children:[v.jsx("h3",{className:"text-sm font-medium text-[var(--text-primary)]",children:"Keyboard Shortcuts"}),v.jsx("button",{onClick:e,className:"p-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",children:v.jsx(hs,{size:14})})]}),v.jsx("div",{className:"p-4 space-y-2",children:Ak.map((i,r)=>v.jsxs("div",{className:"flex items-center justify-between py-1",children:[v.jsx("div",{className:"flex items-center gap-1",children:i.keys.map((s,n)=>v.jsx("kbd",{className:Bk,children:s},n))}),v.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:i.action})]},r))})]})}):null}const $k={"even-horizontal":v.jsx(Al,{size:14}),"even-vertical":v.jsx(Bl,{size:14}),"main-left":v.jsx(Qd,{size:14}),"main-top":v.jsx(Zd,{size:14}),grid:v.jsx(Xd,{size:14})},Ok={"even-horizontal":"Rows","even-vertical":"Columns","main-left":"Main + Stack","main-top":"Main + Row",grid:"Grid"};function Ik({onNewPane:t}){const[e,i]=O.useState(!1),[r,s]=O.useState(!1),n=F(x=>x.sidebarOpen),o=F(x=>x.toggleSidebar),a=ae(x=>x.activeProjectId),h=X(x=>x.currentPresetIndex),l=X(x=>x.cyclePreset),c=gr(x=>x.addFavourite),u=()=>{if(!a)return;const x=X.getState().getLayout(a),_=de(x);_.length>0&&l(a,_)},d=()=>{if(!a)return;const x=X.getState().getLayout(a),_=de(x);if(_.length===0)return;let g;_.length<=2?g="even-vertical":_.length===3?g="main-left":g="grid";const S=rs(_,g);S&&X.getState().setLayout(a,S)},f=(x,_,g)=>{c({id:crypto.randomUUID(),name:x,preset:_,slots:g})},p=zs[h],m=a?de(X.getState().getLayout(a)).length:0;return v.jsxs("div",{className:"h-9 flex-shrink-0 flex items-center px-2 gap-1 bg-[var(--surface-1)] border-b border-[var(--border)]",children:[!n&&v.jsx("button",{onClick:o,className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Show sidebar (Cmd+D)",children:v.jsx(mk,{size:14})}),v.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),v.jsx("button",{onClick:()=>t("vertical"),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Split vertical (Cmd+N)",children:v.jsx(Bl,{size:14})}),v.jsx("button",{onClick:()=>t("horizontal"),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Split horizontal (Cmd+Shift+N)",children:v.jsx(Al,{size:14})}),v.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),v.jsxs("button",{onClick:u,className:"flex items-center gap-1.5 px-2 py-1 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors text-xs",title:"Cycle layout (Cmd+T)",children:[$k[p],v.jsx("span",{className:"hidden sm:inline",children:Ok[p]})]}),v.jsx("button",{onClick:d,className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Auto reorganize (Cmd+R)",children:v.jsx(e1,{size:14})}),v.jsx("div",{className:"w-px h-4 bg-[var(--border)] mx-1"}),v.jsx("button",{onClick:()=>i(!0),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-yellow-400 hover:bg-[var(--surface-3)] transition-colors",title:"Save as favourite",children:v.jsx(Nl,{size:14})}),v.jsx("div",{className:"flex-1"}),v.jsx("button",{onClick:()=>s(!0),className:"p-1.5 rounded text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:bg-[var(--surface-3)] transition-colors",title:"Keyboard shortcuts",children:v.jsx(_k,{size:14})}),v.jsx(n1,{open:e,onClose:()=>i(!1),onSave:f,defaultPreset:p,defaultSlotCount:Math.max(m,1)}),v.jsx(Nk,{open:r,onClose:()=>s(!1)})]})}function zk(t,e){const i=O.useRef();O.useEffect(()=>{const r=t.current;if(!r)return;const s=new ResizeObserver(()=>{clearTimeout(i.current),i.current=setTimeout(e,uw)});return s.observe(r),()=>{s.disconnect(),clearTimeout(i.current)}},[t,e])}function Fk(t,e){const i=F(d=>d.setDragging),r=F(d=>d.setDropTarget),s=F(d=>d.draggingTerminalId),n=X(d=>d.movePaneInProject),o=X(d=>d.swapPanesInProject),a=O.useCallback(d=>{d.dataTransfer.setData("text/plain",t),d.dataTransfer.effectAllowed="move",i(t)},[t,i]),h=O.useCallback(()=>{i(null),r(null)},[i,r]),l=O.useCallback(d=>{if(d.preventDefault(),d.dataTransfer.dropEffect="move",!s||s===t){r(null);return}const f=d.currentTarget.getBoundingClientRect(),p=(d.clientX-f.left)/f.width,m=(d.clientY-f.top)/f.height;let x="center";const _=.2;p<_?x="left":p>1-_?x="right":m<_?x="top":m>1-_&&(x="bottom"),r({terminalId:t,edge:x})},[t,s,r]),c=O.useCallback(()=>{r(null)},[r]),u=O.useCallback(d=>{d.preventDefault();const f=d.dataTransfer.getData("text/plain");if(!f||f===t)return;const p=F.getState().dropTarget;p&&(p.edge==="center"?o(e,f,t):n(e,f,t,p.edge),i(null),r(null))},[t,e,n,o,i,r]);return{onDragStart:a,onDragEnd:h,onDragOver:l,onDragLeave:c,onDrop:u}}function jk({terminalId:t,projectId:e,isFocused:i,onClose:r,dragProps:s}){const n=oe(u=>u.sessions[t]),o=(n==null?void 0:n.title)??"Terminal",a=(n==null?void 0:n.alive)??!0,h=X(u=>u.getLayout(e)),c=de(h).indexOf(t)+1;return v.jsxs("div",{draggable:!0,onDragStart:s.onDragStart,onDragEnd:s.onDragEnd,className:`
|
|
469
469
|
flex items-center h-7 px-2 gap-1.5 flex-shrink-0
|
|
470
470
|
border-b transition-colors duration-100
|
|
471
471
|
select-none cursor-grab active:cursor-grabbing
|
|
@@ -479,7 +479,7 @@ void main() {
|
|
|
479
479
|
pointer-events-none z-20
|
|
480
480
|
${r?"bg-accent/15 border-2 border-accent/40":"bg-accent/20 border-2 border-accent/50"}
|
|
481
481
|
rounded-sm transition-all duration-100
|
|
482
|
-
`})}function Uk({terminalId:t,projectId:e,cwd:i}){const r=F(f=>f.focusedTerminalId===t),s=F(f=>f.draggingTerminalId===t),n=F(f=>f.searchTerminalId===t),{containerRef:o,fit:a,focus:h}=J5({terminalId:t,projectId:e,cwd:i}),l=Fk(t,e);zk(o,a);const c=O.useCallback(()=>{var m;
|
|
482
|
+
`})}function Uk({terminalId:t,projectId:e,cwd:i}){const r=F(f=>f.focusedTerminalId===t),s=F(f=>f.draggingTerminalId===t),n=F(f=>f.searchTerminalId===t),{containerRef:o,fit:a,focus:h}=J5({terminalId:t,projectId:e,cwd:i}),l=Fk(t,e);zk(o,a);const c=O.useCallback(()=>{var m;ue({type:"pty:kill",terminalId:t}),X.getState().removePaneFromProject(e,t),ae.getState().removeTerminalFromProject(e,t);const f=oe.getState().sessions[t];(m=f==null?void 0:f.terminal)==null||m.dispose(),oe.getState().removeSession(t),Lo(t);const p=de(X.getState().getLayout(e));F.getState().setFocusedTerminal(p[0]??null)},[t,e]),u=O.useCallback(f=>{if(!(F.getState().draggingTerminalId!=null)){const m=s1();if(m){f.preventDefault(),f.stopPropagation(),ue({type:"pty:input",terminalId:t,data:m.map(Ta).join(" ")}),h();return}const x=Ck(f.dataTransfer);if(x.length>0){f.preventDefault(),f.stopPropagation(),ue({type:"pty:input",terminalId:t,data:x.map(Ta).join(" ")}),h();return}}if(f.dataTransfer.types.includes("Files")&&f.dataTransfer.files.length>0){f.preventDefault(),f.stopPropagation();const m=Array.from(f.dataTransfer.files);Promise.all(m.map(x=>fetch("/api/resolve-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x.name,size:x.size,lastModified:x.lastModified,cwd:i})}).then(_=>_.json()).then(_=>_.path).catch(()=>null))).then(x=>{const _=x.filter(Boolean);_.length>0&&(ue({type:"pty:input",terminalId:t,data:_.map(Ta).join(" ")}),h())});return}l.onDrop(f)},[t,l,h]),d=O.useCallback(f=>{if(F.getState().draggingTerminalId!=null){l.onDragOver(f);return}if(f.dataTransfer.types.includes("Files")||f.dataTransfer.types.includes("codefiles")||f.dataTransfer.types.includes("text/uri-list")||f.dataTransfer.types.includes("text/plain")){f.preventDefault(),f.dataTransfer.dropEffect="copy";return}l.onDragOver(f)},[l]);return v.jsxs("div",{"data-terminal-id":t,style:{borderColor:r?"var(--accent)":"transparent"},className:`
|
|
483
483
|
flex flex-col h-full w-full relative border
|
|
484
484
|
${s?"opacity-40":""}
|
|
485
485
|
transition-colors duration-100
|
|
@@ -512,4 +512,4 @@ void main() {
|
|
|
512
512
|
`,children:[v.jsx(i1,{size:12,className:"text-[var(--text-muted)] group-hover:text-[var(--accent)] shrink-0 transition-colors"}),v.jsx("span",{className:"truncate font-medium",children:n.name}),v.jsxs("span",{className:"ml-auto text-[10px] text-[var(--text-muted)] tabular-nums shrink-0",children:[n.slots.length," pane",n.slots.length!==1?"s":""]})]},n.id))})]}),i&&v.jsxs("div",{className:"max-w-sm",children:[v.jsxs("p",{className:"text-sm italic text-[var(--text-muted)] leading-relaxed",children:['"',i.text,'"']}),i.attribution&&v.jsxs("p",{className:"text-xs text-[var(--text-muted)]/60 mt-2",children:["— ",i.attribution]})]})]})})}function Yk(){const t=F(s=>s.syncToast),e=F(s=>s.dismissSyncToast),[i,r]=O.useState(!1);return O.useEffect(()=>{if(!t){r(!1);return}requestAnimationFrame(()=>r(!0));const s=setTimeout(()=>{r(!1),setTimeout(e,200)},3e3);return()=>clearTimeout(s)},[t==null?void 0:t.id]),t?v.jsxs("div",{onClick:()=>{r(!1),setTimeout(e,200)},style:{position:"absolute",top:16,left:"50%",zIndex:9999,display:"flex",alignItems:"center",gap:8,padding:"8px 14px",borderRadius:8,background:"#facc15",color:"#1a1a1a",border:"1px solid #eab308",fontSize:13,cursor:"pointer",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",opacity:i?1:0,transform:i?"translate(-50%, 0)":"translate(-50%, -8px)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:i?"auto":"none"},children:[v.jsx(cl,{size:15,style:{color:"#a16207",flexShrink:0}}),v.jsxs("span",{children:["Synced to ",v.jsx("strong",{children:t.projectName})]})]}):null}function Xk(){const t=F(i=>i.commandPaletteOpen),e=F(i=>i.closeCommandPalette);return t?v.jsx(Qk,{onClose:e}):null}function Qk({onClose:t}){const[e,i]=O.useState(""),[r,s]=O.useState(0),n=O.useRef(null),o=O.useRef(null);O.useEffect(()=>{var u;(u=n.current)==null||u.focus()},[]);const a=O.useMemo(()=>Zk(),[t]),h=O.useMemo(()=>{if(!e.trim())return a;const u=e.toLowerCase();return a.filter(d=>d.label.toLowerCase().includes(u))},[a,e]);O.useEffect(()=>{s(0)},[e]);const l=O.useCallback(u=>{u.action(),t()},[t]),c=u=>{if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),t();return}if(u.key==="ArrowDown"){u.preventDefault(),s(d=>Math.min(d+1,h.length-1));return}if(u.key==="ArrowUp"){u.preventDefault(),s(d=>Math.max(d-1,0));return}if(u.key==="Enter"){u.preventDefault(),h[r]&&l(h[r]);return}};return O.useEffect(()=>{const u=o.current;if(!u)return;const d=u.children[r];d==null||d.scrollIntoView({block:"nearest"})},[r]),v.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",onClick:t,children:v.jsxs("div",{className:"max-w-lg mx-auto mt-[20vh] bg-[var(--surface-1)] border border-[var(--border)] rounded-xl shadow-2xl overflow-hidden",onClick:u=>u.stopPropagation(),children:[v.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-[var(--border)]",children:[v.jsx(Sk,{size:16,className:"text-[var(--text-muted)] shrink-0"}),v.jsx("input",{ref:n,type:"text",value:e,onChange:u=>i(u.target.value),onKeyDown:c,placeholder:"Search commands...",className:"flex-1 bg-transparent text-sm text-[var(--text-primary)] outline-none placeholder:text-[var(--text-muted)]"}),v.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[10px] text-[var(--text-muted)] font-mono",children:"ESC"})]}),v.jsx("div",{ref:o,className:"max-h-72 overflow-y-auto py-1",children:h.length===0?v.jsx("div",{className:"px-4 py-6 text-center text-xs text-[var(--text-muted)]",children:"No matching commands"}):h.map((u,d)=>v.jsxs("button",{onClick:()=>l(u),onMouseEnter:()=>s(d),className:`
|
|
513
513
|
w-full flex items-center gap-3 px-4 py-2 text-left transition-colors
|
|
514
514
|
${d===r?"bg-[var(--surface-2)] text-[var(--text-primary)]":"text-[var(--text-secondary)] hover:bg-[var(--surface-2)]"}
|
|
515
|
-
`,children:[v.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:u.icon}),v.jsx("span",{className:"flex-1 text-xs truncate",children:u.label}),v.jsx("span",{className:"shrink-0 text-[9px] px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[var(--text-muted)]",children:u.category}),u.shortcut&&v.jsx("kbd",{className:"shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[var(--text-muted)] font-mono",children:u.shortcut})]},u.id))})]})})}function Zk(t){const e=[],i=ae.getState().projects,r=gr.getState().favourites,s=ae.getState().activeProjectId;for(const o of Object.values(i))e.push({id:`project:${o.id}`,label:`Switch to ${o.name}`,category:"Project",icon:v.jsx(J0,{size:14}),action:()=>{ae.getState().setActiveProject(o.id)}});for(const o of Object.values(r))e.push({id:`fav:${o.id}`,label:`Launch ${o.name}`,category:"Favourite",icon:v.jsx(Nl,{size:14}),action:()=>{F.getState().requestFavouriteLaunch(o.id)}});const n={"even-horizontal":{label:"Layout: Rows",icon:v.jsx(Al,{size:14})},"even-vertical":{label:"Layout: Columns",icon:v.jsx(Bl,{size:14})},"main-left":{label:"Layout: Main + Stack",icon:v.jsx(Qd,{size:14})},"main-top":{label:"Layout: Main + Row",icon:v.jsx(Zd,{size:14})},grid:{label:"Layout: Grid",icon:v.jsx(Xd,{size:14})}};for(const o of zs){const a=n[o];e.push({id:`layout:${o}`,label:a.label,category:"Layout",icon:a.icon,action:()=>{if(!s)return;const h=X.getState().getLayout(s),l=
|
|
515
|
+
`,children:[v.jsx("span",{className:"shrink-0 text-[var(--text-muted)]",children:u.icon}),v.jsx("span",{className:"flex-1 text-xs truncate",children:u.label}),v.jsx("span",{className:"shrink-0 text-[9px] px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[var(--text-muted)]",children:u.category}),u.shortcut&&v.jsx("kbd",{className:"shrink-0 text-[10px] px-1.5 py-0.5 rounded bg-[var(--surface-3)] text-[var(--text-muted)] font-mono",children:u.shortcut})]},u.id))})]})})}function Zk(t){const e=[],i=ae.getState().projects,r=gr.getState().favourites,s=ae.getState().activeProjectId;for(const o of Object.values(i))e.push({id:`project:${o.id}`,label:`Switch to ${o.name}`,category:"Project",icon:v.jsx(J0,{size:14}),action:()=>{ae.getState().setActiveProject(o.id)}});for(const o of Object.values(r))e.push({id:`fav:${o.id}`,label:`Launch ${o.name}`,category:"Favourite",icon:v.jsx(Nl,{size:14}),action:()=>{F.getState().requestFavouriteLaunch(o.id)}});const n={"even-horizontal":{label:"Layout: Rows",icon:v.jsx(Al,{size:14})},"even-vertical":{label:"Layout: Columns",icon:v.jsx(Bl,{size:14})},"main-left":{label:"Layout: Main + Stack",icon:v.jsx(Qd,{size:14})},"main-top":{label:"Layout: Main + Row",icon:v.jsx(Zd,{size:14})},grid:{label:"Layout: Grid",icon:v.jsx(Xd,{size:14})}};for(const o of zs){const a=n[o];e.push({id:`layout:${o}`,label:a.label,category:"Layout",icon:a.icon,action:()=>{if(!s)return;const h=X.getState().getLayout(s),l=de(h);if(l.length===0)return;const c=rs(l,o);c&&X.getState().setLayout(s,c)}})}return e.push({id:"action:new-pane-v",label:"New pane (vertical)",category:"Action",icon:v.jsx(po,{size:14}),shortcut:"⌘N",action:()=>{if(!s)return;const o=X.getState().getLayout(s),a=de(o),h=F.getState().focusedTerminalId,l=crypto.randomUUID(),c=h??a[a.length-1];c?X.getState().addPaneToProject(s,c,l,"vertical"):X.getState().setLayout(s,{type:"leaf",terminalId:l}),ae.getState().addTerminalToProject(s,l),F.getState().setFocusedTerminal(l)}}),e.push({id:"action:new-pane-h",label:"New pane (horizontal)",category:"Action",icon:v.jsx(po,{size:14}),shortcut:"⌘⇧N",action:()=>{if(!s)return;const o=X.getState().getLayout(s),a=de(o),h=F.getState().focusedTerminalId,l=crypto.randomUUID(),c=h??a[a.length-1];c?X.getState().addPaneToProject(s,c,l,"horizontal"):X.getState().setLayout(s,{type:"leaf",terminalId:l}),ae.getState().addTerminalToProject(s,l),F.getState().setFocusedTerminal(l)}}),e.push({id:"action:close-pane",label:"Close pane",category:"Action",icon:v.jsx(hs,{size:14}),shortcut:"⌘W",action:()=>{var l;if(!s)return;const o=F.getState().focusedTerminalId;if(!o)return;ue({type:"pty:kill",terminalId:o}),X.getState().removePaneFromProject(s,o),ae.getState().removeTerminalFromProject(s,o);const a=oe.getState().sessions[o];(l=a==null?void 0:a.terminal)==null||l.dispose(),oe.getState().removeSession(o),Lo(o);const h=de(X.getState().getLayout(s));F.getState().setFocusedTerminal(h[0]??null)}}),e.push({id:"action:toggle-sidebar",label:"Toggle sidebar",category:"Action",icon:v.jsx(t1,{size:14}),shortcut:"⌘D",action:()=>{F.getState().toggleSidebar()}}),e.push({id:"action:cycle-theme",label:"Cycle theme",category:"Action",icon:v.jsx(cl,{size:14}),action:()=>{F.getState().cycleTheme()}}),e.push({id:"action:toggle-editor-sync",label:"Toggle editor sync",category:"Action",icon:v.jsx(cl,{size:14}),action:()=>{F.getState().toggleEditorSync()}}),e.push({id:"action:toggle-gpu-rendering",label:"Toggle GPU rendering",category:"Action",icon:v.jsx(r1,{size:14}),action:()=>{F.getState().toggleGpuRendering()}}),e.push({id:"action:auto-reorganize",label:"Auto reorganize",category:"Action",icon:v.jsx(e1,{size:14}),shortcut:"⌘R",action:()=>{if(!s)return;const o=X.getState().getLayout(s),a=de(o);if(a.length===0)return;let h;a.length<=2?h="even-vertical":a.length===3?h="main-left":h="grid";const l=rs(a,h);l&&X.getState().setLayout(s,l)}}),e}function Jk(){tk(),rk(),O.useEffect(()=>{ae.getState().hydrateFromServer(),gr.getState().hydrateFromServer(),F.getState().hydrateFromServer()},[]);const t=ae(h=>h.activeProjectId),e=ae(h=>h.activeProjectId?h.projects[h.activeProjectId]:null),i=X(h=>t?h.getLayout(t):null),r=F(h=>h.focusedTerminalId),s=F(h=>h.setFocusedTerminal),n=ae(h=>h.addTerminalToProject),o=O.useCallback(h=>{if(!t||!e)return;const l=crypto.randomUUID(),c=de(i),u=r??c[0];u?X.getState().addPaneToProject(t,u,l,h):X.getState().setLayout(t,{type:"leaf",terminalId:l}),n(t,l),s(l)},[t,e,i,r,n,s]),a=O.useCallback(()=>{o("vertical")},[o]);return v.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-[var(--surface-0)]",children:[v.jsx(Pk,{}),v.jsx(Xk,{}),v.jsxs("div",{className:"relative flex-1 flex flex-col min-w-0",children:[v.jsx(Yk,{}),v.jsx(Ik,{onNewPane:o}),v.jsx("div",{className:"flex-1 min-h-0 min-w-0",children:i?v.jsx(Ou,{node:i,projectId:t,cwd:(e==null?void 0:e.cwd)??"/"},t):v.jsx(Gk,{onNewTerminal:a,projectName:e==null?void 0:e.name})})]})]})}window.__panefulHandleDrop=(t,e,i)=>{var s;let r=F.getState().focusedTerminalId;if(e!=null&&i!=null){const n=(s=document.elementFromPoint(e,i))==null?void 0:s.closest("[data-terminal-id]");if(n){const o=n.dataset.terminalId;r=o,F.getState().setFocusedTerminal(o)}}r&&t.length>0&&ue({type:"pty:input",terminalId:r,data:t.map(Ta).join(" ")})};Wh.createRoot(document.getElementById("root")).render(v.jsx(Wu.StrictMode,{children:v.jsx(Jk,{})}));
|